Skip to content

Open a Quest setup PR when enrolling - #431

Merged
kixelated merged 13 commits into
mainfrom
quest/m1/kix/setup-pr
Nov 3, 2026
Merged

kixelated merged 13 commits into
mainfrom
quest/m1/kix/setup-pr

Conversation

@kixelated

@kixelated kixelated commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Implements quest/m1/kix/setup-pr.md: a maintainer enrolls a repository that has no Quest files, and the App opens a pull request with what quest init writes. No runner is involved. The project waits in a setting-up state that links the pull request, and is enabled when the pull request merges.

Summary

  • Init's file plan moved into the core. planInit lives in src/core/init.ts and reads the repository through a read-only Checkout. It returns the ordered changes ({ path, content | null }): skill stubs (writing missing or outdated ones, deleting retired ones), quest/README.md, the Quests: line, the .gitattributes line, and Claude's hook entries in .claude/settings.json. Conflicts throw InitRefused naming the path. quest init now builds a filesystem Checkout, applies the plan, and registers the merge driver, with identical output and messages. Uninstall reuses the core's helpers (installedStubs, parseSettings, and so on). PREFIX and HOOK_EVENTS moved to the core as well.
  • The Worker plans with the same function. cloudflare/src/github/setup.ts adapts the default branch's recursive Git tree to Checkout. The few files the plan reads come in one GraphQL blob read, hash-checked like the quest snapshot. scripts/build.ts renders the shipped stubs into build/stubs.json.
  • Enrollment flow. On /projects, a row with no Quest files now gets Enable contributions as a link. Its project page shows a short form holding only the optional "What is this project working toward?" question. Submitting it (POST …/setup) rechecks maintainer authority, visibility, and the OSI license live. It then publishes the plan on kix/setup with the Git Data API, the same #branch/#disarming path job branches use, and opens a ready pull request. Its body lists each change, plus what it leaves out: pinning quest in a tool manager and adapting existing instructions. It also mentions the bootstrap job when there is no flake.nix.
  • Setting up. A new github_project_setups table (migration 0021) records the setup. The project page and the picker show "Setting up" with the pull request's link. When a pull_request webhook closes or reopens it, the service rereads the pull request. A merge enables the project through the same live checks as Enable, including quest check, with the enroller's authority, so no second visit is needed. The project page reconciles the same way if a webhook was missed, and keeps the reason if enabling fails. A pull request closed without merging offers a retry (fresh plan from the current default branch) or a disconnect.
  • Refusals. An init refusal is shown on the setup page naming the path, and nothing is written. A goal the planned quest/README.md would fail quest check on is refused before publishing.
  • Docs. New "Setup pull request" section in cloudflare/GITHUB.md, plus a README build note. quest rm removed the quest and its link in quest/m1/kix/README.md.

