You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Test: cover the pack metadata compression fallback path #96
#95 reworked how pack stores metadata: when compression is enabled and shrinks the metadata, the compressed scratch buffer is written; when compression is disabled or does not shrink, the raw meta_buffer is written instead.
The compressed path is covered by PackLayout.CompressesMetadataAboveThreshold (metadata > 1 MiB, header says LZ4, round trip). The fallback path (compression enabled but LZ4 returns 0 or does not shrink) has no direct test. A regression there could write the wrong buffer or header type/size and still pass the current suite.
Proposal
Make the buffer-selection logic testable, for example by factoring it into a small helper that takes the Compress result and returns the stored pointer/size and header fields; then unit-test both branches.
Or add a test-only compressor injection point so a test can force the "not shrinking" result.
Alternatively, construct a fixture whose metadata LZ4 cannot shrink, if that can be made deterministic.
Acceptance
A test exercises the fallback branch and checks the written bytes/header (metadata_compressed_type == kNone, metadata_compressed_size == metadata_original_size) and a successful unpack.
Activity