Skip to content

Add existing-ID codecs, input diagnostics and a Bech32m comparison form - #4

Merged
PerchAnton merged 5 commits into
mainfrom
refmint/existing-id-codec
Oct 27, 2026
Merged

PerchAnton merged 5 commits into
mainfrom
refmint/existing-id-codec

Conversation

@PerchAnton

@PerchAnton PerchAnton commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

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.0 Bech32m 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/codec import 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:

  • Previous full RefMint: 15,255 bytes; current full root: 14,147 bytes (7.3% smaller).
  • Current codec-only form: 8,773 bytes; Bech32m plus adapter: 9,327 bytes.
  • Summed per-file gzip still favors Bech32m: 3,353 vs 3,160 bytes. These are unminified module totals, not bundle or archive sizes.
  • Adapter code remains 4 vs 61 nonblank/noncomment lines; the logic lives in the library.

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/. See docs/comparison.md for reproduction (including the prior commit), measurement boundaries and tradeoffs; docs/format-v1.md freezes the wire contract. This PR prepares 0.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.

@PerchAnton
PerchAnton merged commit 6c89051 into main Oct 27, 2026
6 checks passed
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.

1 participant