refactor(memo): fold encode_request and encode_name_note policy - #2
Open
craftsoldier wants to merge 1 commit into
Open
refactor(memo): fold encode_request and encode_name_note policy#2craftsoldier wants to merge 1 commit into
craftsoldier wants to merge 1 commit into
Conversation
extract classify_action(action, ua) so encode_request and encode_name_note share one copy of the Release-must-have-empty-ua / Claim-and-Update-must-have-non-empty-ua policy. The two encoders can no longer drift apart on the strictness check; one call site, one audit. No change to any emitted or accepted memo bytes. The sacred cross-language vectors in tests/vectors.rs are unchanged and still pass, as do all memo round-trip and reject tests.
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.
What
Extract
memo::classify_action(action, ua)soencode_requestandencode_name_noteshare one copy of the per-actionuapolicy check (Release must have emptyua; Claim and Update must have non-emptyua).Why
Both encoders previously had a byte-identical 6-arm
match action { Release if !ua.is_empty() => FieldCount, Claim | Update if ua.is_empty() => EmptyArg, ... }block. A future edit to one but not the other is a silent strictness divergence in the memo grammar. One call site, one audit, no drift. This is the audit observation D2 (encoder drift) indocs/code_review.md.Verification
No new clippy or doc warnings introduced by this change (pre-existing
type_complexitywarnings on the publicparse_*_memosignatures are unchanged).What this does NOT do
tagged_zns_hash's absorb steps) is tracked in a separate PR, since they target independent audit observations and can land or revert independently.