Skip to content

ci: fix the three e2e lane failures from #37 - #38

Merged
michielbdejong merged 5 commits into
mainfrom
claude/fix-lane-e2e-config
Sep 22, 2026
Merged

michielbdejong merged 5 commits into
mainfrom
claude/fix-lane-e2e-config

Conversation

@michielbdejong

Copy link
Copy Markdown
Contributor

main is red. #37's run went green on build-server, hosting-surface and all four non-browser lanes, but every browser job failed. Two causes are mine; a third is pre-existing and not fixed here.

job result
Detect changed lanes, Build atomic-server, Lint/tooling/certification, hosting surface ✅
Lane: calendar, issue-tracker, localthought, timesheets ✅
Lane: pets (e2e), Lane: notion (live,e2e), E2E: generic plugin system ❌

1. import.meta in a CJS-loaded config

integrations/tooling/playwright.config.ts built testDir/tsconfig with new URL(..., import.meta.url). Playwright loads a config via requireOrImport, and with no "type": "module" in any package.json above that directory — this repo has no root package.json at all — it takes the CJS branch: SyntaxError: Cannot use 'import.meta' outside a module. Both options are resolved relative to the config file anyway, so they're plain relative paths now.

2. @tomic/lib dist missing

plugins.spec.ts resolves @tomic/lib to its built dist/index.cjs. In the old single-job workflow that existed because build.rs had already built the frontend in the same job. Splitting build-server onto its own runner means only the binary travels between them. The package is now built (pnpm --filter @tomic/lib build, a few seconds of tsup) in the jobs that run Playwright.

3. Uncovered by fixing 1: a paths mapping that breaks interop

tsconfig.e2e.json mapped @playwright/test and @tomic/lib through paths. @playwright/test is CommonJS, and a paths-resolved import of it fails with Named export 'expect' not found. The mapping is gone; an integrations/node_modules symlink pointing at browser/e2e/node_modules lets both resolve the ordinary way, since both are dependencies of the @tomic/e2e workspace package. CI creates it beside the existing browser symlink; run-lane.mjs creates it locally so a local e2e run needs no manual setup.

Verification

Listing tests through both configs now loads everything — 2 lane specs, 10 upstream generic ones:

[chromium] › notion/e2e/notion.spec.ts:27:3 › Notion discovers databases through the proxy…
[chromium] › pets/e2e/pets.spec.ts:23:3 › Pets imports in the background after account connection
Total: 2 tests in 2 files

Still not executed locally — running them needs a built atomic-server binary, which is the same gap that let these three through in the first place. This PR's CI run is the real test.

Not fixed here

notion's live tier fails in atomic.live.test.ts with Authentication failed: Incorrect signature for auth headers. That's not a wiring problem and it isn't new: PR #36's run died at the timesheets typecheck step, before the live test was reached, so the single-job workflow had been hiding it behind an earlier failure. It needs its own diagnosis — filing separately rather than bundling a guess into this fix.

🤖 Generated with Claude Code

Michiel de Jong and others added 2 commits September 22, 2026 14:29
…face

PR #37's own run went green on everything except the three browser jobs. Two
of those are my bugs, both invisible to the local verification I did — I could
run the typecheck/unit tiers locally but not e2e, which needs a built server.

1. integrations/tooling/playwright.config.ts built `testDir` and `tsconfig`
   with `new URL(..., import.meta.url)`. Playwright loads a config through
   `requireOrImport`, and with no `"type": "module"` in any package.json above
   that directory — this repo has no root package.json at all — it lands in
   the CJS branch and throws `Cannot use 'import.meta' outside a module`. Both
   options are resolved relative to the config file anyway, so they are now
   plain relative paths.

2. plugins.spec.ts resolves `@tomic/lib` to its built dist/index.cjs. In the
   old single-job workflow that file existed because build.rs had already
   built the frontend in the same job; splitting build-server onto its own
   runner means only the binary travels, so the package is now built in the
   jobs that run Playwright.

Fixing (1) exposed a third: tsconfig.e2e.json mapped `@playwright/test` and
`@tomic/lib` through `paths`, which breaks CJS/ESM interop — `@playwright/test`
is CommonJS, and a paths-resolved import of it fails with "Named export
'expect' not found". The mapping is gone; an integrations/node_modules symlink
pointing at browser/e2e/node_modules lets both resolve the ordinary way, since
both are dependencies of the `@tomic/e2e` workspace package. CI creates it
beside the existing browser symlink; run-lane.mjs creates it locally.

Verified by listing tests through both configs: 2 lane specs and the 10
upstream generic ones all discover and load.

Not fixed here: notion's live tier fails with an auth-signature error in
atomic.live.test.ts. That is not a wiring problem, and it is not new — PR #36's
run died at the timesheets typecheck step, before the live test was reached, so
the single-job workflow had been hiding it. It needs its own diagnosis.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The notion lane's live tier failed with "Authentication failed:
Unauthorized. Error checking authentication headers. Incorrect signature
for auth headers", on the very first authenticated request the installer
makes (`requireInstallationServer` -> `GET /did?subject=...`).

