Skip to content

CR-7: post comments and reviews through the gh login (#326) - #413

Closed
BunsDev wants to merge 2 commits into
mainfrom
cr7-write-submit
Closed

BunsDev wants to merge 2 commits into
mainfrom
cr7-write-submit

Conversation

@BunsDev

@BunsDev BunsDev commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Part of #326, first of three increments. Stacked on #410 (cr7-anchors); GitHub retargets it to main when #410 merges.

Decision

Val answered on 2026-10-25: writes go through the person's own gh login (not a GitHub App), and decisions 2–4 (state menu, title/description, reviewer requests) are in scope. AGENTS.md records the approval and its limits.

What this adds

  • code-review:write: a separate, localOnly channel, never code-review:read.
    • Main names the session from the IPC sender and the document epoch, so another window or a reload can't use a preview.
    • Before a preview and again before sending, main re-reads the account, the repository's permission (by stable id) and the PR's head, target, state and lock.
    • Main checks that gh's login state is unchanged before dispatch.
  • Transport: six GET shapes and exactly two POST endpoints (issue comment, PR review). The body goes to gh on stdin. There is no PATCH, PUT, DELETE, GraphQL or merge, and a test checks the sources for them.
  • At most one send per intent:
    • the dispatch is recorded durably before gh runs;
    • operations on one PR run one at a time;
    • a double click or a second window sends once.
  • Unclear outcomes: a 5xx, timeout, crash or unreadable answer leaves the send unknown, never retried. Check GitHub reads it back and matches author, exact body with a hidden intent marker, and head. Stop tracking is the person's explicit choice.
  • Refusals: permission that is unreadable, missing or locked; self-approval; a closed PR; a moved head or target; an outdated base-side anchor. Each has its own fixed text, and nothing GitHub printed reaches the renderer.
  • UI: comment and review composers whose previews name the account, owner/repo #n and head. Comment on this line in Changes. A card for a send in doubt.

Not in this PR: the head-guarded merge (increment 2; its pure preflight is #412) and decisions 2–4 (increment 3).

Validation

  • pnpm build && pnpm test && pnpm test:e2e: exit 0.
    • Desktop unit: 1,955 passed, 17 skipped.
    • Other unit suites: 180 passed, 5 skipped.
    • Desktop E2E: 456 passed, 7 skipped.
    • Site E2E: 7 passed.
  • New tests: 11 service unit tests, an IPC test through the compiled main handler with the real gh transport, and 5 Electron tests (e2e/code-review-actions.spec.ts). They cover success, a double click, rejection, a head move, a timeout, a crash during a POST GitHub recorded → restart → reconcile, and a 502 → stop tracking.
  • The Electron tests found a real bug, fixed here: the delayed draft save stored the text from before the last keystroke.
  • Mock and synthetic gh only. No live write was run, and no real PR, comment or review was created. A live check needs a disposable repository Val names.

Evidence: docs/reviews/2026-10-25-cr7-write-submit.md. Design: docs/design/code-review.md (CR-7 writes).

Please don't merge without Val's go-ahead.

🤖 Generated with Claude Code

BunsDev and others added 2 commits October 24, 2026 18:10
CR-5's anchorFor returns a seven-field LineAnchor with commitSha, the commit
its line numbers count in. The unwired intent model checked for an exact
six-field shape, so it refused every real anchor, and its digest never bound
the diff base.

LineAnchor moves into the shared contract. patch.ts re-exports it and the
model uses it. commitSha must be 40-hex, must be the head on the head side,
and is part of the digest. The future write adapter still checks a base-side
commitSha against the fresh read's diffBaseSha.

This also records the check of CR-4's action slots. Adds no GitHub mutation,
IPC channel or UI. Refs #326.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Val decided on 2026-10-25: Code Review writes go through the person's own
gh login, and decisions 2-4 are in scope. This is the first increment.

- code-review:write: a separate localOnly channel. Main names the session
  from the sender and document epoch, re-reads the account, repository
  permission and PR before preview and before send, and checks gh's login
  state before dispatch. Fixed endpoints only: two POSTs, bodies on stdin.
- Sends are durable, at most once per intent; an unclear outcome stays
  unknown until a read-back matches the intent marker or the person stops
  tracking it.
- Comment and review composers, line comments from Changes, and a doubt card.
- Unit, IPC and Electron coverage of success, rejection, timeout, crash and
  reconciliation, all against a synthetic gh. No live write was run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vercel

vercel Bot commented Oct 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
modex Ready Ready Preview Oct 25, 2026 10:55pm UTC

Request Review

BunsDev commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #416, now verified merged as b3aad0d85b91f479d5415abdec15d9f74a5dd61c. Protected queue run 40420085521 passed (468 desktop tests, 4 skips, 7 site tests). Git's clean merge of reviewed integration head fffd07ec7006347142453217e6bdf899373ff31d onto the squash parent produces the exact landed tree.

This PR's published head is an ancestor of the reviewed integration head. The integration includes the reviewed write-race and uncertainty repairs. This closure records supersession, not live-write or human acceptance of #326. Your source worktree remains protected; no owner release or deletion is performed here.

@BunsDev BunsDev closed this Oct 27, 2026

This branch was successfully deployed

1 active deployment
Preview — f4893655 Deployed Oct 25, 2026 by vercel[bot]
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