Skip to content

feat: implement issue #686 — canary #668 increment 5: Layer 0 — pure decision cores + codified 'decision logic in a tested script' standard#687

Merged
don-petry merged 5 commits into
mainfrom
dev-lead/issue-686-20260712-2146
Jul 12, 2026
Merged

feat: implement issue #686 — canary #668 increment 5: Layer 0 — pure decision cores + codified 'decision logic in a tested script' standard#687
don-petry merged 5 commits into
mainfrom
dev-lead/issue-686-20260712-2146

Conversation

@don-petry

@don-petry don-petry commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Closes #686

Implemented by dev-lead agent. Please review.

Summary by CodeRabbit

  • Bug Fixes

    • Improved pull request review readiness decisions with consistent handling for drafts, closed or merged requests, required checks, requested changes, and unresolved threads.
    • Non-required check failures no longer block review dispatch.
    • Added clear decision outcomes and consistent precedence when multiple conditions apply.
  • Documentation

    • Documented the review readiness criteria and decision flow.
    • Added standards for keeping reusable decision logic independently tested and workflow integration lightweight.
  • Tests

    • Added comprehensive coverage for readiness scenarios and edge cases.

…decision cores + codified 'decision logic in a tested script' standard
@don-petry don-petry requested a review from a team as a code owner July 12, 2026 21:53
@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 Jul 12, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@don-petry, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 41 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5142283b-d7b6-4fa6-bd30-c3ffe2396391

📥 Commits

Reviewing files that changed from the base of the PR and between 6fbf060 and 1f630e0.

📒 Files selected for processing (2)
  • AGENTS.md
  • standards/agent-standards.md
📝 Walkthrough

Walkthrough

The PR extracts PR readiness gating into a pure, tested shell function, updates the reusable workflow to delegate decisions to it, expands decision-matrix coverage, and documents the pure decision-core standard.

Changes

PR readiness decision flow

Layer / File(s) Summary
Readiness core and decision matrix
.github/scripts/pr-auto-review/lib/ready-check.sh, .github/scripts/pr-auto-review/README.md, test/workflows/pr-auto-review/ready.bats
pr_auto_review_ready evaluates draft/state, required checks, review decisions, and unresolved threads in fixed precedence order; Bats tests cover dispatch, skip classes, malformed checks, precedence, and self-check exclusion.
Workflow fact gathering and output wiring
.github/workflows/pr-auto-review-reusable.yml
The workflow gathers PR facts, calls the readiness core, derives readiness from its exit status, and emits normalized decision outputs.
Pure decision-core standards
AGENTS.md, standards/agent-standards.md
Repository guidance requires reusable decision logic to live in pure, side-effect-free, Bats-tested scripts while workflows provide I/O glue.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Workflow
  participant ReadinessCore
  participant ChecksGate
  participant GitHub
  Workflow->>GitHub: Gather PR metadata, checks, and thread count
  Workflow->>ReadinessCore: Pass collected PR facts
  ReadinessCore->>ChecksGate: Evaluate required checks
  ChecksGate-->>ReadinessCore: Return checks readiness
  ReadinessCore-->>Workflow: Return decision class and exit status
  Workflow-->>GitHub: Emit decision output and dispatch or skip
Loading

Possibly related PRs

🚥 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: moving pr-auto-review decision logic into pure decision cores and codifying the tested-script standard.
Linked Issues check ✅ Passed The changes match the issue: readiness logic moved into pure functions, workflow reduced to glue, bats coverage added, and the tested-script standard was codified.
Out of Scope Changes check ✅ Passed All changes are directly tied to the issue: workflow/script refactor, tests, and standards documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev-lead/issue-686-20260712-2146

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.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces a unified, pure readiness core function pr_auto_review_ready in ready-check.sh to evaluate PR readiness criteria, along with comprehensive BATS unit tests and updated documentation across several files. The review feedback highlights a potential Bash syntax error when parsing malformed or null JSON inputs with jq and suggests a robust fallback, as well as recommending additional test cases to cover these null-safety paths.

