feat(iid): add canonical IID parsing and derivation - #18
Merged
Conversation
- Port the reference implementation from the private source (0xIntuition/intuition-v2 @ 8b9e9aa11): all 26 scheme canonicalizers, NORM-1, gen1 preimage/hash, geohash, UUIDv5/podcast-guid, keccak16. - Fix the parser value character class to the spec grammar (%x21-7E): space and non-ASCII values now reject as malformed, matching the normative parse vectors (recorded in iid-spec implementation-notes). - Redesign the identity-ladder contract around the public declarative source/recipe types (field, same-as, url-origin, geohash, podcast-guid, and the frozen named derivations) and implement the pure declarative derivation engine that interprets them; ladders are serializable data, never callbacks. - Add the typed inspection API (inspectIntuitionId) distinguishing malformed / unknown-scheme / noncanonical, with canonical repair for read paths, plus anchor-eligibility reasons (class-c vs polymorphic). - Execute the full 145-vector conformance corpus from @0xintuition/iid-spec in the test suite (212 tests) alongside ported and new engine tests. - Register iid second in the central package registry. Identity impact: none — no existing golden bytes change; all spec-stated golden values (ISBN upconversion, gen1 movie r4) reproduce exactly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
P02 of the iid-v1.1.0-alpha release train. Adds
@0xintuition/iid— the pure, offline IID reference implementation: parsing, typed validation, all 26 scheme canonicalizers, NORM-1,gen1derivation, and the new declarative identity-ladder engine.Ported from the authoritative private reference (
0xIntuition/intuition-v2@8b9e9aa11), with two deliberate design changes over the private code:field,same-as,url-origin,geohash,podcast-guid, named derivationsacct-strong/acct-weak/appid-bundle/rss-item/termset-term/caip10-eoa/caip10-contract/caip19-erc20; recipe fieldsfield/year/text-hash/geohash). The engine interprets them as a pure function; no engine for these existed anywhere before this PR. Field keys per derivation are documented on the engine and frozen.same-asselection is order-independent (lexicographically smallest canonical wins).%x21-7E— space/non-ASCII values reject as malformed. The private parser's catch-all was recorded in iid-spec's implementation-notes; the two normative parse vectors it failed now pass.Also adds the typed result API the plan calls for:
inspectIntuitionIddistinguishesmalformed/unknown-scheme/noncanonical(with canonical repair for read paths — resolvable historical spellings are never valid new anchors) and reports anchor-ineligibility reasons (class-cvspolymorphic-scheme).Package impact
@0xintuition/iid0.1.0-alpha.0Target versions
@0xintuition/iid@0.1.0-alpha.0. Peer:viem ^2.0.0. Dev: exact@0xintuition/iid-spec@0.1.0-alpha.0(conformance corpus input).Identity impact
Identity impact: none — no existing golden bytes change. All spec-stated golden values reproduce exactly (ISBN-10→13 upconversion,
gen1movie r4fb681afe…, golden ISRC).Fixture impact
none added; the full 145-vector corpus from
@0xintuition/iid-specexecutes in this package's tests (212 tests, Node via vitest; the clean-room smoke covers Bun).Contract artifact
n/a
Rollout notes
.and./package.jsonentrypoints with compiled output; 12-package clean-room smoke passes on Node+Bun.🤖 Generated with Claude Code