Skip to content

feat(verdict): PR gate verdict function + squabble verdict (S3) - #178

Open
hyperpolymath wants to merge 6 commits into
vendor/ci-design-w49from
s3/verdict-core
Open

hyperpolymath wants to merge 6 commits into
vendor/ci-design-w49from
s3/verdict-core

Conversation

@hyperpolymath

@hyperpolymath hyperpolymath commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

S3 of the CI programme W49 (design §3, vendored under docs/upstream/proven-cicd-w49/): the PR gate verdict as one pure, total function in squabble-core, plus squabble verdict [--json] to replay recorded evidence offline.

Stacked. Base is vendor/ci-design-w49 (the hub's read-only vendored design + corpus, no PR of its own), so this diff shows only S3. That branch must land first.

Corpus pin. The conformance test is pinned to pr-verdict/ at proven-cicd 41dfc6554400d5ab46981883dc586302c184eeff (PR #193 head) and fails if the vendored README stops naming it. The CI v1 session is moving S1/S2 to the 7208a2e signature rule; if fixtures change the hub re-vendors and the pin is bumped deliberately.

Changes

  • crates/squabble-core/src/verdict.rs: evidence types, the seven verdicts + Unsettled, derive (total), try_derive (refuses an untrusted record: wrong schema, empty required set, bad timestamp).
  • crates/squabble-cli/src/verdict.rs, main.rs: squabble verdict. Exit 0 = every record got a verdict; 2 = usage error or any record refused (stderr, nothing on stdout if all failed).
  • Tests: squabble-core/tests/verdict_conformance.rs (48 vendored fixtures + 2 local cases, determinism, READY-implies-all-pass, mutation check), squabble-cli/tests/verdict_cli.rs.

Decisions where the design is silent (all provisional)

  1. Inheritance s ~ s': both signatures complete (strong, failed_count == n > 0 with exactly n distinct identities, checked in this module; a missing count is incomplete, fail closed) and the head identities a subset of the base's. Hub decision 2026-11-30.
  2. obs(T,c) = base-tip entry if completed, else nearest completed on the chain, else none (NeverOnBase).
  3. CI-BROKEN: cause = first matching clause in step-4 order; checks = every check matching any clause (hub S2-3).
  4. Empty required set is an error, not READY (no pass on absence).
  5. Pending past since + timeout_minutes at evidence_at is treated as Infra Timeout even if the extractor did not record it.
  6. PR-BROKEN note only when head and base are both weak and share a step (matches the fixtures).
  7. Hub rulings applied: threads-unknown blocker, pull.owner_acts input, v1 ReviewBlocker/SupersededReason vocabularies.

Corpus gaps found (to report upstream)

Mutation testing found two derivation behaviours no vendored fixture pins: a weak signature naming only part of its failures must not inherit, and a Pending already past its timeout. Covered here by two local cases built from vendored fixtures; upstream should add them.

Not done in this PR

  • S4 Creusot contracts (properties 3-5): not started.
  • Wiring into board::classify, so "MergeabilityUnknown no longer reachable as a verdict" is not yet shown; the verdict function takes evidence records, not board::Reason.
  • Expected verdicts are hand-derived upstream; they agree with this implementation, which is evidence they are consistent with §3.3, not independent proof of §3.3.
  • The commit is unsigned per the programme's "unsigned DRAFT PRs" rule; the estate's always-sign rule (CLAUDE.md feat(squabble): call-in-the-big-guns moves + ecosystem context + squabble fight #9) needs the owner's call.

RSR Quality Checklist

Required

  • Tests pass: cargo test --workspace 493 passed, 0 failed (baseline 479, +14 new); cargo test -p squabble-cli --features boj not re-run to completion here
  • Code is formatted: cargo fmt --all -- --check clean
  • Linter is clean: cargo clippy --workspace --all-targets -- -D warnings clean
  • No banned language patterns (Rust only; no Python/TS/Go/npm)
  • No unsafe blocks
  • No banned functions
  • SPDX license headers present on all new source files
  • No secrets, credentials, or .env files included

As Applicable

  • .machine_readable/descriptiles/STATE.a2ml updated: not done
  • No new dependencies (thiserror, serde, serde_json already in the crate)

Testing

Run locally: cargo test --workspace; cargo test -p squabble-core --test verdict_conformance -- --nocapture prints, per mutant, how many fixtures kill it (all 16 mutants killed once the two local cases are included; two survive the vendored corpus alone). Not run: just test end to end (includes --features boj), SPARK, Creusot, the CI workflows.


Generated by Claude Code

S3 of the CI programme W49 (design section 3). squabble-core::verdict derives
exactly one of the seven verdicts (or Unsettled before its deadline) from a
recorded proven/pr-evidence/v1 record. It reads no clock but evidence_at, so a
stored record replays to its stored verdict. `squabble verdict [--json]` replays
records offline; an untrusted record exits 2 with nothing on stdout.

Conformance runs the vendored corpus (pr-verdict/ at proven-cicd
c66eb82c1341e239c4323fc88bfef770a8584e3c, pinned in the test) plus two local
cases for gaps the corpus leaves open. Each derivation step and five specific
mutants are shown to fail at least one fixture.

Not done here: Creusot contracts (S4), wiring into `board::classify`, and the
7208a2e complete-set rule beyond what evidence v1 can express.

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: c8812b77-26bd-4263-ade5-887dcd1fb8f6

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

…lure

Design 3.6 property 3 says that if every failing check is inherited or cured
the verdict is not PR-BROKEN. The ruling on 3.5 makes a start failure caused by
the PR's own workflow edit PR-BROKEN with no Fail observation, so the property
as written has a hole. This local case pins it: lint is inherited-red and the
verdict is still PR-BROKEN, through the start-failed check.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDgb6vQnxAZ8czX8SLb
The re-vendored corpus (proven-cicd fb7ae871525d3339fd2e56112a182ea39db1e0e4,
55 fixtures) adds signature.failed_count. Complete now means strength strong
AND failed_count == n > 0 with exactly n distinct identities, checked here
rather than trusting the extractor's flag. A missing count is incomplete (fail
closed). The conformance pin and fixture count move to the new corpus; a local
case pins "strong flag but count != identities", and a new mutant that ignores
the count is killed by it. The property-3 local case gains failed_count.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDgb6vQnxAZ8czX8SLb
hyperpolymath pushed a commit that referenced this pull request 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
The hub re-vendored the PR-verdict corpus at proven-cicd
41dfc6554400d5ab46981883dc586302c184eeff (58 fixtures), which adds the three
gap-filling fixtures found by mutation testing here. The three local copies are
removed; the pin and count move to the new corpus.

With failed_count in the schema, strength is redundant on consistent records,
so the InheritIgnoresStrength mutant is no longer killed by the vendored corpus.
One local case pins the fail-closed reading of a contradictory record (flagged
weak, count equals identities): weak never inherits. The property-3 carve-out
case stays local; upstream does not have it.

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

Copy link
Copy Markdown

@hyperpolymath
hyperpolymath marked this pull request as ready for review November 30, 2026 17:23
@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-30T17:23:35.610238Z
We couldn’t complete this review. Comment @codex review to try again.
9b8ee6c Draft marked ready
ℹ️ 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.

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