Skip to content

Make the pre-push gate test the working tree, not port 4200 - #245

Merged
adamjohnwright merged 2 commits into
mainfrom
fix/preflight-tests-the-working-tree
Sep 18, 2026
Merged

adamjohnwright merged 2 commits into
mainfrom
fix/preflight-tests-the-working-tree

Conversation

@adamjohnwright

Copy link
Copy Markdown
Contributor

Closes #243.

playwright.config.ts had reuseExistingServer: !process.env['CI'], and this host always has serve-prod.js on :4200 serving beta out of dist/. So a local e2e run tested the last deployed build, not the commit about to be pushed.

It surfaced as diagram-behaviour.spec.ts:48 failing on a clean main while CI was green on the same commit. The served build predated the fix that test asserts by eight hours:

dist/reactome/browser/index.html   2026-09-17 13:14:18
b11c0e3 (#236, the fix asserted)   2026-09-17 21:43:58

Today's failure direction was the harmless one — red on good code, costing a --no-verify push on a branch that was fine. The same mechanism passes on a tree that is broken, and that is the direction that matters for a gate.

The fix

E2E_PORT asks for a server of our own. Preflight sets 4201, so it builds and serves the tree under test while beta keeps 4200.

A distinct port rather than reuseExistingServer: false on 4200: the latter makes Playwright abort with "port already in use", which on this host would mean stopping beta before every push. Interactive runs keep the reuse — one ng serve with hot reload and many test runs is the right trade while developing. It is only the gate that must not reuse.

Verified that npm forwards the argument rather than assuming it:

> npm run start:simple -- --port 4201
> npm run generate:indices && npm run stage:content && ng serve --port 4201

which matters because the staging steps are what the search specs need — a bare ng serve would skip them.

Measured, same two specs, same commit

reusing :4200 (beta's build)    1 failed, 21 passed
own server on :4201            17 passed, 5 skipped, exit 0

This PR is its own test. The previous push was rejected by this gate; this one went through it with no --no-verify, and the only change on the branch is the gate.

The five new skips are the point, not a loss

They are the render-service tests, which skip with a stated reason when /RenderService/health does not answer. So RENDER_TARGET=127.0.0.1:1 had been silently ineffective all along: the reused server proxied to this box's real render service, so the local smoke exercised the present-service path while its own comment said it existed to reproduce CI's absent one. It now reproduces it, and matches CI, which has no render service either.

That is the second bug the reuse was hiding, and it was hiding it in the dangerous direction — a check that claimed to cover a path it never took.

Not in scope

#243 also suggested having e2e/support/backend.ts report when it serves a request from another spec's recording. That is not the cause here — pool() does readdirSync over the whole directory, so a subset run has the same pool as a full one, which is where my first diagnosis of this was wrong. It is still worth doing and it is the same piece of work as #232, so it stays there.

🤖 Generated with Claude Code

adamjohnwright and others added 2 commits September 18, 2026 04:37
`playwright.config.ts` had `reuseExistingServer: !process.env['CI']`, and this
host always has `serve-prod.js` on :4200 serving beta out of `dist/`. So a local
run tested the last deployed build rather than the commit about to be pushed.

It showed up as `diagram-behaviour.spec.ts:48` failing on a clean `main` while
CI was green on the same commit. The served build predated the fix that test
asserts by eight hours:

    dist/reactome/browser/index.html   2026-09-17 13:14:18
    b11c0e3 (#236, the fix asserted)   2026-09-17 21:43:58

Today's failure direction was harmless -- red on good code -- and it cost a
`--no-verify` push on a branch that was fine. The same mechanism passes on a
tree that is broken, which is the direction that matters.

E2E_PORT now asks for a server of our own. Preflight sets 4201, so it builds and
serves the tree under test while beta keeps 4200. A distinct port rather than
`reuseExistingServer: false`, because that aborts on "port already in use" and
would mean stopping beta before every push.

Measured, same two specs, same commit:

    reusing :4200 (beta's build)   1 failed, 21 passed
    own server on :4201           17 passed, 5 skipped, exit 0

The five new skips are the point rather than a loss. They are the
render-service tests, which skip with a reason when `/RenderService/health` does
not answer -- so `RENDER_TARGET=127.0.0.1:1` had been silently ineffective all
along. The reused server proxied to this box's real render service, so the local
smoke exercised the *present*-service path while its own comment said it existed
to reproduce CI's absent one. It now reproduces it, and matches CI, which has no
render service either.

Interactive runs keep the reuse: one `ng serve` with hot reload and many test
runs is the right trade while developing. It is only the gate that must not.

Refs #243

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@adamjohnwright
adamjohnwright merged commit 5e73fc0 into main Sep 18, 2026
6 checks passed
@adamjohnwright
adamjohnwright deleted the fix/preflight-tests-the-working-tree branch September 18, 2026 05:03
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.

Preflight tests whatever is already on :4200, not the working tree

1 participant