Skip to content

test: prove dual-decode of legacy + bin envelopes, re-pin protocol 1.1 fixture (LAB-791) - #57

Merged
27Bslash6 merged 3 commits into
mainfrom
agent/winston/44da75ab
Jul 26, 2026
Merged

test: prove dual-decode of legacy + bin envelopes, re-pin protocol 1.1 fixture (LAB-791)#57
27Bslash6 merged 3 commits into
mainfrom
agent/winston/44da75ab

Conversation

@27Bslash6

@27Bslash6 27Bslash6 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Readers-first release for the StorageEnvelope compressed_data bin encoding — rollout step 1 of #54, per the merged protocol 1.1 RFC (protocol#44, decisions/envelope-bin-encoding.md). Test-only: no src/ change, the writer still emits legacy array-of-ints. Ticket: LAB-791 (parent LAB-764).

What

  • Fixture re-vendor: tests/vectors/wire-format.json re-vendored from protocol@6863495d — fixture 1.1.0, 12 vectors (6 legacy + 6 *_bin twins). FIXTURE_SHA256 re-pinned and the provenance comment's commit hash updated together (deliberate update per the LAB-423 precedent; the .gitattributes -text rule keeps windows runners from breaking the pin).
  • tests/wire_format_vectors.rs: decode-identity through ByteStorage::retrieve() now runs against both vector sets, forever. Re-encode byte-identity (store() and codec-level) is filtered to the legacy set — the encoding the writer currently emits; the writer-flip diff switches that filter to *_bin. New guard test: every *_bin twin actually carries a bin marker and is field-identical to its legacy parent.
  • tests/dual_decode.rs (seeded from the LAB-764 toolchain experiment): full reader matrix — plain Vec<u8> reader (shipped today) and serde_bytes reader (post-flip) × array/bin wire — over every pinned vector, including bin wire through today's shipped retrieve() with checksum + ratio guards intact. Also asserts the writer-flip forecast: serde_bytes re-encode of each pinned *_bin twin is byte-identical to the protocol pin, so the step-3 assertion switch is guaranteed to land green. The experiment's throughput half is deliberately absent — benchmark evidence belongs to the writer-flip stage (LAB-510 harness).
  • Width-boundary coverage (MUST from the RFC panel review): the fixture twins never leave bin8 territory, so width_boundary_bin8_bin16 sweeps real LZ4 output across the 255/256 B boundary (asserting both header widths are hit) and width_boundary_bin16_bin32 round-trips a >65,535 B compressed envelope (bin32). Unit-level in core rather than fixture vectors: the decision record assigns fixture-level width vectors to the writer-flip PR, where the real writer can generate them natively.
  • README testing section updated to describe the two-encoding fixture split.

Release

Release-As: 0.3.1 footer in the commit — test-only patch release so the stage-3 SDK rebuilds (py wheel / ts NAPI+wasm / rs bump) have a core version to pin.

Gates

  • Crypto/protocol panel: not required for this step — test-only + fixture re-vendor, format-neutral by construction (no src/ change can alter wire bytes; LAB-423/LAB-347 precedent, recorded on LAB-764). The stage-4 writer flip takes the panel.
  • Local: cargo fmt --check, cargo clippy --all-features -- -D warnings, cargo test --all-features, cargo test --features ffi all green.

Summary by CodeRabbit

  • Documentation

    • Updated protocol wire-format guidance to clarify legacy versus *_bin compressed_data encodings for protocol 1.1, including identical payload expectations and re-encoding verification.
  • Tests

    • Added compatibility tests that confirm both reader shapes handle legacy and *_bin twins, and that payloads decode and re-encode correctly across MessagePack bin8/bin16/bin32 boundaries.
    • Expanded wire-format fixtures with new binary twin vectors and bumped the protocol version to 1.1.0.
    • Strengthened fixture validation (including checksums and byte-level encoding markers) to ensure suite consistency.

…1 fixture (LAB-791)

