feat(iso8583): freeze-prep — lock down Bitmap, rename PutTag→SetTag#9
Open
canaan5 wants to merge 2 commits into
Open
feat(iso8583): freeze-prep — lock down Bitmap, rename PutTag→SetTag#9canaan5 wants to merge 2 commits into
canaan5 wants to merge 2 commits into
Conversation
API freeze-prep ahead of v1: enforce the always-derived bitmap invariant through the type system, and align tag-write naming with the field API. - Unexport the engine-internal Bitmap mutators Set/Clear/SetWord so application code cannot mutate a bitmap directly (the wire bitmap is always derived from the present-field set at marshal time). The read surface is unchanged. - Add immutable constructors iso8583.BitmapFromWords([3]uint64) (wire/word-level, used by BitmapCodec implementations) and iso8583.BitmapFor(des ...int) (by present DE, for codec authors and tests). - Update the internal engine, the fieldcodec bitmap codec, and tests to the new constructors. - Rename Message.PutTag -> SetTag for consistency with Set/SetS/SetP; update the two callers (message.go, fieldcodec/tlv). Breaking (pre-1.0). gofmt/go vet clean; full suite passes under go test -race.
This was referenced Jun 3, 2026
# 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.
API freeze-prep ahead of v1. Closes two of the four
iso8583seams from the API-surface audit. Breaking (pre-1.0); full suite passes undergo test -race.1. Lock down the
BitmapmutatorsThe design guarantees the wire bitmap is always derived from the present-field set — yet
Bitmap.Set,Clear, andSetWordwere exported, contradicting that invariant and freezing engine internals into the v1 surface.Set/Clear/SetWord(engine-internal).iso8583.BitmapFromWords([3]uint64)— wire/word-level, forBitmapCodecimplementations (replaces the codec's use ofSetWord).iso8583.BitmapFor(des ...int)— by present DE number, for codec authors and tests.IsSet,Word,Count,Width,Range,String.2. Rename
Message.PutTag→SetTagConsistency with the
Set/SetS/SetPfamily. Updated the two callers (message.go,fieldcodec/tlv).Verification
gofmt -lclean,go vet ./...clean.go test -race ./...— all packages pass.message.go,codec.go),fieldcodec/bitmap.go, and internal/external tests.Still open from the audit (not in this PR — they're design calls)
GetTag/SetTag/TagSeq/LookupTag) rather than flowing through the unifiedFieldPathgrammar, andSetTagstill takes aValuewhileSettakesany. Bigger decision — flagged for follow-up.FieldDefexposes public struct fields;WidthCodecand theDescribefamily want a confirm-or-change pass.ARCHITECTURE.md§2.4 still showsBitmap.Setas exported (design doc vs. impl drift) — minor doc follow-up.