Skip to content

Add Rust codec round-trip tests#29

Open
ringotokens-commits wants to merge 2 commits into
Peter7896:mainfrom
ringotokens-commits:bounty/rust-codec-tests-2
Open

Add Rust codec round-trip tests#29
ringotokens-commits wants to merge 2 commits into
Peter7896:mainfrom
ringotokens-commits:bounty/rust-codec-tests-2

Conversation

@ringotokens-commits

@ringotokens-commits ringotokens-commits commented Jul 9, 2026

Copy link
Copy Markdown

TentOfTrials Rust Codec Bounty PR Draft

Issue: #2

Patch: /Users/aiagent/Documents/Codex/2026-07-08/yo/outputs/tentoftrials_rust_codec_bounty.patch

Diagnostic artifacts:

  • /Users/aiagent/Documents/Codex/2026-07-08/yo/outputs/tentoftrials_rust_build-c2c53e9d.json
  • /Users/aiagent/Documents/Codex/2026-07-08/yo/outputs/tentoftrials_rust_build-c2c53e9d.logd

Summary

Adds deterministic protocol frame codec regression coverage for malformed frames and decoder recovery. The patch also fixes the frame header size constant to match the 20-byte header emitted by the encoder, rejects nonzero reserved bytes, and lets the decoder resynchronize on a later valid frame after malformed input.

Changes

  • Corrected FRAME_HEADER_SIZE from 24 to 20 to match the actual encoded wire header.
  • Added decoder resynchronization via next-frame magic scanning after malformed magic/version/length/reserved fields.
  • Rejects invalid reserved bytes with ProtocolError::InvalidMessage.
  • Added tests for:
    • truncated headers;
    • truncated payload completion and recovery;
    • invalid reserved bytes followed by a valid frame;
    • checksum mismatch followed by a valid frame;
    • invalid junk/magic followed by a valid frame;
    • oversized payload length followed by a valid frame.
  • Added macos-x64 encryptly binary mapping so python3 build.py can generate diagnostics on Intel macOS when the bundled binary exists.

Testing

CARGO_HOME=/Users/aiagent/Documents/Codex/2026-07-08/yo/work/rust-toolchain-home/cargo \
RUSTUP_HOME=/Users/aiagent/Documents/Codex/2026-07-08/yo/work/rust-toolchain-home/rustup \
PATH=/Users/aiagent/Documents/Codex/2026-07-08/yo/work/rust-toolchain-home/cargo/bin:$PATH \
cargo test --lib

Result:

test result: ok. 22 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
python3 build.py

Result:

  • Backend/Rust: PASS
  • Frontend: PASS
  • v2-market-stream: PASS
  • Diagnostics generated:
    • diagnostic/build-c2c53e9d.json
    • diagnostic/build-c2c53e9d.logd
  • Full multi-language build exits 1 locally because this machine lacks go, cmake, luac, ghc, Java runtime, and the existing C module has a compile error.

Diagnostic password printed by the build:

174688db560a8b12450b

Checklist

  • Relevant modules affected by these changes build locally
  • Tests pass locally
  • Diagnostic build log is committed in this PR
  • Full multi-language build passes locally
  • Documentation has been updated, if applicable
  • Configuration or schema changes are documented, if applicable
  • No generated build artifacts are committed, except the required diagnostic build log
  • Changes are scoped to the PR purpose and avoid unrelated cleanup
  • Security, privacy, and error-handling implications have been considered

Note: the local full build failure is outside the Rust codec change; cargo test --lib passes.

/claim #2

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