Skip to content

tests: R02/R04 acceptance witnesses; disclose five promotion/evidence gaps (P2) - #111

Merged
RecursiveIntell merged 1 commit into
mainfrom
rsi/p2-r02r04-witnesses-20261130
Nov 30, 2026
Merged

RecursiveIntell merged 1 commit into
mainfrom
rsi/p2-r02r04-witnesses-20261130

Conversation

@RecursiveIntell

Copy link
Copy Markdown
Owner

What this does

Adds executable test witnesses for acceptance clauses of work packages R02 (truthful experimental modes, repeat/comparability) and R04 (honest exported evidence and score interpretation) that a read-only acceptance map found had no test. Tests only; no product code.

New test files: living-memory/living-memory/tests/r02_witness_tests.rs, r02_env_drift_witness_tests.rs, r04_witness_tests.rs, and forge-pilot/tests/r04_witness_tests.rs.

Clauses now asserted:

  • R02: RepeatedPaired with trial_count == 1 is refused before any dispatch; a baseline environment/provenance fingerprint that drifts across executed pairs is not comparable (with a no-drift control); check outcomes that vary across pairs give an inconclusive violation and FlakySignal; real runs record cache_mode == Unknown and timing_admissible == false.
  • R04: an exact tie with the baseline and a regressing candidate are refused on weighted_improvement with no promotion appended (with a +0.10 control); trials present but none completed derive lifecycle Unverified; invalid pair_comparability derives lifecycle Unverified; a tampered canonical evidence bundle is refused at transform_envelope_v3 with a digest error; a newer contradicted bundle blocks promotion despite an older clean one; the evidence export and transform outputs exercised here contain no rollout/rollback decisions, including for a promoted bundle; a failed import leaves no complete import row and records exactly one failure receipt (with a healthy control); bundle warnings label scores as unavailable / not calibrated confidence, and that label reaches the canonical verification notes.

Gaps found (not fixed here)

Five clauses are not met by current product code or contract policy. Their honest tests fail on unmodified main (c64e9c9), reproduced by a second run on unmodified main. The gap tests are not in this PR. They are deliberately left out of this PR rather than weakened:

  1. Duplicated trial records count as independent: three byte-identical copies of one completed trial give completed_trial_count == 3 (expected 1). Location: living-memory/src/lab/evidence.rs to_canonical_evidence_bundle.
  2. Promotion with zero completed trials succeeds: promote() reads only the assessment (enforce_verification_evidence). Location: living-memory/src/lab/promote.rs enforce_verification_evidence.
  3. Invalid comparability still derives PromotionState::Eligible in derived_promotion_state, while the lifecycle value for the same input is Unverified, so the two disagree. Location: evidence.rs derived_promotion_state. (The gap test stops at this assertion, so whether promote() then succeeds was not observed.)
  4. Missing raw artifact: a receipt reference to an absent store row, or a trial naming a receipt the bundle does not carry, is still Verified and promotable; receipt references are not resolved against the store (two failing assertions). Locations: evidence.rs lifecycle derivation, promote.rs.
  5. Evidence age: promote() has no freshness check. The acceptance contract as written specifies no TTL, so this is a policy gap as much as a code gap; the supersession reading of "stale" is covered above.

Note the split: in (2) the lifecycle value is Unverified but promote() does not consult it and still succeeds; in (3) the lifecycle value is Unverified while derived_promotion_state returns Eligible, a second inconsistency distinct from the gate.

Evidence

On head 2698593 (rebased onto main c64e9c9; the witness diff is byte-identical before and after the rebase):

  • cargo fmt --all -- --check and cargo clippy --locked -p forge-engine -p forge-pilot --lib --tests -- -D warnings: clean.
  • cargo test --locked -p forge-engine -p forge-pilot --lib --tests: 353 passed, 0 failed, 0 ignored.
  • The contract's acceptance recipes all pass: R02 (31 + 27), R04 forge-pilot (1 + 8 + 6), R04 forge-engine (12 + 27 + 5).
  • The witnesses were mutation-checked: 15 single-line mutants of the product guards were applied, and every one was caught by at least one witness; sources were restored byte-identical (sha256). The run was made before the rebase on the same test content. This shows each mutant is caught, not that every witness has a dedicated mutant.

These are local runs on one host; hosted CI results will be reported by this PR's own checks.

Scope and limits

  • No product behaviour changes. The five gaps above remain open until fixed in a separate change.
  • No provider call, deployment or activation.

R02: single-pair RepeatedPaired refusal, cache_mode/timing_admissible unknown,
flaky check outcomes, baseline environment drift across pairs.
R04: tie/regressing candidate promotion refusal, zero-completed and invalid
comparability lifecycle, superseded evidence, tampered envelope refusal,
no rollout decisions on export, failed import withholds complete row,
bundle warnings label scores uncalibrated.
Tests only; no product code changed.
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-30T22:09:04.556134Z
We couldn’t complete this review. Comment @codex review to try again.
2698593 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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

@RecursiveIntell
RecursiveIntell merged commit 4d030f8 into main Nov 30, 2026
14 checks passed
RecursiveIntell added a commit that referenced this pull request Dec 1, 2026
…e-20261130

forge-engine: gate promotion on retained executions (R02/R04 gaps from #111)
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.

1 participant