Skip to content

feat(review): add v2.2 submission descriptors - #2233

Merged
Alan-TheGentleman merged 3 commits into
mainfrom
feat/1611-submission-descriptors-v22
Aug 2, 2026
Merged

feat(review): add v2.2 submission descriptors#2233
Alan-TheGentleman merged 3 commits into
mainfrom
feat/1611-submission-descriptors-v22

Conversation

@Alan-TheGentleman

@Alan-TheGentleman Alan-TheGentleman commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

🔗 Linked Issue

Closes #1611


🏷️ PR Type

  • type:feature — Versioned protocol capability

📝 Summary

  • Publishes review-integration capabilities v2.2 and status/v4 without modifying v2.0 or v2.1 artifacts.
  • Adds provider-bound correction-plan and targeted-validation submission descriptors using existing review.finalize.
  • Proves exact argv execution, replay safety, arbitrary-CWD operation, and black-box j44 completion.

📂 Changes

Area Change
v2 contracts Adds capabilities/v2.2 and status/v4 schemas/fixture.
Native transitions Emits one-slot, provider-bound submission descriptors for exactly two collect handoffs.
Validation Rejects stale, mismatched, replayed, malicious, or altered submissions without authority mutation.
Binary acceptance Executes both routes from an unrelated CWD through opaque repository context.
Bench j44 Uses descriptor operation token and ordered argv from the sandbox root.

🧪 Test Plan

  • v2.0 and v2.1 immutable hash tests
  • v2.2 fixture/runtime/schema conformance
  • status/v4 placement and adversarial schema cases
  • Arbitrary-CWD built-binary correction and validation
  • Authority byte-invariance on every rejected submission
  • Focused and full race tests
  • Root tests, build, vet, format and ratchets
  • j44 and benchmark module tests
  • Windows/macOS static builds

✅ Contributor Checklist

  • Linked approved issue
  • Exactly one type:* label
  • Maintainer-approved size:exception
  • Conventional commits, no attribution trailers
  • v2.0 and v2.1 published artifacts remain immutable

Size exception

size:exception requested for 1,425 changed lines (+1,376/-49 across 19 files).

This single vertical v2.2 contract change is 1,425 changed lines (+1,376/-49 across 19 files). The schema/fixture/status surface, runtime, immutable-artifact compatibility checks, arbitrary-CWD binary coverage, and black-box benchmark flows must land together to prevent protocol skew. No dependency, workflow, release, or unrelated product changes are included.

Summary by CodeRabbit

  • New Features

    • Added provider-issued submission descriptors for correction and targeted validation workflows.
    • Added contract-aware status reporting and improved repository-context handling.
    • Added Review Integration protocol v2.2 capabilities and native Git status schema v4.
    • Review operations can now run from explicitly selected working directories.
  • Bug Fixes

    • Strengthened validation for tokens, paths, revisions, operation metadata, and submission arguments.
    • Prevented stale, altered, duplicate, or unauthorized submissions from being executed.
    • Improved error handling while protecting repository path details.

Copilot AI review requested due to automatic review settings August 2, 2026 04:07
@Alan-TheGentleman Alan-TheGentleman added size:exception Maintainer-approved exception for PRs above the 400 changed-line review budget type:feature New feature labels Aug 2, 2026
@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 491a21ff-e5a1-442d-bf45-f02d7b7b30fe

📥 Commits

Reviewing files that changed from the base of the PR and between 9db0c0c and c9ea680.

📒 Files selected for processing (6)
  • bench/journeys_wave1.go
  • bench/journeys_wave1_test.go
  • contracts/review-integration/v2/schemas/capabilities-v2.2.schema.json
  • internal/cli/review_capabilities_test.go
  • internal/reviewtransaction/repository_context_test.go
  • internal/reviewtransaction/repository_locator.go

📝 Walkthrough

Walkthrough

