Skip to content

test: cover the metadata compression fallback decision - #97

Merged
blocksmith314 merged 1 commit into
mainfrom
test/96-metadata-fallback
Nov 24, 2026
Merged

blocksmith314 merged 1 commit into
mainfrom
test/96-metadata-fallback

Conversation

@blocksmith314

Copy link
Copy Markdown
Owner

Summary

  • Factor the compressed-vs-raw metadata choice into PlanMetadataStorage().
  • Unit-test the compressed, zero-compressed, equal-size and no-shrink cases, asserting the stored size and the header size/type recorded for the fallback path.
  • Production pack uses the plan to choose compressed_meta or meta_buffer; behavior and archive bytes are unchanged.

Tests

  • Release ctest: 178/178 passed
  • ASan ctest: 178/178 passed

Performance

The touched code is pack-only. One comparison against origin/main measured pack +1.4% wall time / +0.8% peak RSS. The unpack path is untouched; a same-code A/A control (same commit for baseline and current) measured unpack time +0.1% but peak RSS +5.9%, showing the gate's memory delta is within this machine's noise.

Closes #96

Factor the compressed-vs-raw metadata choice into PlanMetadataStorage() and unit-test the compressed, zero-compressed and no-shrink cases, including the header size/type recorded for the fallback path.

Refs #96

@blocksmith314 blocksmith314 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review

LGTM. PlanMetadataStorage() encodes the old decision exactly:

  • compressed only when compressed_size > 0 && compressed_size < raw_size
  • fallback stores the raw size and records kNone in metadata_compressed_type
  • stored_size / header_size are consistent for both paths
  • compressed_meta lifetime still covers the synchronous RandomWrite

The production path now uses the plan for stored_metadata_size and the header fields, so behavior and archive bytes are unchanged.

Verified locally: Release ctest 178/178, ASan ctest 178/178, CI 5/5 green.

Minor suggestion, not blocking: the unit test covers the decision function, but not that PackPipeline writes the fallback header/bytes. An integration test that forces a no-shrink result and checks metadata_compressed_type == kNone / raw size would pin the production wiring too.

The reported pack +1.4% wall time is within the noted noise for a pure refactor, and the unpack path is untouched.

@blocksmith314
blocksmith314 merged commit 16a7965 into main Nov 24, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test: cover the pack metadata compression fallback path

1 participant