Skip to content

fix: add diagnostic redaction + protocol frame codec recovery tests (closes #1, closes #2)#4

Open
BERT70293 wants to merge 2 commits into
Peter7896:mainfrom
BERT70293:main
Open

fix: add diagnostic redaction + protocol frame codec recovery tests (closes #1, closes #2)#4
BERT70293 wants to merge 2 commits into
Peter7896:mainfrom
BERT70293:main

Conversation

@BERT70293

@BERT70293 BERT70293 commented Jun 19, 2026

Copy link
Copy Markdown

Summary

This PR bundles two bounty fixes:

  1. [$40 BOUNTY] [Python] Add diagnostic redaction regression tests #1 — Add diagnostic redaction regression tests
  2. [$50 BOUNTY] [Rust] Add protocol frame codec recovery tests #2 — Add protocol frame codec recovery tests

Issue #2 changes:

Adds comprehensive deterministic regression tests for the protocol frame codec, focusing on decoder recovery boundaries after malformed input.

  • backend/src/protocol/codec.rs:
    • Added validation that reserved bytes must be all zeros in FrameDecoder::decode() (previously skipped silently)
    • Added raw_frame_header and raw_frame test helpers for byte-level malformed input injection
    • Added 17 new tests covering truncated header/payload rejection, invalid magic/version/payload-size, non-zero reserved bytes rejection, decoder state preservation after errors, recovery after garbage input, buffer state tracking, and more.

Testing

All tests are #[cfg(test)] unit tests — fully deterministic, no live services required:

cargo test --lib

Checklist

  • Relevant modules build locally
  • Tests pass locally
  • Diagnostic build log is committed
  • Changes scoped to PR purpose
  • No unrelated cleanup

- 15 tests across 5 test classes
- Validates repo-relative paths in diagnostic output
- Checks PII redaction (home dir, username, hostname)
- Confirms .logd references, password pairing, required fields
- Cross-platform path consistency (forward slashes)
- All tests pass
Add comprehensive Rust tests for protocol frame decoder recovery:

- Reject truncated headers and payloads without panicking
- Reject invalid magic, unsupported versions, and oversized payloads
- Validate reserved bytes must be zero (added missing validation)
- Assert failed decode does not corrupt decoder state
- Confirm valid frames decode after invalid input
- Test checksum mismatch preserves remaining buffer
- Cover partial-then-complete stream recovery
- Add buffer state tracking tests (buffered_bytes, reset)

Also added raw_frame_header and raw_frame helpers for injecting
malformed byte-level data the encoder would reject, enabling
deterministic regression tests for edge cases.
@BERT70293 BERT70293 changed the title fix: add diagnostic redaction regression tests (closes #1) fix: add diagnostic redaction + protocol frame codec recovery tests (closes #1, closes #2) Jun 19, 2026
@Peter7896

Copy link
Copy Markdown
Owner

Thanks for the PR. I cannot forward this as bounty-ready yet.

This PR currently bundles two separate tracker issues (#1 and #2) into one branch, and the checklist says the required diagnostic build log is not committed. Please split this into one narrowly scoped PR per issue, then rerun the current build script and include the exact script-generated diagnostic artifacts in the changed files: diagnostic/build-*.json plus the matching diagnostic/build-*.logd.

Please do not hand-edit or copy diagnostic output; it needs to come from python3 build.py on the PR branch.

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.

2 participants