Adds v2.2 capabilities and a status-v4 contract for provider-issued submission descriptors. The CLI generates, validates, and executes bound correction and targeted-validation submissions. Journeys and acceptance tests cover external working directories, rejection handling, and terminal approval.

Changes

Submission descriptor contract

Layer / File(s) Summary
Capability and status contracts
contracts/review-integration/v2/..., internal/cli/review_status_contract.go
Adds capabilities v2.2 and status v4 schemas, identifiers, compatibility rules, transition constraints, and descriptor validation.
Capability publication and contract checks
internal/cli/review_capabilities.go, internal/cli/review_capabilities_test.go, internal/cli/review_operation_contract.go, internal/cli/review_provider_artifact_contract_test.go
Publishes protocol 2.2, advertises provider_submission_descriptors, accepts finalize binding flags, and validates v2.2 while preserving v2.1 artifacts.

Transition and execution flow

Layer / File(s) Summary
Transition generation and validation
internal/cli/review_next_transition.go, internal/cli/review_next_transition_test.go, internal/cli/review_status_contract.go, internal/reviewtransaction/repository_locator.go
Generates v2 correction and validation templates, propagates repository context, and validates tokens, bindings, placeholders, and value domains.
Bound finalize execution
internal/cli/review_facade.go
Resolves opaque repository context and validates authority revisions, targets, requests, evidence, and complete provider-issued argument lists before execution.

Journey and validation coverage

Layer / File(s) Summary
Journey and end-to-end validation
bench/journeys_wave1.go, bench/journeys_wave1_test.go, bench/runner.go, internal/cli/review_binary_acceptance_test.go, internal/cli/review_submission_descriptor_test.go, internal/reviewtransaction/repository_context_test.go
Runs v2 correction and validation descriptors, supports explicit working directories, and tests successful, tampered, stale, duplicate, short-token, and terminal workflows.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% 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 identifies the primary change: adding v2.2 review submission descriptors.
Linked Issues check ✅ Passed The changes make correction and validation collection executable, bind submissions to authority context, preserve lineage state, and test rejected submissions for issue #1611.
Out of Scope Changes check ✅ Passed The contract, CLI, repository-context, benchmark, and acceptance-test changes directly support submission descriptors and correction-plan recovery.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/1611-submission-descriptors-v22

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.

Copilot AI 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.

Pull request overview

This PR extends the review-integration protocol surface by publishing capabilities v2.2 and a native Git status v4 schema, and adds provider-bound submission descriptors for the two external collect handoffs (correction plan + targeted validation) using the existing review.finalize operation. It also strengthens replay/forgery resistance by requiring exact argv execution against provider-issued bindings and supports running from arbitrary working directories via opaque repository context.

Changes:

  • Add v2.2 capabilities + status/v4 contracts (schema + fixture) and update conformance/pinning tests.
  • Emit one-slot, provider-bound submission descriptors on the two collect transitions and validate they are correctly bound / safe.
  • Add review finalize support for executing provider-issued descriptor routes (including opaque repository context resolution) plus bench and binary acceptance coverage.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/reviewtransaction/repository_locator.go Allow opaque repository-context validation for correction-required flows (including targeted-validation binding).
