Repository navigation
Add existing-ID codecs, input diagnostics and a Bech32m comparison form - #4
Merged
Merged
Conversation
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.
Applications with existing IDs can encode uint64/UUID values reversibly, without allocating a second random alias. This adds
createReferenceCodec, opt-in input diagnostics and an explicit v1 format structurally separate from alpha.1 random references. Existing parse result shapes, error precedence and legacy formats remain compatible.The return-lookup form compares RefMint with an independent
bech32@2.0.0Bech32m adapter using identical IDs, input rules, records and diagnostics. Both match all 28 scenarios and reject all 1,576 selected single-symbol mutations. Canonical sample lengths are identical (17 numeric, 39 UUID).Checksum evaluation now streams symbols through a precomputed 32-entry feedback table; presentation validation avoids allocations on the common valid-ASCII path; bigint decoding uses exact chunks of at most 50 bits. An optional
refmint/codecimport excludes the random generator and collision planner. The original root import retains every API. JS output omits implementation comments while source and declaration JSDoc are preserved; no runtime dependency was added.Measured size, including the application adapter:
A same-process Node 24.19.0 / Apple M3 run of the same 28 cases measured medians of 556,352 checks/s before optimization, 1,779,391 after, and 822,457 for the unchanged Bech32m adapter. Nine rotated-order rounds consume results; raw samples and source hashes are in
docs/optimization.json. All 123,146 differential comparisons with the previous build matched. This is a local workload-specific result, not a general performance or human-entry claim.Validation: 36 core tests, TypeScript, 2 HTTP server tests, comparison evidence checks and offline package installation pass locally. Tests cover frozen vectors, independent checksum oracle, every UUID bit boundary, ASCII input substitutions and both installed export paths. The form was also checked in the in-app browser. All six CI jobs passed on
531775d9e8c36471b04ad40ccb30c2dcbbac5d3d: Node 22/24/26 on Linux, Node 24 on Windows/macOS, and all 15 Chromium/Firefox/WebKit tests. Local Playwright engines were unavailable; browser-suite results are from hosted CI. CI run.Run
pnpm build && pnpm compare && pnpm demo, then open/comparison/. Seedocs/comparison.mdfor reproduction (including the prior commit), measurement boundaries and tradeoffs;docs/format-v1.mdfreezes the wire contract. This PR prepares0.1.0-alpha.2: package version, changelog, installation links and evidence metadata are updated. The release will include a package archive and all three comparison/evidence reports.Browser CI uses the official Playwright 1.64.1 image pinned by digest, with the matching unprivileged user and a writable pnpm install prefix. Its preinstalled engines and OS dependencies avoid repeated downloads from the runner's apt mirror. All six release-preparation jobs passed on the current head.