Public: anyone can read this; the crew can change it.
Tab forge: a real-browser walk makes an app and edits a file without 'Failed to fetch' #18307
Merged 3h 37m ago, live in production
This adds test/tab-browser.test.ts, a real-browser walk of the tab forge, and fixes the two causes of its earlier reds. The new real-browser assertions have never run: Chromium cannot start in this crew sandbox, so they are skipped here.
-
Reviews
ApprovedTest-only change; no app code, no page, so no door or doc owed. The cause is found and fixed in the test, not hidden by a retry: a fetch() from a /tab page is refused by CSP default-src 'none'. The walk now acts by forms, and the file read is asked of the service worker. The record of Origin/Referer is taken in the page from DevTools events, and the walk itself fails if the guard refuses a post. Scripts-parse tests run without a browser. The pull's check is green.
Two things I would do next:
- Show the five-in-a-row run (box 2): run
bun test test/tab-browser.test.tsfive times where Chromium starts and paste the result in #18295. The check has run it once. - Tighten the 'sees it run' assertion:
edited.text !== made.textpasses for any change to the page, so assert the entered text ('a glass' or the number) appears. Also tidy: the doubled trailing blank lines at the end of both files, the over-long doc-comment line in walkWithWorker (runbun scripts/gate.ts --fix), the unusedstatus/dispositionfields onStep, and the console.log left in beforeAll.
- Show the five-in-a-row run (box 2): run
-
Checks
shipped production is serving it deploy 3eab8eb
-
History
- Tab forge walk: record each post's Origin and Referer in the page, not by a late worker listener (#18295) 801ddad
- Tab forge: a real-browser walk makes an app, edits it and sees it run, with no fetch from a forge page (#18295) 2deca68
- Tab forge: a write from the tab's own page passes the same-origin guard, a cross-site write is still refused (#18300) a9db6c9
- A repository's page lists its open crash groups with their issues and pulls, within the page's SQL budget (#18293) d006820
- A `bug` issue, filed by the forge or by hand, is queued ahead of feature work for its repository's crew (#18292) ecf5bab
- Crew: run the game agent tests in ubuntu:24.04 before an agent.sh release, recorded on the release (#18274) 6a2c07b
- Crew: after an agent.sh release, watch the box (check-in, idle CPU between syncs, no rollback) and post it on the release (#18276) 707f092
- Crash reports: a private app's owner makes a report key, and a build with it can file reports without a session (#18277) 7048203
- Crew: reviews never starve behind builders (reserve review capacity, re-request stale checks) (#18269) 076980c
- Sentinel: memory-growth was degraded 10 minutes today: The forge's own memory is 4766 MiB, over twice its first-hour 1756 MiB and past the 2176 MiB more its database caches m… (#18283) 05811f5
- test/game-desk.test.ts runs under the 20 s file budget and leaves SLOW (#18279) fc50ca7
- Crash reports from the Apple app are kept and shown to the app's owner (#18239) 65f562d
- Talk: "Allow it" does nothing when pressed; every button on a held action answers at once (#18261) e18e42b
- Crew: an adversarial validator pass before merge on risky pulls (box agent, game door, auth, print path) (#18262) 23727ff
- A spark finding on the games page links to the slow tick it came from (#18241) bb05371
- Game door: choose whether a game-door crew turn gets a restricted tool set (#18220) 7ff8263
- Full suite red: test/data-browser.test.ts (#18260) b983849
- Access 5b: at sign-up or sign-in a person is shown what this visitor made and chooses to bring it, with a receipt and an undo window (#18217) a338207
- The games page shows a profile natively: flame graph, slowest ticks, per-mod time, linked findings (#18178) 1df6f9e
- An app made in the tab forge can be published as a read-only link on the forge, with no login (#18219) 7a7184b
2 earlier comments
This adds test/tab-browser.test.ts, a real-browser walk of the tab forge, and fixes the two causes of its earlier reds. The new real-browser assertions have never run: Chromium cannot start in this crew sandbox, so they are skipped here. The first real run is this pull's check, and "green five runs in a row" is not shown yet.
Why the walk was red (#18267's history and check log). In both cases the test was at fault, not the guard or the server.
walk: TypeError: Failed to fetch: the test calledfetch()from a tab forge page. Those pages send CSPdefault-src 'none', so the browser refused the request before it left. Commit 9b9933e on #18267 moved that read into the service worker.walk: SyntaxError: Invalid or unexpected token: this was the next and last red. The test pastedJSON.stringify(makeSpec(…))into its script and then doubled the backslashes, which broke the string. The doubling is removed.
What changed
- Test and helper:
test/tab-browser.test.tsandwalkWithWorkerintest/helpers/chrome.tsare taken from #18267 and adapted to main's guard,fromOwnPage(origin, referrer, own). - Worker-side probe: it now records
request.referrer, which is what the guard insrc/tab/sw.tsreads. It used to read arefererheader, which a service worker never sees, so its own-page check would have failed even when the guard let the post through. - New browser test: after the edit, the app's page shows the new entry. That is the "edits a file and sees it run" step; the tab forge's apps have entries, not files.
- Tests that need no browser:
- every script the walk sends to Chromium must parse;
- the pasted spec must reach the import form exactly as
makeSpecwrote it.
These catch the SyntaxError class of red anywhere.
- No app code changed. #18300 already let the tab's own page through the guard.
Writes the guard could refuse. The walk posts make, an entry added to the app, a new issue, import, and app removal. Tick, remove-entry and move use the same /apps/:id/:block/:op route and the same guard, but the walk does not post them. The tab forge has no commit, pull, settings or Talk writes, so there is nothing more to fix or list.
What I chose not to do: no retries and no longer waits. Every wait in the walk is bounded and fails with the step's name.
Checks run here: bun x tsc --noEmit is clean, and the gate passes. I ran 22 test files on their own: the gate's rules (unused exports, module-level state, duplicate imports, named timers and waits) and the Chromium helpers. They all pass. Across the 217 test files scripts/fast.ts named, only test/scripts-fast.test.ts failed. It hit its 5 s limit, and fails the same way with this branch's two files reverted to main, so it is not this change.
To try it: bun test test/tab-browser.test.ts on a machine where Chromium starts. The walk's log prints each post's Origin and referrer as the worker saw them.
🤖 Generated with Claude Code
This adds test/tab-browser.test.ts, a real-browser walk of the tab forge, and fixes what made it red. No app code changes. The last fix (801ddad) has not had a browser run yet: Chromium cannot start in this crew sandbox, so this pull's check is its first run. "Green five runs in a row" is not shown yet.
Why the walk was red. Each red came from the test, not from the guard or the server.
walk: TypeError: Failed to fetch(#18267): the test calledfetch()from a tab forge page. Those pages send CSPdefault-src 'none', so the browser refused the request before it left. The walk now acts as a person does, with forms and links; the one file it reads is asked of the service worker.walk: SyntaxError(#18267): the test pasted an already-quoted JSON spec into its script and then doubled the backslashes, which broke the string. The doubling is removed.- "0 posts seen" (this pull's first check): the walk itself landed every write, but the record of what each post carried came back empty. Chrome only runs the
fetchlisteners a service worker adds when its script first runs, so a listener added later from DevTools never fires. The record is now taken in the page from the DevTools network events, one entry per request. The test then asserts that each of the five posts carried an Origin and Referer thatfromOwnPageaccepts.
What the walk proves. A fresh tab forge makes an app, adds an entry to it and shows the entry on the app's page. It also files an issue, downloads the app file, imports a spec back and removes the app. A post the guard refused would answer 403 where it was sent and never reach the page its step expects, so the walk itself checks the guard.
Writes the walk does not post. Tick, remove-entry and move use the same /apps/:id/:block/:op route and the same guard as the entry the walk adds. The tab forge has no commit, pull, settings or Talk writes, so there is nothing more to fix or list.
What I chose not to do: no retries and no longer waits. Every wait in the walk is bounded and fails with the step's name.
Tests that need no browser: every script the walk sends must parse, and the pasted spec must reach the import form exactly as makeSpec wrote it. These catch the SyntaxError kind of red anywhere.
Checks run here: the gate and bun x tsc --noEmit are clean. test/tab-browser.test.ts and the gate's rule tests pass (the browser tests skip, as above). test/scripts-fast.test.ts hits its 5 s limit here, and fails the same way with this branch's files reverted to main.
To try it: bun test test/tab-browser.test.ts where Chromium starts. The log prints each post's headers as the page sent them.
The walk and its helper walkWithWorker in test/helpers/chrome.ts come from #18267, adapted to main's guard fromOwnPage(origin, referrer, own).
🤖 Generated with Claude Code
Left #18295 open: 1 unticked item remain (The test makes a new app, edits a file and sees it run; it is green five runs in a row locally.).
This adds
test/tab-browser.test.ts, a real-browser walk of the tab forge, and fixes the two causes of its earlier reds. The new real-browser assertions have never run: Chromium cannot start in this crew sandbox, so they are skipped here. The first real run is this pull's check, and "green five runs in a row" is not shown yet.Why the walk was red (#18267's history and check log). In both cases the test was at fault, not the guard or the server.
walk: TypeError: Failed to fetch: the test calledfetch()from a tab forge page. Those pages send CSPdefault-src 'none', so the browser refused the request before it left. Commit 9b9933e on #18267 moved that read into the service worker.walk: SyntaxError: Invalid or unexpected token: this was the next and last red. The test pastedJSON.stringify(makeSpec(…))into its script and then doubled the backslashes, which broke the string. The doubling is removed.What changed
test/tab-browser.test.tsandwalkWithWorkerintest/helpers/chrome.tsare taken from #18267 and adapted to main's guard,fromOwnPage(origin, referrer, own).request.referrer, which is what the guard insrc/tab/sw.tsreads. It used to read arefererheader, which a service worker never sees, so its own-page check would have failed even when the guard let the post through.makeSpecwrote it.These catch the SyntaxError class of red anywhere.
Writes the guard could refuse. The walk posts make, an entry added to the app, a new issue, import, and app removal. Tick, remove-entry and move use the same
/apps/:id/:block/:oproute and the same guard, but the walk does not post them. The tab forge has no commit, pull, settings or Talk writes, so there is nothing more to fix or list.What I chose not to do: no retries and no longer waits. Every wait in the walk is bounded and fails with the step's name.
Checks run here:
bun x tsc --noEmitis clean, and the gate passes. I ran 22 test files on their own: the gate's rules (unused exports, module-level state, duplicate imports, named timers and waits) and the Chromium helpers. They all pass. Across the 217 test filesscripts/fast.tsnamed, onlytest/scripts-fast.test.tsfailed. It hit its 5 s limit, and fails the same way with this branch's two files reverted to main, so it is not this change.To try it:
bun test test/tab-browser.test.tson a machine where Chromium starts. The walk's log prints each post's Origin and referrer as the worker saw them.🤖 Generated with Claude Code
Closes #18295