Readers-first release for the StorageEnvelope compressed_data bin
encoding (protocol 1.1, decisions/envelope-bin-encoding.md; rollout
step 1 of #54):

- Re-vendor tests/vectors/wire-format.json from protocol@6863495d
  (fixture 1.1.0: 6 legacy vectors + 6 *_bin twins) and re-pin
  FIXTURE_SHA256 with updated provenance.
- Decode-identity through ByteStorage::retrieve() now runs against BOTH
  vector sets, forever; re-encode byte-identity stays pinned to the
  legacy set until the writer flip (which switches it to *_bin).
- tests/dual_decode.rs: full reader matrix (plain Vec<u8> reader and
  serde_bytes reader x array/bin wire) over every pinned vector, seeded
  from the LAB-764 toolchain experiment, plus bin8/bin16 boundary sweep
  and bin32 round-trips with real LZ4 output.

No src/ change; the writer still emits legacy array-of-ints. Test-only
patch release so the stage-3 SDK rebuilds have a version to pin.

Release-As: 0.3.1
@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: c359511d-723b-4741-9afe-8e96dbe3ac00

📥 Commits

Reviewing files that changed from the base of the PR and between 0f9334a and e4ae645.

📒 Files selected for processing (2)
  • tests/dual_decode.rs
  • tests/wire_format_vectors.rs

Walkthrough

Protocol 1.1 wire-format fixtures now include legacy and MessagePack bin encodings. Tests validate metadata, pinned integrity, equivalent decoding, writer-specific byte identity, retrieval, and bin8/bin16/bin32 width boundaries.

Changes

Protocol 1.1 wire-format compatibility

Layer / File(s) Summary
Protocol 1.1 vector contract
tests/vectors/wire-format.json, README.md
The fixture is versioned as 1.1.0, documents both encodings, and adds six *_bin twins linked to legacy vectors.
Pinned vector validation
tests/wire_format_vectors.rs
Vector metadata, SHA-256 integrity, version requirements, legacy-only byte identity, and bin-twin field equivalence are validated.
Dual-reader and width coverage
tests/dual_decode.rs
Both reader shapes and ByteStorage::retrieve() decode legacy and bin wires, including bin8, bin16, and bin32 boundaries.

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main changes: dual-decode tests and re-pinning the protocol 1.1 fixture.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/winston/44da75ab

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/dual_decode.rs`:
- Around line 106-138: Replace the bare unwrap calls in the vector test flow,
including the conversions around assert_all_readers_decode, the additional lines
in the referenced range, assert_width_tier, and the sweep loop, with contextual
expect messages that include the vector name and relevant wire/input operation.
Follow wire_format_vectors.rs conventions so every failure identifies the
triggering vector while preserving the existing test behavior.
- Around line 72-90: The dual-decode tests currently use plain Vec<u8> for
StorageEnvelope::compressed_data, so they do not validate MessagePack binary
decoding. Update StorageEnvelope and all affected test fixtures, including
tests/dual_decode.rs:72-90 and tests/wire_format_vectors.rs:215-285, to use
serde_bytes or an equivalent byte-buffer type, then retain the assertions
proving both plain and _bin envelopes decode through the old reader, new reader,
and retrieve().
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 52204c60-3a5a-4eff-908f-cc2deb4a2b29

📥 Commits

Reviewing files that changed from the base of the PR and between cba6adf and 0f9334a.

📒 Files selected for processing (4)
  • README.md
  • tests/dual_decode.rs
  • tests/vectors/wire-format.json
  • tests/wire_format_vectors.rs

Comment thread tests/dual_decode.rs
Comment thread tests/dual_decode.rs Outdated
CodeRabbit review: bare .unwrap() calls lost which-vector context on
failure; align with wire_format_vectors.rs's panic-with-name convention.
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 25, 2026
@27Bslash6

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Apply the FIX-FIRST expert-panel findings on cachekit-core#57 (all test-only,
no src/ change, wire bytes unchanged):

- must-fix: tighten the bin micro-regression bound from +4 to +1 B. The panel
  re-derived and measured (lz4_flex 0.12.2) worst-case delta(bin-legacy) as
  exactly +1 ("empty", 25->26 B); at +4 a +2/+3 bloat regression stays green --
  the exact false-green this readers-first drift gate exists to catch, and the
  ceiling the writer-flip step (LAB-764) will read as the micro-regression
  contract.
- should-fix: pin the fixed-size bin marker asserts to == 0xc4 (bin8) in
  dual_decode.rs and wire_format_vectors.rs. The 0xc4..=0xc6 range accepted any
  width, so a width-selection regression emitting bin16/bin32 on a tiny payload
  passed while breaking cross-SDK byte-identity. Range kept only in the
  width_boundary_* tests that legitimately span widths.
- cut: drop the redundant (256..=65535)/>65535 range asserts in
  width_boundary_bin16_bin32 (dominated by the 0xc5/0xc6 marker asserts -- rmp
  selects width by length, so marker <=> range) and assert_width_tier's
  now-unused -> usize return.

Optional cosmetic finding (per-vector [name] context on fixture hex-decode
expects) deferred: the sha256-pinned fixture already makes any decode failure a
whole-suite RED, so per-site context adds little for 7 sites of churn.

fmt + clippy -D warnings + affected integration tests all green.

Co-authored-by: multica-agent <github@multica.ai>
@kodus-27b

kodus-27b Bot commented Jul 25, 2026

Copy link
Copy Markdown

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug
Performance
Security
Business Logic

Access your configuration settings here.

@27Bslash6
27Bslash6 merged commit 49a7017 into main Jul 26, 2026
33 checks passed
@27Bslash6
27Bslash6 deleted the agent/winston/44da75ab branch July 26, 2026 14:01
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.

1 participant