Comment thread .github/scripts/pr-auto-review/lib/ready-check.sh
Comment thread test/workflows/pr-auto-review/ready.bats
@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — review-changes (applied)

Changes committed and pushed.

@don-petry don-petry enabled auto-merge (squash) July 12, 2026 21:57
@don-petry don-petry disabled auto-merge July 12, 2026 21:57
@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — review-changes (applied)

Changes committed and pushed.

@don-petry don-petry enabled auto-merge (squash) July 12, 2026 22:01
@don-petry don-petry disabled auto-merge July 12, 2026 22:01
@don-petry don-petry enabled auto-merge (squash) July 12, 2026 22:03
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 12, 2026
@don-petry don-petry disabled auto-merge July 12, 2026 22:52
@donpetry-bot

Copy link
Copy Markdown
Contributor

CI checks on this PR are still running. Once they complete, re-mention @donpetry-bot to trigger a fresh review.

Posted by the donpetry-bot PR-review cascade.

@donpetry-bot

Copy link
Copy Markdown
Contributor

@donpetry-bot I'm on it — starting a fresh review now. Results will appear in a few minutes.

@donpetry-bot

Copy link
Copy Markdown
Contributor

CI checks on this PR are still running. Once they complete, re-mention @donpetry-bot to trigger a fresh review.

Posted by the donpetry-bot PR-review cascade.

@donpetry-bot

Copy link
Copy Markdown
Contributor

@donpetry-bot I'm on it — starting a fresh review now. Results will appear in a few minutes.

@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — fix-reviews (applied)

Changes committed and pushed.

@donpetry-bot

Copy link
Copy Markdown
Contributor

CI checks on this PR are still running. Once they complete, re-mention @donpetry-bot to trigger a fresh review.

Posted by the donpetry-bot PR-review cascade.

@donpetry-bot

Copy link
Copy Markdown
Contributor

@donpetry-bot I'm on it — starting a fresh review now. Results will appear in a few minutes.

@don-petry

Copy link
Copy Markdown
Contributor Author

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

No changes were needed for this PR.

@don-petry don-petry enabled auto-merge (squash) July 12, 2026 23:11
@donpetry-bot

Copy link
Copy Markdown
Contributor

CI checks on this PR are still running. Once they complete, re-mention @donpetry-bot to trigger a fresh review.

Posted by the donpetry-bot PR-review cascade.

@donpetry-bot

Copy link
Copy Markdown
Contributor

@donpetry-bot I'm on it — starting a fresh review now. Results will appear in a few minutes.

@donpetry-bot

Copy link
Copy Markdown
Contributor

CI checks on this PR are still running. Once they complete, re-mention @donpetry-bot to trigger a fresh review.

Posted by the donpetry-bot PR-review cascade.

@donpetry-bot

Copy link
Copy Markdown
Contributor

