Skip to content

feat(pwa): add managed pinned application updates - #169

Draft
Vyachean wants to merge 160 commits into
developfrom
feature/managed-pinned-updates
Draft

feat(pwa): add managed pinned application updates#169
Vyachean wants to merge 160 commits into
developfrom
feature/managed-pinned-updates

Conversation

@Vyachean

@Vyachean Vyachean commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Status

Draft — the managed-update core is implemented, and the recovery architecture is now complete in the single canonical document. PR 169 is not implementation-complete until the recovery flow and its required proof are present.

Goal

Add managed pinned application updates for stable (/) and develop (/branch/develop/) with Automatic and Manual modes, immutable per-release archives, controlled activation, rollback between managed releases, and explicit worker-owned recovery.

Canonical architecture

docs/managed-pinned-updates.md is the single source of truth.

Accepted model:

  • one persisted active release and at most one candidate;
  • candidate phases available | ready | activating | failed;
  • complete release identity: releaseNumber, appVersion, buildId, buildDate;
  • browser-native Service Worker lifecycle without skipWaiting() or clients.claim();
  • one short OperationQueue and one preparation/cleanup-only PreparationCoordinator;
  • activation commits only after durable BOOT_OK;
  • failed activation keeps the previous managed release selected;
  • only one navigation owns an activation attempt;
  • reconciliation effects are declarative, attempt-local, and response-ordered;
  • owned requests never fall back to live deployment bytes;
  • stable and develop are isolated managed channels; ordinary manual branches retain Workbox; PR previews remain non-PWA.

Recovery architecture

The worker must provide a self-contained diagnostic recovery page for:

  • absent controller state;
  • invalid controller state;
  • unavailable controller storage;
  • a valid but unrestorable active release.

State-loss recovery:

  • never infers a release from caches;
  • requires explicit Install latest version;
  • fully validates and prepares exact latest before writing state;
  • recreates initial Automatic state;
  • treats latest as a new baseline without an older trusted rollback target;
  • never clears user data.

Known-active recovery:

  • Retry reattempts exact active restoration;
  • exact latest equal to active restores that release without changing lifecycle state;
  • strictly newer latest becomes ready candidate and passes the ordinary clean-launch and BOOT_OK activation flow;
  • older latest, conflicting identity, and superseding ready/activating are forbidden.

Diagnostics use stable allowlisted categories only. Raw state, exception messages, stack traces, paths, tokens, and user content are forbidden. Recovery commands use the existing 120-second long-operation semantics and remain idempotent under retries and concurrent windows.

Initial Workbox transition

legacy Workbox /sw.js
→ verified managed release 1 becomes the initial managed baseline
→ full rollback guarantees begin with managed release 2

Release 1 and any later state-loss recovery baseline must contain no irreversible user-data migration. If such a baseline cannot finish boot, navigation reconciliation must still be able to discover and activate a corrected newer release.

Remaining before merge

  1. Implement the recovery section of docs/managed-pinned-updates.md without changing valid-state update, activation, publisher, or user-data ownership.
  2. Add unit, worker, browser, accessibility, concurrency, timeout, and product-data preservation proof required by the architecture.
  3. Run on one unchanged final workspace:
pnpm verify --full --only managed-updates
pnpm verify:release
  1. GitHub verify is green on the exact final head.
  2. Final complete resulting-diff review finds no blocker.
  3. Operator UI/accessibility acceptance covers settings, notifications, activation, rollback, and both recovery modes.
  4. Mark the PR ready only after those checks.

Merge

Target: develop.

Method: squash merge after final approval.

Vyachean and others added 3 commits July 28, 2026 15:33
…ates

- implement tests for develop channel isolation, lifecycle management, and migration from legacy workers
- ensure independent state management for stable and develop channels
- validate automatic and manual update processes, including rollback and offline behavior
- cover migration scenarios from legacy Workbox workers to managed controllers
@github-actions

Copy link
Copy Markdown
Contributor

Preview deployment

This comment is updated automatically on every push to this PR.

Vyachean and others added 7 commits July 28, 2026 20:42
- add state locking mechanism to ensure serialized access to controller state
- implement update discovery process for automatic and manual modes
- create comprehensive tests for state management and update checks
- ensure proper handling of state transitions and error scenarios
- add support for rolled-back update states in the service worker
- enhance the update settings UI to reflect rollback scenarios
- introduce tests for rollback behavior in both manual and automatic modes
- ensure the service worker correctly handles failed installation attempts
…e correctly

