Skip to content

security(receipt): issue RepairReceiptV2 only from validated movement and optional execution evidence #2333

Open

Description

@EffortlessSteven

Parent

Depends on

Problem

The existing receipt path has gained important provenance checks, but the final issuance contract is still spread across legacy receipt JSON, agent-verify JSON, canonical re-render checks, and optional execution-result work.

A caller must not be able to turn a hand-authored movement or execution result into a current-looking RIPR receipt. At the same time, static-only receipts remain useful and should not be forced to pretend a verification command ran.

Outcome

Define and implement RepairReceiptV2 as the only new canonical issuance format for the agent repair loop.

The issuer must revalidate/recompute every producer-owned input it claims, bind all evidence to one compatible repository/input lineage, and record static and executed assurance as independent axes.

Required receipt contents

RepairReceiptV2
  receipt schema and producer identity
  repository/root identity
  base, before, after, and current revision identities
  analysis/config/input/snapshot identities
  canonical gap and seam identities
  before/after artifact commitments
  recomputed static movement disposition
  verify CommandSpec identity and digest
  optional validated VerificationExecutionResultV1 commitment
  execution assurance state
  receipt issuance disposition/currentness
  bounded warnings, limitations, and non-claims
  canonical content commitment

The canonical byte representation and commitment algorithm must be specified and fixture-pinned.

Issuance rules

  • Parse and validate the original analysis artifacts through their typed schema.
  • Recompute static movement rather than trusting caller-supplied movement JSON.
  • Require same repository and compatible base/input/config lineage.
  • Resolve actual current repository state; caller HEAD values are assertions, not authority.
  • Validate canonical gap/seam identity across artifacts and current route where applicable.
  • Validate an execution result against the exact producer-owned CommandSpec before recording executed assurance.
  • A missing execution result yields verification_not_run, never implied pass.
  • A failed, timed-out, cancelled, stale, or policy-rejected execution remains recordable with its exact assurance state.
  • Reject receipts whose repository changed unexpectedly between validated evidence and issuance unless the contract explicitly classifies the evidence as historical/noncurrent.
  • Commit the final canonical receipt bytes and provide a typed check command.

Compatibility

  • Keep reading current static-only receipts for a bounded compatibility period with explicit legacy assurance/currentness.
  • New issuance defaults to V2 after the cutover.
  • Do not silently upgrade a legacy receipt to V2; reissue only from validated source artifacts.
  • Document the removal condition for legacy issuance code and fields.

Required rejection cases

artifact_tampered
verify_json_not_canonical
execution_result_tampered
wrong_repository
wrong_root
incomparable_lineage
config_or_input_mismatch
gap_or_seam_mismatch
current_head_mismatch
command_spec_mismatch
execution_result_stale
receipt_replay_noncurrent
unsupported_schema
canonical_commitment_mismatch

Required tests

  • static improved, verification not run;
  • static unchanged, verification pass;
  • static improved, verification fail;
  • static regressed, verification pass;
  • validated historical comparable evidence;
  • copied artifacts from another repository with same gap ID;
  • hand-authored verify JSON;
  • altered before/after artifact after commitment;
  • altered execution result;
  • wrong CommandSpec digest;
  • repository changes before issuance;
  • replay old valid receipt against new HEAD/config;
  • legacy receipt read and explicit non-V2 classification;
  • deterministic canonical bytes across absolute checkout roots.

Acceptance criteria

  • no caller-authored movement or execution result can be issued as producer-valid without source revalidation;
  • static and execution assurance are independent and visible;
  • currentness and historical comparability are explicit;
  • receipt identity binds repository, revision, config/input, gap/seam, artifacts, command, and optional execution result;
  • canonical V2 bytes are deterministic and content-committed;
  • receipt checking rejects tamper and replay cases with typed regeneration guidance;
  • legacy compatibility is bounded and documented;
  • no merge approval, correctness, coverage, or mutation-adequacy claim is added.

Proof

cargo test -p ripr agent_receipt -- --test-threads=1
cargo test -p ripr receipt_v2 -- --test-threads=1
cargo test -p ripr --test cli_smoke agent -- --test-threads=1
cargo xtask check-output-contracts
cargo xtask check-fixture-contracts
cargo xtask check-command-catalog
cargo xtask check-traceability
cargo xtask precommit
git diff --check

Non-goals

  • cryptographic remote signing or a centralized receipt service;
  • automatic test or mutation execution during receipt issuance;
  • gate-policy or support-tier promotion;
  • accepting arbitrary caller commands as producer-owned verification.

Activity

  1. added
    status/needs-work
    on Jul 23, 2026
  2. coderabbitai commented on Jul 23, 2026

    @coderabbitai
    🔗 Related PRs

    #1670 - perf(review-comments): emit bounded phase receipts [merged]
    #2207 - spec(receipt): separate assurance state axes [merged]
    #2231 - fix(receipt): make default paths portable [open]
    #2239 - fix(receipt): bound long default paths [merged]
    #2254 - security(receipt): validate canonical verify input [merged]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  3. EffortlessSteven commented on Aug 1, 2026

    @EffortlessSteven
    MemberAuthor

    Earnest review (2026-08-01)

    Open: RepairReceiptV2 appears only in planning docs, never in code — the live receipt is still the v1 RepairReceipt struct. The v2 design is sound but is blocked on the #2334 corpus landing first, so no production code is wrong here. Recommend keeping this pinned behind #2334 and not starting the struct migration until the corpus exists.

  4. EffortlessSteven commented on Oct 26, 2026

    @EffortlessSteven
    MemberAuthor

    Formal-verifier evidence dependency — 2026-10-26

    #10745/#10689 explicitly preserve this issue and #2334 as canonical receipt-issuance/adversarial-integration owners. #10689 owns the first Kani observation/import profile; #10748 owns Verus. #7236 remains intrinsic test-work/cost evidence.

    Pure externally attributed observations and native-output fixtures can be useful before V2 issuance, but cannot claim that acceptance. Preserve exact consumed source/guard/configuration, actual native scope and provenance separately from process disposition and static movement. A supplied hash is not producer authentication, and running a verifier is not dynamic execution of the target program.

    The Kani controls now include an interrupted same-path/same-HEAD run leaving an older complete export and success counts lacking individual successful-property IDs. Those cases feed the existing #2334 corpus; no arbitrary executor or parallel receipt service is added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status/needs-work

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions