Skip to content

fix(review): Catch return-side hook contract breaks - #6

Merged
vbelolapotkov merged 3 commits into
mainfrom
codex/fix-api-contract-return-handling
Jul 30, 2026
Merged

fix(review): Catch return-side hook contract breaks#6
vbelolapotkov merged 3 commits into
mainfrom
codex/fix-api-contract-return-handling

Conversation

@vbelolapotkov

@vbelolapotkov vbelolapotkov commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Closes #5.

Why

The API contract reviewer only checked what hook consumers received. It could clear a change that preserved the filter invocation and arguments while changing how the caller processed callback return values, such as removing established normalization. That left real third-party compatibility breaks invisible and encouraged the unsafe conclusion that undocumented runtime behavior was not contractual.

Approach

  • Compare caller-side filter return handling before and after the diff.
  • Treat established runtime behavior as contractual when supported by implementation, tests, or consumer evidence.
  • Require concrete evidence that observable results are unchanged before dismissing a candidate as internal refactoring.
  • Keep dispatch behavior unchanged and add four deterministic regression guards for the prompt contract.
  • Regenerate the Codex plugin manifest from the canonical marketplace entry.

Testing

  • Focused return-side regression tests: 4 passed.
  • Full pirategoat-tools suite: 2,777 passed, 24 skipped.
  • Codex marketplace compatibility tests: 12 passed.
  • Codex compatibility generator check passed.
  • Marketplace and reviewer registry JSON validation passed.
  • Git diff whitespace and added-character checks passed.

Changelog: Added because this changes pirategoat-tools reviewer behavior in version 1.111.1.

Summary by CodeRabbit

  • Bug Fixes
    • Improved API contract review guidance to cover hook/filter return-value handling, including normalization, coercion, and validation.
    • Strengthened detection of observable contract changes and reduced false dismissals when changes aren’t proven internal.
    • Treats established runtime behavior as contractual even when not documented.
  • Tests
    • Added regression assertions to verify evidence acceptance from implementation/tests (even without direct consumer code) and improve prompt coverage.
  • Chores
    • Reverted the plugin version to 1.111.1 and consolidated the changelog entry to reflect these fixes.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8a3307b6-86f8-4a23-ae26-80ec88b6b2cf

📥 Commits

Reviewing files that changed from the base of the PR and between 2ef10f8 and beb7df4.

📒 Files selected for processing (3)
  • .claude-plugin/marketplace.json
  • plugins/pirategoat-tools/.codex-plugin/plugin.json
  • plugins/pirategoat-tools/CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • plugins/pirategoat-tools/.codex-plugin/plugin.json
  • .claude-plugin/marketplace.json
  • plugins/pirategoat-tools/CHANGELOG.md

📝 Walkthrough

Walkthrough

Updated api-contract-reviewer to detect caller-side hook return handling changes, strengthened its evidence rules, added prompt-contract regression tests, and aligned plugin metadata and changelog entries with version 1.111.1.

Changes

API Contract Reviewer Updates

Layer / File(s) Summary
Return-side contract guidance
plugins/pirategoat-tools/agents/api-contract-reviewer.md
The reviewer now checks post-callback normalization, coercion, validation, established runtime behavior, changed filter return handling, and evidence that observable results remain unchanged.
Prompt wiring and regression coverage
plugins/pirategoat-tools/scripts/review/agent_registry.json, plugins/pirategoat-tools/tests/review/agent/test_bootstrap_integration.py
The registry focus and integration tests cover the expanded return-side hook contract and evidence requirements.
Release metadata
.claude-plugin/marketplace.json, plugins/pirategoat-tools/.codex-plugin/plugin.json, plugins/pirategoat-tools/CHANGELOG.md
Plugin versions are set to 1.111.1, with the changelog consolidating the related reviewer, test, evidence, and checklist updates under that release.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: detecting return-side hook contract breaks.
Linked Issues check ✅ Passed The changes address issue #5 by adding return-side contract checks, relaxing evidence rules appropriately, and adding regression coverage.
Out of Scope Changes check ✅ Passed The diff stays focused on the contract-reviewer update, with only supporting docs, tests, changelog, and manifest version changes.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-api-contract-return-handling

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.

@vbelolapotkov
vbelolapotkov marked this pull request as ready for review July 29, 2026 15:19
- Audit caller processing of filter callback returns
- Prevent undocumented-contract and refactoring false clearances
- Add deterministic coverage and bump pirategoat-tools to 1.111.1
@vbelolapotkov
vbelolapotkov force-pushed the codex/fix-api-contract-return-handling branch from 8c71138 to c4ba65e Compare July 29, 2026 15:57
@vbelolapotkov

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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 `@plugins/pirategoat-tools/agents/api-contract-reviewer.md`:
- Around line 61-62: Update Rule 0 and its corresponding consumer-proof gate in
the contract review guidance so pre-diff implementation and test evidence can
establish a finding for changed, established observable behavior without
requiring direct consumer code. Preserve the existing consumer requirement where
implementation/test evidence is absent, and add a regression guard covering
implementation or test evidence with no consumer proof.
- Around line 114-120: Update the fenced checklist in the API contract review
documentation to specify the text language identifier, changing the unlabeled
fence around the checklist to a text-labeled fence while leaving the checklist
content unchanged.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ab55ae48-9ccd-4b28-bc8e-91688e76c25e

📥 Commits

Reviewing files that changed from the base of the PR and between c5bec1e and c4ba65e.

📒 Files selected for processing (6)
  • .claude-plugin/marketplace.json
  • plugins/pirategoat-tools/.codex-plugin/plugin.json
  • plugins/pirategoat-tools/CHANGELOG.md
  • plugins/pirategoat-tools/agents/api-contract-reviewer.md
  • plugins/pirategoat-tools/scripts/review/agent_registry.json
  • plugins/pirategoat-tools/tests/review/agent/test_bootstrap_integration.py

Comment thread plugins/pirategoat-tools/agents/api-contract-reviewer.md
Comment thread plugins/pirategoat-tools/agents/api-contract-reviewer.md Outdated
- Accept pre-diff implementation or tests as contract evidence without direct consumer code.
- Add regression coverage and label the reviewed checklist fence.
- Bump pirategoat-tools to 1.111.2.
@vbelolapotkov
vbelolapotkov merged commit e0f98b7 into main Jul 30, 2026
2 checks passed
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.

api-contract-reviewer: Consumer Test misses return-side hook contracts

1 participant