Skip to content

fix(ci-health): B-ALLOWLIST is additive, with an Idris2 proof (stopgap for the standards move) - #1198

Merged
hyperpolymath merged 6 commits into
mainfrom
claude/allowlist-monotone
Nov 17, 2026
Merged

hyperpolymath merged 6 commits into
mainfrom
claude/allowlist-monotone

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

What

  • scripts/ci-health/remediate.sh B-ALLOWLIST used to replace the allow-list. It now:
    • reads the repo's current selected-actions setting first, and writes nothing if it can't;
    • writes current ∪ required;
    • writes github_owned_allowed and verified_allowed back exactly as read;
    • skips the write when nothing is missing;
    • checks the read-back against that union.
  • verification/proofs/idris2/AllowlistRemediation.idr is a new Idris2 model of the remediation, in the shape of ActionsLockClosure. It proves:
    • keepsCurrent: monotone, so nothing allowed before is lost;
    • coversRequired: every required pattern is present;
    • onlyAdds: nothing beyond the required set is added;
    • flagsKept: neither trust flag changes;
    • noWriteWhenCovered: a list that misses nothing is left alone;
    • converges: after one run detect.sh stops firing;
    • idempotent: a second run changes nothing;
    • the four corpus rows, as equations the type checker reduces.
  • Corpus and binding. There are four fixtures (empty, extras, partial, covered), and the mock gh is now stateful. test/ci-health-test.sh runs the real remediate.sh and detect.sh on each fixture and checks every property above. It also checks the model's -- corpus: line and the equation under it, so the model and the script can't drift apart. test/ci_health_allowlist_corpus_test.exs puts that shell suite into the ledger's exunit lane.
  • Ledger. Two new rows: allowlist-remediation (idris2, proven) and allowlist-remediation-corpus (exunit, tested-only). The rendered table and the four quoted censuses now read 35 proven of 57; … 13 tested-only. PROOF-STATUS gains an explanation section and a boundary-table row.
  • Docs. The rollout record states the stopgap's real contract, and records the owner's ruling that WF028 moves onto design: one parsed workflow model for every workflow rule #971's parsed workflow model rather than getting a model of its own. DEBT-REGISTER CI-9 records this defect.

Why

This is the stopgap the owner chose for hyperpolymath/standards → metadatastician/standards. The CI-health sweep would run it across roughly 360 repos the moment HYPATIA_DISPATCH_PAT works. Before this change, any repo with a pattern of its own would have lost it, so the workflows using it would be refused at startup. A repo that had turned verified-creator actions off would have had them turned back on. In both cases the script would still have printed FIXED … exact set verified.

The bug was reproduced against main's script: a repo allowing someone/special-action@* came out of the PUT without it, and with verified_allowed: true.

There was also a separate gap: test/ci-health-test.sh was run by no workflow, so the CI-health tests were dark until this change.

Evidence

  • idris2 --check AllowlistRemediation.idr: passes. Idris 2 0.7.0, built from source with scripts/dev/install-toolchain.sh --with-idris2, under %default total, with no believe_me, assert_total or postulate. A wrong count in rowExtras (131 instead of 130) is rejected (Mismatch between: S … and 0).
  • bash test/ci-health-test.sh: PASS. Negative controls:
    • main's remediate.sh → FAIL [covered]: a current pattern was dropped;
    • forcing verified_allowed to true → fails the extras row;
    • a drifted model equation → fails the binding.
  • mix test (Elixir 1.19.4 / OTP 27): 3588 tests, 0 failures, 3 skipped (246 excluded). mix compile --warnings-as-errors: clean.
  • scripts/proof-ledger.sh check (57 rows valid), claims (4 quotes agree), and render --check all pass. tests/proof-ledger-test.sh: 53/53. scripts/check-proof-status.sh: 0 mismatches.
  • shellcheck 0.9.0 is clean on remediate.sh, mock-gh and ci-health-test.sh. asciidoctor --failure-level WARN is clean on all six .adoc files. scripts/check-readme-claims.sh passes, and mix format --check-formatted passes on the new test.
  • Self-scan (./hypatia scan .): 0 findings on the changed files. 17 findings elsewhere were not compared with main.
  • The ledger row says proven. Verify Proofs derives that from its own idris2 --check receipt on this head, so the PR goes red if it doesn't hold. The PROOF-STATUS section says "receipt run: pending" until the run ID is recorded after merge.

