fix(review): bind capture evidence to reviewed target#1796
Conversation
Ensure provider-owned subject context and strict evidence schemas survive capture while rejecting post-review substitutions.
📝 WalkthroughWalkthroughThe PR adds a versioned verification-evidence contract, propagates frozen reviewer task bindings through START and STATUS, enriches managed reviewer results with provider-owned metadata, and canonicalizes lens results before artifact admission and replay. ChangesReview capture contracts
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
Maintainer action requested: please apply |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@internal/cli/review_schema.go`:
- Around line 74-79: Align the schema and native parsing in the final
verification check parser around the check structure and validation logic: allow
non-empty padded name and command values consistently with the schema, while
still rejecting whitespace-only values. Track whether command is omitted versus
explicitly set to an empty string (for example via a pointer) and reject the
latter, then add boundary tests covering padded and empty/omitted command cases.
🪄 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: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 25052b03-993d-401d-a33c-0063f952b984
📒 Files selected for processing (30)
contracts/review-integration/v1/fixtures/capabilities-v1.4.fixture.jsoncontracts/review-integration/v1/fixtures/start-v2.fixture.jsoncontracts/review-integration/v1/fixtures/status-v2.fixture.jsoncontracts/review-integration/v1/fixtures/verification-evidence.fixture.jsoncontracts/review-integration/v1/schemas/start-v2.schema.jsoncontracts/review-integration/v1/schemas/status-v2.schema.jsoncontracts/review-integration/v1/schemas/verification-evidence.schema.jsondocs/review-authority-threat-model.mddocs/review-integration.mdinternal/assets/assets_test.gointernal/assets/opencode/plugins/review-result-artifacts.tsinternal/assets/review_result_artifacts_behavior_test.gointernal/assets/skills/_shared/review-ledger-contract.mdinternal/cli/review_artifact.gointernal/cli/review_artifact_test.gointernal/cli/review_capabilities.gointernal/cli/review_capabilities_test.gointernal/cli/review_facade.gointernal/cli/review_next_transition.gointernal/cli/review_next_transition_test.gointernal/cli/review_operation_contract.gointernal/cli/review_schema.gointernal/cli/review_schema_test.gointernal/cli/review_start_context_test.gointernal/cli/review_start_contract.gointernal/cli/review_status_contract.gointernal/components/sdd/review_ledger_contract_test.gointernal/reviewtransaction/artifact_admission.gointernal/reviewtransaction/artifact_admission_test.goscripts/test-review-contract-package.sh
| if strings.TrimSpace(check.Name) == "" || strings.TrimSpace(check.Name) != check.Name || | ||
| (check.Status != reviewVerificationPassed && check.Status != reviewVerificationFailed) || len(check.Evidence) == 0 { | ||
| return evidence, nil, fmt.Errorf("invalid final verification check %d", index+1) | ||
| } | ||
| if check.Command != "" && (strings.TrimSpace(check.Command) == "" || strings.TrimSpace(check.Command) != check.Command) { | ||
| return evidence, nil, fmt.Errorf("invalid final verification check %d command", index+1) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Align the advertised schema and native parser.
The schema accepts padded name/command values (\S only requires one non-whitespace character), but these lines reject them. Conversely, command: "" violates the schema yet is accepted because an omitted command and an empty command decode identically. Track command presence (for example, with *string) and make the schema/parser whitespace rules identical; add boundary tests for both cases.
🤖 Prompt for 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.
In `@internal/cli/review_schema.go` around lines 74 - 79, Align the schema and
native parsing in the final verification check parser around the check structure
and validation logic: allow non-empty padded name and command values
consistently with the schema, while still rejecting whitespace-only values.
Track whether command is omitted versus explicitly set to an empty string (for
example via a pointer) and reject the latter, then add boundary tests covering
padded and empty/omitted command cases.
|
Thanks for the substantial work here. PR #1797 is the smaller, already-clean carrier for #1699, at To avoid overlapping ownership, I recommend keeping #1797 as the canonical carrier for #1699 and narrowing #1796 to its unique #1689 work, including removing #1699 from its closing references and duplicated #1699 scope. Could maintainers please confirm the canonical carrier before further changes proceed? |
Behavior-first validation for #1689I revalidated The plugin passes the raw result without adding top-level Would the maintainer prefer to keep #1796 as the focused adapter/plugin fix, or integrate that change into the #1801 branch? |
Proposed safe rebase boundary against Refresh 7This PR is partially superseded, but its current #1689 enrichment must not merge unchanged. The corresponding acceptance correction is recorded in #1689. Already equivalent in
|
|
I reproduced the remaining post-enrichment deadlock with this PR active: all preserved payloads already contained A tested follow-up is available at https://github.com/aparragithub/gentle-ai/tree/fix/1796-preserved-result-replay ( I also requested |
|
@doblas, I opened a focused draft PR against your #1796 branch: It contains the clean preserved-result replay commit Please review whether you prefer to merge the draft or cherry-pick the commit into #1796. |
Linked Issue
Closes #1689
Closes #1699
Related to #1775 and #1788. Those issues are not yet marked
status:approved, so this PR does not auto-close them.PR Type
type:bug- Bug fix (non-breaking change that fixes an issue)type:feature- New feature (non-breaking change that adds functionality)type:docs- Documentation onlytype:refactor- Code refactoring (no functional changes)type:chore- Build, CI, or tooling changestype:breaking-change- Breaking change (fix or feature that changes existing behavior)Summary
Changes
contracts/review-integration/v1/internal/assets/opencode/plugins/review-result-artifacts.tsinternal/cli/internal/reviewtransaction/docs/and shared review contractTest Plan
internal/assets,internal/cli,internal/reviewtransaction, andinternal/components/sddwith-count=1.shellcheck scripts/test-review-contract-package.shpassed throughkoalaman/shellcheck:stable.pre-commit,pre-push, andpre-prreceipt gates allowed the exact reviewed candidate.Automated Checks
All repository checks remain authoritative and are expected to run in CI.
Contributor Checklist
status:approved.size:exception: the 1,135-line reviewed work unit couples public schemas, native admission, provider capture, tests, and documentation; splitting it would break the cross-boundary contract.type:bug; maintainer application is pending.Co-Authored-Bytrailer.Notes for Reviewers
Native review lineage:
review-27dc64136fee676e.The content-bound receipt was preserved through delivery.
origin/mainadvanced after review, and nativepre-prvalidation proved a compatible, path-disjoint base advance with identical delivered patch identity.Summary by CodeRabbit
New Features
Bug Fixes
Documentation