Skip to content

Apply Bswup improvements (#12408)#12418

Open
msynk wants to merge 30 commits into
bitfoundation:developfrom
msynk:12408-bswup-improvements
Open

Apply Bswup improvements (#12408)#12418
msynk wants to merge 30 commits into
bitfoundation:developfrom
msynk:12408-bswup-improvements

Conversation

@msynk

@msynk msynk commented May 31, 2026

Copy link
Copy Markdown
Member

closes #12408

Summary by CodeRabbit

  • New Features
    • Progress/install UI now includes an ARIA-friendly progress bar plus a styled error panel (title/message/details) with a context-aware Retry action; asset rows respect showAssets.
    • Added optional update polling and new update/error outcomes (updateNotFound, updateCheckFailed, error), plus enhanced forceRefresh with cache filtering.
  • Bug Fixes
    • Improved service-worker robustness: safer manifest handling, hardened fetch routing, and more reliable multi-tab update/reload coordination.
  • Documentation
    • Expanded README with updated configuration, JavaScript API behavior, and service-worker guidance.
  • Style
    • Added error-panel/retry-button styling for the progress component.

@coderabbitai

coderabbitai Bot commented May 31, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@msynk, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 22 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 83811ed6-8906-4442-b75c-1b2faa83e583

📥 Commits

Reviewing files that changed from the base of the PR and between 571f537 and 968fc99.

📒 Files selected for processing (2)
  • src/Bswup/FullDemo/Server/Components/App.razor
  • src/Bswup/FullDemo/Server/Program.cs

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Updates Bit.Bswup runtime and service-worker behavior, adds progress/error UI, refreshes build and demo wiring, introduces FullDemo app/server components, and expands the README for the new message and update flow.

Changes

Bit.Bswup Service Worker, UI, and Demo Updates

Layer / File(s) Summary
Progress UI and error handling
src/Bswup/Bit.Bswup/BswupProgress.razor, src/Bswup/Bit.Bswup/Scripts/bit-bswup.progress.ts, src/Bswup/Bit.Bswup/Styles/bit-bswup.progress.css
Adds the hidden #bit-bswup configuration container, default progress/error UI, error-panel rendering and retry handling, runtime asset-visibility toggling, error panel styling, and initialization support for delayed startup.
Legacy demo page and worker config
src/Bswup/Bit.Bswup.Demo/Pages/HomePage.razor, src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.js, src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.published.js
Changes the demo home header text, removes the favicon/icon precache include, keeps the missing external asset reference, and switches the published demo worker to an exclude list with case-insensitive URL matching.
Service worker manifest validation and config
src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts
Expands worker-side typing, validates and normalizes malformed manifests, gates startup on manifest validity, separates manifest version from cache bucket identity, and defaults runtime tolerance and retry settings.
Service worker install and asset caching
src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts
Updates passive-mode caching and cross-tab messaging, changes asset reconciliation and retry handling, and adds helper logic for cache URLs, request construction, integrity behavior, cache cleanup, manifest safety, and URL-pattern normalization.
Runtime initialization, reload coordination, and message flow
src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts
Adds the one-time initialization guard, captures service-worker registration state, guards reloads, expands message handling, and introduces polling plus registration-aware update checks and Blazor startup selection.
Cleanup worker lifecycle
src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw-cleanup.ts
Updates cleanup worker typing and version assignment, moves client teardown to activation, and changes unregister signaling to claim clients, post UNREGISTER, and await delayed fallback notifications.
Build, TypeScript, and repository wiring
src/Bswup/Bit.Bswup/Bit.Bswup.csproj, src/Bswup/Bit.Bswup/tsconfig.json, src/Bswup/Bit.Bswup/tsconfig.sw.json, src/Bswup/Bit.Bswup.slnx, src/Bswup/FullDemo/Client/Bit.Bswup.FullDemo.Client.csproj, src/Bswup/FullDemo/Server/Bit.Bswup.FullDemo.Server.csproj, src/Bswup/FullDemo/Client/Properties/launchSettings.json, src/Bswup/FullDemo/Server/Properties/launchSettings.json
Adjusts static web asset generation, splits DOM and worker TypeScript compilation, updates solution references, and refreshes the demo and FullDemo project wiring and launch settings.
Full demo app and server wiring
src/Bswup/FullDemo/Client/Routes.razor, src/Bswup/FullDemo/Client/Shared/MainLayout.razor, src/Bswup/FullDemo/Server/Components/App.razor, src/Bswup/FullDemo/Server/Components/_Imports.razor, src/Bswup/FullDemo/Server/Program.cs, src/Bswup/FullDemo/Server/Pages/_Host.cshtml, src/Bswup/FullDemo/Server/Pages/_Layout.cshtml, src/Bswup/FullDemo/Server/Startup/Middlewares.cs, src/Bswup/FullDemo/Server/Startup/Services.cs
Adds the new FullDemo Blazor router, layout, host app shell, and server entrypoint while replacing the older startup path.
Full demo client pages and imports
src/Bswup/FullDemo/Client/Pages/Home.razor, src/Bswup/FullDemo/Client/_Imports.razor, src/Bswup/NewDemo/Bit.Bswup.NewDemo/Components/App.razor
Updates the FullDemo client routing imports and home page title, and removes the extra body header from the new app shell.
Documentation updates
src/Bswup/README.md
Expands the README examples and API docs for the updated handler messages, service-worker options, cache versioning, polling, and force-refresh behavior.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Browser
  participant BitBswup
  participant ServiceWorker
  participant Blazor
  Browser->>BitBswup: startup / DOMContentLoaded
  BitBswup->>ServiceWorker: registration.update()
  ServiceWorker-->>BitBswup: updateNotFound / updateCheckFailed / waiting
  BitBswup->>Blazor: startBlazor() when allowed
  ServiceWorker-->>BitBswup: controllerchange / WAITING_SKIPPED / error
  BitBswup->>Browser: reloadOnce()
Loading

Poem

🐰 I sniff the cache and tap the screen,
New retries bloom where bugs once been.
The progress bar now speaks with grace,
And errors wear a steadier face.
Hop, hop — the update path is clean.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR includes unrelated placeholder demo edits, such as changing heading text, which are outside the Bswup improvements scope. Remove unrelated demo content edits and keep the PR focused on Bswup runtime, UI, documentation, and demo-alignment work.
Docstring Coverage ⚠️ Warning Docstring coverage is 56.25% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and clearly summarizes the main change: applying Bswup improvements tied to #12408.
Linked Issues check ✅ Passed The changes broadly implement the listed Bswup fixes, including logging, retry/backoff, update polling, safer manifests, and UI/bootstrap updates.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts`:
- Around line 47-57: The manifest validation detects errors (MANIFEST_ERRORS
from validateAssetsManifest) but the code continues to run and later
dereferences self.assetsManifest.assets, causing a crash; after calling
sendError you should stop further startup: return/throw to prevent asset
enumeration, and guard any access to self.assetsManifest.assets (e.g., use
Array.isArray(self.assetsManifest.assets) before iterating) and ensure VERSION
fallback is computed safely (use (self.assetsManifest && typeof
self.assetsManifest.version === 'string') ? self.assetsManifest.version :
'0.0.0-invalid-manifest') so the service worker does not proceed when the
manifest is invalid; update the block around MANIFEST_ERRORS, sendError,
VERSION, and any asset-enumeration code that uses self.assetsManifest.assets to
enforce this early exit and safe checks.

In `@src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts`:
- Around line 321-324: The catch block in checkForUpdate currently calls
handle(BswupMessage.error, ...) which routes transient registration.update()
failures into the blocking install-error path; change this to emit a
non-blocking message instead (e.g., add a new enum/value like
BswupMessage.updateCheckFailed or use a non-fatal level such as
BswupMessage.warn/info) and call handle(...) with that new message name,
preserving the payload ({ reason: 'update', message: String((err && (err as
any).message) || err), reload }) so callers can still react but the default
progress handler will not hide the app or show the install-failed UI. Ensure to
update any switch/handler that consumes BswupMessage.* to treat the new
updateCheckFailed value as non-blocking.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ae99fd6f-8550-4920-b5b5-7982f9b3572d

📥 Commits

Reviewing files that changed from the base of the PR and between 046d116 and 825d8af.

📒 Files selected for processing (7)
  • src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.js
  • src/Bswup/Bit.Bswup/BswupProgress.razor
  • src/Bswup/Bit.Bswup/Scripts/bit-bswup.progress.ts
  • src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts
  • src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts
  • src/Bswup/Bit.Bswup/Styles/bit-bswup.progress.css
  • src/Bswup/README.md

Comment thread src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts Outdated
Comment thread src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts Outdated
@msynk

msynk commented Jun 1, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai re-review

@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
echo "=== bit-bswup.sw.ts ==="
fd "bit-bswup.sw.ts" --exec cat {}

echo ""
echo "=== bit-bswup.ts ==="
fd "bit-bswup.ts" -E "*.js" --exec cat {}

echo ""
echo "=== bit-bswup.progress.ts ==="
fd "bit-bswup.progress.ts" --exec cat {}

echo ""
echo "=== BswupProgress.razor ==="
fd "BswupProgress.razor" --exec cat {}

echo ""
echo "=== bit-bswup.progress.css ==="
fd "bit-bswup.progress.css" --exec cat {}

echo ""
echo "=== service-worker.js (demo) ==="
fd "service-worker.js" --search-path "Bit.Bswup.Demo" --exec cat {}

echo ""
echo "=== README.md (Bswup) ==="
cat src/Bswup/README.md

Length of output: 87174



@msynk: Reviewed the PR thoroughly. The improvements are substantial — the structured error reporting, errorTolerance: 'strict' default, retry logic with exponential backoff, update polling, cacheVersion, and multi-tab lifecycle fixes are all well-designed. A few issues worth addressing:


🔴 Critical — Crash when assetsManifest fails to load

In bit-bswup.sw.ts, validateAssetsManifest correctly catches a missing/null manifest and pushes an error — but execution continues and the module-level ALL_ASSETS initialisation immediately dereferences .assets on the potentially-null manifest:

const MANIFEST_ERRORS = validateAssetsManifest(self.assetsManifest);
if (MANIFEST_ERRORS.length) {
    sendError({ reason: 'manifest', message: '...', url: ASSETS_URL });
    // ↑ execution falls through!
}
// ...
const ALL_ASSETS = self.assetsManifest.assets   // TypeError: Cannot read properties of null
    .filter(...);

If the importScripts(ASSETS_URL) call fails (404, network error, syntax error in the generated assets file), self.assetsManifest is undefined and the SW crashes with an unhandled TypeError before any error event can reach the page. Suggest guarding:

if (MANIFEST_ERRORS.length) {
    sendError({ ... });
    // Prevent further initialisation from crashing on a null manifest.
    self.addEventListener('install', (e: any) => e.waitUntil(Promise.reject(new Error('Invalid assetsManifest'))));
    throw new Error('assetsManifest validation failed: ' + MANIFEST_ERRORS.join('; '));
}

🟡 Moderate — checkForUpdate may emit spurious updateNotFound

In bit-bswup.ts, after await registration.update(), the code reads registration.installing immediately:

await registration.update();
if (!registration.installing && !registration.waiting) {
    handle(BswupMessage.updateNotFound);   // ← may fire even when install is in-flight
}

reg.update() resolves when the server responds (the SW byte-comparison is done), but the browser may not have set reg.installing synchronously by the time the next microtask runs. This can produce a false UPDATE_NOT_FOUND that races with the updatefound event. A small setTimeout(0) / requestAnimationFrame or relying solely on the absence of an updatefound event would be more reliable.


🟡 Moderate — Retry button shown for non-retriable errors

In bit-bswup.progress.ts, errorRetryButton is revealed for every BswupMessage.error including manifest validation failures (reason: 'manifest') and SRI integrity failures (reason: 'integrity'). For those cases, reloading won't help without a redeployment. Consider hiding the retry button (or changing its label to "Reload") when data.reason is one of those permanent failure types.


🟡 Moderate — Handler parameter injected unsanitised into JS string

In BswupProgress.razor:

BitBswupProgress.start(..., '@(Handler)');

If Handler contains a single quote or semicolon (e.g. '; alert(1)//), it breaks out of the string literal. Handler is a developer-supplied [Parameter] so the practical risk is low, but HttpUtility.JavaScriptStringEncode or @Json.Serialize(Handler) would make it safe and consistent.


🟢 Minor — verbose() is defined but never called

In bit-bswup.ts, verbose() is defined alongside error/warn/info/debug but is never invoked in the script. If it's intended to be part of the public log-level hierarchy it should be used, otherwise it can be removed to keep the codebase clean.


🟢 Minor — Error panel shown over partial progress bar

When BswupMessage.error fires mid-download in bit-bswup.progress.ts, the error panel appears but the progress bar and percentage elements remain visible showing a partial value. Consider hiding them when revealing the error panel:

case BswupMessage.error:
    // ...
    if (progressEl) progressEl.parentElement!.style.display = 'none';
    if (percentEl) percentEl.style.display = 'none';
    if (errorEl) errorEl.style.display = 'block';

🟢 Minor — README sample handler missing error case

The bitBswupHandler switch in README.md covers updateNotFound (new) but omits BswupMessage.error. Since structured error reporting is a headline feature of this PR, adding a sample case would help developers wire it up:

case BswupMessage.error:
    console.error('Bswup install error:', data.reason, data.message);
    // optionally surface data.url / data.hash for diagnostics
    return;

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves Bit.Bswup’s update experience and robustness by adding user-visible install error reporting (with retry), introducing opt-in update polling (interval and/or tab visibility), improving multi-tab update consistency, and expanding Blazor script auto-detection to cover both Blazor Web App and standalone WebAssembly entry points.

Changes:

  • Add update polling controls (updateInterval, updateOnVisibility) and expose/extend JS API docs (BitBswup.checkForUpdate, skipWaiting, forceRefresh).
  • Improve service worker install reliability (manifest validation, retries/backoff, strict vs lax error tolerance, safer multi-tab activation/claim behavior).
  • Enhance the progress UI with an error panel (message/details + retry) and corresponding styles.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/Bswup/README.md Documents new script attributes, error tolerance behavior, multi-tab behavior, security notes, and JS API.
src/Bswup/Bit.Bswup/Styles/bit-bswup.progress.css Adds styling for the new install error panel and retry button behavior.
src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts Adds idempotent initialization, update polling, better controllerchange handling, richer logging levels, and expanded Blazor script detection.
src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts Adds manifest validation + error reporting, retry/backoff for asset fetches, strict/lax install semantics, safer cache update sequencing, and RegExp parsing improvements.
src/Bswup/Bit.Bswup/Scripts/bit-bswup.progress.ts Adds UI handling for install errors (message/details/retry) and keeps assets list visibility in sync with runtime config changes.
src/Bswup/Bit.Bswup/BswupProgress.razor Updates the progress component markup to include an error panel and changes initialization to run via a <script> block.
src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.published.js Removes demo precachedAssetsInclude config line.
src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.js Adjusts demo config to use errorTolerance = 'lax' with explanatory comment.

Comment thread src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts Outdated
Comment thread src/Bswup/Bit.Bswup/BswupProgress.razor Outdated
Comment thread src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts
Comment thread src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts Outdated
Comment thread src/Bswup/Bit.Bswup/BswupProgress.razor Outdated
Comment thread src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts
@msynk msynk requested a review from Copilot June 2, 2026 19:39
@msynk

msynk commented Jun 2, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai re-review

@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown

@msynk: Sure, I'll kick off a fresh review of the PR now.

✅ Actions performed

Full review triggered.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment thread src/Bswup/Bit.Bswup/BswupProgress.razor Outdated
Comment thread src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts (1)

333-362: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use e.waitUntil() for async work in the service worker message handler.

Returning a Promise from the message listener doesn’t reliably keep the worker alive; use ExtendableMessageEvent.waitUntil(...) for skipWaiting(), clients.claim(), cache deletion/filling, and the follow-up postMessage.

Suggested fix
-function handleMessage(e: MessageEvent<string>) {
+function handleMessage(e: any) {
     diag('handleMessage:', e);

     if (e.data === 'SKIP_WAITING') {
-        return self.skipWaiting()
-            .then(() => self.clients.claim())
-            .then(() => deleteOldCaches())
-            .then(() => sendMessage('WAITING_SKIPPED'));
+        e.waitUntil(
+            self.skipWaiting()
+                .then(() => self.clients.claim())
+                .then(() => deleteOldCaches())
+                .then(() => sendMessage('WAITING_SKIPPED'))
+        );
+        return;
     }

     if (e.data === 'CLAIM_CLIENTS') {
-        return self.clients.claim()
-            .then(() => deleteOldCaches())
-            .then(() => e.source?.postMessage('CLIENTS_CLAIMED'));
+        e.waitUntil(
+            self.clients.claim()
+                .then(() => deleteOldCaches())
+                .then(() => e.source?.postMessage('CLIENTS_CLAIMED'))
+        );
+        return;
     }

     if (e.data === 'BLAZOR_STARTED') {
-        createAssetsCache(true);
+        e.waitUntil(createAssetsCache(true));
+        return;
     }

     if (e.data === 'CLEAN_UP') {
-        deleteOldCaches(); // remove the old caches
+        e.waitUntil(deleteOldCaches()); // remove the old caches
     }
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts` around lines 333 - 362, The
message handler currently returns Promises but must use e.waitUntil(...) to keep
the service worker alive; wrap each async branch so that SKIP_WAITING uses
e.waitUntil(self.skipWaiting().then(() => self.clients.claim()).then(() =>
deleteOldCaches()).then(() => sendMessage('WAITING_SKIPPED'))), CLAIM_CLIENTS
uses e.waitUntil(self.clients.claim().then(() => deleteOldCaches()).then(() =>
e.source?.postMessage('CLIENTS_CLAIMED'))), BLAZOR_STARTED uses
e.waitUntil(createAssetsCache(true)), and CLEAN_UP uses
e.waitUntil(deleteOldCaches()), ensuring all calls to self.skipWaiting(),
self.clients.claim(), deleteOldCaches(), createAssetsCache(true), sendMessage
and e.source?.postMessage are inside the waitUntil chains.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/Bswup/Bit.Bswup/BswupProgress.razor`:
- Around line 37-39: The inline script in BswupProgress.razor calls
BitBswupProgress.start(...) unguarded which throws if bit-bswup.progress.js
hasn't loaded; update the init to check for the global before invoking (e.g.,
use window.BitBswupProgress?.start(...) or an explicit if
(window.BitBswupProgress) call) passing the same parameters (AutoReload,
ShowLogs, ShowAssets, AppContainer, HideApp, AutoHide, Handler), or
alternatively move the startup into the component lifecycle (OnAfterRenderAsync)
and call JS interop to invoke BitBswupProgress.start to guarantee ordering.
- Line 38: The call to BitBswupProgress.start injects AppContainer and Handler
as raw single-quoted JS literals which can be broken by
quotes/backslashes/newlines; change those embeddings to JSON-encoded JS-safe
strings instead (e.g., replace the single-quoted '@(AppContainer)' and
'@(Handler)' with the output of
System.Text.Json.JsonSerializer.Serialize(AppContainer) and
JsonSerializer.Serialize(Handler) so the values are properly escaped and already
quoted), update the BswupProgress.razor to use JsonSerializer.Serialize for both
AppContainer and Handler and add the required using/import for System.Text.Json
if missing.

In `@src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts`:
- Around line 86-94: The cache bucket currently uses only CACHE_VERSION (derived
from self.cacheVersion or VERSION) which allows different manifests to share a
bucket; change the cache naming so the manifest VERSION is always part of the
bucket identity. Keep the existing CACHE_VERSION calculation (using
self.cacheVersion fallback to VERSION) but construct CACHE_NAME to include both
VERSION and CACHE_VERSION (e.g. `${CACHE_NAME_PREFIX} - ${VERSION} -
${CACHE_VERSION}`), so the manifest VERSION remains in the cache bucket while
cacheVersion can still be used to pin/force refresh.
- Around line 516-540: The current logic sets isIntegrity true whenever
hasIntegrity && fetchErr instanceof TypeError, which treats all TypeError fetch
rejections as SRI failures and prevents retries; change the detection in the
addCache flow so a bare TypeError does NOT automatically mark an integrity
failure: remove fetchErr instanceof TypeError from the isIntegrity predicate and
instead only classify as integrity when there is a clear integrity signal (e.g.,
the error message matches the integrity/digest regex) or after explicitly
recomputing and comparing the response bytes to asset.hash; keep transient
TypeError cases as retryable (use lastError/continue while attempt <
MAX_RETRIES), and only increment integrityFailureCount, set sendError.reason to
'integrity', and skip retries when you have a confirmed integrity mismatch (use
the integrity regex or the explicit digest comparison to decide).

In `@src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts`:
- Line 35: Guard runBswup against late script injection by checking
document.readyState before adding the listener: if the document is already
"interactive" or "complete" call runBswup() immediately, otherwise attach
window.addEventListener('DOMContentLoaded', runBswup) (refer to the runBswup
symbol). Also fix BitBswup.forceRefresh where cacheFilter.test(key) is used:
avoid inconsistent results when cacheFilter has the global (g) or sticky (y)
flags by resetting cacheFilter.lastIndex = 0 before each test or by creating a
non-global equivalent RegExp from cacheFilter (use cacheFilter.source with flags
stripped of g/y) and testing against that; reference the BitBswup.forceRefresh
method and the cacheFilter variable so the change is made exactly where repeated
RegExp.test calls occur.
- Around line 497-500: forceRefresh builds the shouldDelete predicate from
cacheFilter but when cacheFilter is a RegExp it calls cacheFilter.test()
repeatedly, which can misbehave for /.../g or /.../y because RegExp.lastIndex is
mutated; fix by updating the RegExp branch in the shouldDelete construction
(used in forceRefresh) to reset cacheFilter.lastIndex = 0 before calling
cacheFilter.test(key) so each key is tested from the start; reference the
shouldDelete variable and cacheFilter RegExp usage in forceRefresh when making
the change.

---

Outside diff comments:
In `@src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts`:
- Around line 333-362: The message handler currently returns Promises but must
use e.waitUntil(...) to keep the service worker alive; wrap each async branch so
that SKIP_WAITING uses e.waitUntil(self.skipWaiting().then(() =>
self.clients.claim()).then(() => deleteOldCaches()).then(() =>
sendMessage('WAITING_SKIPPED'))), CLAIM_CLIENTS uses
e.waitUntil(self.clients.claim().then(() => deleteOldCaches()).then(() =>
e.source?.postMessage('CLIENTS_CLAIMED'))), BLAZOR_STARTED uses
e.waitUntil(createAssetsCache(true)), and CLEAN_UP uses
e.waitUntil(deleteOldCaches()), ensuring all calls to self.skipWaiting(),
self.clients.claim(), deleteOldCaches(), createAssetsCache(true), sendMessage
and e.source?.postMessage are inside the waitUntil chains.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d3c76fdc-5fec-4833-85fc-89e300ee0dd0

📥 Commits

Reviewing files that changed from the base of the PR and between 046d116 and 733a05a.

📒 Files selected for processing (8)
  • src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.js
  • src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.published.js
  • src/Bswup/Bit.Bswup/BswupProgress.razor
  • src/Bswup/Bit.Bswup/Scripts/bit-bswup.progress.ts
  • src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts
  • src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts
  • src/Bswup/Bit.Bswup/Styles/bit-bswup.progress.css
  • src/Bswup/README.md
💤 Files with no reviewable changes (1)
  • src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.published.js

Comment thread src/Bswup/Bit.Bswup/BswupProgress.razor Outdated
Comment thread src/Bswup/Bit.Bswup/BswupProgress.razor Outdated
Comment thread src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts
Comment thread src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts
Comment thread src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts Outdated
Comment thread src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts Outdated
@msynk msynk requested a review from Copilot June 4, 2026 10:16
@msynk

msynk commented Jun 4, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai re-review

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

@msynk: Sure, triggering a fresh review of the PR now.

✅ Action performed

Full review finished.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Comment thread src/Bswup/Bit.Bswup/BswupProgress.razor Outdated
Comment thread src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Nitpick comments (1)
src/Bswup/README.md (1)

105-110: ⚡ Quick win

Consider showing complete error details in the example.

The comment documents that data.url and data.hash are available "when known", but the example only logs data.reason and data.message. For a more complete reference example, consider showing all available fields.

📝 Suggested enhancement
         case BswupMessage.error:
             // Structured install failure. data.reason is one of 'manifest' | 'integrity' |
             // 'fetch' | 'cache' | 'request' | 'install-incomplete'; data.message is human
             // readable, and data.url / data.hash point at the offending asset when known.
-            console.error('Bswup install error:', data.reason, data.message);
+            console.error('Bswup install error:', data.reason, data.message, data.url, data.hash);
             return;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Bswup/README.md` around lines 105 - 110, The example logging for the
BswupMessage.error case only prints data.reason and data.message; update the
handler for the BswupMessage.error branch (the switch case) to log all available
error details (data.reason, data.message, and when present data.url and
data.hash, plus the whole data object for unknown fields) so consumers see the
complete failure context; use the existing BswupMessage.error case and data
variable to append url and hash if defined and include a fallback of logging the
entire data object.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/Bswup/Bit.Bswup/Scripts/bit-bswup.progress.ts`:
- Around line 129-149: The retry suppression omitted the 'install-incomplete'
reason so deterministic failures can still show the retry button; update the
nonRetriableReasons used where errorRetryButton is handled (the
nonRetriableReasons array and the isRetriable check in the same block) to
include 'install-incomplete' alongside 'manifest' and 'integrity' so isRetriable
becomes false for that reason, keep the existing behavior for invoking
data.reload() or window.location.reload() unchanged.

In `@src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts`:
- Around line 388-425: The extract() function currently assigns options =
(window[optionsName] || defaultoptions) which replaces defaults when a partial
window[optionsName] exists; change it to merge defaults with any global config
(e.g. create options by combining defaultoptions and window[optionsName] such as
Object.assign({}, defaultoptions, window[optionsName]) or using the spread
operator) so missing keys in window[optionsName] fall back to defaultoptions;
keep the subsequent attribute overrides (log, sw, scope, handlerName,
blazorScript, updateInterval, updateOnVisibility) applied on top of the merged
options.
- Around line 427-438: The current handle function permanently replaces
options.handler with a noop when window[options.handlerName] is missing,
preventing later attachment from being picked up; change it so you do not
overwrite options.handler on missing handler — instead read
window[options.handlerName] into a local variable (e.g., foundHandler) or only
assign to options.handler when a real function is present, call that local/found
handler if available, and leave options.handler untouched (so future
registrations on window[options.handlerName] can be discovered); update the
logic in the handle function that references options.handlerName and
options.handler to reflect this non-destructive check.

In `@src/Bswup/Bit.Bswup/Styles/bit-bswup.progress.css`:
- Around line 74-89: Replace the deprecated word-break: break-word in the
.bit-bswup-error-message and .bit-bswup-error-details selectors by removing
those declarations and adding overflow-wrap: anywhere (leave existing
white-space: pre-wrap intact) so the stylesheet no longer triggers the Stylelint
warning.

In `@src/Bswup/README.md`:
- Line 218: Update the README entry for the `FullOffline` mode to correct the
grammar by changing "from first time the app is loaded" to "from the first time
the app is loaded" so the description reads: "Enables the full offline mode
where all assets are cached and served from the cache from the first time the
app is loaded."
- Around line 228-234: Update the "Polling for updates" paragraph to fix the
numeric inconsistency: change "There are three ways to check more often:" to
"There are two ways to check more often:" (since only the built-in options using
updateInterval/updateOnVisibility and calling BitBswup.checkForUpdate() are
listed), ensuring the section header "Polling for updates" and references to
updateInterval, updateOnVisibility and BitBswup.checkForUpdate() remain
unchanged.
- Line 213: The README wording incorrectly states that per-asset ?v= and SRI
derive from the manifest version; update the text to accurately reflect that
CACHE_VERSION / cacheVersion only affect the cache bucket name (computed into
CACHE_NAME) while per-asset cache-buster and integrity are set inside
createNewAssetRequest() using each asset's asset.hash (with fallback to
self.assetsManifest.version) and requestInit.integrity = asset.hash; replace the
sentence to mention that ?v= primarily comes from asset.hash (fallback to
manifest.version) and SRI uses asset.hash, and remove any implication that those
values reference self.cacheVersion or CACHE_VERSION.

---

Nitpick comments:
In `@src/Bswup/README.md`:
- Around line 105-110: The example logging for the BswupMessage.error case only
prints data.reason and data.message; update the handler for the
BswupMessage.error branch (the switch case) to log all available error details
(data.reason, data.message, and when present data.url and data.hash, plus the
whole data object for unknown fields) so consumers see the complete failure
context; use the existing BswupMessage.error case and data variable to append
url and hash if defined and include a fallback of logging the entire data
object.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 427f1025-c5ef-456e-b74d-6a2168e132d7

📥 Commits

Reviewing files that changed from the base of the PR and between 046d116 and de9c330.

📒 Files selected for processing (9)
  • src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.js
  • src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.published.js
  • src/Bswup/Bit.Bswup/BswupProgress.razor
  • src/Bswup/Bit.Bswup/Scripts/bit-bswup.progress.ts
  • src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw-cleanup.ts
  • src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts
  • src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts
  • src/Bswup/Bit.Bswup/Styles/bit-bswup.progress.css
  • src/Bswup/README.md
💤 Files with no reviewable changes (1)
  • src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.published.js

Comment thread src/Bswup/Bit.Bswup/Scripts/bit-bswup.progress.ts
Comment thread src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts
Comment thread src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts
Comment thread src/Bswup/Bit.Bswup/Styles/bit-bswup.progress.css
Comment thread src/Bswup/README.md Outdated
Comment thread src/Bswup/README.md Outdated
Comment thread src/Bswup/README.md
@msynk msynk requested a review from Copilot June 6, 2026 06:44
@msynk

msynk commented Jun 6, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai re-review

@msynk

msynk commented Jun 28, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai re-review

@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

@msynk Sure — kicking off a fresh full review of #12418 now.

✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts (1)

430-435: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Extend the message event lifetime for the async cache work. In src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts:431-435, BLAZOR_STARTED and CLEAN_UP fire detached promises; wrap them in e.waitUntil(...) so the worker stays alive until createAssetsCache(true) / deleteOldCaches() settle, and keep the error handling on the cleanup/top-up paths.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts` around lines 430 - 435, The
`message` handler in `bit-bswup.sw.ts` is starting async cache work without
extending the event lifetime. Update the `BLAZOR_STARTED` and `CLEAN_UP`
branches inside the `message` event listener to wrap `createAssetsCache(true)`
and `deleteOldCaches()` with `e.waitUntil(...)`, so the service worker stays
alive until those promises settle. Keep the existing error handling/logging
around the cleanup/top-up flows when making this change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/Bswup/Bit.Bswup/Bit.Bswup.csproj`:
- Around line 47-52: The BuildJavaScript target is only tracking TypeScript
sources and tsconfig files, so changes to the node toolchain can leave stale
wwwroot outputs in incremental builds. Update the Inputs on BuildJavaScript to
also include the dependency manifests used by InstallNodejsDependencies,
especially package.json and package-lock.json, so a toolchain upgrade forces
recompilation through the existing tsc and tsc -p tsconfig.sw.json steps.

---

Outside diff comments:
In `@src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts`:
- Around line 430-435: The `message` handler in `bit-bswup.sw.ts` is starting
async cache work without extending the event lifetime. Update the
`BLAZOR_STARTED` and `CLEAN_UP` branches inside the `message` event listener to
wrap `createAssetsCache(true)` and `deleteOldCaches()` with `e.waitUntil(...)`,
so the service worker stays alive until those promises settle. Keep the existing
error handling/logging around the cleanup/top-up flows when making this change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a00b14d1-7bb2-4de7-801d-d8ef62667c00

📥 Commits

Reviewing files that changed from the base of the PR and between 48dbfb3 and a1ee5c5.

📒 Files selected for processing (12)
  • src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.js
  • src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.published.js
  • src/Bswup/Bit.Bswup/Bit.Bswup.csproj
  • src/Bswup/Bit.Bswup/BswupProgress.razor
  • src/Bswup/Bit.Bswup/Scripts/bit-bswup.progress.ts
  • src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw-cleanup.ts
  • src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts
  • src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts
  • src/Bswup/Bit.Bswup/Styles/bit-bswup.progress.css
  • src/Bswup/Bit.Bswup/tsconfig.json
  • src/Bswup/Bit.Bswup/tsconfig.sw.json
  • src/Bswup/README.md
💤 Files with no reviewable changes (1)
  • src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.published.js

Comment thread src/Bswup/Bit.Bswup/Bit.Bswup.csproj Outdated
@msynk

msynk commented Jun 28, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai re-review

@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

@msynk Sure — kicking off a fresh full review of #12418 now.

✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/Bswup/Bit.Bswup/Scripts/bit-bswup.progress.ts (1)

125-149: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Handle failed data.reload() calls in the auto-reload path.

Both auto-reload branches assume data.reload() succeeds. If it rejects, downloadFinished can leave the app hidden with the splash stuck (default AutoHide is false), and updateReady gives the user no manual fallback. Catch the failure and restore/show the manual reload path instead of only cleaning up in .then().

Proposed fix
-                        if (autoReload_ || data.firstInstall) {
-                            data.reload().then(() => {
-                                hideApp_ && appEl && (appEl.style.display = appElOriginalDisplay);
-                                bswupEl && (bswupEl.style.display = 'none');
-                            });
+                        if (autoReload_ || data.firstInstall) {
+                            Promise.resolve(data.reload())
+                                .then(() => {
+                                    hideApp_ && appEl && (appEl.style.display = appElOriginalDisplay);
+                                    bswupEl && (bswupEl.style.display = 'none');
+                                })
+                                .catch((err) => {
+                                    console.error('BitBswup reload failed:', err);
+                                    hideApp_ && appEl && (appEl.style.display = appElOriginalDisplay);
+                                    reloadButton && (reloadButton.style.display = 'block');
+                                    reloadButton && (reloadButton.onclick = data.reload);
+                                });
                         } else {
                             reloadButton && (reloadButton.style.display = 'block');
                             reloadButton && (reloadButton.onclick = data.reload);
@@
-                        if (autoReload_) {
-                            data.reload();
+                        if (autoReload_) {
+                            Promise.resolve(data.reload()).catch((err) => {
+                                console.error('BitBswup reload failed:', err);
+                                reloadButton && (reloadButton.style.display = 'inline');
+                                reloadButton && (reloadButton.onclick = data.reload);
+                            });
                         } else {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Bswup/Bit.Bswup/Scripts/bit-bswup.progress.ts` around lines 125 - 149,
Handle failed data.reload() in both the downloadFinished and updateReady
branches of bit-bswup.progress.ts. The current auto-reload path only handles
success, so if data.reload() rejects the UI can stay hidden and no manual retry
is offered. Update the logic around data.reload() to catch rejections, restore
the app/splash visibility cleanup in the failure path, and fall back to showing
the reloadButton with its onclick wired to data.reload so users can retry
manually.
🧹 Nitpick comments (2)
src/Bswup/README.md (2)

225-229: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Correct forceRefresh unregister scope.

Line 229 says "unregisters all service workers" but the implementation only unregisters the service worker whose scope controls the current page (navigator.serviceWorker.getRegistration()), not every same-origin registration. Update the wording to match the actual behavior.

- `BitBswup.forceRefresh(cacheFilter?)`: Clears caches, unregisters all service workers, and reloads the page.
+ `BitBswup.forceRefresh(cacheFilter?)`: Clears caches, unregisters the app's service worker, and reloads the page.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Bswup/README.md` around lines 225 - 229, The `BitBswup.forceRefresh` docs
overstate unregister scope by saying it “unregisters all service workers,” but
the implementation only unregisters the current page’s controlling registration
via `navigator.serviceWorker.getRegistration()`. Update the
`forceRefresh(cacheFilter?)` description in the README to match the actual
behavior and make it clear it only removes the active registration for the
current scope, not every same-origin service worker.

227-227: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document the updateCheckFailed event.

When BitBswup.checkForUpdate() encounters a transient failure (offline, server hiccup), the runtime emits updateCheckFailed rather than error so the default progress UI doesn't hide the app. Add this case to the handler example and mention it in the API description so callers can show a "check failed" message.

        case BswupMessage.updateNotFound:
            return console.log('checked for an update, already on the latest version.');
+
+       case BswupMessage.updateCheckFailed:
+           return console.warn('update check failed:', data.message);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Bswup/README.md` at line 227, The README entry for
BitBswup.checkForUpdate() is missing the updateCheckFailed event handling.
Update the API description and the handler example to mention that transient
check failures emit updateCheckFailed instead of error, and show how callers
should handle it in the same update-flow documentation alongside updateFound,
stateChanged, updateReady, downloadFinished, and updateNotFound.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/Bswup/Bit.Bswup/Bit.Bswup.csproj`:
- Around line 13-14: The BswupAssetsBuildTfm logic in Bit.Bswup.csproj is pinned
to the first TargetFrameworks entry, which breaks single-framework builds
targeting a non-first TFM. Update the MSBuild property so
ResolveStaticWebAssetsInputsDependsOn and related asset-generation hooks use
$(TargetFramework) whenever it is already set, and only fall back to the first
TargetFrameworks value for cross-targeting builds. Keep the fix aligned with the
existing BswupAssetsBuildTfm condition so JS/CSS generation still runs for
dotnet build/publish -f scenarios.

In `@src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw-cleanup.ts`:
- Around line 42-46: The cleanup logic in the service worker is broadcasting
UNREGISTER too broadly because `clients.matchAll({ includeUncontrolled: true })`
returns every same-origin client. Update the cleanup flow in `sw-cleanup.ts` to
filter the matched clients to only window clients whose URL falls under
`self.registration.scope` before calling `client.postMessage('UNREGISTER')`, so
the `reloadSignals` loop only targets the current registration.

---

Outside diff comments:
In `@src/Bswup/Bit.Bswup/Scripts/bit-bswup.progress.ts`:
- Around line 125-149: Handle failed data.reload() in both the downloadFinished
and updateReady branches of bit-bswup.progress.ts. The current auto-reload path
only handles success, so if data.reload() rejects the UI can stay hidden and no
manual retry is offered. Update the logic around data.reload() to catch
rejections, restore the app/splash visibility cleanup in the failure path, and
fall back to showing the reloadButton with its onclick wired to data.reload so
users can retry manually.

---

Nitpick comments:
In `@src/Bswup/README.md`:
- Around line 225-229: The `BitBswup.forceRefresh` docs overstate unregister
scope by saying it “unregisters all service workers,” but the implementation
only unregisters the current page’s controlling registration via
`navigator.serviceWorker.getRegistration()`. Update the
`forceRefresh(cacheFilter?)` description in the README to match the actual
behavior and make it clear it only removes the active registration for the
current scope, not every same-origin service worker.
- Line 227: The README entry for BitBswup.checkForUpdate() is missing the
updateCheckFailed event handling. Update the API description and the handler
example to mention that transient check failures emit updateCheckFailed instead
of error, and show how callers should handle it in the same update-flow
documentation alongside updateFound, stateChanged, updateReady,
downloadFinished, and updateNotFound.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0728f6d6-dbdc-4ad2-928d-fc0f9f8e24df

📥 Commits

Reviewing files that changed from the base of the PR and between 48dbfb3 and f92cdaa.

📒 Files selected for processing (12)
  • src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.js
  • src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.published.js
  • src/Bswup/Bit.Bswup/Bit.Bswup.csproj
  • src/Bswup/Bit.Bswup/BswupProgress.razor
  • src/Bswup/Bit.Bswup/Scripts/bit-bswup.progress.ts
  • src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw-cleanup.ts
  • src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts
  • src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts
  • src/Bswup/Bit.Bswup/Styles/bit-bswup.progress.css
  • src/Bswup/Bit.Bswup/tsconfig.json
  • src/Bswup/Bit.Bswup/tsconfig.sw.json
  • src/Bswup/README.md
💤 Files with no reviewable changes (1)
  • src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.published.js

Comment thread src/Bswup/Bit.Bswup/Bit.Bswup.csproj Outdated
Comment thread src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw-cleanup.ts Outdated
@msynk

msynk commented Jun 28, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai re-review

@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

@msynk Sure — kicking off a fresh full review of #12418 now.

✅ Action performed

Full review finished.

@msynk

msynk commented Jun 28, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai re-review

@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

@msynk Sure — kicking off a fresh full review of #12418 now.

✅ Action performed

Full review finished.

@msynk

msynk commented Jun 30, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai re-review

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

@msynk Sure — kicking off a fresh full review of #12418 now.

✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

♻️ Duplicate comments (2)
src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts (2)

126-147: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Only use CLAIM_CLIENTS for first-install reloads.

When an update install fails, reg.waiting is gone but reg.active is still present, so this branch posts CLAIM_CLIENTS to the already-active worker instead of forcing a navigation retry. That makes the Retry button effectively a no-op for update-error recovery.

Suggested fix
                 reload = () => {
                     if (reg.waiting) {
                         reg.waiting.postMessage('SKIP_WAITING');
                         return new Promise<void>(() => { });
                     }

-                    if (reg.active) {
+                    if (reg.active && !hadActiveWorkerAtStartup) {
                         reg.active.postMessage('CLAIM_CLIENTS');
                         return new Promise<void>((res) => blazorStartResolver = res as (value: unknown) => void);
                     }

-                    // No worker to coordinate with - fall back to a plain reload.
+                    // Update retry (or no worker to coordinate with): force a navigation so
+                    // the browser re-runs registration/install logic.
                     window.location.reload();
                     return new Promise<void>(() => { });
                 };
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts` around lines 126 - 147, The reload
logic in the `reload` function is treating any `reg.active` worker as a
first-install case, which causes Retry after an update failure to post
`CLAIM_CLIENTS` to an already-active worker instead of navigating again. Update
the branching so `CLAIM_CLIENTS` is only sent for true first-install reloads,
and make the `reg.active` path for update-error recovery fall back to a plain
`window.location.reload()` (or equivalent navigation retry) in `bit-bswup.ts`.

268-295: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Don't report failed Blazor startup as BLAZOR_STARTED.

Both the rejected startPromise path and the undefined path call onStarted(). That resolves the first-install reload flow and posts BLAZOR_STARTED even when Blazor never booted, so the service worker and progress UI continue down the success path while the page can stay blank/inert.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts` around lines 268 - 295, The
`CLIENTS_CLAIMED` handling in `bit-bswup.ts` currently treats failed or missing
Blazor startup the same as success by routing both the rejected `startPromise`
path and the `undefined` path through `onStarted()`. Split the success and
failure flows in the `startBlazor(true)` / `blazorStartResolver` logic so
`BLAZOR_STARTED` is only posted after a real successful startup, and on
rejection or unavailable startup resolve the reload flow separately without
signaling success.
🧹 Nitpick comments (1)
src/Bswup/FullDemo/Server/Program.cs (1)

11-12: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Scope CORS to the origins that actually need it.

Line 42 opens every controller mapped on Line 47 to any origin, header, and method. That is a very permissive default for a server app and makes future controller additions cross-origin callable unless someone remembers to tighten it later. Prefer a named policy for the demo origin(s), or remove CORS entirely if this stays same-origin.

Also applies to: 42-42, 47-47

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Bswup/FullDemo/Server/Program.cs` around lines 11 - 12, The CORS setup in
Program should not leave all controllers broadly cross-origin callable by
default. Update the CORS configuration around builder.Services.AddCors() and the
policy usage in the controller pipeline to use a named policy that only allows
the specific demo origin(s), headers, and methods needed, or remove CORS
entirely if the app is same-origin. Use the existing setup points in Program and
the controller mapping where the policy is applied to keep the change scoped.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/Bswup/Bit.Bswup.Demo/Pages/HomePage.razor`:
- Line 6: Replace the placeholder `111` heading in `HomePage.razor` by either
using the real page title or removing the extra `<h1>` entirely, since this
duplicated heading conflicts with the existing main heading. Update the markup
around the `HomePage` page content so only one meaningful top-level heading
remains.

In `@src/Bswup/Bit.Bswup.slnx`:
- Around line 10-15: The solution-level InstallNodejsDependencies target is now
invalid because the newly added FullDemo app projects do not define that target.
Update the solution composition in Bit.Bswup.slnx or add a no-op/passthrough
InstallNodejsDependencies target to the affected FullDemo project files (for
example, the Client and Server csproj symbols) so the solution-wide target can
execute without MSB4057.

In `@src/Bswup/Bit.Bswup/BswupProgress.razor`:
- Around line 24-58: The BswupProgress.razor markup still uses inline style
attributes for initial visibility, which keeps it incompatible with strict CSP.
Update the BswupProgress component to remove the inline display styles from the
root container, assets list, and error blocks, and move those defaults into CSS
classes or data-attribute-driven styling in the BswupProgress/bit-bswup
stylesheet. Keep the existing element IDs like bit-bswup, bit-bswup-assets, and
bit-bswup-error so the external script can continue toggling state without
inline styles.

In `@src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw-cleanup.ts`:
- Around line 28-34: Move the cache deletion logic out of the install flow and
into the service worker’s activate handling after clients.claim() so controlled
tabs are not left using a worker whose caches were already purged. Update the
cleanup logic in the sw-cleanup script by keeping skipWaiting() in install, then
performing the cacheKeys/caches.delete cleanup from the activate path once the
new worker has claimed clients; use the existing cache key filters for bit-bswup
and blazor-resources when relocating the code.

In `@src/Bswup/FullDemo/Server/Components/App.razor`:
- Around line 40-41: Move the Bswup progress bootstrap so the
`DemoBswupProgressBar` component is rendered before `bit-bswup.progress.js`
loads. In `App.razor`, reorder the `<script
src="_content/Bit.Bswup/bit-bswup.progress.js"></script>` and
`<DemoBswupProgressBar />` elements so `BswupProgress.razor` can find the
emitted `data-bit-bswup-*` attributes when the script initializes.

---

Duplicate comments:
In `@src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts`:
- Around line 126-147: The reload logic in the `reload` function is treating any
`reg.active` worker as a first-install case, which causes Retry after an update
failure to post `CLAIM_CLIENTS` to an already-active worker instead of
navigating again. Update the branching so `CLAIM_CLIENTS` is only sent for true
first-install reloads, and make the `reg.active` path for update-error recovery
fall back to a plain `window.location.reload()` (or equivalent navigation retry)
in `bit-bswup.ts`.
- Around line 268-295: The `CLIENTS_CLAIMED` handling in `bit-bswup.ts`
currently treats failed or missing Blazor startup the same as success by routing
both the rejected `startPromise` path and the `undefined` path through
`onStarted()`. Split the success and failure flows in the `startBlazor(true)` /
`blazorStartResolver` logic so `BLAZOR_STARTED` is only posted after a real
successful startup, and on rejection or unavailable startup resolve the reload
flow separately without signaling success.

---

Nitpick comments:
In `@src/Bswup/FullDemo/Server/Program.cs`:
- Around line 11-12: The CORS setup in Program should not leave all controllers
broadly cross-origin callable by default. Update the CORS configuration around
builder.Services.AddCors() and the policy usage in the controller pipeline to
use a named policy that only allows the specific demo origin(s), headers, and
methods needed, or remove CORS entirely if the app is same-origin. Use the
existing setup points in Program and the controller mapping where the policy is
applied to keep the change scoped.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0084a955-d3d0-42b0-818d-144fe8d14435

📥 Commits

Reviewing files that changed from the base of the PR and between 70dad4b and 021176a.

⛔ Files ignored due to path filters (3)
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/wwwroot/bit-bw-64.png is excluded by !**/*.png
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/wwwroot/favicon.ico is excluded by !**/*.ico
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/wwwroot/icon-512.png is excluded by !**/*.png
📒 Files selected for processing (52)
  • src/Bswup/Bit.Bswup.Demo/Pages/HomePage.razor
  • src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.js
  • src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.published.js
  • src/Bswup/Bit.Bswup.slnx
  • src/Bswup/Bit.Bswup/Bit.Bswup.csproj
  • src/Bswup/Bit.Bswup/BswupProgress.razor
  • src/Bswup/Bit.Bswup/Scripts/bit-bswup.progress.ts
  • src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw-cleanup.ts
  • src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts
  • src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts
  • src/Bswup/Bit.Bswup/Styles/bit-bswup.progress.css
  • src/Bswup/Bit.Bswup/tsconfig.json
  • src/Bswup/Bit.Bswup/tsconfig.sw.json
  • src/Bswup/FullDemo/Client/App.razor
  • src/Bswup/FullDemo/Client/Bit.Bswup.FullDemo.Client.csproj
  • src/Bswup/FullDemo/Client/Pages/Home.razor
  • src/Bswup/FullDemo/Client/Properties/launchSettings.json
  • src/Bswup/FullDemo/Client/Routes.razor
  • src/Bswup/FullDemo/Client/Shared/MainLayout.razor
  • src/Bswup/FullDemo/Client/_Imports.razor
  • src/Bswup/FullDemo/Server/Bit.Bswup.FullDemo.Server.csproj
  • src/Bswup/FullDemo/Server/Components/App.razor
  • src/Bswup/FullDemo/Server/Components/_Imports.razor
  • src/Bswup/FullDemo/Server/Pages/_Host.cshtml
  • src/Bswup/FullDemo/Server/Pages/_Layout.cshtml
  • src/Bswup/FullDemo/Server/Program.cs
  • src/Bswup/FullDemo/Server/Properties/launchSettings.json
  • src/Bswup/FullDemo/Server/Startup/Middlewares.cs
  • src/Bswup/FullDemo/Server/Startup/Services.cs
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/Bit.Bswup.NewDemo.Client.csproj
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/Layout/DemoBswupProgressBar.razor
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/Layout/DemoBswupProgressBar.razor.css
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/Layout/MainLayout.razor
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/Layout/MainLayout.razor.css
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/Pages/Counter.razor
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/Pages/Home.razor
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/Program.cs
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/Routes.razor
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/_Imports.razor
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/wwwroot/app.css
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/wwwroot/manifest.json
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/wwwroot/service-worker.js
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/wwwroot/service-worker.published.js
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo/Bit.Bswup.NewDemo.csproj
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo/Components/App.razor
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo/Components/Pages/Error.razor
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo/Components/_Imports.razor
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo/Program.cs
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo/Properties/launchSettings.json
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo/appsettings.Development.json
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo/appsettings.json
  • src/Bswup/README.md
💤 Files with no reviewable changes (8)
  • src/Bswup/FullDemo/Client/App.razor
  • src/Bswup/FullDemo/Server/Startup/Services.cs
  • src/Bswup/FullDemo/Server/Pages/_Host.cshtml
  • src/Bswup/FullDemo/Server/Startup/Middlewares.cs
  • src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.published.js
  • src/Bswup/FullDemo/Server/Pages/_Layout.cshtml
  • src/Bswup/FullDemo/Client/Properties/launchSettings.json
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo/Components/App.razor

Comment thread src/Bswup/Bit.Bswup.Demo/Pages/HomePage.razor
Comment thread src/Bswup/Bit.Bswup.slnx
Comment thread src/Bswup/Bit.Bswup/BswupProgress.razor
Comment thread src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw-cleanup.ts Outdated
Comment thread src/Bswup/FullDemo/Server/Components/App.razor
@msynk

msynk commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai re-review

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

@msynk Sure — kicking off a fresh full review of #12418 now.

✅ Action performed

Full review finished.

✅ Action performed

Full review finished.

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

@msynk Sure — kicking off a fresh full review of #12418 now.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
src/Bswup/FullDemo/Server/Components/App.razor (1)

40-41: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Progress script still loads before DemoBswupProgressBar is rendered.

This exact ordering was flagged in a prior review and remains unfixed here. bit-bswup.progress.js's autoStart() reads data-bit-bswup-* attributes off #bit-bswup at script-load time and bails out if the element isn't present yet, so loading the script before the component renders its markup means auto-initialization silently fails on first parse.

🐛 Proposed fix
-    <script src="_content/Bit.Bswup/bit-bswup.progress.js"></script>
-    <DemoBswupProgressBar />
+    <DemoBswupProgressBar />
+    <script src="_content/Bit.Bswup/bit-bswup.progress.js"></script>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Bswup/FullDemo/Server/Components/App.razor` around lines 40 - 41, The
progress script is still being loaded before DemoBswupProgressBar renders, so
autoStart in bit-bswup.progress.js can run before `#bit-bswup` exists and silently
fail. Move the script include to after the DemoBswupProgressBar component in
App.razor, or otherwise ensure the component markup is rendered before the
script executes, so the data-bit-bswup-* attributes are present when the script
initializes.
🧹 Nitpick comments (2)
src/Bswup/FullDemo/Server/Components/App.razor (1)

43-48: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove commented-out dead markup.

This block is unreachable Razor markup left behind; consider deleting it now that DemoBswupProgressBar is the active implementation.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Bswup/FullDemo/Server/Components/App.razor` around lines 43 - 48, Remove
the dead commented-out Razor markup in App.razor, since DemoBswupProgressBar is
now the active implementation. Delete the obsolete <link> and <BswupProgress>
block rather than leaving it commented so the App component stays clean and
easier to maintain.
src/Bswup/FullDemo/Server/Program.cs (1)

42-42: 🔒 Security & Privacy | 🔵 Trivial | 💤 Low value

Remove the blanket CORS policy

The demo is served from the same server/origin, so AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod() is broader than needed here. Prefer a named policy with the specific client origin, or drop CORS entirely if no cross-origin calls are expected.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Bswup/FullDemo/Server/Program.cs` at line 42, The current CORS setup in
Program is overly permissive because app.UseCors is allowing any origin, header,
and method. Replace this blanket policy by configuring a named CORS policy with
the specific client origin used by the demo, and apply that policy in the
pipeline; if the app only serves same-origin requests, remove the CORS
middleware entirely. Use the existing app.UseCors call in the server startup
flow to locate and update the policy.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@src/Bswup/FullDemo/Server/Components/App.razor`:
- Around line 40-41: The progress script is still being loaded before
DemoBswupProgressBar renders, so autoStart in bit-bswup.progress.js can run
before `#bit-bswup` exists and silently fail. Move the script include to after the
DemoBswupProgressBar component in App.razor, or otherwise ensure the component
markup is rendered before the script executes, so the data-bit-bswup-*
attributes are present when the script initializes.

---

Nitpick comments:
In `@src/Bswup/FullDemo/Server/Components/App.razor`:
- Around line 43-48: Remove the dead commented-out Razor markup in App.razor,
since DemoBswupProgressBar is now the active implementation. Delete the obsolete
<link> and <BswupProgress> block rather than leaving it commented so the App
component stays clean and easier to maintain.

In `@src/Bswup/FullDemo/Server/Program.cs`:
- Line 42: The current CORS setup in Program is overly permissive because
app.UseCors is allowing any origin, header, and method. Replace this blanket
policy by configuring a named CORS policy with the specific client origin used
by the demo, and apply that policy in the pipeline; if the app only serves
same-origin requests, remove the CORS middleware entirely. Use the existing
app.UseCors call in the server startup flow to locate and update the policy.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 914d74d8-9dc1-41f5-92ed-ecd22c13b6eb

📥 Commits

Reviewing files that changed from the base of the PR and between 70dad4b and 571f537.

⛔ Files ignored due to path filters (3)
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/wwwroot/bit-bw-64.png is excluded by !**/*.png
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/wwwroot/favicon.ico is excluded by !**/*.ico
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/wwwroot/icon-512.png is excluded by !**/*.png
📒 Files selected for processing (52)
  • src/Bswup/Bit.Bswup.Demo/Pages/HomePage.razor
  • src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.js
  • src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.published.js
  • src/Bswup/Bit.Bswup.slnx
  • src/Bswup/Bit.Bswup/Bit.Bswup.csproj
  • src/Bswup/Bit.Bswup/BswupProgress.razor
  • src/Bswup/Bit.Bswup/Scripts/bit-bswup.progress.ts
  • src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw-cleanup.ts
  • src/Bswup/Bit.Bswup/Scripts/bit-bswup.sw.ts
  • src/Bswup/Bit.Bswup/Scripts/bit-bswup.ts
  • src/Bswup/Bit.Bswup/Styles/bit-bswup.progress.css
  • src/Bswup/Bit.Bswup/tsconfig.json
  • src/Bswup/Bit.Bswup/tsconfig.sw.json
  • src/Bswup/FullDemo/Client/App.razor
  • src/Bswup/FullDemo/Client/Bit.Bswup.FullDemo.Client.csproj
  • src/Bswup/FullDemo/Client/Pages/Home.razor
  • src/Bswup/FullDemo/Client/Properties/launchSettings.json
  • src/Bswup/FullDemo/Client/Routes.razor
  • src/Bswup/FullDemo/Client/Shared/MainLayout.razor
  • src/Bswup/FullDemo/Client/_Imports.razor
  • src/Bswup/FullDemo/Server/Bit.Bswup.FullDemo.Server.csproj
  • src/Bswup/FullDemo/Server/Components/App.razor
  • src/Bswup/FullDemo/Server/Components/_Imports.razor
  • src/Bswup/FullDemo/Server/Pages/_Host.cshtml
  • src/Bswup/FullDemo/Server/Pages/_Layout.cshtml
  • src/Bswup/FullDemo/Server/Program.cs
  • src/Bswup/FullDemo/Server/Properties/launchSettings.json
  • src/Bswup/FullDemo/Server/Startup/Middlewares.cs
  • src/Bswup/FullDemo/Server/Startup/Services.cs
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/Bit.Bswup.NewDemo.Client.csproj
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/Layout/DemoBswupProgressBar.razor
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/Layout/DemoBswupProgressBar.razor.css
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/Layout/MainLayout.razor
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/Layout/MainLayout.razor.css
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/Pages/Counter.razor
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/Pages/Home.razor
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/Program.cs
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/Routes.razor
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/_Imports.razor
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/wwwroot/app.css
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/wwwroot/manifest.json
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/wwwroot/service-worker.js
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo.Client/wwwroot/service-worker.published.js
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo/Bit.Bswup.NewDemo.csproj
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo/Components/App.razor
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo/Components/Pages/Error.razor
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo/Components/_Imports.razor
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo/Program.cs
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo/Properties/launchSettings.json
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo/appsettings.Development.json
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo/appsettings.json
  • src/Bswup/README.md
💤 Files with no reviewable changes (8)
  • src/Bswup/FullDemo/Client/Properties/launchSettings.json
  • src/Bswup/Bit.Bswup.Demo/wwwroot/service-worker.published.js
  • src/Bswup/FullDemo/Client/App.razor
  • src/Bswup/FullDemo/Server/Startup/Middlewares.cs
  • src/Bswup/FullDemo/Server/Startup/Services.cs
  • src/Bswup/FullDemo/Server/Pages/_Host.cshtml
  • src/Bswup/FullDemo/Server/Pages/_Layout.cshtml
  • src/Bswup/NewDemo/Bit.Bswup.NewDemo/Components/App.razor

@msynk

msynk commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai re-review

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

@msynk Sure — triggering a review of #12418 now.

Note: CodeRabbit uses incremental reviews and won't re-review commits that have already been reviewed unless automatic reviews are paused first. If you've pushed new commits since the last review, this will pick those up; otherwise there may be nothing new to report.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@msynk

msynk commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai re-review

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

@msynk Sure — triggering a fresh review of #12418 now.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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.

bit Bswup improvements

2 participants