Skip to content

feat(review): emit structured inline review findings + a review.inline_comments toggle#1525

Merged
JSONbored merged 1 commit into
mainfrom
claude/inline-comments-contract
Jun 26, 2026
Merged

feat(review): emit structured inline review findings + a review.inline_comments toggle#1525
JSONbored merged 1 commit into
mainfrom
claude/inline-comments-contract

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

PR A of 2 for a CodeRabbit-style quiet inline-comments feature — this is the inert data contract; the GitHub posting + processor wiring follow in PR B. Nothing consumes the new findings yet, so behavior is unchanged until PR B activates it.

  • The AI reviewer can now ALSO emit structured, line-anchored findings {path, line, severity, body}. ModelReview + the ok result carry an inlineFindings array.
  • parseModelReview parses them fail-safe: a malformed/absent field degrades to []; each item missing a usable path / positive line / body is dropped (never partial); severity defaults to nit unless exactly blocker.
  • composeInlineFindings dedupes by path+line (first wins), drops public-unsafe bodies (toPublicSafe), and caps the total at 10.
  • The instruction is appended to the system prompt only when the caller asks for it, so with the feature OFF the prompt is byte-identical and the model emits nothing.
  • A manifest-only .gittensory.yml review.inline_comments toggle (default OFF), wired exactly like review.profile (type, parse, present, serialize, resolve) — no DB column.

Scope

  • src/services/ai-review.tsInlineFinding, parse, compose, prompt suffix, result field
  • src/signals/focus-manifest.tsreview.inline_comments (manifest-only)
  • tests: ai-review, focus-manifest, one signals-coverage literal

Validation

  • npm run typecheck clean · npm run test:coverage 4625 passed · 100% line+branch on the diff (verified per-file; remaining uncovered branches in those files are all pre-existing, outside the patch)
  • Tests cover: fail-safe parse (non-object/missing-field/non-positive-line/non-string-body), severity default, dedupe/cap/public-safe, the prompt suffix appended only when requested, and the manifest parse/present/round-trip/resolve/invalid-warning.

Safety

  • No public-surface change (inert). No secrets / private terms. Default-OFF at both the prompt and the manifest. Adversarially reviewed (4 independent verifiers; the byte-identical-when-off, fail-safe, and config round-trip invariants confirmed).

…e_comments toggle

PR A of a CodeRabbit-style quiet inline-comments feature (the inert data contract; the
GitHub posting + wiring follow in PR B). The AI reviewer can now ALSO emit structured,
line-anchored findings {path, line, severity, body}: ModelReview/result carry an
inlineFindings array, parseModelReview parses it fail-safe (a malformed/absent field
degrades to [], each item missing a usable path/line/body is dropped, never partial),
and composeInlineFindings dedupes by path+line, drops public-unsafe bodies, and caps the
total. The instruction is appended to the system prompt ONLY when the caller asks for it,
so with the feature off the prompt is byte-identical and the model emits nothing.

Adds a manifest-only .gittensory.yml review.inline_comments toggle (default OFF) wired
the same way as review.profile — type, parse, present, serialize, resolve — with no DB
column. Nothing consumes the findings yet, so behavior is unchanged until PR B.
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jun 26, 2026
@superagent-security

Copy link
Copy Markdown

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.46%. Comparing base (6b1389b) to head (fb824f6).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1525   +/-   ##
=======================================
  Coverage   95.45%   95.46%           
=======================================
  Files         195      195           
  Lines       21121    21148   +27     
  Branches     7637     7649   +12     
=======================================
+ Hits        20161    20188   +27     
  Misses        383      383           
  Partials      577      577           
Files with missing lines Coverage Δ
src/services/ai-review.ts 98.32% <100.00%> (+0.19%) ⬆️
src/signals/focus-manifest.ts 98.13% <100.00%> (+<0.01%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored JSONbored merged commit e21adb2 into main Jun 26, 2026
18 checks passed
@JSONbored JSONbored deleted the claude/inline-comments-contract branch June 26, 2026 13:18
JSONbored added a commit that referenced this pull request Jun 26, 2026
PR B activates the CodeRabbit-style inline-comments feature (PR A #1525 shipped the inert
contract). On top of the decision summary, the AI reviewer's line-anchored findings are
posted as ONE non-blocking review (event: COMMENT, never REQUEST_CHANGES) so a contributor
sees exactly what to fix for a resubmission without the gate ever changing.

- createPullRequestReviewComments: a quiet COMMENT-event review with inline comments,
  threading the action mode (dry-run suppression).
- inline-comments.ts: rightSideLinesFromPatch validates each finding's line against the
  diff hunks (out-of-diff lines dropped → never a 422), selectInlineComments dedupes/caps,
  postInlineReviewComments is fail-safe (swallows API errors, never touches the gate), and
  maybePostInlineComments posts once per head SHA — a cache hit carries no findings, so the
  ~2-min re-gate sweep never reposts, and the off-path does zero extra work.
- Gated at three layers (all default OFF): GITTENSORY_REVIEW_INLINE_COMMENTS, the
  GITTENSORY_REVIEW_REPOS allowlist, and the per-repo review.inline_comments manifest toggle.
- Docs + .env.example + flag plumbing (env.d.ts, wrangler.jsonc, cf-typegen).
@github-actions github-actions Bot mentioned this pull request Jun 26, 2026
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant