Skip to content

fix: backlog 2026-07 — payload-too-large enforcement, version sync, README module docs - #7

Merged
SoundMatt merged 1 commit into
mainfrom
fix/backlog-2026-07
Jul 27, 2026
Merged

fix: backlog 2026-07 — payload-too-large enforcement, version sync, README module docs#7
SoundMatt merged 1 commit into
mainfrom
fix/backlog-2026-07

Conversation

@SoundMatt

Copy link
Copy Markdown
Owner

Summary

Fixes every open issue in the 2026-07-27 RELAY ecosystem audit backlog for rust-LIN.

Issues fixed

#4 (P0) — relay::Node::send() / Bus::publish() never enforced LIN_MAX_DATA_LEN

ErrPayloadTooLarge (spec §5.1) was dead code on the real 8-byte-overflow path, and LinAdapter::send collapsed every from_message failure (bad ID, wrong protocol) into PayloadTooLarge, misusing the sentinel for unrelated errors.

  • LinAdapter::send (src/adapt.rs) now checks msg.payload.len() against LIN_MAX_DATA_LEN directly and returns ErrPayloadTooLarge, independent of whichever Bus implementation sits behind the adapter.
  • Conversion/publish failures now route through Error::kind() instead of being force-mapped to PayloadTooLarge, so a malformed LIN ID no longer produces a false PayloadTooLarge.
  • VirtualBus::publish_with_type and MockBus::publish (src/virtual_bus/mod.rs, src/mock/mod.rs) now validate payload length themselves and return Error::PayloadTooLarge for real violations — distinct from validate_frame's ErrInvalidFrame, per spec §5.3 ("ValidateFrame MUST return ErrInvalidFrame; it MUST NOT return ErrPayloadTooLarge").
  • Added regression tests at all three call sites (adapt::tests, mock::tests, virtual_bus::tests), including the exact reproduction from the issue.

#5 (P2) — three mismatched version numbers

Cargo.toml was still 0.1.0 while the latest tag was v0.4.0, so rust-lin version --format json silently reported a stale version per the RELAY §12.1 version-document contract. Bumped Cargo.toml to 0.4.1 (the version this PR ships as) and dropped the duplicated version number from ARCHITECTURE.md's heading so there's one fewer place to keep in sync going forward, per the issue's own suggested fix.

#6 (P2) — README module table omitted ldf, safety, slave

Added rows for all three publicly-exported modules (src/ldf/mod.rs, src/safety/mod.rs, src/slave/mod.rs) to the README's module table, matching the existing row style.

Issues closed as already-resolved

None — all three open issues required a real code/doc change.

Issues left open

None — all open issues are addressed in this PR.

Verification

  • cargo fmt --check — clean
  • cargo clippy --all-targets --all-features -- -D warnings — clean
  • cargo test — 107 lib unit tests + 46 integration tests + 2 doctests, all passing (including the new regression tests)
  • cargo run --bin rust-lin -- version --format json manually verified to report "version": "0.4.1"

…rsion, document ldf/safety modules

relay::Node::send() and Bus::publish() (VirtualBus, MockBus) never
enforced the 8-byte LIN_MAX_DATA_LEN payload limit, so ErrPayloadTooLarge
(spec §5.1) was dead code on the real violation path. Worse, from_message
collapsed every conversion failure (bad ID, wrong protocol) into
PayloadTooLarge, misusing the sentinel for unrelated errors.

- LinAdapter::send now checks msg.payload.len() against LIN_MAX_DATA_LEN
  directly and returns ErrPayloadTooLarge, independent of the underlying
  Bus implementation.
- from_message/publish conversion failures now route through
  Error::kind() instead of being force-mapped to PayloadTooLarge.
- VirtualBus::publish_with_type and MockBus::publish now validate
  payload length and return Error::PayloadTooLarge for real violations,
  distinct from validate_frame's ErrInvalidFrame (spec §5.3).
- Added regression tests for all three call sites.

Also:
- Cargo.toml version bumped from the stale 0.1.0 placeholder to 0.4.1,
  matching the actual release; ARCHITECTURE.md's title no longer
  duplicates a version number that drifts out of sync.
- README module table now documents the ldf, safety, and slave modules
  that were already public but undocumented.

Closes #4
Closes #5
Closes #6

Signed-off-by: Matt Jones <47545907+SoundMatt@users.noreply.github.com>
@SoundMatt
SoundMatt merged commit 629605b into main Jul 27, 2026
7 checks passed
@SoundMatt
SoundMatt deleted the fix/backlog-2026-07 branch July 27, 2026 16:29
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