internal/cli/review_next_transition.go Add submission descriptor structs + emit provider-bound argv templates for correction/validation collect steps.
internal/cli/review_status_contract.go Introduce status/v4 identity handling and enforce descriptor binding/placement/shape validation.
internal/cli/review_facade.go Add descriptor-bound review finalize flags + exact-argv verification + opaque-root resolution for arbitrary CWD execution.
internal/cli/review_operation_contract.go Register new finalize flags in operation metadata.
internal/cli/review_submission_descriptor_test.go New end-to-end tests for descriptor binding, replay safety, and “single substituted value” execution behavior.
internal/cli/review_next_transition_test.go Add v4 next_transition schema validation helper and refactor shared schema compilation to handle v1/v2 roots.
internal/cli/review_correction_plan_request_test.go Update to validate next_transition against the published v4 schema.
internal/cli/review_provider_artifact_contract_test.go Add pinning for v2.1 artifacts and extend strict schema checks for new v2.2/v4 assets.
internal/cli/review_capabilities.go Publish capabilities protocol 2.2 and add provider_submission_descriptors feature.
internal/cli/review_capabilities_test.go Validate v2.2 fixture/schema conformance and ensure v2.1 artifacts remain readable.
internal/cli/review_binary_acceptance_test.go Prove built binary can execute descriptor routes from an unrelated CWD without leaking paths.
contracts/review-integration/v2/schemas/status-v4.schema.json New published status/v4 schema including submission descriptor constraints.
contracts/review-integration/v2/schemas/capabilities-v2.2.schema.json New published capabilities v2.2 schema (protocol 2.2 surface).
contracts/review-integration/v2/fixtures/capabilities-v2.2.fixture.json New v2.2 conformance fixture.
bench/runner.go Allow journey steps to invoke the product from arbitrary directories.
bench/journeys_wave1.go Exercise descriptor-based correction + validation completion in the wave journey flow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@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: 10

🤖 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 `@bench/journeys_wave1.go`:
- Around line 497-499: Update the validation around descriptor.ArgumentTokens in
the submission descriptor flow to verify that at least five tokens exist before
accessing ArgumentTokens[4]. Preserve the existing placeholders and
--request-hash= checks, returning the current diagnostic error instead of
allowing a short token list to panic.

In `@contracts/review-integration/v2/schemas/capabilities-v2.2.schema.json`:
- Line 95: Update the shared schema definition for feature names and change the
items within the requires property to reference it instead of accepting
arbitrary non-empty strings. Preserve uniqueItems and ensure all listed feature
names, including compact_v2_authority, are covered by the enum.

In `@internal/cli/review_binary_acceptance_test.go`:
- Around line 405-417: Consolidate the binary execution helpers by making
runReviewBinaryAt delegate to the shared implementation rather than duplicating
command setup and validation. Preserve its working-directory behavior and
stdout-only return contract, and update runReviewBinaryStreams to delegate to
runReviewBinaryStreamsAt using an empty directory as proposed.

In `@internal/cli/review_facade.go`:
- Around line 2132-2145: Remove the redundant outer err check after the
repository-root branches. In the submissionBindingProvided branch, handle and
return the error from resolveOpaqueReviewRepositoryRoot immediately; keep the
existing wrapped error return in the SnapshotBuilder ResolveRepositoryRoot path,
ensuring each branch handles its own error exactly once.
- Around line 2533-2536: Validate submission.Value.SubstitutionLocation against
the length of the copied ArgumentTokens slice before indexing expected in the
argument comparison flow. If the slot is negative or outside the slice, return
the existing preflight failure result instead of panicking; preserve the current
replacement and DeepEqual behavior for valid slots.
- Around line 2491-2494: Refactor validateReviewFinalizeSubmission to accept a
small struct grouping the descriptor-related fields, including expectedRevision,
targetIdentity, requestHash, and repositoryContext, instead of passing these
positional values individually. Update every caller to construct and pass the
struct, while preserving the existing validation behavior and other arguments.

In `@internal/cli/review_next_transition.go`:
- Around line 465-507: Extract the six shared leading tokens from
reviewCorrectionPlanSubmission and reviewTargetedValidationSubmission into a
helper, and define reviewSubmissionValueLocation from that prefix length. Use
the helper in both builders, replace their literal substitution location 6 with
reviewSubmissionValueLocation, and update ReviewTransitionSubmission.Validate to
slice using the same constant while preserving the existing token order and
validation behavior.

In `@internal/cli/review_status_contract.go`:
- Around line 542-568: Update the repository-context validation in both the
correction-plan and targeted-validation branches of the surrounding transition
validator: compare input.submissionRepositoryContext() against the authoritative
input.Arguments["repository-context"] value, rather than using that self-derived
context to build reviewCorrectionPlanSubmission or
reviewTargetedValidationSubmission. Preserve the existing authority checks and
reject descriptors whose context differs from the bound capture argument.

