Skip to content

feat: implement issue #612 — [Phase 1] Route pr_diff review through the artifact contract (behavior-preserving extraction) - #746

Merged
don-petry merged 5 commits into
mainfrom
dev-lead/issue-612-20260615-0002
Jun 15, 2026
Merged

feat: implement issue #612 — [Phase 1] Route pr_diff review through the artifact contract (behavior-preserving extraction)#746
don-petry merged 5 commits into
mainfrom
dev-lead/issue-612-20260615-0002

Conversation

@don-petry

@don-petry don-petry commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Closes #612

Implemented by dev-lead agent. Please review.

Summary by CodeRabbit

  • Chores

    • Fixed GitHub Actions lint workflow to properly include all test entries in the execution list.
    • Added comprehensive test suite to verify the PR review dispatch system functionality.
  • Refactor

    • Updated PR review script to use a configurable registry system for managing review prompts and output routing, replacing hard-coded path references.

…he artifact contract (behavior-preserving extraction)
@don-petry
don-petry requested a review from a team as a code owner June 15, 2026 00:13
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

scripts/review-one-pr.sh is updated to look up the rubric cascade and output channel for artifact_type=pr_diff from a registry helper, replacing five hard-coded references to prompts/triage.md, prompts/deep-review.md, and scripts/post-pr-review.sh. A new Bats test file validates the dispatch wiring and registry invariants, and the CI lint workflow adds it to the test run list.

Changes

Registry-driven pr_diff dispatch

Layer / File(s) Summary
Registry lookup and prompt path resolution
scripts/review-one-pr.sh
Adds a dispatch block (lines 34–75) that calls review_registry_lookup for artifact_type=pr_diff to populate REVIEW_RUBRIC, REVIEW_OUTPUT_CHANNEL, RUBRIC_TRIAGE_PROMPT, RUBRIC_DEEP_PROMPT, and ARTIFACT_TYPE/CONTENT_REF.
Tier prompt and posting call site updates
scripts/review-one-pr.sh
Replaces hard-coded prompts/triage.md with $RUBRIC_TRIAGE_PROMPT (line 577), hard-coded prompts/deep-review.md with $RUBRIC_DEEP_PROMPT (line 769), and all three verdict-posting calls to scripts/post-pr-review.sh with bash "$REVIEW_OUTPUT_CHANNEL" (lines 755, 914, 987).
Bats test suite for dispatch wiring and registry invariants
tests/test_pr_diff_dispatch.bats
New test file asserting that review-one-pr.sh sources the registry helper, dispatches on pr_diff, resolves output_channel and rubric via review_registry_lookup, removes hard-coded post-pr-review.sh call sites, and that the registry maps pr_diff output channel to scripts/post-pr-review.sh with the expected prompt cascade.
CI workflow test list update
.github/workflows/lint.yml
Adds tests/test_pr_diff_dispatch.bats to the bats command invocation in the lint workflow.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

  • #612 [Phase 1] Route pr_diff review through the artifact contract: This PR directly implements all acceptance criteria from issue #612 — dispatch via registry for artifact_type=pr_diff, registry-resolved rubric and output channel, preservation of scripts/post-pr-review.sh as the output adapter, and new Bats tests validating the wiring.
  • #610: The artifact contract and rubric registry system introduced here is the first planned step described in epic #610.

Suggested labels

needs-human-review

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: implementing issue #612 to route pr_diff review through the artifact contract, which is the core objective of this PR.
Linked Issues check ✅ Passed The PR addresses all 5 acceptance criteria from issue #612: resolves rubric/output_channel from registry for pr_diff [#1], uses PR URL/diff as content_ref [#2], posts via post-pr-review.sh with identical markers [#3], existing bats suite passes unchanged [#4], and DRY_RUN/FORCE_REVIEW behavior preserved [#5].
Out of Scope Changes check ✅ Passed All changes are scoped to issue #612 requirements: lint.yml fix for bats invocation, review-one-pr.sh dispatch refactor, and new test_pr_diff_dispatch.bats tests—no unrelated modifications present.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev-lead/issue-612-20260615-0002

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — review-changes (no-changes)

