Skip to content

proof: trusted base read by the standard's shared gate, not a lexical scan (§8.4) - #62

Draft
hyperpolymath wants to merge 1 commit into
mainfrom
claude/shared-trusted-base-scan
Draft

hyperpolymath wants to merge 1 commit into
mainfrom
claude/shared-trusted-base-scan

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

This PR moves secret-types' §8.4 trusted-base gate onto the shared scan added in the standard, and removes the local lexical awk scanner.

Status: draft. It pins standards 5addf98, which sits on the standards branch claude/agda-trusted-base-scan and is not yet merged. Once that standards PR merges, repin to its merge commit, then take this out of draft. The repin rewrites one receipt header line again.

The hole this closes (confirmed). It reproduces on main (c772168):

  • Agda 2.6.4.3 accepts postulate Level : LevelUniv; Hidden : Level.
  • scan-agda-postulates.awk stops at the first colon, so it reports Level and never sees Hidden.
  • With the prover's Agda.Primitive edited that way (copied data directory, Agda_datadir), scripts/check-trusted-base.sh printed PASS on every step and exited 0.

The same hole was reported on metadatastician/lintel#31; lintel moves in metadatastician/lintel#37.

Changes

  • Shared gate. scripts/check-trusted-base.sh now runs the standard's scripts/check-agda-trusted-base.sh, which uses scripts/agda-postulates.js.
    • It reads the postulates Agda itself reports for the cone (--html), and lexes no Agda source.
    • It refuses any postulate in a module under src/.
    • It requires the prover's postulates to equal grade-receipt.sh --trusted-base, the list the receipt writes.
    • It runs a live semicolon control on every call.
  • Input-set check stays here. The §8.5.1 check reads the cone the shared gate reports.
  • Removed: scripts/scan-agda-postulates.awk, tests/trusted-base/ and their .gitattributes line. Their controls now live with the shared gate.
  • New pin. scripts/grade-receipt.sh pins six standards files at 5addf98. This also takes in the upstream changes to proof-receipt.sh and deed_lint.js since 940a27a.
  • Receipt. verification/receipts/agda_praxis.deed changes in one header line only: the standards commit its reader is pinned at. Claims and grades are unchanged (N-1, N-2, N-3, N-7, N-8 and N-9 at PWG-1).
  • CI. proofs.yml sets up Bun in the proofs job, with the same pinned action and version as the receipt job, and installs unzip. The PASS: trusted base line the ledger row quotes keeps its prefix.
  • PROOF-STATUS.adoc now describes the new mechanism.

RSR Quality Checklist

Required

  • Tests pass (just test or equivalent). Partly. See Testing: three test scripts fail here exactly as they do on main, for reasons this PR does not touch.
  • Code is formatted. Scripts and docs only.
  • Linter is clean: actionlint 1.7.12 passes on proofs.yml.
  • No banned language patterns. The reader is plain JavaScript run by Bun.
  • No unsafe blocks without // SAFETY: comments (none touched).
  • No banned functions.
  • SPDX license headers present on all new/modified source files.
  • No secrets, credentials, or .env files included.

As Applicable

  • Documentation updated: PROOF-STATUS.adoc.

Testing

All runs used Agda 2.6.4.3, built from Hackage because the Debian mirror is blocked in this container, and Bun 1.4.4.

Check Pinned prover Prover with Agda.Primitive altered (Level : LevelUniv; Hidden : Level)
scripts/check-trusted-base.sh on main (awk scanner) PASS, rc 0 PASS, rc 0 (the hole)
scripts/check-trusted-base.sh on this branch PASS, rc 0 FAIL, rc 1: +Agda.Primitive|Hidden|-

These also passed:

  • grade-receipt.sh --write then --check: the only change is the one header line, and the grades are identical to main.
  • scripts/check.sh.
  • tests/aspect_tests.sh, tests/e2e.sh and tests/invisible-characters-test.sh.

These fail here, and fail identically on main, so they are unrelated:

  • tests/ffi_strings_test.sh: "Zig is required".
  • tests/proven_suite_test.sh and tests/run_proven_suite_test.sh: "runner leaked its temporary benchmark report".

Not verified here:

  • The Debian agda-bin build has not been exercised; this PR's CI run will be the first.

Commits are signed with this session's SSH signing key. The owner's id_ed25519_signing key was not available in this container.


Generated by Claude Code

… scan (§8.4)

