Skip to content

feat(verification): S4 contracts for verdict properties 3 and 5 - #179

Open
hyperpolymath wants to merge 11 commits into
s3/verdict-corefrom
s4/verdict-contracts
Open

hyperpolymath wants to merge 11 commits into
s3/verdict-corefrom
s4/verdict-contracts

Conversation

@hyperpolymath

@hyperpolymath hyperpolymath commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

S4 of the CI programme W49: Creusot contracts and mirror tests for design 3.6 properties 3 (no blame for the base) and 5 (infra is never PR-BROKEN), on the verdict function from #178.

Stacked. Base is s3/verdict-core (#178), which sits on vendor/ci-design-w49; both must land first.

Status, stated plainly (updated after the hosted run)

  • Hosted proof run passed on head 3c2e99d (job: https://github.com/hyperpolymath/cicd-squabbler/actions/runs/46467409483/job/142020601407): the planted false postcondition was refused, the planted true one proved, and verification/squabble-creusot reported Proved (21 files) with 0 source-detected trusted axioms. The 2026-11-04 receipt in docs/CREUSOT.adoc covers 13 files; 21 is consistent with the new model and contracts being included, but I have not mapped the 21 files individually.
  • What that does and does not mean. "21 files" is a file-level result, not a theorem count. The contracts are a model of the verdict rules over per-check booleans and infra codes, not a proof of squabble_core::verdict::derive. The link to the real function is the mirror tests (11 passed locally, stable half), which are tests, not proofs.
  • Not done: docs/CREUSOT.adoc has no receipt for this revision (a receipt is source-bound to a merge revision, so it belongs after merge). Verus: not run, no toolchain. A local cargo creusot also proved the contracts (Proved (21 files)) once the prover install finished.
  • An earlier run on b4b066b showed red: it was cancelled by workflow concurrency when the Cargo.lock commit was pushed, and its verdict job reported the cancelled prerequisite. It was not a proof failure.

Planted violations (hosted gate refuses a break in these contracts)

The gate's built-in control only shows the oracle can say no. To show it also catches a break in these contracts, one derivation step in contracts.rs was weakened per property on a throwaway commit, pushed, and reverted. Both were also refused by a local cargo creusot run first, on the same goal.

Property Plant (commit, reverted) Hosted result Run
3 no_blame_for_the_base ignores cured and inherits (d2df0fe, reverted 27269d9) contracts.rs lines 87-93: proof failed, Goal Coma.vc_no_blame_for_the_base unproved https://github.com/hyperpolymath/cicd-squabbler/actions/runs/46470302439/job/142030471670
5 pr_broken_by_infra drops the kind == 0 test (ccbeeba, reverted c5700b4) contracts.rs line 117: proof failed, Goal Coma.vc_pr_broken_by_infra unproved (5/7) https://github.com/hyperpolymath/cicd-squabbler/actions/runs/46472023778/job/142036688574

After each revert the gate returned to green (property 3: run 46471121276; final head a3f7fc5: run 46472909923, all four Creusot jobs and 29 checks success, 2 skipped).

  • The plants are in contracts.rs, not model.rs: Creusot only reads the contracts file.
  • A merge commit from the repo owner's account landed on this branch on top of the property-5 plant (b63cb5e); it was merged into this branch with the real contract restored (no force-push). Its own runs are red for that reason and are superseded.
  • This shows the gate catches a weakening of these two contracts. It does not make the contracts a proof of derive (see Status).

Changes

  • model.rs: introduced, cured, no_blame_for_the_base, pr_broken_by_infra (ordinary Rust) + the verdict_mirror tests.
  • contracts.rs: the same as literal #[requires]/#[ensures] pairs.
  • Property 4 (replay) is tested, not contracted: derive reads only the record, so there is nothing to state about a model.
  • Fixes a pre-existing break: the crate's existing mirror tests no longer compiled (AllowList gained verified_allowed); just verify-mirror was failing on the base. Fixed with the field's default.
  • serde_json added as a dev-dependency (mirror tests only). The crate's Cargo.lock (never tracked before) is added in a separate commit; it pins the verification crate only.

Spec finding

Property 3 as written ("every failing check inherited or cured => not PR-BROKEN") is false once the 3.5 ruling applies: a start failure the PR itself caused is PR-BROKEN with no Fail observation. Pinned by a local case in #178 (property-3-hole-...). The per-check statement here is the correct form; the verdict-level one needs the carve-out.

RSR Quality Checklist

  • Tests: stable half 11 passed / 0 failed (above); workspace was 493 passed on feat(verdict): PR gate verdict function + squabble verdict (S3) #178's head (not re-run after this branch)
  • No new unsafe, no banned functions, no secrets; SPDX headers kept
  • Creusot proof: hosted gate passed (see Status); local prove not run
  • docs/CREUSOT.adoc not updated (no proof receipt exists for this revision, and none is claimed)

https://claude.ai/code/session_01J4QvDgb6vQnxAZ8czX8SLb


Generated by Claude Code

…ies 3 and 5

Adds a model of the verdict's per-check blame rule and the infra rule to the
squabble-creusot crate, the same statements as literal requires/ensures
contracts, and stable-Rust mirror tests that run the model against the real
squabble_core::verdict::derive over every combination (24 head/tip/merge-base
cases; 5 infra kinds x edits x starts-on-base). Property 4 (replay) is tested,
not contracted: it holds by construction since derive reads only the record.

Also fixes the crate's existing mirror tests, which no longer compiled because
AllowList gained verified_allowed.

STATUS: the contracts compile as Rust (cargo check) but have NOT been proved:
cargo creusot prove has not run here. They are stated, not proved.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDgb6vQnxAZ8czX8SLb
@gitnotebooks

gitnotebooks Bot commented Nov 30, 2026

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: e991d769-3343-4230-b6da-ab5d0d88ad0a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

The crate is its own workspace root (see its Cargo.toml) and documents having
its own lockfile, but none was committed. This is the resolution from local
`cargo check` and `cargo test --no-default-features` on nightly-2026-08-03,
including creusot-std 0.14 and the serde_json dev-dependency. It pins the
verification crate only; the root workspace lock is untouched.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDgb6vQnxAZ8czX8SLb
@hyperpolymath hyperpolymath changed the title feat(verification): S4 contracts for verdict properties 3 and 5 (stated, not yet proved) feat(verification): S4 contracts for verdict properties 3 and 5 Nov 30, 2026
The verdict function now requires failed_count == identities for a signature
to be complete (#178). The mirror tests built signatures without a count, so
cured/inherited cases stopped matching: the model-vs-derive test caught the
drift. The helper now sets failed_count to the number of identities.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDgb6vQnxAZ8czX8SLb
Throwaway: weakens no_blame_for_the_base so it ignores cured and inherits.
The hosted Creusot gate must refuse this. Reverted by the next commit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDgb6vQnxAZ8czX8SLb
…racts.rs"

Restores the real contract. The hosted Creusot gate refused the plant with
"contracts.rs lines 87-93: proof failed, Goal Coma.vc_no_blame_for_the_base"
(run 46470302439, job 142030471670).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDgb6vQnxAZ8czX8SLb
Throwaway: weakens pr_broken_by_infra so any infra kind can blame the PR when
the diff touches the workflow and it starts on the base. The hosted Creusot
gate must refuse this. Reverted by the next commit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDgb6vQnxAZ8czX8SLb
@hyperpolymath
hyperpolymath marked this pull request as ready for review November 30, 2026 17:23
hyperpolymath and others added 3 commits November 30, 2026 17:23
…racts.rs"

Restores the real contract. The hosted Creusot gate refused the plant with
"contracts.rs line 117: proof failed, Goal Coma.vc_pr_broken_by_infra"
(run 46472023778, job 142036688574).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDgb6vQnxAZ8czX8SLb
@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.

@sonarqubecloud

Copy link
Copy Markdown

hyperpolymath added a commit that referenced this pull request Dec 1, 2026
…#180)

## Summary

S9 of the CI programme W49: `squabble drift`, a read-only comparison of
a repository's workflow callers against the layer-3 templates, with a
pure core in `squabble-core::drift`.

**Stacked** on `vendor/ci-design-w49` (the hub's read-only vendored
design, corpus and templates), which must land first. Independent of
#178 and #179.

## What it reports

| Finding | Meaning |
|---|---|
| `EditedCaller` | caller bytes differ from its template rendered with
the caller's own pin. `certainty: certain` only when the pin is the
latest known; otherwise `unknown-cause`, because an edit and a template
change since the old pin look identical and the template at the old pin
is not available |
| `StalePin` | pin is behind the latest known pin. Until release tags
exist this only means **behind vendor-time main** (a branch tip, not a
release); `latest.stale_pin_means` in the output says so |
| `NotFullShaPin` *(provisional: not one of the four kinds in design 6.1
S9)* | pin is a branch, tag or short SHA, so it cannot be rendered
against a release |
| `LeftoverGuardCaller` | a retired `ci-gate-tamper-guard` caller is
still present (by file name or by calling a tamper-guard reusable; notes
`pull_request_target`) |
| `MissingLockEntry` | the repo carries `.github/workflows/actions.lock`
but it has no record for a workflow |
| `OnboardedGateCaller` | a gate caller whose template says DE-ONBOARDED
from `actions.lock` still has a leaf record in the lock (owner ruling
2026-11-30: keep gate callers out of the lock, follow the template).
De-onboarded = the file key present with an empty list (`'<file>': []`);
a missing key is `MissingLockEntry`. Driven by the marker in the
template text (11 vendored templates carry it) |

`squabble drift [--json] [--repo DIR] [--templates DIR]
[--latest-suite-sha SHA] [--latest-proven-sha SHA]`. Exit 0 no drift, 4
drift found, 2 bad usage or unreadable input (nothing on stdout). Never
writes.

## Evidence (run here)

- `cargo test --workspace`: 500 passed, 0 failed on this base (479
baseline + 21 new: 10 core unit, 11 binary-level). `cargo fmt --check`
and `cargo clippy --workspace --all-targets -- -D warnings` clean.
- Binary-level tests build fixture repositories at test time from the
vendored templates and cover: clean, edited (certain), stale-only, stale
+ different (unknown-cause), retired guard caller, missing and present
lock record, no lock file, branch pin, umbrella caller, usage errors,
and **no writes** (the repository and the templates are snapshotted
before and after).
- Mutation check of the detector: breaking each rule makes tests fail
(edit detection 7, stale pin 6, guard caller 4, lock entry 4, full-SHA
check 4, certainty 5). A first stale-pin mutation showed 0 failures
because it did not compile; it was redone with a mutation that compiles.
- Run on this repository itself (read-only, working tree unchanged): it
matches 2 workflows. `creusot.yml` is stale (pinned `6a35e51…`, latest
`0e7c81b…`) and differs from its template, reported `unknown-cause` as
designed; `proven-coverage-collect.yml` differs from its exact-copy
template. Every workflow has a lock record.

## Limits, stated plainly

- **"Latest suite pin" is a branch tip, not a release.** Unless
`--latest-suite-sha` is given it is the SHA the vendored templates were
taken at (`0e7c81b…`, read from the vendor README); the output says so
(`suite_sha_source`). The owner has not cut release tags, so there is no
released pin to compare against yet. The umbrella pin has no default and
is reported as not checked.
- The umbrella caller's tag comment is taken from the caller, not
verified against its SHA; the output says so.
- Lock check is presence of a record per workflow only, not its contents
(that is the lock gate's job).
- Only the vendored (latest) templates are available; staleness against
the template *at the old pin* is not judged.
- Not wired into any workflow or schedule, and it opens no PR: it
reports only. Matching and rules are mine where the design is silent
(design 6.1 S9 lists the four kinds, not the matching), so they are
provisional.

## RSR Quality Checklist

- [x] Tests pass (500/0, above); fmt and clippy clean
- [x] No `unsafe`, no banned functions, no secrets; SPDX headers
present; no new dependencies
- [ ] `docs/` and STATE not updated
- [ ] Not wired into CI (unwired is not done; wiring needs the owner's
call on where it runs)

## Updates since opening

- **SonarCloud:** it raised 4 findings (one critical: `analyse` had
cognitive complexity 59 against 30; three minor method-reference nits).
`analyse` is now a short driver over named checks; Sonar's API reports 0
open issues for this PR after the refactor. Behaviour is unchanged:
re-running the six detection mutations fails the same number of tests as
before.
- **Hub request:** `latest.stale_pin_means` labels `StalePin` as "behind
vendor-time main (a branch tip, not a release; no release tags exist
yet)" by default. Two more binary-level tests pin the wording (workspace
now 502 passed, 0 failed).
- **Provisional:** `NotFullShaPin` and the matching rules are mine where
the design is silent. At an old pin, differences stay `unknown-cause`;
the proper fix is at source (proven-cicd publishing a templates manifest
per release, template path to sha256), which the hub has put on the
estate list.
- **Not wired** into any workflow or schedule; wiring waits until the
owner merges this.
- Earlier red Creusot "verdict" results on this PR were my own newer
pushes cancelling the in-flight run (the workflow cancels in progress),
not proof failures; this PR changes no Creusot-checked file.

## Owner decision needed: this rule conflicts with this repo's own
lock-sync gate

`OnboardedGateCaller` implements the 2026-11-30 ruling as written. But
`scripts/check-lock-sync.sh` (the Lock Sync Gate) has a clause that
every `uses:` in a workflow, job-level reusable refs included, must be
locked under its own workflow path. Tested on a scratch copy with
`creusot.yml` set to `[]` and nothing else changed: the checker fails
(`refs missing from the lockfile:
hyperpolymath/proven-cicd-and-workflows@6a35e51…`, exit 1). On this
repo, `creusot.yml` is the only workflow calling a proven-cicd reusable;
it has been onboarded since it was added and it starts and runs (4
Creusot jobs on today's PR heads), which is evidence against the
template's claim that an onboarded cross-repo reusable startup-fails
here.

So today `squabble drift` flags `creusot.yml` as `OnboardedGateCaller`
while the Lock Sync Gate requires exactly that leaf. Options, for the
owner: (a) change the checker to exempt de-onboarded gate callers (a
gate-file change, not mine to make); (b) keep onboarded here and correct
the template comments; (c) neither, and treat the finding as advisory.
No PR de-onboarding `creusot.yml` has been opened, because it would turn
the Lock Sync Gate red.

## Evidence for the new rule

Workspace 510 passed, 0 failed; fmt and clippy clean. Five core unit
tests plus three binary-level tests, one data-driven over every marked
vendored template (leaf recorded: flagged, exit 4; empty entry: clean,
exit 0). Four mutations of the rule fail 4, 6, 4 and 2 tests.

https://claude.ai/code/session_01J4QvDgb6vQnxAZ8czX8SLb

---
_Generated by [Claude Code](https://claude.ai/code)_

This branch has not been deployed

No deployments
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.

2 participants