Repository navigation
feat(canonical): JCS (RFC 8785) canonical JSON, verified against ijson-jcs; the KYAML ratchet - #159
Merged
Merged
Conversation
…estate's ijson-jcs crate; the KYAML ratchet src/canonical.jl adds MetaManifold.Canonical -- jcs_bytes(x) and jcs_sha256(x) -- the deterministic byte form of a JSON-shaped value for hashing, signing and content-addressing: object keys sorted by UTF-16 code unit (so an astral-plane key sorts before a high-BMP key, the trap naive code-point ordering misses), Float64 values serialized per ECMAScript's Number::toString (shortest round-trip digits, positional between 1e-6 and 1e21, a signed exponent outside it, -0.0 collapsed to 0), integers outside I-JSON's exact range and NaN/Inf refused as no consumer reads them back as the same value. The oracle is the estate's ijson-jcs crate (Rust, RFC 7493 + RFC 8785): the eleven cases in test/fixtures/jcs_oracle.jsonl were PRODUCED by that crate, and test_canonical.jl asserts this implementation reproduces every one byte-for-byte -- key sorting including the astral case, the ES number table (4.50, 2.4499999999999998e16, 1e30, 1e-6, 1e-7, 1e21, 1e20, subnormals, -0.0), string escaping, nesting, literals -- plus hand-written testsets for key-order irrelevance, the refusals, and the content-address property (a chart spec built in any key order hashes identically). Verified 22/22. KYAML (YAML-POLICY Y-3): the standards repo's kyaml-format.sh is adopted verbatim, and a ratchet testset runs it --check over every tracked *.kyaml. Tool-named files keep their extensions per D307, and the shared config defaults convert as an upstream unit rather than unilaterally -- this repo's YAML is upstream-shared or tool-named, and the policy's own sequencing calls unconverted files backlog, not violations. New estate-owned YAML config is written as .kyaml from now on, and this gate holds it to form. Stacked on #157 (the root-completions PR); rebase onto main once that lands. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
|
Warning Review limit reachedYou'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 11 minutes. View limit details
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. Comment |
|
hyperpolymath
enabled auto-merge (squash)
October 15, 2026 17:08
hyperpolymath
disabled auto-merge
October 15, 2026 17:08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What this adds
MetaManifold.Canonical—jcs_bytes(x)andjcs_sha256(x): the deterministic byte form of a JSON-shaped value for hashing, signing and content-addressing, per RFC 8785. Object keys sort by UTF-16 code unit (an astral-plane key sorts before a high-BMP key — the trap naive code-point ordering misses); Float64 values serialize per ECMAScript'sNumber::toString(shortest round-trip digits, positional between 1e-6 and 1e21, a signed exponent outside it,-0.0collapsing to0); integers outside I-JSON's exact range and NaN/Inf are refused, as no consumer reads them back as the same value.The oracle is the estate's own
ijson-jcscrate (Rust, RFC 7493 + RFC 8785): the eleven cases intest/fixtures/jcs_oracle.jsonlwere produced by that crate, andtest_canonical.jlasserts this implementation reproduces every one byte-for-byte — the ES number table (4.50→4.5,2.4499999999999998e16→24500000000000000,1e30→1e+30,1e-6→0.000001,1e-7→1e-7,1e20positional but1e21exponential, subnormals,-0.0→0), string escaping, and the astral-sort case. Plus hand-written testsets for key-order irrelevance, the refusals, and the content-address property.KYAML (YAML-POLICY Y-3): the standards repo's
kyaml-format.shis adopted verbatim, and a ratchet testset runs it--checkover every tracked*.kyaml. Per D280/D307: tool-named files keep their extensions, and the shared config defaults convert as an upstream unit, not unilaterally — this repo's YAML is upstream-shared or tool-named, and the policy calls unconverted files backlog, not violations.This is the first slice of the ijson-jcs adoption: the writer and the differential-oracle verification. Wiring canonical hashes into
attestation.ymland the analysis routes is deliberately not here — those are upstream-shared files and deserve upstream discussion first.Verification
test_canonical.jl, 285/285 with the pin suite.Julia tests(which installs the pinned R) is the full-suite authority.Notes
This is #158 rebuilt on
main: #157's merge auto-closed the stacked original, and the single commit's tree is byte-identical to it. The commit is unsigned — the shared signing agent died mid-session (the fragility the launcher's--agentmode exists to fix; itsssh-addstep needs the passphrase interactively).Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe vibe@mistral.ai