Skip to content

test(release): check a cached 0.8.0 phone app against a 0.9.0 relay - #211

Merged
gregpriday merged 9 commits into
developfrom
feature/issue-195-check-a-cached-0-8-0-phone-app-against-a
Nov 19, 2026
Merged

gregpriday merged 9 commits into
developfrom
feature/issue-195-check-a-cached-0-8-0-phone-app-against-a

Conversation

@gregpriday

Copy link
Copy Markdown
Contributor

Adds scenario 4 to pnpm compat:check: the released 0.8.0 phone app, running in Chromium with its own service worker, kept loaded while its relay moves to the new version, until the app updates itself in place. Scenarios 1 to 3 use a simulated phone; this one runs the released app's own code, worker, IndexedDB and update path, which is what a phone with a cached 0.8.0 shell actually does.

Resolves #195

What scenario 4 checks

  1. Released app, old relay. The v0.8.0 GitHub release's relay is claimed by the new CLI, and the released app pairs through its own screens (the desktop compares the code the phone shows). Notifications are turned on in the app. Headless Chromium has no push service, so PushManager hands out a subscription on push.compat-check.invalid, a reserved name that never resolves, allowed through PUSH_ENDPOINT_ALLOW.
  2. Relay upgraded under the open page. The relay is replaced by the new bundle on the same storage and port, as decisions update does, while the page stays open. The cached page is only moved within itself (pushState + popstate), so no navigation loads the new shell, and every action is checked to come from that same document.
  3. Only the 0.8.0 phone paired:
    • every socket ticket the cached page gets from the new relay declares neither advisory-deadlines-v1 nor agent-stopped-push-v1, and the directory lists it as the only phone or tablet;
    • an advisory ask is refused as not_supported: no-capable-reader by the CLI (exit 1, nothing on stdout) and by the library; the relay's question list is unchanged, and Home, synced past later questions, never shows it;
    • the relay keeps the subscription the old relay stored, enabled and declaring nothing; an agent-stopped request reports no-subscription, and the row records no send;
    • the cached app answers one ordinary question and declines another, and the new desktop types each outcome once.
  4. The phone updates in place. The new worker installs and waits while the cached page is open; a second page of the same phone loads the new app under the old worker, and the cached page closes. The new app asks the old worker what it can show, gets no answer, gives up, and declares nothing; an agent-stopped request still reports no-subscription. After "Restart to update" the new worker takes over and answers that it can show the push, the same subscription declares agent-stopped-push-v1, and the relay picks it for the next request and tries to send it (failed, since the host never answers). The row is read back at the end: still one, the same one, enabled and declaring.
  5. Questions from before the update. The new app shows the answered question with the person's choice and its terminal receipt, and the declined one as declined; the owner reopens the declined one, it is answered in the new app, and the desktop types that answer once.

tools/compat-check/phone-app.mjs holds the browser loader, the in-page fixture and judgeDeclarations. The fixture stubs PushManager and records every subscription the app sends, every message it posts a worker, the worker's own answer to the app's FEATURES question, and the registration's workers as the page saw them at each moment. The judge fails the run on a declaration made before the update, while the new worker waited, with the worker state unknown, or without the active worker having said it can show the push. It also fails it on a missing question to the old worker, a second subscription, a withdrawn declaration, or a trace with fewer subscriptions than the browser saw sent. The scenario's log is phone-4.jsonl, with screenshots when it stops.

Other changes

  • --only takes 1 to 4. startRelay takes extra Worker variables. The actor's invite returns its link, its approval can compare the code the phone shows, and it can list the device directory.
  • A run that includes scenario 4 warns before the installs when Chromium is missing (E2E_CHROMIUM, or the e2e package's playwright-core build). The browser leaves signal handling to the runner, which now also stops everything on SIGHUP.
  • An --old that already has advice or agent-stopped pushes skips scenario 4 and says so. A skipped scenario never counts as run, so a run where every chosen scenario skipped fails.
  • docs/operations.md describes scenario 4 and its prerequisites, replacing "A phone app cached from an older release is not covered here."

Testing

  • node --test tools/compat-check/phone-app.test.mjs (new, added to test:tools): 29 tests. The judge accepts a correct trace, and each rule has a case that fails when the rule is removed. Together with tools/release/release.test.mjs: 56/56 pass.
  • pnpm compat:check --old 0.8.0 (new side packed from this branch on develop at 5c98a1e, against the v0.8.0 release): all four scenarios pass, 3.1 min. Scenario 4 was re-run alone after each later fix and passes on the final head.
  • Impact selection: 1 of 146 suite files (this branch's own test), plus tools/release/release.test.mjs: 56/56 pass.

Open

From the final review pass, not fixed here:

  • A socket ticket the cached page gets after the ticket check (while the new worker installs, before that page closes) is not checked.
  • If the relay's send cleared the agent-stopped capability but left the row enabled, a later page load could declare it again before the final read of the row. Per-endpoint sends are covered by worker/tests/push-jobs.test.ts.
  • If both the page that restarts and the page it reloads into send a declaration, either response satisfies the wait (they share a page label). The final read of the row is the backstop.
  • Agent-stopped outcomes are the relay's own (no-subscription, failed), not observed outbound requests. The relay only sends to https endpoints on port 443 at a hostname, so a local observer for the reserved host is not possible.

- compat-check scenario 4 runs the released phone app in Chromium across the relay upgrade and the app's own update
- phone-app.mjs holds the browser loader, the push subscription fixture and the declaration judge
…d keep page snapshots on failure

- document scenario 4 in docs/operations.md
…ation counts

- the fixture records the worker's answer to the app's FEATURES question and when the app stops waiting
- the judge binds the old-worker question to the mixed page, refuses an unknown worker state and an incomplete trace, and runs on the whole trace at the end
- requests are timed at their start and named by page; the advisory checks follow a ticket from the cached page
- the new worker installs while the cached page is open, so the mixed page always finds it waiting
- exact display checks in the updated app, a full count of the desktop's notices, and a skipped scenario never counts as run
- the browser leaves the signals to the runner
…ly after the app's own handler

- every post-swap ticket of the cached page is checked for what it declares
- subscription posts are counted only for pages, and tied to the page that sent them
- the cached page's update check is not awaited; SIGHUP stops the run like SIGINT
- a missing Chromium is a warning before the installs, and fails scenario 4 only once it applies
- judge tests for each predicate's edges
…worker from Node

- Playwright's waitForFunction resolves on an async predicate's promise, so the waiting worker is polled with evaluate
- the declaration is taken from the updated page's own trace, then its answer is awaited after the reload
- every ticket of the cached page is checked once the cached phase is over, one without features included
- transfer lists that can be read only once, and response bodies that stall, no longer hold the fixture or the run
…d bound the worker poll

- the fixture replaces only a transfer list that is not already an array, and never copies the app's options
- the body drain's timer no longer holds the process, and the row's features must be a list
@gregpriday
gregpriday merged commit 9de528d into develop Nov 19, 2026
2 checks passed
@gregpriday
gregpriday deleted the feature/issue-195-check-a-cached-0-8-0-phone-app-against-a branch November 19, 2026 15:24
@gregpriday gregpriday mentioned this pull request Nov 19, 2026
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.

Check a cached 0.8.0 phone app against a 0.9.0 relay

1 participant