Not done

  • Mathesis bridge. Mathesis bridge records accept theory endpoints only (Agda, Rocq, Lean), and this is an Idris2 engineering proof. The link to mathesis THY-1 (Monotone.reach-mono) is recorded in PROOF-STATUS instead.
  • Live run. The live GitHub API is not exercised. That needs the rotated HYPATIA_DISPATCH_PAT and a dry_run: true sweep.
  • Curated list duplicates. action-superset.txt has two duplicate lines (SonarSource/sonarqube-scan-action, dawidd6/action-send-mail). They're left as they are; the new code deduplicates.

Generated by Claude Code

…replaces it

remediate.sh B-ALLOWLIST PUT the curated set as the whole allow-list and
forced github_owned_allowed and verified_allowed on. A repository's own
patterns were dropped, so its workflows using them would be refused at
startup, and a deliberate verified_allowed=false became true; the read-back
still printed "exact set verified". This is the stopgap chosen for the
standards repository's move, which the sweep runs estate-wide once its
token works.

It now reads the current setting first (and writes nothing if it cannot),
writes current UNION required with both flags as read, skips the write when
nothing is missing, and checks the read-back against that union.

test/ci-health-test.sh runs remediate.sh and detect.sh over a four-row
corpus (empty, extras, partial, covered) through a stateful mock gh: no
pattern dropped, every required pattern present, flags kept, a second run
writes nothing, detect.sh stops firing. Negative controls: main's script
fails the covered row; forcing verified_allowed on fails extras. The suite
was run by no workflow; test/ci_health_allowlist_corpus_test.exs puts it in
the ExUnit lane.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_01J4QvDfvetbJ5z7uREtbJWw
An engineering property of one script, so Idris2 under PROOF-POLICY §1,
in the shape of ActionsLockClosure: keepsCurrent (monotone), coversRequired,
onlyAdds, flagsKept, noWriteWhenCovered, converges and idempotent, proved
for patterns with decidable equality, plus the four corpus rows as
equations. test/ci-health-test.sh binds each row's `-- corpus:` line and
equation to the fixtures; a drifted equation fails it, and idris2 rejects a
wrong count.

Ledger rows allowlist-remediation (idris2, proven) and
allowlist-remediation-corpus (exunit, tested-only); the rendered table and
the four quoted censuses move to 35 proven of 57; 13 tested-only.
keepsCurrent is the premise of mathesis THY-1 (Monotone.reach-mono); it is
not a Mathesis bridge record, whose endpoints are theory provers only.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_01J4QvDfvetbJ5z7uREtbJWw
The rollout record states the stopgap's actual contract (current UNION
required, trust flags as read) and the owner ruling that WF028 gets no
separate model: its call extraction moves onto the parsed workflow model of
#971. DEBT-REGISTER CI-9 records the defect found and fixed.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_01J4QvDfvetbJ5z7uREtbJWw
@hyperpolymath
hyperpolymath marked this pull request as ready for review November 17, 2026 16:57
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 3 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

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: 8bef6fa1-b5f9-4e98-94fa-eaf20bc58b92
Commits

Reviewing files that changed from the base of the PR and between 0a258da and 4dc96ee.

Files selected for processing: 16

  • AFFIRMATION.adoc
  • EXPLAINME.adoc
  • README.adoc
  • docs/DEBT-REGISTER.adoc
  • docs/operations/standards-move-estate-rollout.adoc
  • scripts/ci-health/remediate.sh
  • test/ci-health-test.sh
  • test/ci_health_allowlist_corpus_test.exs
  • test/fixtures/ci-health/allowlist/covered.json
  • test/fixtures/ci-health/allowlist/empty.json
  • test/fixtures/ci-health/allowlist/extras.json
  • test/fixtures/ci-health/allowlist/partial.json
  • test/fixtures/ci-health/mock-gh
  • verification/PROOF-STATUS.adoc
  • verification/proof-ledger.jsonl
  • verification/proofs/idris2/AllowlistRemediation.idr
  • 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

