Skip to content

Conversation

@msynk
Copy link
Member

@msynk msynk commented Dec 11, 2025

closes #11870

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Improved service worker reliability with additional safety measures to prevent errors during message handling.
  • Refactor

    • Enhanced cache cleanup mechanism to efficiently remove outdated caches during service worker updates and application lifecycle.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 11, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The pull request introduces a cleanup command to the Bswup service worker system. Changes span two related files: the service worker script now handles a new 'CLEAN_UP' inter-process message to trigger cache deletion, while the main registration script creates a cleanup callback that sends this message to active and waiting service worker states.

Changes

Cohort / File(s) Summary
Cleanup command implementation
src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts, src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts
Added inter-process messaging to trigger cache cleanup independent of reload. Service worker listens for 'CLEAN_UP' message and invokes deleteOldCaches(). Main script provides cleanup callback that posts messages to active/waiting service worker registrations using optional chaining. Cleanup callback integrated into download completion notification flow. BOM character removed from service worker version line.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Optional chaining usage in message posting — verify null-safety handling is consistent
  • Service worker message handler logic — ensure CLEAN_UP message dispatch doesn't conflict with other messaging patterns
  • Integration of cleanup callback in notification payload — confirm it's passed correctly in both "downloadFinished" and "bypass" code paths

Poem

🐰 Cleanup hops in, a new command to stay,
No reload required—the modern way!
Messages whisper 'tween worker and code,
Old caches fade down the storage road,
Keeping your app both swift and light.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add cleanup command (#11870)' directly matches the main objective of adding a new cleanup command to Bswup, clearly summarizing the primary change.
Linked Issues check ✅ Passed The PR implements all requirements from issue #11870: adds a cleanup command, provides it alongside the reload command, and enables storage control when reload is inappropriate.
Out of Scope Changes check ✅ Passed All changes are focused on implementing the cleanup functionality: removing a BOM character, adding CLEAN_UP message handling, and integrating cleanup with service worker registration.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@msynk msynk marked this pull request as draft December 11, 2025 12:02
@msynk msynk marked this pull request as ready for review December 13, 2025 18:02
@msynk msynk merged commit 660a0f5 into bitfoundation:develop Dec 13, 2025
3 checks passed
@msynk msynk deleted the 11870-bswup-cleanup-command branch December 13, 2025 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The Bswup needs a new cleanup command

1 participant