Source
PR #144 R1 type-design review (MEDIUM finding, deferred to follow-up).
Problem
PR #144 introduced WireField (16 variants) and AllocationContext (11 variants) typed enums. AllocationContext applied a clean prefix discipline:
Inline* / Encoded* for the two compression-block read paths
Flat* for v3-v9 flat-layout
V10* for v10+-specific sites
Bytes suffix for raw byte buffers
WireField did NOT apply the same discipline. 4 variants are layout-version-specific but lack the prefix:
EntryCount is flat-index only (v3-v9). Should be FlatEntryCount.
NonEncodedCount is v10+ main-index only. Should be V10NonEncodedCount.
FileCount is FDI-only (bounded by fdi_size / MIN_FDI_FILE_RECORD_BYTES). Should be FdiFileCount.
DirCount is FDI-only (bounded by fdi_size / MIN_FDI_DIR_RECORD_BYTES). Should be FdiDirCount.
Tests reading WireField::FileCount at a matches! site can't tell from the name whether they're matching the FDI's file_count or some hypothetical future flat-index file_count. Display strings ("file_count", "dir_count") are similarly ambiguous.
Fix
Rename the 4 variants. Decide whether to break the Display strings too:
Option A — variant rename only, keep Display strings (preserves operator log greps):
WireField::FlatEntryCount // Display: "entry_count"
WireField::V10NonEncodedCount // Display: "non_encoded_count"
WireField::FdiFileCount // Display: "file_count"
WireField::FdiDirCount // Display: "dir_count"
Option B — rename both variant and Display string (symmetric, breaks dashboards):
WireField::FlatEntryCount // Display: "flat_entry_count"
WireField::V10NonEncodedCount // Display: "v10_non_encoded_count"
WireField::FdiFileCount // Display: "fdi_file_count"
WireField::FdiDirCount // Display: "fdi_dir_count"
Option A is safer for log-grep stability. Option B is more honest. Pick one and update the per-variant Display pin test (wire_field_display_tokens_are_wire_stable in error.rs).
Files
crates/paksmith-core/src/error.rs (definition + Display + pin test)
crates/paksmith-core/src/container/pak/index/{path_hash,flat,entry_header}.rs (call sites)
Source
PR #144 R1 type-design review (MEDIUM finding, deferred to follow-up).
Problem
PR #144 introduced
WireField(16 variants) andAllocationContext(11 variants) typed enums.AllocationContextapplied a clean prefix discipline:Inline*/Encoded*for the two compression-block read pathsFlat*for v3-v9 flat-layoutV10*for v10+-specific sitesBytessuffix for raw byte buffersWireFielddid NOT apply the same discipline. 4 variants are layout-version-specific but lack the prefix:EntryCountis flat-index only (v3-v9). Should beFlatEntryCount.NonEncodedCountis v10+ main-index only. Should beV10NonEncodedCount.FileCountis FDI-only (bounded byfdi_size / MIN_FDI_FILE_RECORD_BYTES). Should beFdiFileCount.DirCountis FDI-only (bounded byfdi_size / MIN_FDI_DIR_RECORD_BYTES). Should beFdiDirCount.Tests reading
WireField::FileCountat amatches!site can't tell from the name whether they're matching the FDI'sfile_countor some hypothetical future flat-indexfile_count. Display strings ("file_count","dir_count") are similarly ambiguous.Fix
Rename the 4 variants. Decide whether to break the Display strings too:
Option A — variant rename only, keep Display strings (preserves operator log greps):
Option B — rename both variant and Display string (symmetric, breaks dashboards):
Option A is safer for log-grep stability. Option B is more honest. Pick one and update the per-variant Display pin test (
wire_field_display_tokens_are_wire_stablein error.rs).Files
crates/paksmith-core/src/error.rs(definition + Display + pin test)crates/paksmith-core/src/container/pak/index/{path_hash,flat,entry_header}.rs(call sites)