Skip to content

refactor(engine): replace bincode IPC codec with postcard (RUSTSEC-2025-0141) - #406

Merged
Kohei-Wada merged 1 commit into
mainfrom
refactor/ipc-postcard
Sep 13, 2026
Merged

Kohei-Wada merged 1 commit into
mainfrom
refactor/ipc-postcard

Conversation

@Kohei-Wada

Copy link
Copy Markdown
Owner

Closes #395.

bincode is unmaintained (RUSTSEC-2025-0141) and was sitting in deny.toml's ignore list. It existed solely for the engine-worker wire format, which is internal — parent and child are the same binary, so there is no format compatibility to preserve and the swap is free.

  • ttymap-engine: bincode 2 → postcard 1.1 (default-features = false, use-std) — adds only cobs to the tree, no heapless.
  • write_message / read_message swap encode_to_vec / decode_from_slice for to_stdvec / from_bytes. The u32-LE length prefix, the 16 MB cap and the UnexpectedEof-on-peer-close contract are untouched.
  • Dropped the RUSTSEC-2025-0141 ignore from deny.toml (the lru one stays — see RUSTSEC-2026-0253: Potential use-after-free due to lack of panic safety in LruCache::pop() #402).
  • ipc_handshake now drives Init → Ready → Draw → FrameReady → Shutdown. Previously no MapFrame ever crossed the wire in a test, so the large child→parent payload — the one at real risk from a codec swap — was unverified.
  • Corrected the FrameReady size note: a 240×80 frame measures ~115 KB encoded, not the ~430 KB the comment claimed.
  • Doc sync: CLAUDE.md, docs/architecture.md and the three "bincode-framed" doc comments.

Verification

  • cargo clippy --all-targets -- -D warnings clean, cargo fmt --check clean.
  • cargo test: full workspace green, including the extended ipc_handshake (2 passed) that now asserts frame dims and centre survive the round trip.
  • Ran the real TUI, not just tests: spawned ./target/release/ttymap --lat 35.68 --lon 139.76 --zoom 8 on a 160×50 pty for 20 s and counted what it painted — 6481 Braille cells, 6226 of them non-blank. Real tile geometry is arriving over the postcard pipe and rendering.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GFGFsYeFLqRaWUAzXonwd3

bincode is unmaintained (RUSTSEC-2025-0141) and was carried in
deny.toml's ignore list. The dependency existed only for the
engine-worker wire format, which is entirely internal — both ends ship
from the same workspace, so there is no format compatibility to keep.

- ttymap-engine: bincode 2 -> postcard 1.1 (default-features off,
  use-std; pulls only cobs)
- write_message / read_message swap encode_to_vec / decode_from_slice
  for to_stdvec / from_bytes; the u32-LE length prefix and the 16 MB
  cap are unchanged
- drop the RUSTSEC-2025-0141 ignore from deny.toml
- ipc_handshake now drives Init -> Ready -> Draw -> FrameReady ->
  Shutdown, so a real MapFrame crosses the wire in the test rather
  than only Config / ThemeId in one direction
- correct the FrameReady size note: 240x80 measures ~115 KB encoded,
  not the ~430 KB the comment claimed

Closes #395

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GFGFsYeFLqRaWUAzXonwd3

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This PR successfully addresses RUSTSEC-2025-0141 by replacing the unmaintained bincode codec with postcard for internal IPC. The implementation is clean and well-tested. The codec swap is straightforward (bincode's encode_to_vec/decode_from_slice → postcard's to_stdvec/from_bytes), the wire format contract is preserved (u32-LE length prefix, 16 MB cap, UnexpectedEof-on-close), and the enhanced test now verifies that large MapFrame payloads survive the round trip. Documentation and deny.toml have been updated accordingly. No blocking issues identified.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

@Kohei-Wada
Kohei-Wada merged commit 680dcce into main Sep 13, 2026
7 checks passed
@Kohei-Wada
Kohei-Wada deleted the refactor/ipc-postcard branch September 13, 2026 03:39
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.

RUSTSEC-2025-0141: Bincode is unmaintained

1 participant