No changes were needed for this PR.

@don-petry
don-petry enabled auto-merge (squash) June 15, 2026 00:14

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the PR review script to dynamically resolve the review rubric and output channel from a rubric registry helper instead of using hardcoded paths, and introduces a comprehensive BATS test suite to verify this dispatch wiring. The feedback suggests stripping trailing carriage returns from the resolved registry values to prevent execution failures on Windows environments.

Comment thread scripts/review-one-pr.sh Outdated
@don-petry
don-petry disabled auto-merge June 15, 2026 00:14
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 15, 2026
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-reviews (applied)

Changes committed and pushed.

@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — waiting on PR blockers (intent: review-changes)

PR: #746
No changes were committed, but the PR still has blocking checks or reviews (failing or cancelled checks, or changes-requested reviews). The retry cron will re-attempt automatically. Next attempt after: 2026-06-15T00:50:37Z

@don-petry

Copy link
Copy Markdown
Collaborator Author

Note

@don-petry I reviewed this PR and no code changes were needed, but it still has blocking checks or reviews (failing or cancelled checks, or changes-requested reviews), so I cannot mark it done yet. I'll re-check automatically.
Next attempt after: 2026-06-15T00:50:37Z

@don-petry
don-petry enabled auto-merge (squash) June 15, 2026 00:20
@don-petry
don-petry disabled auto-merge June 15, 2026 00:22
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — review-changes (no-changes)

No changes were needed for this PR.

@don-petry
don-petry enabled auto-merge (squash) June 15, 2026 00:23
@don-petry
don-petry disabled auto-merge June 15, 2026 11:29
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — review-changes (no-changes)

No changes were needed for this PR.

@don-petry
don-petry enabled auto-merge (squash) June 15, 2026 11:31

@donpetry-bot donpetry-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review — APPROVED ✓

Risk: LOW
Reviewed commit: a36c997b96285d2a3de01536fac6961b14d37dfa
Review mode: triage-approved (single reviewer)

Summary

