Skip to content

test(cloudflare): run publication end to end against the seeded GitHub fake - #213

Merged
kixelated merged 5 commits into
mainfrom
quest/m0/kix/github-fake
Oct 24, 2026
Merged

kixelated merged 5 commits into
mainfrom
quest/m0/kix/github-fake

Conversation

@kixelated

@kixelated kixelated commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Completes and deletes quest/m0/kix/github-fake.md, a follow-up of kixelated/quest#190.

Problem

cloudflare/test/publish.test.ts kept its own stateful GitHub fake, while the seeded local server's fake (cloudflare/dev/github.ts) modeled only the inbox flows. The local server could not run a job's publication, so the epic's end-to-end test could not start from the seeded fake.

Changes

  • dev/github.ts now models what publication needs:
    • commits and trees in a fork network's shared object store, built only on known objects;
    • fast-forward (and forced) branch updates on both the upstream and its service fork;
    • pull request listing by head, creation (numbered after existing issues and pulls), title/body updates, and markPullRequestReadyForReview;
    • the issue and pull request reads behind a job's context (body, comments, reviews, threads, check runs).
  • Like GitHub, the fake scopes each installation token to the repositories and permissions it was minted for. A Git write with the wrong token is refused, which backs the publication tests' token assertions. The service fork has its own installation (forkInstallation).
  • publish.test.ts drops its test-local fake. It uses the shared one with a small world of its own, and replaces the fake's knobs (loseMove, onCreate, forkParent, head, role, now) with world edits and a shared intercept wrapper. A new test checks that the fake refuses out-of-scope writes.
  • seed.test.ts adds an end-to-end run: a runner publishes the seeded queued job's commit, opens its draft pull request, and marks it ready. A retry of the failed import job then adopts the pull request it left.
  • dev/serve.ts passes request headers to the fake, since token scoping needs them. The seeded server boots and serves /inbox.

Choices made without asking

  • Token scoping in the fake. The old fake returned fixed fork-token/upstream-token strings. The shared fake mints distinct tokens and enforces their scope, so tests assert scope through the fake rather than through token names.
  • Repo.branches replaces Repo.claims. It is a map of upstream branch to commit, so an iterated pull request's head branch can move. A quest/* entry without a pull request is still a claim. Issue.comments is now the comment list rather than a count.
  • Seed consistency. The seed now records the fork branch quest/m0/import at pull request 20's head, so a retry of the failed import job can publish.
  • Publication tests keep their own small world rather than reusing the rocket seed. Their numbers stay readable and the publish tests don't depend on seed data.

Validation

  • just check and just test pass locally: 465 CLI tests and 335 Worker tests.
  • just worker-seeded boots and serves the inbox.

Notes

Suggested follow-ups

  • Other Worker tests (projects, inbox, jobs, push) still carry their own fetch mocks. Some might move onto the shared fake where they exercise flows it models. This is a candidate for /quest-plan, not done here.

🤖 Generated with Claude Code

(Written by Claude Opus 5.5)

kixelated and others added 2 commits October 23, 2026 23:03
…b fake

The seeded fake (dev/github.ts) now models commits and trees in a fork
network's shared object store, fast-forward and forced branch updates on
the upstream and its service fork, pull request listing, creation,
updates, and ready-for-review, and the issue and pull request reads a
job's context makes. Like GitHub, it scopes each installation token to
the repositories and permissions it was minted for, so a write with the
wrong token fails.

publish.test.ts drops its own stateful fake for this one, with a small
world of its own and the shared `intercept` wrapper for lost responses
and concurrent changes. The seed test adds a runner that publishes the
seeded queued job's commits and pull request, and a retry that adopts the
failed import job's pull request, whose fork branch the seed now records.

The local server passes request headers to the fake, which needs them
for token scoping.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title Run publication end to end against the seeded fake GitHub test(cloudflare): run publication end to end against the seeded GitHub fake Oct 24, 2026
@kixelated
kixelated marked this pull request as ready for review October 24, 2026 06:23
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T15:55:20.753251Z 41fb6ad New commits
🔒 Security Review ✅ Completed 2026-10-24T15:56:26.973685Z 41fb6ad New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

kixelated and others added 3 commits October 24, 2026 08:39
Resolve the publish test conflict with #210's review-thread paging: keep the
seeded GitHub fake, teach it to page review threads 100 at a time, and port the
busy pull request test onto it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d fake

#205's plan test asserted on the old inline fake's request log; read it from the
mocked fetch like the rest of the suite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated

Copy link
Copy Markdown
Collaborator Author

Landing summary

Landing head 41fb6ad with a squash merge.

Changes since the last reviewed head (8d95317)

Decisions

  • The maintainer chose to land without waiting for the optional Codex security review. It had been stuck on "running" for more than 8 hours, and Codex's code review of 8d95317 was clean.
  • The optional native Windows (windows-11-arm) job fails in test/gate.test.ts ("concurrent processes never admit past the headroom"). This PR doesn't touch that test, and main fails the same job at 82a9566, so the failure doesn't block this merge.

(Written by Claude Opus 5.5)

@kixelated
kixelated merged commit 572de71 into main Oct 24, 2026
3 of 4 checks passed
@kixelated
kixelated deleted the quest/m0/kix/github-fake branch October 24, 2026 16:01
kixelated added a commit that referenced this pull request Oct 24, 2026
Resolves conflicts with #213 and #214:

- `landed` in quest/core now returns the merged PR it finds, so the CLI's
  `mergedPull` (renamed in #214 to return the PR's URL) keeps using the one
  shared rule, and the Worker checks it for undefined.
- The fake GitHub's merged-claims additions now build on #213's
  `Repo.branches` model: a quest ref is any listed `quest/*` branch or open
  upstream PR's branch, at its tip, with the PRs from it that merged. A kept
  branch is just a listed branch; a closed PR's optional `head` pins the commit
  it ended at once its branch moves on. The fake's merge endpoint marks the
  PR merged.
- The seeded test lists the kept branches itself, and checks the inbox
  against the quest a pushed branch claims, since #215's agent cards now show
  every queued job's quest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated added a commit that referenced this pull request Oct 24, 2026
Main's publication tests now run against the shared GitHub fake in
cloudflare/dev/github.ts (#213). Port what merge jobs need into it: pull
request labels and the timeline that added them, the hold query, the
auto-merge and merge mutations, comparing a commit with main, and a
commit's .github/workflows tree. The merge job publication tests now
drive that fake, and pulled jobs' read tokens keep contents: read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant