Skip to content

proofs: PROOF-POLICY §2.1 invocation, grade records, ledger fixes - #19

Merged
hyperpolymath merged 5 commits into
mainfrom
claude/new-session-ywdrth-agda-policy
Nov 9, 2026
Merged

hyperpolymath merged 5 commits into
mainfrom
claude/new-session-ywdrth-agda-policy

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

Brings this repository's Agda gate and proof ledger into line with PROOF-POLICY (metadatastician/standards, 3-practice/PROOF-POLICY.adoc), sections 2.1, 5 and 8.

  • Gate: theory proofs must run under agda --safe --without-K --cubical-compatible (§2.1). The gate ran without --cubical-compatible.
  • Ledger: it used DESIGNED, which is not in the closed §5 vocabulary, and recorded no Proof Witness Grades (§8.5).
  • Stale rows: H-2 and N-2 described a world that has since changed.

Changes

  • scripts/check-agda.sh:
    • Every module, unit test and expected rejection runs under --safe --without-K --cubical-compatible (plus --no-libraries --ignore-interfaces --double-check).
    • It scans src/ for postulate outside comments (§8.4.6), alongside --safe.
  • scripts/check-proofs.sh: the template's manifest gate uses the same three flags for Agda.
  • docs/status/PROOF-STATUS.adoc:
    • Uses the §5 vocabulary.
    • New Proof Witness Grades section:
      • the Agda leg's invocation, version (2.6.4.3, asserted by proofs.yml), import cone, postulate count and receipt;
      • Rocq and Lean legs OPEN;
      • PWG-3 only at commits whose proofs.yml run used the canonical invocation. Earlier runs count as historical evidence (§2.1).
    • H-2: occupancy-types adopted HWM as its occupancy algebra (its O-1). Signed drift is still OPEN.
    • N-2: typed-wasm transcribes MinMax (tropMax = minMaxSeq) and checks the transcription against this tree by refl.
    • Open list: now says K-CUT-LOSS is proved in choreographic-types (its K-1).
  • README.adoc: the status column and the just check-agda comment.
  • CHANGELOG.adoc: entry added.

Not changed: no Agda source, statement or proof. The deed's IS-NOT line ("occupancy-types' own algebra, for which HWM is a proposal") is the owner's identity clause, so I left it. It is now out of date with H-2.

RSR Quality Checklist

Required

  • Tests pass (bash scripts/check-agda.sh, see Testing)
  • Code is formatted (just fmt or equivalent)
  • Linter is clean (no new warnings or errors)
  • No banned language patterns (no Python, Go, TypeScript, Deno or ReScript; JavaScript runs on Bun)
  • No unsafe blocks without // SAFETY: comments
  • No banned functions (believe_me, unsafeCoerce, Obj.magic, Admitted, sorry)
  • SPDX license headers present on all new/modified source files
  • No secrets, credentials, or .env files included

As Applicable

  • Documentation updated for user-facing changes
  • CHANGELOG or release notes updated

Testing

Run locally on Agda 2.6.3, the only version available in this environment:

  • Full gate: bash scripts/check-agda.sh passes with the new flags (core proofs, unit tests, all 8 expected rejections refused for their stated reason).
    • Agda 2.6.3 prints 19 UnsupportedIndexedMatch warnings under --cubical-compatible, none of them errors. CI runs Agda 2.6.4.3.
  • Postulate scan, checked both ways:
    • The clean tree passes.
    • A planted postulate planted : Set in Morphism.agda fails the gate with ERROR: postulate in the import cone (src/).
    • A postulate that appears only in comments passes.
  • The receipt that counts is this PR's proofs.yml run on Agda 2.6.4.3.

Generated by Claude Code

scripts/check-agda.sh now runs every module, unit test and expected
rejection under `--safe --without-K --cubical-compatible`, the invocation
PROOF-POLICY §2.1 makes canonical for theory proofs, and scans src/ for
`postulate` outside comments (§8.4.6). The Agda leg of
scripts/check-proofs.sh uses the same three flags.

PROOF-STATUS uses the closed §5 vocabulary and records Proof Witness
Grades: the Agda leg's invocation, version, import cone and receipt;
Rocq and Lean legs OPEN; PWG-3 only at commits whose proofs.yml run used
the canonical invocation.

H-2 and N-2 had gone stale: occupancy-types adopted HWM (its O-1), and
typed-wasm transcribes MinMax (tropMax = minMaxSeq) and checks the
transcription against this tree. K-CUT-LOSS is proved in
choreographic-types (its K-1).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Y6FD63UrriRBHqmhhEca9t
@coderabbitai

coderabbitai Bot commented Nov 9, 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 59 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

Commits

Reviewing files that changed from the base of the PR and between e25d35d and 885c8b4.

Files selected for processing: 9

  • .github/workflows/proofs.yml
  • CHANGELOG.adoc
  • README.adoc
  • docs/status/PROOF-STATUS.adoc
  • scripts/check-agda.sh
  • scripts/check-proofs.sh
  • scripts/scan-postulates.pl
  • tests/check_agda_find_failure_test.sh
  • tests/scan_postulates_test.sh
  • 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

…ble input

The postulate scan stripped `{- -}` blocks before line comments, so a
`{-` inside a `--` comment could hide a following `postulate` up to a
`-}` in a later comment. Its regex also mis-handled nested block
comments, ignored string literals, split file names on spaces, and
passed when perl could not read a file.

scripts/scan-postulates.pl reads each file in source order: `--`
comments run to the end of the line, `{- -}` comments nest, string and
character literals are skipped. It exits 2 on an unreadable file or an
empty file list. check-agda.sh passes the import cone to it as a
NUL-separated list and refuses an empty cone.

tests/scan_postulates_test.sh covers each case (comment-hidden, nested,
string, character literal, path with a space, unreadable file, no files)
and runs in proofs.yml before the gate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Y6FD63UrriRBHqmhhEca9t
`mapfile < <(find ...)` ignored find's exit status, so a directory find
could not read left a partial cone and the postulate scan could pass
without seeing every source. find now writes to a temporary file and its
failure stops the gate. Checked as an unprivileged user with an
unreadable directory under the cone: the gate stops with "could not list
the import cone".

The scanner test uses [[ ]] for its comparisons.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Y6FD63UrriRBHqmhhEca9t
A stub find on PATH prints one real file of the import cone and exits
non-zero, as find does on a directory it cannot read. CI can stage this
even when it runs as root, which a chmod 000 directory cannot. The gate
must exit non-zero, say it could not list the cone, and not report the
postulate scan as passed. Against the previous check-agda.sh (find in a
process substitution) the test fails: the scan passed on the partial
list. Runs in proofs.yml after the scanner tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Y6FD63UrriRBHqmhhEca9t
The estate code-hygiene gate (cicd-suite code-hygiene-check) reads a
whole-word STUB as an untracked debt marker and failed the Central
Estate CI/CD Audit on the heredoc delimiter. Rename it; the test is
unchanged and still passes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Y6FD63UrriRBHqmhhEca9t
@sonarqubecloud

sonarqubecloud Bot commented Nov 9, 2026

Copy link
Copy Markdown

hyperpolymath commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner Author

Two checks are red on this PR, but neither comes from its changes.

  • Code Quality. This run ends in startup_failure with no jobs (run 42632115830). main fails the same way (e25d35d, 2026-11-03). This PR does not touch .github/workflows/quality.yml. No fix exists yet. GitHub keeps no logs for a startup failure, so the cause has to be found from the workflow file, in a change of its own.
  • Canon lockstep. The dogfood-gate.yml job fetches canon.lock live from metadatastician/standards/main. It compares that file's canon version and its criteria and gates hashes with what resource-algebra_chora.deed declares. It passed on main at e25d35d on 2026-11-03. It fails now because the canon moved after that run, not because of this PR. This PR touches neither the deed nor the workflow. The same check is red for the same reason on mathesis and rsr-template-repo. Re-syncing the deed with the current canon is a separate change.

Generated by Claude Code

Copy link
Copy Markdown
Owner Author

Proven 3-outcome test & bench suite failed in its benchmark regression gate, not in a test. On run 42632113500, the escape_hatches workload measured ratio 2.492x (limit 2.0x), absolute 2.196x (limit 2.5x). Every other lane passed.

I don't think this PR caused it:

  • The same suite passed on this PR's previous head, e0f1e9c. The only difference between that commit and 885c8b4 is a two-line rename of a heredoc marker in tests/check_agda_find_failure_test.sh.
  • The benchmark times scripts/check-escape-hatches.sh. Locally, its median over 7 runs is 104 ms on main and 103 ms on this PR's head. The PR doesn't change the work being measured.
  • benches/baseline.json notes that passing runs on shared runners have reached 1.53x. The ratio compares this workload with others in the same run, so a noisy runner can cross 2.0x on unchanged code.

I re-ran the failed job once at 14:52Z, and it is still queued. If it fails again, I'll treat it as a real regression and look for the cause.


Generated by Claude Code

@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-09T15:35:57.179572Z
We couldn’t complete this review. Comment @codex review to try again.
885c8b4 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 to hyperpolymath/rsr-template-repo that referenced this pull request Nov 9, 2026
## Summary

The Agda leg of `scripts/check-proofs.sh` ran `agda --safe`.
PROOF-POLICY §2.1 (`metadatastician/standards`,
`3-practice/PROOF-POLICY.adoc`) makes `agda --safe --without-K
--cubical-compatible` the canonical invocation for theory proofs,
required explicitly in local recipes and CI.

Every repository minted from the template inherits this gate, so the
template is where to fix it. hyperpolymath/resource-algebra#19 and
hyperpolymath/occupancy-types#18 make the same change in their copies.

## Changes

- `scripts/check-proofs.sh`: the `agda` case runs `agda --safe
--without-K --cubical-compatible`.
- `verification/proofs/agda/MANIFEST`: records that the template's
`Properties.agda` checks under the new flags.
- `CHANGELOG.adoc`: a *Changed* entry under `[Unreleased]`.

## RSR Quality Checklist

### Required

- [x] Tests pass (see Testing)
- [x] Code is formatted (`just fmt` or equivalent)
- [x] Linter is clean (no new warnings or errors)
- [x] No banned language patterns (no Python, Go, TypeScript or
ReScript; JavaScript runs on Bun)
- [x] No `unsafe` blocks without `// SAFETY:` comments
- [x] No banned functions (`believe_me`, `unsafeCoerce`, `Obj.magic`,
`Admitted`, `sorry`)
- [x] SPDX license headers present on all new/modified source files
- [x] No secrets, credentials, or `.env` files included

### As Applicable

- [x] `CHANGELOG` or release notes updated

## Testing

- `agda --safe --without-K --cubical-compatible -i
/usr/share/agda-stdlib -i . Properties.agda` (Agda 2.6.3, standard
library 1.7.3): exit 0. It prints `UnsupportedIndexedMatch` warnings
from the standard library, none of them errors. Plain `--safe` also
exits 0, so the change is not what makes this pass.
- I did not run `scripts/check-proofs.sh agda` end to end here. In this
environment the standard library is not registered as an Agda library,
and that leg resolves imports through the library configuration.

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

---------

Co-authored-by: Claude <[email protected]>
@hyperpolymath
hyperpolymath merged commit 3f9900e into main Nov 9, 2026
43 of 45 checks passed
@hyperpolymath
hyperpolymath deleted the claude/new-session-ywdrth-agda-policy branch November 9, 2026 23:00
hyperpolymath pushed a commit that referenced this pull request Nov 10, 2026
Main (#19-#21) ran the strict Agda flag set, recorded ledger corrections and
added ⊕-least (C-2). Owner ruling: keep this branch's leg structure, reset
every grade, add ⊕-least to both legs.

- resource-algebra.agda-lib, check-agda.sh: main's flag sets.
  check-proofs.sh: main's agda line, this branch's `rocq compile`.
- Rocq and Lean legs: add_least, the counterpart of Agda ⊕-least, with its
  Print Assumptions / #print axioms line. The Rocq proof checks under Coq
  8.18 (stdlib renamed for that version) and is closed under the global
  context; CI checks both legs on Rocq 9.3.0 and Lean 4.35.0.
- PROOF-STATUS.adoc: this branch's structure. Every pwg is reset to
  ungraded: the 9f175cc receipts predate the merge. C-2 cites ⊕-least and
  add_least; the invocation names main's flags; H-2 and N-2 take main's
  downstream statuses. S-1, S-2 and S-4 stay PROVEN, as main's own audit
  note says they are closed refutations.
- PROOF-NEEDS.adoc: this branch's structure; PN-1 names main's flags.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0136P7ZnmBahbhfkFEP6ark4
hyperpolymath added a commit that referenced this pull request Nov 10, 2026
…23)

## Why

"Core proofs and expected rejections" has failed on `main` since #21
(`aac649c`); it passed on `d8c5213` just before. The Agda proofs
themselves pass: core proofs, unit tests and all 8 expected rejections.
What fails is `tests/check_agda_find_failure_test.sh`: "FAIL: gate
passed although find failed (exit 0)".

#19 added a comment-aware postulate scan of the import cone (`src/`,
PROOF-POLICY §8.4.6) to `scripts/check-agda.sh`, plus that test, which
checks that a failing `find` stops the gate. #21's squash dropped the
scan block from the script but kept the test.

## What

`scripts/check-agda.sh` gets #19's block back unchanged, after the
`flags=` line and before the first Agda call: list `src/**/*.agda` with
`find` into a file (so a `find` failure stops the gate), refuse an empty
cone, and run `scripts/scan-postulates.pl`, which is still on `main`.

## Testing

- `tests/check_agda_find_failure_test.sh`: PASS ("a find failure stops
the gate (exit 1) before the postulate scan passes"). Agda is not
installed in this session, so `AGDA` pointed at a stub that prints a
version; the test exits before any Agda call.
- `scripts/check-agda.sh` with the same stub prints "PASS: no postulate
in the import cone (src/)".
- `tests/scan_postulates_test.sh`: PASS.
- CI runs the full gate with the pinned Agda 2.6.4.3.

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

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