@donpetry-bot I'm on it — starting a fresh review now. Results will appear in a few minutes.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@AGENTS.md`:
- Around line 114-131: Update the “Decision Logic Lives in a Pure, Tested
Script” guidance to allow pure scripts under both scripts/** and
.github/scripts/**, matching the cited PR auto-review exemplar. Remove the
duplicated section from standards/agent-standards.md and replace it with a
cross-reference to the canonical guidance in AGENTS.md, preserving a single
source of truth.

In `@standards/agent-standards.md`:
- Around line 112-134: Replace the duplicated “Decision-Making Reusables — Pure,
Tested Decision Cores” guidance and exemplar table in
standards/agent-standards.md with a concise cross-reference to the canonical
AGENTS.md decision-core section, following the adjacent “BMAD Method Workflows”
convention. Preserve a clear pointer to that source without repeating its rules,
examples, or payoff text.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 42912ee6-7db0-42e1-b478-5493a9bdabf7

📥 Commits

Reviewing files that changed from the base of the PR and between 347d3cb and 6fbf060.

📒 Files selected for processing (6)
  • .github/scripts/pr-auto-review/README.md
  • .github/scripts/pr-auto-review/lib/ready-check.sh
  • .github/workflows/pr-auto-review-reusable.yml
  • AGENTS.md
  • standards/agent-standards.md
  • test/workflows/pr-auto-review/ready.bats

Comment thread AGENTS.md
Comment thread standards/agent-standards.md
@don-petry don-petry disabled auto-merge July 12, 2026 23:22
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 12, 2026
@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — fix-reviews (applied)

Changes committed and pushed.

@don-petry don-petry disabled auto-merge July 12, 2026 23:24
@sonarqubecloud

Copy link
Copy Markdown

@donpetry-bot

Copy link
Copy Markdown
Contributor

CI checks on this PR are still running. Once they complete, re-mention @donpetry-bot to trigger a fresh review.

Posted by the donpetry-bot PR-review cascade.

@donpetry-bot

Copy link
Copy Markdown
Contributor

@donpetry-bot I'm on it — starting a fresh review now. Results will appear in a few minutes.

@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — waiting on PR blockers (intent: fix-reviews)

PR: #687
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-07-12T23:57:07Z

@don-petry don-petry enabled auto-merge (squash) July 12, 2026 23:27

@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: 1f630e01876b38c5bfdb9e1c5fcf2d7475397ade
Review mode: triage-approved (single reviewer)

Summary

Refactors the pr-auto-review readiness gate: criteria #1/#3/#4 move from inline workflow bash into a pure, unit-tested function (pr_auto_review_ready) in ready-check.sh, with the workflow reduced to I/O glue. Adds a 17-case decision-matrix bats suite and codifies the 'decision logic in a pure, tested script' standard in AGENTS.md (cross-referenced from standards/agent-standards.md). Fully implements issue #686 with no behavior change to the decision classes or the #680 required-checks gate.

Linked issue analysis

Closes #686 (increment 5 of #668). All acceptance criteria are met: (1) criteria #1/#3/#4 decision logic lives in pure functions in ready-check.sh and check-and-dispatch is thin I/O glue; (2) decision= outputs are preserved as literal strings (Layer 2 telemetry + canary structural grep unaffected) and the #680 required-vs-non-required gate is delegated verbatim to pr_auto_review_checks_ready; (3) full decision-matrix bats coverage including precedence, null/malformed inputs, no-checks, non-required-advisory-does-not-block (#680 pin), and self-check exclusion; (4) standard codified in AGENTS.md with the canary engine and ready-check.sh as exemplars; (5) ShellCheck green.

Findings

No blocking findings.

  • Correctness: jq null/malformed-JSON handling in pr_auto_review_ready is sound (type guard + empty-output check, both covered by tests). Criterion precedence matches the prior inline behavior and is test-pinned.
  • Security: no secrets, no new untrusted-input interpolation in the workflow; ${{ }} expressions used are safe contexts (github.repository, github.run_id). Secret-scanning MCP tool was unavailable this run; the gitleaks CI check passed and the diff contains only shell/test/markdown content.
  • Minor (non-blocking): a non-numeric UNRESOLVED_COUNT would make the [ -gt ] test error and yield an empty decision class — unreachable in practice since the workflow derives it from a GraphQL length expression.
  • Prior review threads (gemini null-safety, CodeRabbit standards-duplication) are all resolved; CodeRabbit's latest review is APPROVED.
  • Note: the workflow now gathers all PR facts (checks, branch rules, GraphQL threads) before deciding, so draft/closed PRs incur a few extra API calls — an acceptable tradeoff for the pure-core design.

CI status

All required checks green on 1f630e0: Lint, ShellCheck, CodeQL, SonarCloud, agent-shield / AgentShield, Detect ecosystems, Agent Security Scan — plus Lint and bats (PR Auto-Review Tests), Secret scan (gitleaks), npm audit, CodeRabbit. The CANCELLED dev-lead / dispatch and dev-lead / ci-relay entries are non-required advisory agent checks and do not gate merge (confirmed against the main branch required-status-check rules).


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

@don-petry don-petry merged commit 3e1767a into main Jul 12, 2026
28 of 38 checks passed
@don-petry don-petry deleted the dev-lead/issue-686-20260712-2146 branch July 12, 2026 23:30

@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: 1f630e01876b38c5bfdb9e1c5fcf2d7475397ade
Review mode: triage-approved (single reviewer)

Summary

Refactor per issue #686 (canary #668 increment 5): extracts the remaining pr-auto-review readiness criteria (#1 open/non-draft, #3 CHANGES_REQUESTED, #4 unresolved threads) from inline workflow bash into a pure, unit-tested decision core (pr_auto_review_ready in ready-check.sh), adds a 20-case decision-matrix bats suite, and codifies the 'decision logic in a tested script' standard in AGENTS.md with a cross-reference in standards/agent-standards.md. Triage assessment confirmed: no security-sensitive surface touched, behavior-preserving refactor, all findings from prior tool reviews resolved.

Linked issue analysis

Issue #686 acceptance criteria are all substantively addressed: (1) criteria #1/#3/#4 now live in ready-check.sh as the pure pr_auto_review_ready function and check-and-dispatch is thin I/O glue; (2) decision= outputs are preserved and emitted as literal strings so the Layer 2 telemetry / canary structural greps keep working, and the #680 required-vs-non-required gate is delegated verbatim to pr_auto_review_checks_ready with a dedicated pin test; (3) the full decision matrix is covered in test/workflows/pr-auto-review/ready.bats (happy path, each skip class, no-checks/empty/null/malformed JSON, precedence ordering, self-check exclusion) under the PR Auto-Review Tests workflow (Lint and bats: SUCCESS); (4) the standard is codified in AGENTS.md citing both exemplars, with agent-standards.md cross-referencing instead of duplicating (per resolved CodeRabbit feedback); (5) ShellCheck green.

Findings

No blocking findings.

  • Security: the workflow diff removes inline logic and calls the sourced lib; no new permissions, secrets, or untrusted-input interpolation into shell. CodeQL (actions), gitleaks, AgentShield, Agent Security Scan all green. The run_secret_scanning MCP tool was not available in this environment; the gitleaks CI check (SUCCESS) covers secret detection.
  • Correctness: null-safety of CHECKS_JSON is handled (jq type guard + empty-string check) and tested for empty/null/malformed inputs; UNRESOLVED_COUNT defaults to 0. Precedence semantics (earlier criterion wins) are explicit and tested.
  • Minor (non-blocking): the glue now gathers all facts (gh pr checks, branch rules, GraphQL threads) before deciding, so draft/closed PRs incur a few extra read-only API calls that were previously short-circuited. Decisions are unchanged; acceptable cost for the pure-core design.
  • Prior tool reviews: CodeRabbit's CHANGES_REQUESTED was addressed and superseded by its APPROVED review; all 4 review threads (gemini x2, coderabbit x2) are resolved.

CI status

All required checks green: Lint, ShellCheck, Lint and bats (PR Auto-Review Tests), CodeQL, Analyze (actions), Secret scan (gitleaks), SonarCloud, npm audit, Agent Security Scan, agent-shield — all SUCCESS. CANCELLED entries are non-required dev-lead dispatch/ci-relay advisory contexts; SKIPPED entries are ecosystem audits not applicable to this repo. reviewDecision: APPROVED; no unresolved review threads.


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.

canary #668 increment 5: Layer 0 — pure decision cores + codified 'decision logic in a tested script' standard

2 participants