Phase 1 of the artifact-contract extraction (epic #610, issue #612): scripts/review-one-pr.sh now resolves its {rubric, output_channel} from the rubric registry keyed on artifact_type=pr_diff instead of hard-coding the cascade. Behavior-preserving — the registry manifest resolves pr_diff to the existing triage->deep-review->synthesize prompts and scripts/post-pr-review.sh, so production review is identical. +120/-5 across 3 files.

Linked issue analysis

Closes #612. All acceptance criteria verified:

  • AC#1: review-one-pr.sh sources lib/review-registry.sh and resolves rubric + output_channel via review_registry_lookup for artifact_type=pr_diff (replacing the hard-coded triage/deep prompt paths and post-pr-review.sh call sites).
  • AC#2: content_ref is the PR URL; the metadata+diff prefetch is unchanged, so prompts consume the same inlined context.
  • AC#3: registry resolves pr_diff output_channel to scripts/post-pr-review.sh (verified at PR head); post-pr-review.sh itself is untouched, so idempotency markers and decision format remain byte-identical.
  • AC#4: lint.yml only ADDS tests/test_pr_diff_dispatch.bats to the bats list (no existing entries dropped, no assertions edited); bats CI is green.
  • AC#5: DRY_RUN is still passed through to the resolved channel; no change to DRY_RUN/FORCE_REVIEW logic.

Findings

No blocking issues.

  • Verified the registry dependency exists at the PR head: scripts/lib/review-registry.sh (from #611) and the versioned manifest scripts/lib/review-registry.tsv, which registers pr_diff -> rubric 'prompts/triage.md,prompts/deep-review.md,prompts/synthesize.md', output_channel 'scripts/post-pr-review.sh'.
  • All four referenced targets (triage.md, deep-review.md, synthesize.md, post-pr-review.sh) exist on disk, so the dispatch cannot fail to resolve.
  • 'bash "$REVIEW_OUTPUT_CHANNEL"' executes a value sourced only from the in-repo versioned manifest, not from PR/user input — no injection surface.
  • Minor (non-blocking): the dispatch binds rubric entries [0]/[1] (triage, deep) but not [2] (synthesize), which is still invoked via its existing hard-coded path. This is consistent with the Phase-1 behavior-preserving intent and is not a regression.
  • Tests in test_pr_diff_dispatch.bats are wiring/grep assertions plus two registry-resolution checks that lock in today's output channel and prompt order.

CI status

All checks green. SUCCESS: Lint, ShellCheck, shellcheck, bats, unit-tests, CodeQL (actions+python), SonarCloud, agent-shield, holdout-guard, Secret scan (gitleaks), Agent Security Scan, validate-agent-profiles, gh-aw-compile, review, CodeRabbit. SKIPPED (n/a): dependabot-automerge, dependency-audit ecosystem jobs, dev-lead/ci-relay. mergeStateStatus=BLOCKED only because reviewDecision=REVIEW_REQUIRED (this review).


Reviewed automatically by the PR-review agent (single-reviewer mode: fable 5). Reply if you need a human review.

@sonarqubecloud

Copy link
Copy Markdown

@don-petry
don-petry merged commit 4292ba4 into main Jun 15, 2026
27 of 28 checks passed
@don-petry
don-petry deleted the dev-lead/issue-612-20260615-0002 branch June 15, 2026 11:46

@donpetry-bot donpetry-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review — APPROVED ✓

Risk: MEDIUM
Reviewed commit: 5c556072e21a6802927c64a51be2e77f84fbd8f2
Review mode: triage-approved (single reviewer)

Summary

Phase-1 artifact-contract refactor of scripts/review-one-pr.sh: the production PR path now dispatches through the rubric registry for artifact_type=pr_diff instead of hard-coding prompt/output paths. Resolves to identical behavior — triage→deep-review prompts and post-pr-review.sh output channel — verified against the versioned manifest. Also adds the new bats suite to lint.yml's test list and a wiring test file. Behavior-preserving, well-tested, all CI green.

Linked issue analysis

Closes #612 ([Phase 1] route pr_diff review through the rubric registry). The dispatch sources lib/review-registry.sh (added by merged #611), resolves {rubric, output_channel} for pr_diff, binds cascade entry 1→triage and entry 2→deep-review, and posts via the resolved channel. Confirmed scripts/lib/review-registry.tsv at the head SHA registers pr_diff → 'prompts/triage.md,prompts/deep-review.md,prompts/synthesize.md' and output_channel 'scripts/post-pr-review.sh', matching every call site and test assertion. AC #1 (registry-driven dispatch) and AC #3 (resolves to today's behavior) are met.

Findings

No blocking findings.

  • Dispatch indirection is a no-op: resolved rubric/output_channel equal the previously hard-coded values, so the cascade behaves identically.
  • bash "$REVIEW_OUTPUT_CHANNEL" sources its value from the repo-versioned manifest (not user input), so no command-injection exposure.
  • gemini-code-assist's sole suggestion (strip trailing CR for Windows) is already implemented: both lookups pipe through 'tr -d \r'.
  • Minor (non-blocking): the rubric's third entry (synthesize.md) is registered but not separately bound at the dispatch layer; consistent with the existing code and fine for Phase 1.
  • New wiring tests lock the contract without running the live cascade; lint.yml correctly adds tests/test_pr_diff_dispatch.bats to the suite.

CI status

All required checks green: CodeQL, shellcheck/ShellCheck, bats, unit-tests, Lint, SonarCloud, Agent Security Scan, gitleaks, validate-agent-profiles, gh-aw-compile, holdout-guard, agent-shield. Conditional dependency-audit/dependabot jobs SKIPPED (expected). reviewDecision=APPROVED. CodeRabbit is a non-blocking advisory bot.


Reviewed automatically by the PR-review agent (single-reviewer mode: fable 5). Reply if you need a human review.

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.

[Phase 1] Route pr_diff review through the artifact contract (behavior-preserving extraction)

2 participants