Repository navigation
Tighten the Worker's local and test setup - #438
Conversation
Quest-Claim: c04f2edf89b5868e
…e-check the seeded server Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…les per commit in the fake GitHub The fake answered as if every default branch were `main`, every repository public and MIT-licensed with every merge method, every role maintain, write, or read, and every commit holding the default branch's files. Tests that need otherwise mocked `fetch` themselves. - Honor `defaultBranch` everywhere the fake named `main`, and follow a listed default branch for `/commits/<default>`. - Add per-login `roles` (including null for a 404), `private`, `archived`, `license`, and `mergeMethods`, which refuses a disallowed merge as GitHub does. - Answer `/contents/<path>?ref=` from the ref's tree, written trees included. - Answer SPDX for the license asked, approving all but source-available ones. - Derive objects from the repository ID, so a rename or transfer keeps them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hared GitHub fake `maintainerOf` answered GitHub with a hand-written mock and knobs. It now builds a fresh fake world per test that matches the observations it seeds, and tests state GitHub changes as world edits: roles, a closed issue or pull request, a moved head, a commit without a flake, reviews, labels and timeline, merge refusals, and allowed merge methods. Races and outages wrap the fake with `intercept` or a persistent failure. The project setup routes and the sign-in-again and link-account pages use the fake too. Webhook reads that used to fail on unmodeled requests now succeed, so the tests that relied on an unread webhook fail its read explicitly, and the world holds the issue a notified webhook names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 42 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. CodeRabbit Verify
|
# Conflicts: # cloudflare/dev/github.ts # cloudflare/test/inbox.test.ts
|
quest land watch: the merge queue removed this pull request at 94b442f because it conflicts with The land fixer works on it in the background, and the watcher re-enqueues it at the back of the queue once it is fixed or judged flaky, or hands it back here with what it needs. (written by quest land watch) |
|
quest land watch: armed auto-merge on this pull request at f6953a1, so it joins the back of the merge queue once its required checks pass, with the land fixer's fix ( (written by quest land watch) |
|
quest land watch: the merge queue removed this pull request at f6953a1 because it conflicts with The land fixer works on it in the background, and the watcher re-enqueues it at the back of the queue once it is fixed or judged flaky, or hands it back here with what it needs. (written by quest land watch) |
|
codex / Codex land fixer: plugins: [
// Bun loads Markdown assets as text (bunfig.toml); load them the same way here.
{
name: "markdown-text",
transform(code, id) {
if (id.endsWith(".md")) return { code: `export default ${JSON.stringify(code)};`, map: null };
},
},
],
test: {
// Git reads none of the caller's own configuration, such as commit signing
// with a key or program the fixtures cannot reach; each fixture sets its identity.
// Git for Windows maps "/dev/null" to its null device but rejects os.devNull's "\\.\nul".
env: { GIT_CONFIG_GLOBAL: "/dev/null" },
...(live
? { include: ["test/live/**/*.test.ts"], testTimeout: 30 * 60_000, hookTimeout: 60_000 }
: { include: ["test/**/*.test.ts"], exclude: [...configDefaults.exclude, "test/live/**"] }),
},
});
succeeded in 111259ms:
$ vitest run
RUN v5.0.5 /work
bash "/tmp/quest-test-jk7Lxs/phase.sh"
Terminated command time -o /dev/null "/nix/store/2mxhj3nrvxxqm6gf6rwnrvz048zqdclp-bun-1.4.2/bin/bun" "/tmp/quest-test-jk7Lxs/leaf.js"
error: recipe `phase` failed on line 2 with exit code 143
bash "/tmp/quest-test-0vuinH/phase.sh"
Hangup command time -o /dev/null "/nix/store/2mxhj3nrvxxqm6gf6rwnrvz048zqdclp-bun-1.4.2/bin/bun" "/tmp/quest-test-0vuinH/leaf.js"
error: recipe `phase` failed on line 2 with exit code 129
"/nix/store/2mxhj3nrvxxqm6gf6rwnrvz048zqdclp-bun-1.4.2/bin/bun" "--config=/work/bunfig.toml" "/work/src/cli/bin.ts" "worktree" "run" "work" "--" "/nix/store/2mxhj3nrvxxqm6gf6rwnrvz048zqdclp-bun-1.4.2/bin/bun" "/tmp/quest-test-AI130s/leaf.js"
bash "/tmp/quest-test-GhLH9C/phase.sh"
Terminated command time -o /dev/null "/nix/store/2mxhj3nrvxxqm6gf6rwnrvz048zqdclp-bun-1.4.2/bin/bun" "/tmp/quest-test-GhLH9C/leaf.js"
error: recipe `phase` failed on line 2 with exit code 143
bash "/tmp/quest-test-NC5QTV/phase.sh"
Terminated command time -o /dev/null "/nix/store/2mxhj3nrvxxqm6gf6rwnrvz048zqdclp-bun-1.4.2/bin/bun" "/tmp/quest-test-NC5QTV/leaf.js"
error: recipe `phase` failed on line 2 with exit code 143
"/nix/store/2mxhj3nrvxxqm6gf6rwnrvz048zqdclp-bun-1.4.2/bin/bun" "--config=/work/bunfig.toml" "/work/src/cli/bin.ts" "gate" "/nix/store/2mxhj3nrvxxqm6gf6rwnrvz048zqdclp-bun-1.4.2/bin/bun" "/tmp/quest-test-qYsPWF/leaf.js"
error: recipe `run` failed on line 2 with exit code 143
"/nix/store/2mxhj3nrvxxqm6gf6rwnrvz048zqdclp-bun-1.4.2/bin/bun" "--config=/work/bunfig.toml" "/work/src/cli/bin.ts" "worktree" "run" "work" "--" "/nix/store/2mxhj3nrvxxqm6gf6rwnrvz048zqdclp-bun-1.4.2/bin/bun" "/tmp/quest-test-7Zl1j0/leaf.js"
error: recipe `phase` failed on line 2 with exit code 143
"/nix/store/2mxhj3nrvxxqm6gf6rwnrvz048zqdclp-bun-1.4.2/bin/bun" "--config=/work/bunfig.toml" "/work/src/cli/bin.ts" "gate" "/nix/store/2mxhj3nrvxxqm6gf6rwnrvz048zqdclp-bun-1.4.2/bin/bun" "/tmp/quest-test-Q1YdGc/leaf.js"
error: recipe `phase` failed on line 2 with exit code 129
bash "/tmp/quest-test-Xr108o/phase.sh"
Terminated command time -o /dev/null "/nix/store/2mxhj3nrvxxqm6gf6rwnrvz048zqdclp-bun-1.4.2/bin/bun" "/tmp/quest-test-Xr108o/leaf.js"
error: recipe `phase` failed on line 2 with exit code 143
bash "/tmp/quest-test-JIn4qE/phase.sh"
Hangup command time -o /dev/null "/nix/store/2mxhj3nrvxxqm6gf6rwnrvz048zqdclp-bun-1.4.2/bin/bun" "/tmp/quest-test-JIn4qE/leaf.js"
error: recipe `phase` failed on line 2 with exit code 129
bash "/tmp/quest-test-wY3YjT/phase.sh"
Terminated command time -o /dev/null "/nix/store/2mxhj3nrvxxqm6gf6rwnrvz048zqdclp-bun-1.4.2/bin/bun" "/tmp/quest-test-wY3YjT/leaf.js"
error: recipe `phase` failed on line 2 with exit code 143
bash "/tmp/quest-test-0mp8mX/phase.sh"
Terminated command time -o /dev/null "/nix/store/2mxhj3nrvxxqm6gf6rwnrvz048zqdclp-bun-1.4.2/bin/bun" "/tmp/quest-test-0mp8mX/leaf.js"
error: recipe `phase` failed on line 2 with exit code 143
"/nix/store/2mxhj3nrvxxqm6gf6rwnrvz048zqdclp-bun-1.4.2/bin/bun" "--config=/work/bunfig.toml" "/work/src/cli/bin.ts" "gate" "/nix/store/2mxhj3nrvxxqm6gf6rwnrvz048zqdclp-bun-1.4.2/bin/bun" "/tmp/quest-test-FyxCiu/leaf.js"
error: recipe `phase` failed on line 2 with exit code 143
"/nix/store/2mxhj3nrvxxqm6gf6rwnrvz048zqdclp-bun-1.4.2/bin/bun" "--config=/work/bunfig.toml" "/work/src/cli/bin.ts" "gate" "/nix/store/2mxhj3nrvxxqm6gf6rwnrvz048zqdclp-bun-1.4.2/bin/bun" "/tmp/quest-test-YzTxfH/leaf.js"
error: recipe `phase` failed on line 2 with exit code 129
Test Files 28 passed (28)
Tests 1016 passed | 2 skipped (1018)
Start at 10:10:13
Duration 111.16s (tests 87%, transform 9%, import 3%)
exec
/bin/bash -lc "python3 - <<'PY'
import json
from pathlib import Path
result=[{
'number':438,
'action':'fixed',
'head':'b0f686d008653914672c566842527540aa6433aa',
'reason':'Merged base and resolved the project-fixtures conflict using the shared fake GitHub with existing review support; passed root bun run build, bun run check, bun run test (1016 tests), and cloudflare bun run check, bun run test (519 tests and seeded-server check).',
'failure':'Merge conflict in cloudflare/test/project-fixtures.ts',
'blame':True
}]
Path('quest-land-result.json').write_text(json.dumps(result,indent=2)+'\\n')
PY
git status --short && git log -1 --format='%H %P' pr-438 && git diff --check" in /work
succeeded in 0ms:
?? quest-land-result.json
b0f686d008653914672c566842527540aa6433aa f6953a1cd8682d46117ae6c069e711d4f5215d8a f3b1d044fd48767fefb67af0077ce5abc48d4d1e
codex
Fixed #438 on `pr-438` at `b0f686d008653914672c566842527540aa6433aa`, resolving the fixture conflict while preserving both sides’ intent.
Builds and checks passed; 1,535 tests and the seeded-server check passed.
Wrote [quest-land-result.json](/work/quest-land-result.json) and left it uncommitted.
tokens used
57,348
Fixed #438 on `pr-438` at `b0f686d008653914672c566842527540aa6433aa`, resolving the fixture conflict while preserving both sides’ intent.
Builds and checks passed; 1,535 tests and the seeded-server check passed.
Wrote [quest-land-result.json](/work/quest-land-result.json) and left it uncommitted.
fixer result written
GitHub refused the fixer's push, so its validated resolution travels in this comment: PR head (written by codex / Codex) |
The quest land fixer's resolution, rebuilt by `quest land apply` after the daemon handed it back unpushed.
# Conflicts: # quest/m2/README.md
Finishes quest/m2/worker-dev.md: parallel agents can run seeded servers without signing each other out, the seed fills the agent cards' raw output, the seeded server's wiring is smoke-checked, the project/inbox/jobs/push tests run against the shared fake GitHub, and a daily job runs each Worker test case in its own process.
Changes
Session cookies. Browsers share localhost's cookies across ports. The seeded server's entry Worker (
cloudflare/dev/serve.ts) now prefixes every cookie the app sets withseeded-<port>., and passes the app only cookies with that prefix, stripped. Two servers sharing one cookie jar keep separate sessions. Signing out of one leaves the other signed in, and the inbox WebSocket still upgrades through the entry Worker. All three were checked by hand with curl on ports 8791 and 8792.Seeded raw output.
dev/seed.tsuploads raw output through the realappendstore a runner's uploads use: a transcript long enough to page ("Load more"), a short one, and one marked as having reached the cap.test/seed.test.tsreads all three, plus a job with no output.Static assets. At the current wrangler/miniflare pins, the seeded server already serves
build/public(/site.css,/app.js,/sw.js, the theme, the manifest). moq-dev/quest#258 most likely hit an older pin; moq-dev/quest#280 bumped wrangler and miniflare since. To keep it working,bun run seeded --checkstarts the server on a free port and checks over its socket that:/site.cssserves the built stylesheet/inboxaccepts that cookie/inboxrejects the same session under another server's cookie namejust worker-testnow runs this check (about 6 s). A mutation run that dropped the assets and the prefix failed both checks.Shared fake.
maintainerOf()intest/project-fixtures.tsnow runsfakeGitHubover a fresh per-testworld(). Its 16 hand-rolled knobs are gone; tests edit GitHub state instead (roles, closed issues and pulls, branch tips, signatures, review commits, merge refusals, merge methods, labels, timeline, landing).inbox,jobs,push,inbox-reads, and the project setup-route tests now use the fake.intercept, or through a smallfailing()helper for repeated failures.main, per-login roles (admin, triage, custom, or none → 404),private,archived, a detected license, allowed merge methods (405 when disallowed), file contents at any commit, and SPDX answers for the license asked about. Commit, tree, and head IDs now derive from the repository ID, so a rename or transfer keeps them.Each test alone.
cloudflare/scripts/isolated.tslists every case withvitest listand runs each location (file:line) in its ownvitest runprocess, a few at a time. A location that matches no test fails. Run it withjust worker-test-isolated [--jobs N] [filters…]..github/workflows/isolated.ymlruns it daily and on dispatch, withcontents: readonly and no secrets or write credentials.Choices made without asking
Cookie isolation lives only in the dev entry Worker, not in Better Auth's production config, so production cookie names and the login tests are unchanged.
The isolated job runs daily at 06:23 UTC. It would take roughly 25 minutes on a 4-core hosted runner, with a 120-minute timeout. Cases declared on one line, such as a loop's, run together in one process.
Two hand-written mocks stay in
projects.test.ts, because the fake doesn't model their flows:github()harness. It injects malformed trees, blobs, GraphQL errors, and SPDX data, and checks subrequest budgets.The Plan scoped the move to "where it models their flows". Login tests keep their OAuth mocks.
Moving the tests surfaced three tests that passed only because the old mock threw on every webhook's background read. Two now fail that read on purpose (GraphQL 502), as their scenario needs. In the push test, the world now holds issue quest: plan converging MoQ onto standalone Quest #3, as GitHub would, so the expected badge count is 4.
Validation
After merging main at
ee96a82e(head4457a19b): the land fixer's resolution of theproject-fixtures.tsconflict withf3b1d044, rebuilt byquest land applybecause GitHub refused the fixer's push (this PR adds a workflow), then a merge of the rest of main whose only conflict was thequest/m2/README.mdlink list (main deleted the gate-ownership link, this PR the worker-dev link; both dropped):just check: pass.just test: pass (CLI 1035 passed, 5 skipped; Worker 531 passed; seeded-server check OK).quest check --base origin/main: 65 documents ok.After merging main at
94b442f7(main's new head-approval inbox test ported onto the fake:signed()signs the head's commit in the world, and the outsider is a read-roleother(); the fake keeps main's merge-queue and check-run additions alongside the configurable default branch):just check: pass.just test: pass (CLI 990 passed, 2 skipped; Worker 491 passed; seeded-server check OK).Before the merge:
just check: pass.just test: pass (CLI 936 passed, 2 skipped; Worker 475 passed; seeded-server check OK).just worker-test-isolated --jobs 8: all 371 locations passed on their own (before the migration). After the migration, the inbox, jobs, push, projects, and seed locations (194) passed on their own again.Follow-ups
intercept).Review
4457a19ba9434dfb0591c545dc049d326f4d725a: local review skipped under the guide's exemptions, by Claude Code (Opus 5.5). Since the reviewed head94b442f7, the branch gained only the land fixer's recorded mechanical fixes (f6953a1c, andedf4bf96rebuilt from its handback), which port main's owner IDs and review query onto the shared fake in test code, and a merge of main whose one conflict was a quest link list. Comparinggit diff <base> <head>for both heads, the PR's own changes differ only in those test adaptations and the dropped link.quest review), gpt-6.1-sol, medium effort. Head94b442f765299695cad2bdeef42d6cf132ab9eee(merge of main), round 1: no findings. Headd21ca7f9c3298f7b20364e25619062aeb74bfd95, round 1: no findings.🤖 Generated with Claude Code
(Written by Claude Opus 5.5)