Choices made without asking

  • A separate github_project_setups table, not a setup value in github_projects.state. SQLite can't alter that CHECK, and rebuilding the table would cascade through six dependent tables. A separate table also keeps every existing "enrolled means enabled or paused" check (jobs, delivery, observations, inbox) unchanged. The UI still presents the project as enrolled, setting up.
  • Branch kix/setup, matching bootstrap's kix/devshell outside the claim namespace. A retry fast-forwards with a merge of the current default branch into kix's earlier setup commit, so a concurrent push fails the update instead of being reset away. A kix/setup holding commits kix didn't record writing is refused, naming the branch.
  • Symlinks are refused on GitHub. A Git tree stores a symlink's target as data. Rather than resolve it, a symlink on a planned path is refused, pointing at quest init in a clone. The CLI still follows valid symlinks as before.
  • The goal: at most 2,000 characters. Heading syntax is escaped (ATX # and setext underlines). Anything else quest check would refuse, such as a nested heading or a link to a missing quest, is refused at submit. The goal isn't stored, so a retry asks again.
  • The setup pull request opens ready, not as a draft: it is complete work for the maintainer to merge.
  • Disconnecting a setting-up project leaves its pull request and branch on GitHub, so kix closes and deletes nothing in the repository.
  • The webhook only triggers a reconcile. Enabling always rereads the pull request and rechecks authority live.
  • Setup writes are conditional on the setup row they read. A merged setup enables only while its row, with that pull request, still exists in the same transaction. A retry records its commit only while the row is unchanged and the project isn't enrolled. So a disconnect, a pause, or another retry made during the GitHub reads stands; the losing request reports the current state or asks to try again.

Merging main (2026-11-03)

Checks

just check and just test pass locally on f77b8a7: 983 root tests (2 skipped) and 505 Worker tests, including 15 in cloudflare/test/setup.test.ts against the fake GitHub.

Follow-ups

  • moq-dev/quest#407 (owner allowlist) touches the same service and picker. Whichever lands second merges the other; the allowlist's #repository check covers openSetup and settleSetup with no extra work.
  • Sibling PRs editing src/cli/setup.ts (moq-dev/quest#420, merge-driver-upkeep, worktree-hooks) will conflict with the move. Their init changes now belong in src/core/init.ts.

Review

  • Reviewer: Codex (quest review), gpt-6.1-sol, medium effort, new session for the merged branch
  • Head: c71454e, against origin/main fc7bab3. f77b8a7 adds only a conflict-free merge of origin/main (moq-dev/quest#416).
  • Round 1 (f8297ef): [medium] a disconnect or pause made while a merged setup's live checks ran was undone by the reconcile's stale snapshot: fixed (6bf900b). Every write in #enable's batch is guarded by the setup row and its pull, with a regression test.
  • Round 2: [medium] a disconnect made during a retry's GitHub requests was undone by the retry's upsert: fixed (65f1985). The pending commit is recorded only while the row is unchanged; later updates are scoped to that commit; regression test.
  • Round 3 (65f1985): no findings.
  • Round 4 (c71454e, after a hand-resolved merge of moq-dev/quest#427): no findings.
  • Earlier rounds on cb9ae7d (gpt-6.1-sol, medium): setup-retry force reset, setext and nested headings, lone CR, and the goal check against the post-merge tree. All fixed; the last round had no findings.

🤖 Generated with Claude Code

(Written by Claude Opus 5.5)

kixelated and others added 7 commits November 2, 2026 19:43
Quest-Claim: a1576d8b3956a615
The core's planInit returns the files installing Quest writes or removes,
computed through a read-only Checkout, so the Worker can publish the same
files the CLI writes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A repository without Quest files enables through the App's setup pull
request: the core's init file plan, published on kix/setup with no runner.
The project waits in a setting-up state that links the pull request and is
enabled when it merges, from the webhook or the next page view.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A retry merges the default branch into kix's earlier setup commit, so a push
made meanwhile fails the update instead of being reset away. A goal line of
only = or - no longer underlines the line above as a heading.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Escaping heading syntax cannot cover every Markdown construct, so the
planned quest/README.md is checked with the core before anything is
published.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review November 3, 2026 04:20
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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 45 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d1bbaeaf-3546-4223-9da3-4eae5c74a1b7
Commits

Reviewing files that changed from the base of the PR and between fc7bab3 and f77b8a7.

Files selected for processing: 20
  • cloudflare/GITHUB.md
  • cloudflare/README.md
  • cloudflare/bunfig.toml
  • cloudflare/migrations/0021_project_setups.sql
  • cloudflare/scripts/build.ts
  • cloudflare/src/github/service.ts
  • cloudflare/src/github/setup.ts
  • cloudflare/src/github/webhook.ts
  • cloudflare/src/index.tsx
  • cloudflare/src/projects.tsx
  • cloudflare/test/projects.test.ts
  • cloudflare/test/setup.test.ts
  • cloudflare/tsconfig.json
  • quest/m1/kix/README.md
  • quest/m1/kix/setup-pr.md
  • src/cli/setup.ts
  • src/cli/skills.ts
  • src/cli/worktree-hook.ts
  • src/core/index.ts
  • src/core/init.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

kixelated and others added 6 commits November 3, 2026 08:05
Port #420's stub refresh into the core's planInit, since init's plan moved
there: an outdated Quest stub of a current skill is rewritten in place,
keeping its newlines, and linked stubs are left alone.

Renumber the setup migration to 0021, after main's 0020_head_approval.sql.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A disconnect, retry, or pause made while a merged setup's live checks ran
was undone by the reconciliation's earlier snapshot. Each write of the
enabling batch now checks the setup row, with its pull request, still
exists in the same transaction, and a reconciliation that lost the race
reports where the project stands now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A retry read the setup row, made several GitHub requests, then upserted
it, so a disconnect made meanwhile was undone and the new pull request
would enable contributions on merge. The pending commit is now recorded
only while the row is the one the retry read and the project is not
enrolled; later updates are scoped to that commit, and a setup gone by
the end is reported instead of read as present.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	src/cli/setup.ts
@kixelated
kixelated added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit d7ef15e Nov 3, 2026
17 checks passed
@kixelated
kixelated deleted the quest/m1/kix/setup-pr branch November 3, 2026 17:05
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.

1 participant