SonarCloud shell:S7688 on the seven new tests in remediate.sh and
ci-health-test.sh (both bash, as #997 did for the Logtalk guard).

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_01J4QvDfvetbJ5z7uREtbJWw

Copy link
Copy Markdown
Owner Author

Rust License & Ban Check is red on f4dac73, but not because of this PR, which touches no Rust and no Cargo.lock. cargo-deny fails on two RustSec advisories that were published since the last green run. main will fail the same way on its next run, because the advisory database is fetched live.

  • RUSTSEC-2026-0544: libz-sys 1.1.31 has a heap buffer overflow in zlib gz_vacate(). It's reached through git2 → libgit2-sys. Proposed fix: cargo update -p libz-sys. I checked it locally: it locks exactly one package, 1.1.31 → 1.1.33.
  • RUSTSEC-2026-0543: chrono is unmaintained, and no safe upgrade exists. Every crate in the workspace uses it. The choices are to migrate to jiff or time, or to record a reasoned [advisories] ignore in deny.toml. That's an owner decision, so I haven't touched it here.

No fix PR exists yet, and both changes are outside this PR's scope, so I haven't added them here.


Generated by Claude Code

Owner ruling 2026-11-17: the sweep's 401 is resolved by #1197 (GitHub App
installation tokens replace HYPATIA_DISPATCH_PAT), not by rotating the PAT.
The owed-actions table and the update triggers now say so.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_01J4QvDfvetbJ5z7uREtbJWw
hyperpolymath added a commit that referenced this pull request Nov 17, 2026
…3) (#1201)

## What

- **RUSTSEC-2026-0544 (vulnerability).** `libz-sys` 1.1.31 → **1.1.33**,
via `cargo update -p libz-sys`, which locks one package. zlib
1.3.1.2–1.3.2 overflow the heap in `gz_vacate()`. The workspace reaches
it through `git2` → `libgit2-sys`.
- **RUSTSEC-2026-0543 (unmaintained).** **`chrono` → `jiff`** in all
four crates (`cli`, `data`, `adapters`, `integration`). The owner ruled
on 2026-11-17 to migrate rather than ignore the advisory.

  | chrono | jiff |
  |---|---|
  | `DateTime<Utc>` | `Timestamp` |
  | `Utc::now()` | `Timestamp::now()` |
  | `.to_rfc3339()` | `.to_string()` |
  | `.timestamp()` | `.as_second()` |
  | `Duration::days(n)` | `SignedDuration::from_hours(24 * n)` |
  | `DateTime::from_timestamp(s, 0)` | `Timestamp::from_second(s)` |
| `DateTime::<Utc>::from(SystemTime)` | `Timestamp::try_from(...).ok()`
|
  | `.format(...)` | `.strftime(...)` |

`Timestamp - Timestamp` is a calendar `Span` in jiff, so the two
`duration()` helpers and the parallelism assertion now use
`duration_since`, which returns a `SignedDuration`.
- **New `adapters/tests/timestamp_wire_tests.rs`.** It pins the shapes
the forge adapters deserialise:
- `Z`, `+00:00`, milliseconds, microseconds and a non-UTC offset all
parse to the same instant;
  - a naive time is refused, as chrono refused it;
  - RFC 3339 round-trips;
  - the epoch conversion `radicle.rs` uses gives the same result.
- **Docs.** The dependency table in `docs/api/rust-api.adoc` and the
code samples in `docs/integration/github-registry.adoc` now name jiff.

## Why

`cargo-deny` started failing on `main` and on every PR as soon as these
advisories were published (e.g. #1198's *Rust License & Ban Check*).
chrono has no safe upgrade.

## Evidence

- **`cargo-deny` 0.21.0, with the repo's `deny.toml`** (the same config
CI uses):
- on `main`: `advisories FAILED`, with `error[unmaintained]`
RUSTSEC-2026-0543 and `error[vulnerability]` RUSTSEC-2026-0544;
- on this branch: **`advisories ok, bans ok, licenses ok, sources ok`**.
- **`ci.yml`'s commands, all `--locked`, all pass:** `cargo check
--workspace --all-targets`, `cargo fmt --all -- --check`, `cargo clippy
--workspace --all-targets -- -D warnings`, `cargo test --workspace
--all-targets` (every suite ok, including the 4 new wire tests) and
`cargo test --workspace --doc`.
- **The epoch value in the test is checked independently:** `date -u -d
1794935190` gives `2026-11-17T17:06:30Z`.
- **No user-visible format change.** No `Timestamp` is printed with
`Display`; I checked every field of type `Timestamp` and the only other
use is a `sort_by_key`, where the ordering is the same.
- **Serialised JSON still parses, but its fractional seconds may print
differently.** chrono printed 0, 3, 6 or 9 digits after the decimal
point; jiff prints only as many as needed. Both are valid RFC 3339.
- **`chrono` is still listed in `Cargo.lock`,** but only as
`serde_with`'s optional dependency, which isn't enabled
(`testcontainers` takes `serde_with`'s default features). `cargo tree -i
chrono --target all` prints nothing, and `cargo-deny` doesn't count it.
- AsciiDoc: `rust-api.adoc` builds clean. `github-registry.adoc` has the
same 2 warnings as on `main` (a section level at line 1288, and the
optional `rouge` gem).

## Not done

- No live forge API was called. The wire test covers the documented
shapes.

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

Co-authored-by: Claude <[email protected]>
@sonarqubecloud

Copy link
Copy Markdown

Copy link
Copy Markdown
Owner Author

Integration Tests on 4dc96ee: 1 failure out of 3588 tests, in code this PR doesn't touch.

The failing test is test/kyaml_test.exs:336, "flat collections parse in linear time". It times the parse with wall-clock time and asserts large / small < 10. On this run the ratio was 11.38 (job).

Why it isn't this PR's:

  • This PR touches neither Hypatia.Kyaml nor its tests.
  • The input is 4× larger, so linear time predicts about 4× and quadratic about 16×. 11.4 is a noisy ratio on a shared runner, not a sign of quadratic behaviour.

What I did: re-ran the failed job once.

Proposed hardening, for its own PR: measure the ratio in reductions or :erlang.statistics(:runtime) rather than wall-clock time. Alternatively, tag the test async: false and widen the bound to < 12, which still sits clearly below the quadratic 16×.


Generated by Claude Code

@hyperpolymath
hyperpolymath merged commit a5acb96 into main Nov 17, 2026
114 of 116 checks passed
@hyperpolymath
hyperpolymath deleted the claude/allowlist-monotone branch November 17, 2026 19:04
hyperpolymath added a commit that referenced this pull request Nov 17, 2026
## What

`verification/PROOF-STATUS.adoc`, AllowlistRemediation row: `Receipt
run: pending its first run on main` → the receipt from that run.

## Why

#1198 merged with the receipt marked pending, because Verify Proofs had
not yet run on `main`. That run is now done.

## Evidence

- **Verify Proofs run
[44154561700](https://github.com/hyperpolymath/hypatia/actions/runs/44154561700)**
on `a5acb963` succeeded:
  - its `idris2 --check` job 134291680073 succeeded;
  - the job log shows `✓ AllowlistRemediation.idr`.
- **Local checks on the edited file**, all passing:
  - `scripts/proof-ledger.sh render --check`: block is current;
  - `scripts/proof-ledger.sh check`: 57 rows valid;
  - `tests/proof-ledger-test.sh`: 53 passed, 0 failed;
  - `scripts/check-proof-status.sh`: 0 mismatches;
  - `asciidoctor --failure-level WARN`: clean.

## Not done

Nothing.

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

Co-authored-by: Claude <[email protected]>
hyperpolymath added a commit that referenced this pull request Nov 18, 2026
… fits an exponent (#1205)

## What

**1. `integration/src/ci_simulation/mod.rs`: one lifecycle instead of
three copies** (2086 → about 1690 lines)
- `MockGitHubActions`, `MockGitLabCI` and `MockCircleCI` each carried a
~260-line copy of the whole `SimulatedCI` lifecycle.
- That lifecycle is now written once, as `impl<P: SimProvider>
SimulatedCI for P`, over a shared `SimBuildStore`.
- Each provider supplies only `kind()`, `store()` and `initial_jobs()`.
- **Behaviour change (owner ruling: one strict core).** The copies had
drifted. GitLab and CircleCI:
  - let a completed build be cancelled;
  - concluded `Success` even after a failed job;
  - ignored job `needs`;
  - reported `critical_findings = 0`.

All three providers now follow the strict lifecycle GitHub already had.
Each provider's job layout is unchanged.
- **Also fixed (aa09a2e, found by CodeRabbit, the same line is on
`main`).** A workflow job's `needs` held job ids (`"build"`), but
`advance_build` checks them against job names (`"Build"`). So the
default workflow's `Test` job never started.

**2. `test/kyaml_complexity_test.exs`: the KYAML linear-time test**
- **Before:** `t(20k)/t(5k) < 10` in an async module. On #1198 it
measured 11.4 for the current, linear parser.
- **Now:** a synchronous module fits the exponent `k` in `t ∝ n^k` by
least squares over 2,500, 5,000, 10,000 and 20,000 entries. Each size
takes the best of five runs, each in a fresh process. It asserts `k <
1.4`.
- A fourth test checks the fit itself on exact power laws.
- The old test is removed from `test/kyaml_test.exs`.

## Why

- **Simulator:** SonarCloud failed its duplication gate on every PR that
touched the three copies (20.4% on #1201), and the copies had already
diverged into bugs.
- **KYAML:** the two-point wall-clock ratio is noisy enough to fail on a
loaded runner.

## Evidence

**Simulator**
- **ci.yml's Rust commands pass on the workspace:**
  - `cargo check --all-targets --locked`;
  - `cargo fmt --check`;
  - `cargo clippy --all-targets -D warnings`;
  - `cargo test --all-targets`: every test binary ok;
  - `cargo test --doc`.
- **Four new tests run each lifecycle rule against all three
providers.** As a negative control I appended them to `main`'s `mod.rs`.
Three fail there for GitLab CI:
  - cancel returns `Ok(())`;
  - the conclusion is `Some(Success)`;
  - `critical_findings` is `0`.

  The job-layout test passes on both versions.
- **`the_default_workflow_advances_to_completion_through_its_needs`**
fails without aa09a2e. The jobs stop at `[("Build", Completed), ("Test",
Queued)]`.
- **SonarCloud:** quality gate passes, 0.0% duplication on new code.

**KYAML exponent, five fits per shape, measured locally**

| shape | current parser | pre-fix parser (6a3407a) |
|---|---|---|
| map | 1.00 to 1.15 | 1.74 to 1.88 |
| seq | 0.99 to 1.16 | 1.87 to 2.02 |
| flow | 0.98 to 1.04 | 1.56 to 1.69 |

- **Under load:** with one CPU-bound process per scheduler, the current
parser's map shape fits **0.98 and 1.01**. Those two fits completed; the
run hit its 25-minute timeout before the others.
- **Reductions were tried and rejected.** The pre-fix map shape fits
1.06 on reductions, because its quadratic copying ran in BIFs, so a
reductions test would let that regression through.
- **Elixir suite:** `mix test` gives 3709 tests, 0 failures, 3 skipped
(246 excluded). It ran while another VM was saturating every scheduler.
- `mix compile --warnings-as-errors` and `mix format --check-formatted`
are clean.
- The self-scan reports 0 findings on the changed files.

## Not done

- **`governance / Validate Hypatia Baseline` fails, but this PR doesn't
cause it.** It is red on `main` since #1204 (RE011). See the comment on
this PR for the three ways to fix it.
- The `generate_mock_results()` duplication in
`cli/src/commands/search.rs`. It's mock search data, not the CI
simulator, so I left it for its own change.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01J4QvDfvetbJ5z7uREtbJWw

---------

Co-authored-by: Claude <[email protected]>
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.

3 participants