The cause is in this repo, in the proxy half of dev-server.mjs. It sent
every proxied request upstream with `host` rewritten to the upstream's
`host:port`. atomic-server derives the origin it answers a request under
from `Host` (server/src/context.rs::RequestContext::new; with
ATOMIC_DOMAIN=localhost every host is "served here", so the header wins
over the configured origin), and that origin is the message signed auth
headers are verified against (lib/src/authentication.rs, `message =
format!("{} {}", subject, timestamp)`). @tomic/lib signs the URL it is
about to fetch, which is built from the store's serverUrl — the
dev-server. So the client signed `http://localhost:19141/did?subject=...`
and atomic-server rebuilt `http://localhost:19140/did?subject=...`; the
ports differ, the signature does not verify, and every authenticated
request through the proxy is a 401.

Forwarding the header unchanged makes the proxy transparent: with
ATOMIC_SERVER_CHECKOUT=/tmp/atomic-server-pin the server now logs
`RequestContext { origin: "http://localhost:19141" }` and
`run-lane.mjs notion --tier live` passes 5 files / 21 tests, where it
previously failed 1.

Not a regression from the per-lane CI rework: it arrived with the
dev-server itself in 458f169, and no CI run since has reached the "Live
test: notion" step — every one failed at an earlier step — so it has
never been observed until the lane split let the notion lane run on its
own.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@michielbdejong

Copy link
Copy Markdown
Contributor Author

Cherry-picked #39's commit onto this branch, so one CI run proves the whole fix rather than two PRs that are each still red on their own.

The two are independent and neither is green alone:

The first run of this PR confirmed that: pets (e2e) got from failing at config load in ~1s to running for 2m before failing, and notion (live,e2e) still failed — both consistent with the second, unrelated bug.

That second bug is a good find and predates all of this. dev-server.mjs was doing headers: { ...req.headers, host: upstreamUrl.host }. atomic-server derives the origin it answers under from Host (server/src/context.rs::RequestContext::new), and that origin is exactly what signed auth proofs are verified against (lib/src/authentication.rs::check_auth_signature). So a client signing http://localhost:19141/did?subject=… hit a server that rebuilt the message as http://localhost:19140/… — every authenticated request through the proxy was a 401. It was introduced by 458f169, which repointed the live tier from atomic-server directly at this proxy, and no CI run since has reached the notion live step, so nothing surfaced it until the lane split.

Forwarding Host unchanged is also what this file's own docstring already promised — "a single URL behaves like one atomic-server".

I re-ran the tests on the combined branch: 20 passing across dev-server.test.mjs (including the new forwards the client Host header instead of the upstream one) and lanes.test.mjs.

#39 can be closed once this lands.

The combined fix got notion's live tier from 4 passing tests to 20, then hit a
different wall: "this server was built without the plugin runtime, so plugins
cannot run server-side."

atomic-server pins `channel = "1.98.1"` in rust-toolchain.toml, added upstream
four days ago in ontola/atomic-server#1499. `dtolnay/rust-toolchain@stable`
with `targets: wasm32-wasip2` adds the target to *stable*; cargo then runs
under 1.98.1, which does not have it. server/build.rs degrades silently in
that case — no build error, just a binary whose every plugin run fails — so
this surfaced as a late, misleading test failure instead of a broken build.

`rustup target add` from inside the checkout resolves the pinned toolchain and
adds the target there, which is what atomic-server's own dagger pipeline does
(.dagger/src/index.ts). A `rustup target list --installed` check follows it, so
a future toolchain change fails the build loudly rather than quietly shipping
a plugin-less server again.

This was not introduced by the lane split: the same `targets:` line was in the
previous workflow and worked until the upstream pin landed. The live and e2e
tiers had not reached this point in any run since.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@michielbdejong

Copy link
Copy Markdown
Contributor Author

Status on why this still isn't green, since the last run still showed three red jobs.

The two fixes already on this branch did work, and the run proves it even though it failed:

  • build-server passed with the new rustup target list --installed | grep -qx wasm32-wasip2 assertion, so the plugin runtime is genuinely present on the pinned toolchain now.
  • notion's live tier went from 4 passing tests to 21/21. That was the Host-header bug.

What's left is two further causes, both now understood:

1. A teardown race — mine. notion is the only lane with two server-backed tiers. After live, child.kill() sends SIGTERM and atomic-server shuts down gracefully (finishes open connections, ~1–2s), so e2e tried to rebind immediately and my own port guard fired:

Error: port 19141 (devServer) is already bound — it belongs to lane notion (devServer)

Fixed locally: assertFree now waits for the block to drain instead of failing instantly.

2. The dev-server proxy cannot work, and is being deleted rather than patched. pets (e2e) and the generic suite both fail at devDrive() → page.waitForURL timeout. Driving it in a browser shows GET /server → 401, matching the server log rights walk TERMINATED: get_parent failed.

