Skip to content

registry: propose ADR 0005, a canonical JCS JSON route for proof receipts (prototype, unwired) - #103

Open
hyperpolymath wants to merge 1 commit into
mainfrom
claude/jcs-json-receipt
Open

hyperpolymath wants to merge 1 commit into
mainfrom
claude/jcs-json-receipt

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

This PR follows the owner ruling of 2026-11-16. trope-checker will not emit a praxis deed. Instead, the reader in Mathesis should also accept a proof receipt written as canonical JCS I-JSON. This PR is a proposal: an ADR with status proposed, a prototype reader and tests. Nothing is wired into the registry.

  • It does not change claims-registry.mjs, the pinned canon reader or READER.sha256.
  • It does not add trope-checker rows to claims.jsonl.
  • It touches no file that an open PR touches. All three files are new.

Changes

  • docs/decisions/0005-jcs-json-receipt.adoc (proposed). It covers:
    • the JSON form, mapped one to one onto the §8.5.1 deed fields;
    • JCS canonicality as a hard requirement, because the sha256 pin needs one byte form;
    • the I-JSON constraints;
    • why there is no pwg and no foundation_diverse: a receipt that asserts a grade is refused (§8.4, WO 2.4);
    • the full list of refusals;
    • how wiring would work once the ADR is accepted;
    • a gap list for trope-checker's verification/pwg.json;
    • four open questions for the owner.
  • scripts/registry/json-receipt.mjs is the prototype. First it checks the JSON layer: strict UTF-8, no BOM, bytes equal to JCS, I-JSON code points, a closed typed schema, no asserted grade, 40-hex commits, single-line values, and result ∈ {pass, fail} consistent with state. Then it writes the receipt as §8.5.1 deed text and lets the pinned canon reader derive the grade. The reader's own :pwg and :foundation-diverse check is the oracle: for each claim, exactly one pair in the closed vocabulary is accepted. The prototype adds no grading rule.
  • tests/registry/json-receipt.test.mjs: 39 tests.

Testing