In `@internal/cli/review_submission_descriptor_test.go`:
- Around line 88-98: Extend the validation rejection table covering
ReviewTransitionSubmission.Validate with token-order cases using
swapSubmissionTokens: include a general token swap and a swap that moves the
placeholder token out of index 6. Use validationPath as the submitted value and
assert both reordered descriptors are rejected, matching the existing
correction-table coverage.

In `@internal/reviewtransaction/repository_locator.go`:
- Around line 334-337: Update the validation flow around
BuildTargetedValidationRequest to return its underlying err unchanged when
request construction fails. Only return the “review repository context is stale
or has no live matching authority” error when the request succeeds but
correction.CorrectionTargetIdentity differs from binding.TargetIdentity.
🪄 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: d14c756e-9482-4b00-bc68-1ae9cc0a5db7

📥 Commits

Reviewing files that changed from the base of the PR and between 73010b5 and 9db0c0c.

📒 Files selected for processing (17)
  • bench/journeys_wave1.go
  • bench/runner.go
  • contracts/review-integration/v2/fixtures/capabilities-v2.2.fixture.json
  • contracts/review-integration/v2/schemas/capabilities-v2.2.schema.json
  • contracts/review-integration/v2/schemas/status-v4.schema.json
  • internal/cli/review_binary_acceptance_test.go
  • internal/cli/review_capabilities.go
  • internal/cli/review_capabilities_test.go
  • internal/cli/review_correction_plan_request_test.go
  • internal/cli/review_facade.go
  • internal/cli/review_next_transition.go
  • internal/cli/review_next_transition_test.go
  • internal/cli/review_operation_contract.go
  • internal/cli/review_provider_artifact_contract_test.go
  • internal/cli/review_status_contract.go
  • internal/cli/review_submission_descriptor_test.go
  • internal/reviewtransaction/repository_locator.go

Comment thread bench/journeys_wave1.go
Comment thread contracts/review-integration/v2/schemas/capabilities-v2.2.schema.json Outdated
Comment thread internal/cli/review_binary_acceptance_test.go
Comment thread internal/cli/review_facade.go
Comment thread internal/cli/review_facade.go
Comment thread internal/cli/review_facade.go
Comment thread internal/cli/review_next_transition.go
Comment thread internal/cli/review_status_contract.go
Comment thread internal/cli/review_submission_descriptor_test.go
Comment thread internal/reviewtransaction/repository_locator.go
Copilot AI review requested due to automatic review settings August 2, 2026 04:56

Copilot AI 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.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated no new comments.

Suppressed comments (1)

internal/cli/review_facade.go:2107

  • When executing a provider-issued submission descriptor (i.e. using --repository-context / --expected-revision / --target / --request-hash), --lineage is effectively required as part of the repository-context binding. Currently the preflight allows descriptor mode with an empty lineage, but ResolveReviewRepositoryContext will always reject it via validateReviewRepositoryContextBinding, causing a later/less specific failure.
	if submissionBindingProvided && (!negotiated || *contract != ReviewIntegrationContractV2 || strings.TrimSpace(*expectedSubmissionRevision) == "" ||
		strings.TrimSpace(*targetIdentity) == "" || strings.TrimSpace(*requestHash) == "" || strings.TrimSpace(*repositoryContext) == "") {
		return reviewPreflightError(errors.New("review finalize submission descriptors require the complete v2 revision, target, request hash, and repository context binding; refresh with gentle-ai review status --next-transition"))

@Alan-TheGentleman
Alan-TheGentleman merged commit 545485d into main Aug 2, 2026
33 of 34 checks passed
@Alan-TheGentleman
Alan-TheGentleman deleted the feat/1611-submission-descriptors-v22 branch August 2, 2026 05:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:exception Maintainer-approved exception for PRs above the 400 changed-line review budget type:feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(review): correction plan transition cannot be captured or finalized

2 participants