Repository navigation
ci: fix the three e2e lane failures from #37 - #38
Conversation
…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>
|
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: That second bug is a good find and predates all of this. Forwarding I re-ran the tests on the combined branch: 20 passing across #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>
|
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:
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 Fixed locally: 2. The dev-server proxy cannot work, and is being deleted rather than patched. The mechanism: 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 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 Blocking regardless of green: the required check |
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>
mainis red. #37's run went green onbuild-server,hosting-surfaceand all four non-browser lanes, but every browser job failed. Two causes are mine; a third is pre-existing and not fixed here.1.
import.metain a CJS-loaded configintegrations/tooling/playwright.config.tsbuilttestDir/tsconfigwithnew URL(..., import.meta.url). Playwright loads a config viarequireOrImport, and with no"type": "module"in any package.json above that directory — this repo has no rootpackage.jsonat 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/libdist missingplugins.spec.tsresolves@tomic/libto its builtdist/index.cjs. In the old single-job workflow that existed becausebuild.rshad already built the frontend in the same job. Splittingbuild-serveronto 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
pathsmapping that breaks interoptsconfig.e2e.jsonmapped@playwright/testand@tomic/libthroughpaths.@playwright/testis CommonJS, and a paths-resolved import of it fails withNamed export 'expect' not found. The mapping is gone; anintegrations/node_modulessymlink pointing atbrowser/e2e/node_moduleslets both resolve the ordinary way, since both are dependencies of the@tomic/e2eworkspace package. CI creates it beside the existingbrowsersymlink;run-lane.mjscreates 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:
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.tswithAuthentication 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