Context
mst2-codec is consumed by mega2 as a git dependency
(mst2-codec = { git = "https://github.com/gitmono-dev/mst2-codec" }), and its
CI already publishes on version tags. Two additions currently live only on a
branch and are not in the released history:
Page::pages_along_route(entries, route) — the MTP2 route walk
(src/metapage.rs): rebuilds each step from the same partition rule build
uses, then checks the child page id the parent commits to, so a returned page
is byte-identical to the one the tree refers to. Needed by the server's
POST /{snapshot_id}/metadata/pages (spec 04 §8).
- The optional
zstd feature — src/zstd1.rs plus encode_zstd on the three
compressible payloads and strict decoding in parse_frame (spec 06): exactly
one standard frame, window <= 8 MiB, output exactly raw_len, and no
concatenated / skippable / trailing bytes.
Downstream therefore has to pin a branch or a local path, which is why the
consumer keeps a path override today.
Scope
- Review and merge the two additions onto
main.
- Decide and document the release channel: tag a version (the CI publishes on
tags) and/or publish to crates.io, and state which one consumers should use.
- Document the
zstd feature in the README: it is optional, default off, and
the decoder's strictness guarantees are part of the contract (a lenient
decode_all-style consumer would accept payloads this codec rejects on
purpose).
- Keep the codec pure (no I/O, no async) — the zstd addition must not drag a
runtime in; confirm the dependency tree stays minimal and note the C toolchain
requirement (zstd-sys) for builders.
- State the compatibility rule for the wire format: adding a feature must not
change any existing encoding, so a consumer without the feature must reject a
zstd frame rather than mis-decode it (the current behaviour is
Unsupported).
Acceptance
cargo test and cargo test --features zstd both pass from a clean checkout.
- A tagged release exists and
mega2 can drop its path override and build
against the released dependency (tracked in the mega2 repository).
- The README documents the feature, the strictness contract and the minimal
dependency tree.
cargo clippy --all-targets -- -D warnings and cargo fmt --check are green
with and without the feature.
References
- Specs 04 §8, 05 §5, 06 (the behaviour the additions implement)
src/metapage.rs, src/zstd1.rs, src/treeframe.rs, Cargo.toml
Context
mst2-codecis consumed bymega2as a git dependency(
mst2-codec = { git = "https://github.com/gitmono-dev/mst2-codec" }), and itsCI already publishes on version tags. Two additions currently live only on a
branch and are not in the released history:
Page::pages_along_route(entries, route)— the MTP2 route walk(
src/metapage.rs): rebuilds each step from the same partition rulebuilduses, then checks the child page id the parent commits to, so a returned page
is byte-identical to the one the tree refers to. Needed by the server's
POST /{snapshot_id}/metadata/pages(spec 04 §8).zstdfeature —src/zstd1.rsplusencode_zstdon the threecompressible payloads and strict decoding in
parse_frame(spec 06): exactlyone standard frame, window <= 8 MiB, output exactly
raw_len, and noconcatenated / skippable / trailing bytes.
Downstream therefore has to pin a branch or a local path, which is why the
consumer keeps a path override today.
Scope
main.tags) and/or publish to crates.io, and state which one consumers should use.
zstdfeature in the README: it is optional, default off, andthe decoder's strictness guarantees are part of the contract (a lenient
decode_all-style consumer would accept payloads this codec rejects onpurpose).
runtime in; confirm the dependency tree stays minimal and note the C toolchain
requirement (
zstd-sys) for builders.change any existing encoding, so a consumer without the feature must reject a
zstd frame rather than mis-decode it (the current behaviour is
Unsupported).Acceptance
cargo testandcargo test --features zstdboth pass from a clean checkout.mega2can drop its path override and buildagainst the released dependency (tracked in the mega2 repository).
dependency tree.
cargo clippy --all-targets -- -D warningsandcargo fmt --checkare greenwith and without the feature.
References
src/metapage.rs,src/zstd1.rs,src/treeframe.rs,Cargo.toml