test(desktop): E2E config canary/rollback through Pages-compatible origin into Electron [CODE-545] - #411
test(desktop): E2E config canary/rollback through Pages-compatible origin into Electron [CODE-545]#411AprilNEA wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b37f468f83
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const RE_SNAPSHOT_PATH = /^\/v1\/acme\/desktop\/canary\/s\/([0-9a-f]{64})\.json$/; | ||
|
|
||
| function startDistServer(tls: { cert: string; key: string }): Promise<Server> { | ||
| const pointerPath = baseline.pointerPath; |
There was a problem hiding this comment.
Serve artifacts from the fixture's published paths
When the publisher emits an incorrect or changed artifact path, this E2E still passes because it ignores each step's snapshotPath, uses only the baseline pointerPath, and synthesizes the client-expected snapshot route with this hard-coded regex. That makes the claimed publisher-dist/Pages boundary false-green for path drift; build the served artifact map from every fixture pointerPath and snapshotPath so invalid publisher output fails the test.
Useful? React with 👍 / 👎.
| writeFileSync(statePath, '{"lkg":"corrupted', 'utf8'); | ||
| } | ||
|
|
||
| async function main(): Promise<void> { |
There was a problem hiding this comment.
Split the E2E before exceeding the hard change limit
This new executable alone adds 497 lines, excluding the generated fixture, so the commit exceeds the repository's hard 400-line change limit. Split the server, fixture access, and launch helpers into focused modules and keep the commit within the mandated bound.
AGENTS.md reference: AGENTS.md:L48-L48
Useful? React with 👍 / 👎.
| /** | ||
| * CODE-545 E2E: publisher dist tree → Pages-compatible local HTTPS origin → real Electron | ||
| * activation, snapshotInfo, rollback (new activationVersion over old content), tampered | ||
| * pointer/snapshot, replay, corrupt LKG, and offline embedded-defaults fallback. | ||
| * |
There was a problem hiding this comment.
Reduce the banner to a constraint-only comment
This ten-line banner includes an issue identifier and narrates the test scenarios and history rather than limiting itself to the non-obvious standalone-build constraint. Remove the CODE-545 reference and retain at most a one- or two-line warning about rebuilding with the bootstrap.
AGENTS.md reference: AGENTS.md:L42-L43
Useful? React with 👍 / 👎.
Implements the executable client half of CODE-545: an end-to-end canary/rollback E2E that drives the real built Electron app against a Pages-compatible local origin serving publisher-produced artifacts.
Stacked on #410 (
xuan/code-544, Electron config adapters), which is stacked on #404 (xuan/code-543). Sibling HQ PR: arcboxlabs/linkcodehq#36 (xuan/code-545-e2e, stacked on linkcodehq#26 /xuan/code-542) — it adds the pilot publication harness that generates the deterministic fixture consumed verbatim here (apps/desktop/e2e/fixtures/pilot-e2e-v1.json, byte-identical to the HQ-generatedpackages/config-publisher/fixtures/pilot-e2e-v1.json).What this adds
apps/desktop/e2e/config-canary.e2e.mts— E2E harness:MAIN_VITE_CONFIG_BOOTSTRAP, starts a local HTTPS server (temp OpenSSL cert, trusted viaNODE_EXTRA_CA_CERTS) serving the publisher fixture bytes verbatim with Pages-compatible paths and cache headers,_electron(under Xvfb), and exercises renderer → preload IPC → mainDesktopConfigService, assertingsnapshotInfoand effective values throughout.e2e:config-canaryscript inapps/desktop/package.json.apps/desktop/e2e/fixtures/pilot-e2e-v1.json(consumed verbatim from HQ; no publisher/render semantics copied into the client).Scenarios covered (16 assertions, all passing)
embedded defaults before first fetch; offline defaults; baseline publication (activationVersion 1); ETag pointer revalidation; structural canary activation (activationVersion 2); tampered pointer retained current canary; tampered snapshot retained current canary; rollback allocating NEW activationVersion 3 pointing at old baseline snapshot content; replayed pointer refused, rollback retained; roll-forward (activationVersion 4); restart activating staged canary from valid LKG while offline; replay refused after restart; corrupt LKG falling back to embedded defaults; offline refresh with corrupt LKG keeping defaults; recovery via republication.
Verification (Linux orb)
devenv shell -- sh -c 'cd apps/desktop && xvfb-run -a pnpm run e2e:config-canary'— exit 0, 16 PASS lines, real Electron renderer runtime under Xvfb.pnpm exec tsc --build --noEmit apps/desktop— pass; rootpnpm typecheck— pass.NODE_OPTIONS=--max-old-space-size=12288 pnpm exec eslint --concurrency=2 …; defaultpnpm lintOOMs in this environment).pnpm format:check— pass.pnpm test— 308 files passed, 1 skipped; 2482 tests passed, 1 skipped.pnpm exec vitest run apps/desktop/src/main/__tests__/config.test.ts packages/foundation/common/src/config— 43 tests passed.Boundaries / caveats
acme/desktop/canary(test-only); no production special cases.Closes CODE-545 (client half).