refactor(#57): rename utils→b64, split into int/binary/charset, + no_std stream fix#60
Merged
Conversation
Phase 1a of #57. The `utils` module was a non-name for what is the CESR Base64 codec. Rename module + feature `utils` -> `b64`, and rename the inner `utils::utils` (module inception) to `b64::alphabet`. All crate-wide paths (`crate::utils::*` -> `crate::b64::*`), the `b64` feature and its dependents (core, stream, default), and lib.rs updated. Internal file split (encode/decode -> int/binary, charset.rs) follows in 1b. `core::utils` (code-size helpers) is a separate module, renamed in a later phase. BREAKING CHANGE: `cesr::utils::*` is now `cesr::b64::*`; cargo feature `utils` is now `b64`. Refs #57
Phase 1b. b64::encode + b64::decode -> b64::int (int<->b64) + b64::binary (bytes->b64); extract b64::charset (is_b64_url_safe_charset) out of b64::alphabet. Behaviour-preserving; re-exports (cesr::b64::encode_int etc.) unchanged. BREAKING CHANGE: submodule paths cesr::b64::encode::* / cesr::b64::decode::* are now cesr::b64::int::* / cesr::b64::binary::*. Refs #57
cesr-nostd built alloc,core,b64,keri — omitting stream, even though stream is no_std-clean (it needs only `bytes`, not getrandom). Add it so the no_std check actually exercises the stream parser. crypto/serder stay excluded: getrandom has no RNG backend on a bare target (only the wasm `js` one). Refs #57
Merged
3 tasks
joeldsouzax
added a commit
that referenced
this pull request
Jul 2, 2026
…+ error de-collision) (#62) * docs(#57): design for killing the utils dumping grounds + naming/error cleanup Approved design for the remaining #57 work (PR #60 delivered part 1). Locks two decisions: keep per-module error enums (de-collide names), and keep b64 a pure primitive leaf with qb64<->qb2 staying code-aware in stream. Refs #57 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs(#57): implementation plan + spec refinements (byte lookup, lighter de-collision) Plan for the remaining #57 work in 7 gated behaviour-preserving tasks. Spec refined during planning: b64_byte_to_index becomes the single lookup primitive (char version was only used by decode), and error de-collision renames only indexer's two enums (resolves both clashes, avoids ~92 edits in matter/). Refs #57 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * refactor(#57): b64 byte lookup + decode_int (was decode_to_int) b64_char_to_index -> b64_byte_to_index (the single byte lookup primitive); decode_to_int -> decode_int with AsRef<[u8]> input. Behaviour-preserving. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * refactor(#57): delete stream/util.rs, route int/b64 codecs through b64 int_to_b64 -> b64::encode_int; b64_to_int -> b64::decode_int. Kills the second 'utils' dumping ground. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * refactor(#57): rename stream/binary.rs -> stream/qb2.rs, drop 3rd b64_val qb2.rs owns qb64<->qb2; its private b64_val is deleted in favour of b64::alphabet::b64_byte_to_index. Public stream::qb64_to_qb2 path unchanged. Also fixes benches/matter.rs (used the old stream::binary module path directly) and rewords a stream::binary reference in a b64::alphabet.rs doc comment. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * refactor(#57): move code-size lookups to core/matter/code/hard.rs Deletes the third 'utils' dumping ground (core/utils.rs); co-locates the hard-size lookups with their only caller, matter_code.rs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * refactor(#57): indexer int_to_b64 delegates to b64::encode_int Removes the last hand-rolled Base64 integer encoder. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * refactor(#57)!: rename indexer ParseError/ValidationError -> Indexer* BREAKING: de-collides the two error-enum name clashes (stream::ParseError and matter::ValidationError are now unique). Variants and messages unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs(#57): update module table, naming + error conventions, CHANGELOG Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <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.
Phases 1a–1b of the module/naming restructure (#57), plus a folded-in no_std CI fix. Behaviour-preserving throughout — gate green including keripy vectors,
cesr-wasm, andcesr-nostd.What changed
Phase 1a —
utils→b64(9eb3b96): theutilsmodule was a non-name for the CESR Base64 codec. Renamed module + cargo featureutils→b64, and killed theutils::utilsmodule-inception (→b64::alphabet). Whole-crate paths,lib.rs,Cargo.toml,flake.nix, and thefrozen_surfaceAPI-pin test updated.Phase 1b — split by responsibility (
26e2bfd):b64/encode.rs+b64/decode.rs→b64/int.rs(int↔b64, both directions) +b64/binary.rs(bytes→b64); extractedb64/charset.rs(is_b64_url_safe_charset) out ofb64/alphabet.rs.b64/is nowalphabet · int · binary · charset · error.no_std CI fix (
ac513f4):cesr-nostdbuiltalloc,core,b64,keri— omittingstream, even thoughstreamis no_std-clean. Added it so the no_std check exercises the stream parser. (crypto/serderstay out:getrandomhas no bare-target backend.)cesr::utils::*→cesr::b64::*utils→b64cesr::b64::encode::*/::decode::*→cesr::b64::int::*/::binary::*The re-exports (
cesr::b64::encode_int,decode_to_int,encode_binary,is_b64_url_safe_charset) are stable. 0.x → MINOR bump.Not in this PR (follow-up #57 phases)
Fold
stream/utilintob64; renamecore/utils→core/code_size; naming-convention sweep + CLAUDE.md update; CI trigger dedup. Tracked on #57.Verification
nix flake checkgreen: clippy, all tests + keripy differential vectors, doctest,cesr-wasm,cesr-nostd(now withstream).Refs #57
🤖 Generated with Claude Code