fix: backlog 2026-07 — payload-too-large enforcement, version sync, README module docs - #7
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 enforcedLIN_MAX_DATA_LENErrPayloadTooLarge(spec §5.1) was dead code on the real 8-byte-overflow path, andLinAdapter::sendcollapsed everyfrom_messagefailure (bad ID, wrong protocol) intoPayloadTooLarge, misusing the sentinel for unrelated errors.LinAdapter::send(src/adapt.rs) now checksmsg.payload.len()againstLIN_MAX_DATA_LENdirectly and returnsErrPayloadTooLarge, independent of whicheverBusimplementation sits behind the adapter.Error::kind()instead of being force-mapped toPayloadTooLarge, so a malformed LIN ID no longer produces a falsePayloadTooLarge.VirtualBus::publish_with_typeandMockBus::publish(src/virtual_bus/mod.rs,src/mock/mod.rs) now validate payload length themselves and returnError::PayloadTooLargefor real violations — distinct fromvalidate_frame'sErrInvalidFrame, per spec §5.3 ("ValidateFrameMUST returnErrInvalidFrame; it MUST NOT returnErrPayloadTooLarge").adapt::tests,mock::tests,virtual_bus::tests), including the exact reproduction from the issue.#5 (P2) — three mismatched version numbers
Cargo.tomlwas still0.1.0while the latest tag wasv0.4.0, sorust-lin version --format jsonsilently reported a stale version per the RELAY §12.1 version-document contract. BumpedCargo.tomlto0.4.1(the version this PR ships as) and dropped the duplicated version number fromARCHITECTURE.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,slaveAdded 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— cleancargo clippy --all-targets --all-features -- -D warnings— cleancargo test— 107 lib unit tests + 46 integration tests + 2 doctests, all passing (including the new regression tests)cargo run --bin rust-lin -- version --format jsonmanually verified to report"version": "0.4.1"