Repository navigation
feat(core,web): review parity rules, vectors and writers - #56
Conversation
The review-parity client rules of docs/design/review-parity-spec.md section 5 in Rust (forge_core::rules::review) and TypeScript (lib/rules/review.ts), held in parity by 80 new shared vectors: fold_pr_review_v2 (folded head from headUpdate, requested reviewers, resolved threads, dismissals, milestone), author kinds in the state fold (draft/ready from the patch and the author), dismissed reviews skipped by count_approvals, meets_policy, anchor_of, group_review_comments, parse_suggestions/apply_suggestion (ASCII fence whitespace, lone CR, indented fences) and linked_issues. Writers and readers: forge-core Collab post_target_event (kind_route), review comment_count, comment start_line/review_id, set_policy/policy, patches_from_branch, PatchView.head used by dg pr view/review/merge/checkout; forge-web review-writes (postTargetEvent, postComment, a resumable and chain-reconciled pending review submit, setPolicy, updateTarget/updateComment) over a new replaceDocumentIdempotent, readPull folding the head and draft; plaintext writes into private repos are refused until the sealed writers land. forge-relay follows headUpdate for head.sha, check-run watching and synchronize; the timeline labels the new kinds. Live on moutai through the web writers. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Important Review skippedToo many files! This PR contains 108 files, which is 8 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (108)
You can disable this status message by setting the 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. Comment |
… comments The review-parity contract (#56) stores anchors in comment fields only: the forge-anchor body block and the readAnchor adapter are gone. Comments are read with anchorOf (ranges placed under their last line, file-level anchors listed as File comments), posted with postComment, and a review's own comments nest under it in the timeline (groupReviewComments). Dismissed reviews drop out of the review summary as they do from the fold. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
PR 2 of the GitHub-parity review plan (
docs/design/review-parity-spec.md§7). It adds the rules, vectors, writers and readers on top of the contract revision in #48 (forge-collabBMfPmaEiMqDp64NDa4Am79VoRpZ9MPVNnCUy6i3UiyWi). Spec §3.12 lists every function signature for the web and CLI PRs 3–7.Rules (Rust
forge_core::rules::review, TSlib/rules/review.ts)80 new shared vectors run in both harnesses:
fold_review_v2__*,policy__*,anchor__*,review_group__*,suggestion__*,linked_issues__*,fold_pr_v2__*, andapprovals__dismiss*.fold_pr_review_v2computes the review state:headUpdate(only a 40- or 64-hex oid counts), elsepatch.headOid;fold_pr_state_v2starts frompatch.draft, and the author's authorEvents now apply: draft, ready, resolve, request and head update. An author event of any other kind is inert.count_approvalsskips dismissed reviews. A dismissed review neither counts nor clears an earlier verdict.meets_policy,anchor_of,group_review_comments,parse_suggestions,apply_suggestionandlinked_issues.Writers and readers
forge-core
Collab::post_target_event(repo, target, kind, EventPayload { value, oid, ref_id })picks membereventversus authorauthorEventthroughkind_route, and refuses events missing their payload.review(.., comment_count), andcommentwithstart_line/review_id.set_policy/policy, andpatches_from_branch, which uses thesourceRefindex.PatchViewnow carrieshead(the folded head),reviewandlog. The folded head is whatdg pr view,review,merge,checkoutanddiffnow use. Merge reachability is still checked against base tips.forge-web
lib/repo/review-writes.ts:postTargetEventandpostComment(anchors,reviewId).ReviewDraftin the IndexedDB journal, submitted withsubmitReviewDraft. The review is written first withcommentCount, then each comment withreviewId. A resumed draft is first reconciled with the chain, so a write that landed without its local save is adopted rather than posted twice.setPolicy,updateTargetandupdateComment.replaceDocumentIdempotentinlib/sdk/write.ts:readPullfolds the head and the draft state. Approvals skip dismissed reviews.toEventmaps kinds 11–18 andrefId.forge-relay follows
headUpdate, ordered by($createdAt, $id)across both streams. It uses the new head for webhookhead.shaand the check-run watch, and sends asynchronizeaction when the head moves.Private repos (follow-up)
These writers write plaintext. In a private repo, writes of an issue, PR, comment or review, and every edit, are refused before signing (
refusePlaintextInPrivate, which also covers the existingcreateComment). The sealed versions still need to be wired:A private PR edit must re-seal under the patch's own epoch (private-repos.md §4.5, §8.2).
Tests
cargo test --workspacepasses andclippy -D warningsis clean.pnpm test: 1,031 tests pass.FORGE_LIVE=1 … vitest run lib/repo/review-parity.live.test.ts), entirely through the web's writers:reviewIdis refused at consensus (40120); dropping it succeeds.lib/repo/v2.live.test.ts(the fixture) also passes.Review
🤖 Generated with Claude Code