The mechanism: RequestContext::new derives the origin it answers under from the request Host, but config.rs::get_origin() — which the stored resources were bootstrapped under — is built from ATOMIC_PORT, the bind port, with no override. So forwarding Host makes signed auth proofs verify while every resource lookup resolves under an origin that has no data; rewriting Host fixes lookups and breaks the proofs. No setting of that header satisfies both. Confirmed by probe: /server is 401 through the proxy and 200 direct.

So the proxy goes. It only ever existed because the catalog URL used to be compiled into the frontend and therefore had to be same-origin with the server — and atomic-server#1621 removed that. The dev-server becomes what it always should have been: a static host for this repo's plugin.js bundles and catalog.json, with CORS, no upstream, no dependency on atomic-server being up. e2e and live both point at atomic-server directly, which is the topology atomic-server's own dagger pipeline uses (FRONTEND_URL and SERVER_URL both one origin). Verified: notion live passes 21/21 aimed straight at atomic-server, so the live tier never needed the proxy at all.

That work is done locally (dev-server rewritten, 6 tests green) but not pushed yet — I want a local e2e pass first rather than burning another 17-minute build to find out.

One caveat on my own local verification: I earlier reported VITE_E2E ruled out. That was wrong — build.rs had logged assets_tmp is current with dist, skipping copy, so my "rebuild" reused a stale frontend built without it. A forced rebuild is done now and that theory is still live locally. CI always builds fresh with VITE_E2E=true, so it is probably a local-only artifact, but I'm not asserting that until I've watched pets pass.

Blocking regardless of green: the required check Integration tests (pinned atomic-server) is the old job name and no longer exists, so it will sit at "Expected — Waiting for status to be reported" forever and auto-merge can never fire. Branch protection needs repointing at the new names (Detect changed lanes, Build atomic-server (pinned), Lint, tooling tests, certification, Plugin catalog and hosting surface, Lane: *, E2E: generic plugin system).

Michiel de Jong and others added 2 commits September 22, 2026 16:25
The dev-server fronted atomic-server so one origin looked like an
atomic-server hosting this repo's catalog. That cannot be made to work.
`RequestContext::new` derives the origin a request is answered under from its
`Host` header, while the resources themselves are bootstrapped under
`config.rs::get_origin()`, which is built from `ATOMIC_PORT` — the bind port,
with no override. Forward `Host` and signed auth proofs verify while every
resource lookup resolves under an origin holding no data (`/server` -> 401);
rewrite it and lookups work while the proofs fail. No value of that header
satisfies both, which is why 36c5f10 fixed the live tier and broke the browser
one. Measured: `/server` is 401 through the proxy and 200 direct.

The proxy only ever existed because the catalog URL was compiled into the
frontend and so had to be same-origin with the server. atomic-server#1621
removed that, so the dev-server is now what it should always have been: a
static host for this repo's plugin.js bundles and root catalog.json, with CORS
and an ETag, no upstream, and no dependency on atomic-server being up. e2e and
live both point at atomic-server directly — the topology atomic-server's own
dagger pipeline uses, where FRONTEND_URL and SERVER_URL are one origin. notion
live passes 21/21 aimed straight at atomic-server, so it never needed the proxy.

Also fixes a teardown race this surfaced: notion is the only lane with two
server-backed tiers, and atomic-server shuts down gracefully on SIGTERM, so
e2e tried to rebind ports the live tier was still releasing. assertFree now
waits for the block to drain.

Verified locally against the pin: the pets e2e sign-in path, which timed out at
`page.waitForURL` in every previous run, now completes. That test still fails,
later, on the Pets card detaching from the DOM mid-click while the Integrations
page refetches the catalog on every render (7 times per run, unchanged by the
ETag). That churn is in the data-browser component, not in this repo.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The `main merge queue` ruleset requires exactly one context, `Integration
tests (pinned atomic-server)` — a job name this workflow no longer has. It can
never report, so it sits at "Expected — waiting for status to be reported" and
auto-merge can never fire.

Requiring the new job names directly would reproduce the same bug: per-lane
names are dynamic, so `Lane: pets (e2e)` only exists on a run that selected
the pets lane, and any PR not touching that plugin would block forever on a
context that never reports.

So: one stable context. `ci` needs every other job, runs with `if: always()`
so it still reports when the graph is skipped or a dependency failed, and
fails if any job's result is `failure` or `cancelled`. `skipped` passes — lanes
are path-gated by design, and everything below `changes` is skipped when
nothing under integrations/ changed. The results are passed through the
environment rather than interpolated into the script.

workflow.test.mjs keeps the gate honest: it asserts `ci` needs every other job
(a job added later and not wired in would fail while `CI` reported success —
a green gate over a red run), that every name it lists exists, and that it
keeps `if: always()`. Verified the first case actually fails by removing
`hosting-surface` from the list; the assertion names the missing job.

Changing the ruleset itself is not done here — that is a repository setting,
and removing the stale entry without adding this one would leave the merge
queue with no CI gate at all. Both edits belong in one change: require `CI`,
drop `Integration tests (pinned atomic-server)`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@michielbdejong
michielbdejong merged commit d84f046 into main Sep 22, 2026
10 checks passed
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