Skip to content

Add protocol frame codec recovery tests#3

Open
thecosmicskye wants to merge 2 commits into
Peter7896:mainfrom
thecosmicskye:tinyops/frame-codec-recovery-tests-clean
Open

Add protocol frame codec recovery tests#3
thecosmicskye wants to merge 2 commits into
Peter7896:mainfrom
thecosmicskye:tinyops/frame-codec-recovery-tests-clean

Conversation

@thecosmicskye

Copy link
Copy Markdown

Summary

Add deterministic protocol frame codec recovery coverage for malformed frame boundaries, and fix the codec header-size mismatch that prevented existing frame tests from decoding encoded frames.

Fixes #2

Changes

  • Align FRAME_HEADER_SIZE with the 20 bytes emitted by FrameEncoder.
  • Reject nonzero reserved header bytes instead of silently accepting them.
  • Resync the decoder to the next frame magic after malformed header/version/length/reserved input so a later valid frame can still be decoded.
  • Add tests for truncated headers, truncated payloads, invalid reserved bytes, oversized payload lengths, checksum mismatch, invalid magic, and recovery to a valid following frame.

Testing

  • cargo test --lib
    • PASS: 22 tests passed.
  • python3 build.py
    • Generated and committed diagnostic/build-6cf45568.json plus diagnostic/build-6cf45568-part001.logd through part006.logd.
    • Target/backend modules: backend PASS, frontend PASS, market PASS, engine PASS, v2-market-stream PASS, nfc-scanner PASS, openapi-tools PASS.
    • Local prerequisite failures: frailbox failed in existing C code, compliance failed because no Java runtime is installed, and openapi-haskell failed because ghc is unavailable.

Checklist

  • Relevant modules affected by these changes build locally
  • Tests pass locally
  • Diagnostic build log is committed in this PR
  • 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

  • I would like to request that my diagnostic build log is removed before merging

@Peter7896

Copy link
Copy Markdown
Owner

Thanks for the PR. This is the closest current candidate for the protocol codec recovery issue.

Before this can be forwarded for upstream bounty review, I need to verify the diagnostic bundle and scope. Please keep the PR focused on issue #2 only, and make sure the diagnostic files are exactly what python3 build.py generated on this branch. If the build script generated split .logd parts, please do not edit them manually; I will check whether the metadata and artifact layout match the upstream validator expectations before forwarding.

Notime02 added a commit to Notime02/TentOfTrials that referenced this pull request Jun 19, 2026
Notime02 added a commit to Notime02/TentOfTrials that referenced this pull request Jun 19, 2026
Notime02 added a commit to Notime02/TentOfTrials that referenced this pull request Jun 21, 2026
Notime02 added a commit to Notime02/TentOfTrials that referenced this pull request Jun 21, 2026
Notime02 added a commit to Notime02/TentOfTrials that referenced this pull request Jun 21, 2026
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.

[$50 BOUNTY] [Rust] Add protocol frame codec recovery tests

2 participants