MATHESIS_STANDARDS=<standards @ e5a39d7> bun test tests/registry/ gives 68 pass and 0 fail. The reader digest 37ff85be… was verified.

  • Equivalence. Three real deeds go from deed to record to JSON and back to record, and the result is byte-identical under JCS:
    • verification/receipts/theory_praxis.deed: THY-1 and APP-1 to APP-4, all PWG-1;
    • standards example_praxis.deed: PWG-3;
    • standards echo_praxis.deed: PWG-1 through an echo.
  • Derivation. If THY-1's Lean leg is set to BRIDGE-PENDING, the derived grade is PWG-2i and the other claims stay PWG-1. My first expectation here was PWG-2ii, and the test caught the mistake. The reader's rule is [PWG-3, PWG-2i, PWG-2ii][#recheck legs].
  • Falsified first. There are 36 refusal cases. Each one is valid JSON with one defect: non-canonical (×5), BOM, unknown fields (×3), asserted grades (×4), short or uppercase commits (×3), trailing newline or tab or empty or over-long values (×5), results outside pass|fail or contradicting the state (×5), lone surrogate, number, boolean, null, symbol injection, wrong profile, and four reader-level refusals (uppercase token, Agda route, manifest digest, duplicate claim id).
    • With JSON_RECEIPT_STUB=1, the suite runs against a permissive stub that only does JSON.parse. Result: 3 pass, 39 fail. All 36 refusal tests fail, and so do the 3 tests that need the real reader.
    • A standing control asserts on every run that the stub accepts every case.
  • trope-checker fixture. verification/pwg.json is fetched at 0dceab68… and its sha256 is checked (3bf20a2e…5bda). The file is not vendored. The test confirms the file is canonical JCS and confirms the prototype refuses it (unknown field commit). Given to the pinned deed reader as it stands, the file fails with "line 1: line is 26347 octets", as the brief said.
    • Note: this one test needs network access to raw.githubusercontent.com, as registry-check already does. A failed fetch fails the test; it is never skipped.
  • asciidoctor --failure-level WARN renders the ADR clean.

Decisions for the owner (open questions in the ADR)

  1. Should the destination be a standards change, splitting the canon reader into parse and derive(record), with this prototype retired once that lands? This is the most elegant arm, and the ADR recommends it as the destination. The oracle approach exists only because the reader pin must not change.
  2. §8.5.3 git checks: standards' check-proof-receipt.sh reads deeds only. Until it reads JSON, a JSON receipt would be catalogued at PWG-2ii at most.
  3. Keep result? It is the one JSON field with no deed counterpart.
  4. Final LF: allow it, as the estate gate does, or require bare JCS?

Beyond this repo (trope-checker)

The file needs these changes before it can be read as a receipt. They are listed in the ADR:

  • inputs: a §8.5.1 SHA-256 manifest, instead of a git tree SHA-1;
  • axiom dispositions, which are the owner's call;
  • lowercase §5 tokens; PROVEN-WITH-AXIOMS and NOT-INVENTORIED are not in the reader's vocabulary;
  • Agda route source instead of re-proved;
  • receipts nested in their legs;
  • claims with no Agda leg, and the engineering claim, left out.

RSR Quality Checklist

  • Tests pass (bun test tests/registry/)
  • No banned language patterns (Bun JS only)
  • SPDX headers on all new files
  • No secrets
  • docs/decisions/ updated: added as proposed; the owner accepts ADRs

Generated by Claude Code

…ipts

Owner ruling 2026-11-16: rather than trope-checker emitting a deed, the
reader in Mathesis should also accept a receipt that is canonical JCS I-JSON.
This adds the proposal and an unwired prototype.

docs/decisions/0005-jcs-json-receipt.adoc (status: proposed) maps each JSON
field one to one onto the PROOF-POLICY 8.5.1 deed fields, with no pwg and no
foundation_diverse. It makes JCS canonicality a hard requirement, and lists
what the reader refuses.

scripts/registry/json-receipt.mjs checks the JSON layer, writes the receipt as
8.5.1 deed text and lets the pinned canon reader derive each grade. The
reader's own grade check serves as the oracle, so the prototype has no
grading rule. claims-registry.mjs, READER and claims.jsonl are unchanged.

tests/registry/json-receipt.test.mjs: three real deeds round-trip to an
identical record. 36 refusal cases are each refused, and each is accepted by
a permissive stub (JSON_RECEIPT_STUB=1 makes all 36 fail). trope-checker's
verification/pwg.json is fetched at 0dceab6, checked against its sha256, and
refused.

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

Copy link
Copy Markdown

@hyperpolymath
hyperpolymath marked this pull request as ready for review November 16, 2026 23:35
@hyperpolymath
hyperpolymath enabled auto-merge (squash) November 16, 2026 23:36
@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-16T23:36:01.990969Z
We couldn’t complete this review. Comment @codex review to try again.
47c1697 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.

@coderabbitai

coderabbitai Bot commented Nov 16, 2026

Copy link
Copy Markdown

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 14 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 327e4d2 and 47c1697.

Files selected for processing: 3

  • docs/decisions/0005-jcs-json-receipt.adoc
  • scripts/registry/json-receipt.mjs
  • tests/registry/json-receipt.test.mjs

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

hyperpolymath added a commit that referenced this pull request Nov 17, 2026
…rkers (#105)

## Summary

This refreshes the census rows for hyperpolymath/hypatia,
metadatastician/standards and the 14 rows that have Idris2 proofs and a
non-zero `unsafe` count. The hypatia row now covers the actions.lock
closure work in hyperpolymath/hypatia#1026 and
hyperpolymath/hypatia#1187.

This PR first carried its own fix for a scanner false positive: the
Idris2 function `partial'` was counted as four `partial` annotations.
#101 landed on main meanwhile with the same fix, applied to every marker
rule. The merge `39ea12a` keeps main's scanner and drops this PR's
narrower rule and test. **The PR now changes census data only.**

## Changes

| Repository | Change |
|---|---|
| hyperpolymath/hypatia @ `29a9e4a` | own files 58 → 77, declarations
680 → 1040, unsafe 0 |
| metadatastician/standards @ `b49a33e` | own files 2 → 3, declarations
40 → 66 |
| hyperpolymath/echidna | own files 170 → 163, declarations 1969 → 1676,
from its newer commits |
| 13 other Idris2 rows with unsafe markers | move to their current
commits; counts unchanged |

The 13 rows in the last line are ambientops, deed-core,
developer-ecosystem, ephapax, poly-ssg, proven, raze-tui, reposystem,
ssg-collection, cerro-torre, gossamer, paint-type and vordr.

No unsafe count changed in the 14 refreshed Idris2 rows. Their markers
are real `partial` annotations, and the false positive affected only
hypatia.

`docs/atlas/generated/*` is regenerated with `census-atlas.mjs build`
and `render-catalogue.sh`.

## Follow-up

Standards' row still names `docs/proof-debt.adoc` as its status
document. standards#1635 renames standards' record to
`3-practice/PROOF-STATUS.adoc` and retires that ledger. Once it merges,
one more `update-rows.sh metadatastician/standards` will name the new
file.

## RSR Quality Checklist

### Required

- [x] Tests pass: `tests/census/*.sh` all pass, `bun test
tests/atlas/census-atlas.test.mjs` 13/13
- [x] Catalogue matches rows; `census-atlas.mjs check` PASS
- [x] No banned language patterns, no secrets
- [x] No source files changed

### As Applicable

- [ ] Deed and ROADMAP: not changed; project state did not change

## Open PRs this touches

This PR changes only `docs/atlas/census/rows.jsonl` and the four
generated atlas files. Of the other open PRs:

- **#98** refreshes the same hypatia row at
`6f3f16f`. This PR refreshes it at `29a9e4a`, which is later and
includes hypatia#1187. If this merges, #98 is superseded.
- **#96** (resource-algebra row) and
**#100** (ddraig-ssg row) refresh different rows.
They still edit the same files, so whichever merges second will
conflict. To resolve, rerun `scripts/census/update-rows.sh` for its row
on top of the new main, then regenerate. Do not hand-merge the generated
files.
- **#99** touches
`docs/atlas/generated/registry.adoc`, which this PR does not change.
**#102** and **#103** do not
overlap with this PR.

## Testing

Ran `update-rows.sh` on the 16 repositories on top of main at `261e6dc`.
Then ran the census tests, the catalogue diff, and the atlas build,
check and tests.

No licence content is touched.

https://claude.ai/code/session_01TbbnKqskQA5mj5gfMniPzi


---
_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.

3 participants