- update tests to wait for service worker readiness before asserting state
- improve reliability of controller state checks during migration scenarios
- refactor controller state reading logic for clarity and reuse
- ensure that a discovery during an active activation does not trigger
  preparation or approval of another release
- maintain the integrity of the activation process by recording the
  discovery without interfering with the ongoing activation
- add tests to verify that the latest release is recorded correctly
  without affecting the activation state
- ensure cleanups are serialized and do not overlap
- protect preparations from being affected by concurrent cleanups
- update tests to cover new cleanup behavior
- add handling for the latest release to prevent premature deletion
- ensure completed releases remain protected until approval is persisted
- update tests to cover new scenarios for release protection
@Vyachean Vyachean changed the title feat(e2e): add comprehensive tests for managed pinned application updates feat(pwa): add managed pinned application updates Jul 29, 2026
Vyachean and others added 18 commits July 29, 2026 14:51
- remove the detailed AppUpdateSettingsSection component
- add a single action entry for app updates in the settings
- update tests to reflect the new app updates navigation and status display
A sole-window reload is a safe application restart and should be
indistinguishable from closing the final window and reopening it.
FetchEvent.replacesClientId-based reload classification proved
unreliable across engines (Chromium/Firefox activate on it, WebKit
does not), so activation now depends only on same-channel window
liveness. Client identities are still excluded from the window count
by id, but no longer used to detect reloads specifically.

Adds a cross-engine (Firefox/WebKit) lifecycle spec covering the
portable clean-launch contract (uncontrolled/second window blocks,
close-and-reopen activates, boot rollback) using one shared browser
context and release chain per engine, and a Chromium-only regression
covering a second live window blocking a lone navigation's activation.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…fications

- add timeout to update notification for better user experience
- ensure state remains unchanged on same-sequence conflicts
- implement automatic preparation target resolution logic
- enhance tests for update checks and cancellation behavior
…automatic paths

- ensure that only releases newer than the activeRelease can be approved
- add tests to verify that activeRelease and older releases are not approved
- add handling for failed releases in manual mode to prevent notifications
- ensure automatic mode does not allow approvals or preparations
- update tests to cover new behavior for failed releases and mode switching
- update test description to clarify activation starts when no other
  same-channel window is live
- remove unnecessary comments regarding reload behavior
…ce worker

- add support for displaying activation status in the App Update settings
- ensure activation state is reflected in the UI without false update notifications
- enhance service worker message handling to validate requests and manage responses
- introduce tests for activation scenarios and protocol request validation
…ransitions

- refactor message handling to ensure responses are posted before any follow-up work is executed
- improve error handling to return stable failure envelopes without exposing raw exception messages
- update UI components to reflect the correct activation status and version during updates
- enhance tests to cover new behavior and ensure proper ordering of operations during state changes
Vyachean and others added 30 commits August 5, 2026 09:37
…states

- ensure the last-resolved value is maintained when the query re-emits
  transient undefined for active edits
- clear the resolved property only when the property ID changes
- add tests to verify behavior under transient states
…states

- remove outdated tests for useDatabaseProperty
- refactor useDatabaseProperty to simplify property resolution logic
- update defineCacheObservable to use shareReplay for better caching
- adjust databasePropertiesService to prevent unnecessary re-emissions
- throw an error if fallback focus is invoked after the form is unmounted
- ensure fallback focus always returns a valid target while the trap is active
- implement classification for BOOT_OK and BOOT_FAILED reports to manage state transitions accurately
- ensure rollback paths are triggered correctly when cache operations fail
- improve handling of concurrent manual installs to prevent false failures
- isolate client delivery failures during broadcasts to ensure all clients receive messages
- enhance tests to cover new classifications and error handling scenarios
…rgets

- ensure that a non-activation-target response does not settle the watchdog
- update tests to reflect the new behavior of not disarming on false activation
- verify that late GET_ACTIVATION_STATUS responses do not mutate settled states
…t errors

- ensure only one navigation can perform the ready → activating transition
- block other navigations with a controlled 503 response
- separate transient error feedback from lifecycle status in UI
- update tests to cover new behavior and edge cases
…ts run correctly

- modify reconciliation logic to handle effects from failed attempts
- ensure effects are executed after fallback responses are posted
- add tests to verify behavior of ReconciliationFailure handling
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.

1 participant