scripts/scan-agda-postulates.awk listed the prover's postulates by lexing
Agda source, and stopped at the first colon of a declaration.  Agda 2.6.4.3
accepts `postulate Level : LevelUniv; Hidden : Level`, so the scan reported
Level and passed Hidden.  Verified on main (c772168): with Agda.Primitive
altered that way (Agda_datadir), check-trusted-base.sh printed PASS and
exited 0.

check-trusted-base.sh now runs the standard's shared gate,
scripts/check-agda-trusted-base.sh with scripts/agda-postulates.js, pinned
with the receipt tools.  It reads the postulates Agda itself reports for the
cone (--html: each name's kind and definition site), refuses any postulate
in a module under src/, and requires the prover's list to equal
`grade-receipt.sh --trusted-base`, the list the receipt writes.  The
input-set check (§8.5.1) stays here, on the cone that gate reports.  The
local awk scanner, its fixtures and their .gitattributes line go; the
controls, including the semicolon case and an altered prover, live with the
shared gate in the standard.

The standard is repinned to 5addf98 (six files), the commit that adds the
gate.  It is on standards branch claude/agda-trusted-base-scan, not yet on
main: repin to its merge commit before this leaves draft.  The receipt
changes in one header line, the standards commit its reader is pinned at;
its claims and grades are unchanged (N-1, N-2, N-3, N-7, N-8, N-9 at PWG-1;
grade-receipt.sh --check passes).  The proofs job sets up Bun, as the
receipt job does, for the reader.  The "PASS: trusted base" line the ledger
row quotes keeps its prefix.

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

gitnotebooks Bot commented Nov 30, 2026

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Hypatia grid green

🟢 clean · commit 265b76b1ca04 · run 46539208035 · scope: this change (15 file(s))

Advisory: 11 row(s), worst 🔴 high (0 critical, 9 high) — reported, never grading the change.

Reporter Gate Status Critical High Medium Minor Since previous revision
Hypatia scan gating 🟢 clean 0 0 0 0 — no comparable baseline
panic-attack assail advisory 🟢 clean 0 0 0 0 — no comparable baseline
pons asinorum advisory 🟢 clean 0 0 0 0 — no comparable baseline
finishingbot (release readiness) advisory 🔴 high 0 9 5 0 — no comparable baseline
glambot (presentation quality) advisory 🔵 minor 0 0 0 6 — no comparable baseline
rhodibot (RSR compliance) advisory 🟢 clean 0 0 0 0 — no comparable baseline
accessibilitybot advisory ⚪ not applicable 0 0 0 0 — no comparable baseline
cipherbot advisory ⚪ not applicable 0 0 0 0 — no comparable baseline
echidnabot advisory ⚪ not applicable 0 0 0 0 — no comparable baseline
panicbot advisory ⚪ not applicable 0 0 0 0 — no comparable baseline
seambot advisory ⚪ not applicable 0 0 0 0 — no comparable baseline
sustainabot advisory ⚪ not applicable 0 0 0 0 — no comparable baseline
Hypatia scan: 23 finding(s)
  • 23 further finding(s) in files this change does not touch: reported, not graded (0 critical, 8 high).
panic-attack assail: 16 finding(s)
  • 16 further finding(s) in files this change does not touch: reported, not graded (0 critical, 0 high).
pons asinorum: 9 finding(s)
  • 9 further finding(s) in files this change does not touch: reported, not graded (0 critical, 0 high).
finishingbot (release readiness): 174 finding(s)
  • high V1-DOC-ROADMAP.adoc — Required file ROADMAP.adoc not found (Project roadmap).
  • high TOOL-001 — .tool-versions file not found for asdf/mise version management.
  • high SCM-001-NEUROSYM.scm — Required SCM file NEUROSYM.scm not found (Neurosymbolic AI documentation).
  • high SCM-001-AGENTIC.scm — Required SCM file AGENTIC.scm not found (Agentic AI integration documentation).
  • high SCM-001-PLAYBOOK.scm — Required SCM file PLAYBOOK.scm not found (Operational playbooks and procedures).
  • high SCM-001-ECOSYSTEM.scm — Required SCM file ECOSYSTEM.scm not found (Project's place in the ecosystem).
  • high SCM-001-META.scm — Required SCM file META.scm not found (Meta-level information and architectural decisions).
  • high SCM-001-STATE.scm — Required SCM file STATE.scm not found (Project state and progress tracking).
  • high PH-100 — Found 124 placeholders, exceeds maximum allowed (0)
  • medium V1-COM-CONTRIBUTING.md — CONTRIBUTING.md file not found (Contribution guidelines).
  • medium V1-COM-CODE_OF_CONDUCT.md — CODE_OF_CONDUCT.md file not found (Code of conduct).
  • medium V1-SEC-001 — SECURITY.md not found for responsible disclosure.
  • medium TEST-001 — Could not determine if this is a Rust or Deno project.
  • medium REL-004 — No SECURITY.md file found
  • 160 further finding(s) in files this change does not touch: reported, not graded (0 critical, 3 high).
glambot (presentation quality): 95 finding(s)
  • info GS-001 — Install git-seo for comprehensive SEO analysis: https://github.com/hyperpolymath/git-seo
  • info MACH-007 — ECOSYSTEM.scm not found in .machine_readable/ directory.
  • info MACH-007 — META.scm not found in .machine_readable/ directory.
  • info MACH-007 — STATE.scm not found in .machine_readable/ directory.
  • info MACH-005 — No robots.txt found. Consider adding one for crawler control.
  • info VIS-005 — PROOF-STATUS.adoc:33 — Line 85 characters exceeds max length of 80.
  • 89 further finding(s) in files this change does not touch: reported, not graded (0 critical, 2 high).
rhodibot (RSR compliance): 13 finding(s)
  • 13 further finding(s) in files this change does not touch: reported, not graded (0 critical, 12 high).
accessibilitybot: not_applicable — template default: enrol once the repository serves HTML
  • ⚪ not applicable: template default: enrol once the repository serves HTML
cipherbot: not_applicable — template default: enrol once the repository implements cryptography
  • ⚪ not applicable: template default: enrol once the repository implements cryptography
echidnabot: not_applicable — template default: enrol once the repository carries proofs and an ECHIDNA engine is configured
  • ⚪ not applicable: template default: enrol once the repository carries proofs and an ECHIDNA engine is configured
panicbot: not_applicable — panic-attack is already graded by the verdict grid's own panic-attack row, from static-analysis-gate.yml evidence; enrolling panicbot would report one scanner twice and give two rows that can disagree
  • ⚪ not applicable: panic-attack is already graded by the verdict grid's own panic-attack row, from static-analysis-gate.yml evidence; enrolling panicbot would report one scanner twice and give two rows that can disagree
seambot: not_applicable — template default: enrol once a seam register exists at spec/seams/seam-register.json
  • ⚪ not applicable: template default: enrol once a seam register exists at spec/seams/seam-register.json
sustainabot: not_applicable — reserved fleet slot; no adapter exists (gitbot-fleet bots/sustainabot/README.adoc)
  • ⚪ not applicable: reserved fleet slot; no adapter exists (gitbot-fleet bots/sustainabot/README.adoc)

Scope: static findings reported by each row's tool at the named commit. The table grades only findings in files this change touches, so the colour answers "does this change introduce anything?", not "what does the whole repository still carry?". Standing findings are counted in each accordion and in report.json; the baseline filter remains the place where acknowledged debt is recorded. The lane state is the worst GATING row; advisory rows are listed and counted but never set it. Purple, red, yellow and blue grade the worst GRADED finding present; orange is evidence missing, malformed or a scanner that did not run; grey is an explicit scope exclusion with its reason. No row is a security certification. report.json, badge.json and the raw findings are in the verdict-grid artifact on the linked run.

hyperpolymath added a commit to metadatastician/standards that referenced this pull request Dec 1, 2026
…t (§8.4) (#1726)

## Summary

This adds one shared, tested scan for the prover-supplied postulates of
an Agda import cone (PROOF-POLICY §8.4). It replaces each home
repository's own lexical scanner, which closes a class of bypasses at
the source.

## The hole, confirmed

The hole was reported by the CodeRabbit review on
metadatastician/lintel#31, at `scan-agda-postulates.awk` line 145.

- Agda 2.6.4.3 accepts `postulate Level : LevelUniv; Hidden : Level`,
with two postulates on one line separated by a semicolon.
- The awk scanner stops at the first colon, so it reports `Level` and
never sees `Hidden`.

I copied the prover's data directory, edited `Agda.Primitive` that way,
and pointed Agda at the copy with `Agda_datadir`. Then:

- lintel `main` (`434228b`): `scripts/check-trusted-base.sh` prints PASS
on every step and exits 0;
- secret-types `main` (`c772168`): same, PASS and exit 0;
- a `--safe --without-K --cubical-compatible` module that uses `Hidden`
type-checks.

## What this adds

- **`scripts/agda-postulates.js`** (Bun or Node, plain JavaScript). It
lexes no Agda source; instead it reads the pages `agda --html` writes
for the cone.
- A postulate is an anchor that Agda marks `Postulate` at its own
definition site.
- A binding is a `{-# BUILTIN … #-}` pragma whose name links to that
site. It is matched by position, not by short name.
- It refuses (exit 3) a page it cannot read, a cone module with no page,
a page outside the cone, an unknown entity, and two postulates with one
name in one module.
- **`scripts/check-agda-trusted-base.sh`**, the gate:
  1. runs a live semicolon control on the prover in use;
2. type-checks the root under the home gate's flags with
`--dependency-graph --html`;
3. sorts each cone module as development (`--include`) or
prover-supplied (`lib/prim`);
  4. refuses any postulate in a development module;
  5. requires the prover's postulates to equal `--expect`.

  `--cone-out` hands the cone to the home repository's input-set check.
- **`proof-receipt.sh --trusted-base`** prints `receipt_trusted_base`
unchanged. The gate's `--expect` is then the list the receipt records.
- **`scripts/tests/agda-trusted-base-test.sh`** plus fixtures, run in CI
by a new job in `proof-receipt-tools.yml`. The job uses the
digest-pinned `debian:13-slim` image with `agda-bin=2.6.4.3-1+b2`, the
homes' pin.
- **PROOF-POLICY §8.4** names the shared implementation and the
semicolon case.

## Testing

Run with Agda 2.6.4.3 built from Hackage (the Debian mirror was blocked
in that container) and Bun 1.4.4.

**`agda-trusted-base-test.sh`: 24 passed, 0 failed.**
- Reader:
  - one postulate per line, and several on one line split by semicolons;
- `where` blocks, nested modules, `mutual`, `private` and `instance`
blocks;
- the word `postulate` in a line comment, a block comment, a nested
comment, a pragma and a string literal, none of which may be reported;
- BUILTIN-bound postulates, an unbound one, and a `primitive`, which
must not be reported;
  - names that HTML escapes (`_<&>_`, `a'b`).
- Reader refusals: missing page, extra page, unknown attribute, unknown
entity, torn anchor, duplicate name, and a usage error (exit 2).
- Gate:
  - passes on the declared list;
- fails on an undeclared postulate, a declared one the cone lacks, a
changed binding, a declared unbound line, and a postulate in a
development module;
  - reads the declared list from stdin;
  - fails on the altered prover.

**Mutation check.** Three broken readers each fail the suite:
- matching the class exactly, which drops operators: 8 failures;
- keeping only the first postulate per module: 14 failures;
- binding by short name: 9 failures.

**Other checks.**
- `proof-receipt-test.sh`: 198 passed, 0 failed, including 3 new
`--trusted-base` cases.
- actionlint 1.7.12, the build pinned by
`scripts/actionlint-1.7.12.sha256`, is clean.
- shellcheck 0.9.0 is clean apart from SC2015 on the test's `ok`/`bad`
idiom, which this repo's other tests also use.
- `check-pipe-grep-q`, `check-workflow-duplicate-keys` and
`check-inline-python` pass.

**Observed on 2.6.4.3 while building the fixtures.**
- Explicit braces after `postulate` (`postulate { A : Set ; B : Set }`)
are a parse error.
- A form feed after `postulate` makes the next name a bare signature,
which is an error.

Neither is a route to an unseen postulate on this prover.

**Verified in the home repositories' CI.** The shared gate runs and
passes on Debian `agda-bin` 2.6.4.3 in both home PRs' proofs jobs (live
control PASS, trusted base PASS).

**Not verified yet.**
- This PR's own CI job has not run.
- The tampered-prover control needs Debian's `agda-bin` to honour
`Agda_datadir`. If it does not, the test fails loudly ("does not honour
Agda_datadir") and does not skip.

## Home repositories (draft PRs, pinned to `5addf98`)

- metadatastician/lintel#37
- hyperpolymath/secret-types#62

Each repins to this PR's merge commit before leaving draft.

The commit is signed with the session's SSH signing key and committed as
noreply@anthropic.com, not with the owner's `id_ed25519_signing`. The
owner chose to remake it at repin time.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
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