Skip to content

feat(#67)!: infallible Matter::to_qb64 in core (text encoding without stream)#78

Merged
joeldsouzax merged 8 commits into
mainfrom
feat/67-matter-to-qb64-in-core
Jul 5, 2026
Merged

feat(#67)!: infallible Matter::to_qb64 in core (text encoding without stream)#78
joeldsouzax merged 8 commits into
mainfrom
feat/67-matter-to-qb64-in-core

Conversation

@joeldsouzax

Copy link
Copy Markdown
Contributor

Summary

Resolves the DevX / layering wart in #67: encoding a Matter-family primitive (Verfer, Diger, Saider, Prefixer, Signer, Cigar) to qb64 text no longer requires the stream feature.

  • core: Matter<C> gains infallible to_qb64() -> String and to_qb64b() -> Vec<u8>, co-located with the existing decode path (MatterBuilder::from_qualified_base64). Mirrors the sibling Indexer::to_qb64/Siger::to_qb64 contract — the only failure modes are internal-invariant breaks (corrupt sizage table / mis-sized buffer), unreachable for a validated Matter, handled via unreachable!/assert_eq! (programmer-bug carve-out, not a data path).
  • stream: stream::encode::matter_to_qb64 removed; all consumers (3 examples, 1 bench, 1 fuzz test) migrated to the new API. examples/encode_primitive now needs only core, not stream — a direct demonstration of the issue's goal.
  • serder: to_qb64_string / identifier_to_qb64_string (and the internal seal_to_json / matters_to_json_array) are now infallible (-> String / -> Value); the misplaced SerderError::Qb64Encoding(ParseError) and its dead companion SerderError::Encoding(FromUtf8Error) are removed. Fixes the error-domain smell where a read-path ParseError surfaced on a write path.

Breaking changes (MINOR under 0.x — see CHANGELOG)

  • stream::encode::matter_to_qb64 removed → use Matter::to_qb64b.
  • serder::primitives::{to_qb64_string, identifier_to_qb64_string} return String instead of Result<String, SerderError>.
  • SerderError loses the Qb64Encoding and Encoding variants (breaking for downstream exhaustive match).

Test Plan

  • nix flake check green — all 11 checks (clippy god-level, rustfmt, taplo, audit, deny, nextest across feature combinations, doctest, wasm, no_std). 1777 tests pass.
  • Round-trip tests relocated into core and run without the stream feature: from_qualified_base64(x) ↔ to_qb64b()/to_qb64() across fixed, variable-soft, typed/untyped codes.
  • Added ls>0 (lead-byte) and xs>0 (xtra underscore-fill) coverage — mutation-proven: each new test fails under the corresponding one-line mutation.
  • Encode/decode verified as exact inverses (matching framing arithmetic, inverted).

Closes #67.

🤖 Generated with Claude Code

joeldsouzax and others added 8 commits July 4, 2026 23:09
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… variants

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The typos gate splits "mis-sized" on the hyphen and flags the "mis"
fragment as a typo of miss/mist. "mis-sized" is a valid hyphenated
compound (incorrectly sized) used in Matter::to_qb64b's doc comment;
allow it the same way existing domain-term false positives are handled.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codspeed-hq

codspeed-hq Bot commented Jul 5, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 21 untouched benchmarks


Comparing feat/67-matter-to-qb64-in-core (0fe2246) with main (1c62ce8)

Open in CodSpeed

@joeldsouzax joeldsouzax merged commit dd304d1 into main Jul 5, 2026
6 checks passed
@joeldsouzax joeldsouzax deleted the feat/67-matter-to-qb64-in-core branch July 5, 2026 13:01
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.

qb64 encoding of a Matter requires the stream feature (encode/decode live in different layers)

1 participant