refactor(#57): kill the utils dumping grounds + cohesive b64 (naming + error de-collision)#62
Merged
Merged
Conversation
…r 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>
…er 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>
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>
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>
…_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>
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>
Removes the last hand-rolled Base64 integer encoder. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…te-utils # Conflicts: # CHANGELOG.md
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
Completes the remaining #57 work (PR #60 delivered only part 1, the
utils/→b64/rename). Design-first: spec + plan underdocs/superpowers/. Seven gated, behaviour-preserving commits — the full suite (1679 tests) andkeripy_diffdifferential vectors stay green throughout.src/stream/util.rsandsrc/core/utils.rsare deleted, their contents rehomed.b64is now a pure, dependency-free primitive leaf with a single byte lookupb64::alphabet::b64_byte_to_indexand theencode_int/decode_intcodec pair. The char lookup,stream::util::b64_char_to_value, andstream::binary::b64_val(the Base64 char→value lookup was triplicated) collapse to that one primitive. The integer encoder (also triplicated:b64::encode_int,stream::util::int_to_b64, a hand-rolled indexer copy) now routes throughb64::encode_inteverywhere.stream(deliberate deviation from the issue's literal "b64 owns qb64↔qb2" — keepsb64a leaf; mirrors keripy's_infil/_binfilliving on Matter).stream/binary.rs→stream/qb2.rs.core/utils.rstocore/matter/code/hard.rs(co-located with their only caller).indexer::error::{ParseError, ValidationError}→{IndexerParseError, IndexerValidationError}, sostream::ParseErrorandmatter::ValidationErrorare now each defined exactly once. Per-module error enums are kept (documented rule).utils→b64) + new Naming Conventions section; CHANGELOG breaking-change entries.Breaking changes
b64::decode_to_int→b64::decode_int(input bound widenedAsRef<str>→AsRef<[u8]>).b64::alphabet::b64_char_to_index(char) →b64_byte_to_index(u8).core::indexer::error::{ParseError, ValidationError}→{IndexerParseError, IndexerValidationError}.stream::utilmodule removed (int_to_b64/b64_to_intgone — useb64::encode_int/b64::decode_int).stream::binarymodule renamedstream::qb2(the re-exportedstream::qb64_to_qb2/stream::qb2_to_qb64paths are unchanged).Test plan
nix flake checkgreen (clippy across features, nextest 1679, wasm, no_std, doctest, typos, deny, audit, fmt, taplo)keripy_diffdifferential vectors green (proves byte-identical output vs the keripy reference)Closes #57.
🤖 Generated with Claude Code