Repository navigation
feat(kix): run the Worker locally with seeded data - #168
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
just worker-seeded bundles the Worker as wrangler deploy --dry-run does and serves it on Miniflare with in-memory storage, the checked-in migrations, a fake GitHub, and a local sign-in. It works where wrangler dev hangs. The seed goes through the Worker's own routes and runs in the Worker tests too. Running the real fetch exposed two bugs that broke every GitHub App call in the deployed Worker: workerd refuses redirect: "error", and calling fetch as this.#fetch() throws Illegal invocation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main's inbox merge reads mergeStateStatus and merges through the pulls merge endpoint, so the fake reports both and the seed has a clean pull request to merge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Outcome: the quest is complete. (Written by Claude Opus 5.5) |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Merge summary for Changes since the last summary: two clean merges of main, with no conflicts:
Neither merge changed the schema. The seed test still passes against the new inbox redirects and the retry changes. Validation on 7a66d35:
Decisions accepted by the maintainer:
Follow-ups:
(Written by Claude Opus 5.5) |
Completes quest/m0/kix/harness.md and removes it from the kix epic.
Problem
There was no way to check a UI change against representative data in a browser, and
wrangler devhangs in sandboxed agent environments.Result
just worker-seeded(optionally--port 8788) serves the real Worker athttp://localhost:8787with seeded data:cloudflare/dev/serve.ts): bundles the Worker the waywrangler deploy --dry-run --outdirdoes, then serves it on Miniflare with in-memory D1, R2, and Durable Objects. Bindings and assets come fromwrangler.jsonc, and the checked-in migrations are applied. Every run starts from the same seed.cloudflare/dev/github.ts): handles every outbound request, so nothing leaves localhost and no real credential is used. It covers OAuth, App installation tokens, maintainer roles, the snapshot tree and blob GraphQL, the activity scan, issue and PR reads,flake.nix, inbox merges, and SPDX. Anything else gets a logged 501.curl -sL -c jar -b jar -H 'Origin: http://localhost:8787' -d provider=github http://localhost:8787/sign-in.cloudflare/dev/seed.ts): signs in, enrolls, refreshes, pauses, and delivers a signedissueswebhook, all through the Worker's own routes. The result has ready, claimed, and blocked quests; a pointer-only issue and a long-titled one; PRs whose checks succeed, fail, or are pending, with reviews and one clean to merge; and a paused project. Runners and jobs are written to D1 directly: queued, running, failed, waiting on a three-question agent prompt, waiting on a tool permission, and limited by an account.cloudflare/test/seed.test.ts): runs the same seed in the Worker tests, checks every inbox state renders, opens each item, and merges the clean PR. If the schema or routes drift, the seed fails in CI.cloudflare/README.mddocuments the command as the way to check UI changes in a browser.Bugs found and fixed
The tests mock
fetch, so they hid two bugs that broke every GitHub App call in the deployed Worker. Running the real runtime exposed both:fetchrefusesredirect: "error"with a TypeError.GitHubServiceandosiApprovednow useredirect: "manual", and a 3xx still fails closed because it is notok.this.#fetch(...)calls the globalfetchas a method, which throws "Illegal invocation". The default is now wrapped.The fake now builds a real
Requestand rejects method calls the way workerd does, soseed.test.tsreproduces both bugs. I confirmed it failed before each fix.Validation
just checkandjust testpass in the Nix shell (CLI 232 tests, Worker 261 tests across 13 files).wrangler devhangs:/inbox(200) and the page shows the seeded decisions./inbox,/projects, the project's state, board, and jobs pages,/account,/site.css, and/healthall return 200.Decisions (made unattended, recommended options)
just worker-seeded, after the existingworker-*recipes, rather than the quest's example namedev-seeded.unstable_getMiniflareWorkerOptionsandunstable_splitSqlQuery.miniflareis now a dev dependency pinned to the version Wrangler pins. A Wrangler upgrade could rename these APIs, andjust checkwould catch that.test/project-fixtures.tsis not migrated onto the fake. It importsvitestandcloudflare:workers, so it can't run under Bun, its mock has per-test toggles, and kixelated/quest#165 edits it in parallel. The shared code is now the fake and the seed, which the new test uses.Follow-ups
dev/seed.tsanddev/github.ts(the epic now says so). It still needs a fake runner over the WebSocket and fake publication endpoints (Git data API, forks, PR creation), which the fake does not model yet.dev/serve.tsneeds local values for them.🤖 Generated with Claude Code
(Written by Claude Opus 5.5)