Skip to content

docs(uds_protocol): writing pass for the reader - #89

Merged
JustinKovacich merged 2 commits into
docs/uds_session-writing-passfrom
docs/uds_protocol-writing-pass
Oct 21, 2026
Merged

JustinKovacich merged 2 commits into
docs/uds_session-writing-passfrom
docs/uds_protocol-writing-pass

Conversation

@JustinKovacich

Copy link
Copy Markdown
Contributor

Writing pass over crates/uds_protocol to the "Writing for the reader" standard (CONTRIBUTING.md, #84, which this PR is stacked on). Prose only: rustdoc, comments, the Cargo.toml feature comments, the fuzz targets and one word in the README (whose intra-doc links are unchanged; it is also the crate doc). No code line changes: the non-comment lines in the diff are nine renamed test functions, three trailing comments removed from code lines, and two reworded assertion messages.

Before / after (prose lint): hard-fail phrases 27 / 0 (one "load-bearing", ten first-person, sixteen "deliberately"); history 54 / 0; incident 5 / 0; editor instructions 2 / 0; # Why headings 1 / 0; em-dash 108 / 0; comment blocks of 12+ lines 45 / 9. The nine that remain are Error::negative_response_code's example and three-code mapping, the six RequestFileTransfer mode tables with their link definitions, DtcStatusMask's example and bit table, and AddressAndLengthFormatIdentifier's example.

Test renames (nine, each a sentence of 12 or more words; none in a CI filter; every prop_ name kept): for example a_tester_can_still_request_an_unmodeled_read_dtc_information_sub_function is now try_reserved_builds_an_unmodeled_sub_function, and the SERVICES doc that named the_variants_that_are_not_a_2020_request_service_report_no_sub_function follows its rename.

Fixed while reading: fuzz_roundtrip.rs said Request has no PartialEq (it derives it); a doc comment describing whole_records was attached to encode_by_dtc_number (moved); the upload/download $repr doc called AddressAndLengthFormatIdentifier crate-private (it is public). The two "this doc is the published schema description" notes on the repr structs are now // comments, so they are not published.

Removed, and the reasoning it held (this PR is its record; nothing is filed elsewhere):

  • Why Request::is_positive_response_suppressed returns Option<bool>: a wrong false for a vendor request made a session layer start tP_Client, time out and retry twice. One sentence of this stays. Candidate Rationale: for the need that owns SPRMIB reporting.
  • Why has_sub_function answers None for the withdrawn 0x83; why allowed_nack_codes is a floor (clause 9.4; 0x78 is in no table; a whitelist would reject every ResponsePending), kept to one sentence; the full account of which codes negative_response_code never returns and why.
  • modeled_frames sets the SPRMIB on every sub-function service, and the dispatch test once asserted only !is_empty(); assert_encode_size_agrees is not byte coverage (a swapped field pair once passed the suite).
  • The crate-wide lint derogations' site counts (162 production sites, 281 test sites).
  • The incidents behind some forty test comments across the service modules: the communicationType byte matched whole; manufacturer DTCSettingType ranges rejected; a spurious powerDownTime byte; 0x82/0x8A falling through to IsoSaeReserved; the missing DTCFormatIdentifier; the one-byte-too-large shortfall; the non-terminating partial-tail iterator; three missing RequestFileTransfer codes; NamePayload's mode field winning over the variant; TesterPresent normalising reserved bytes to 0x00; a 3-byte WDBI decoding to an empty record; 0x7F normalisation of unmodeled SIDs. Each test now states the behaviour it pins and its ISO citation.
  • The three OpenAPI defects that shipped before tests/openapi_schema.rs existed; the five serde escape routes tests/public_api.rs closes, described in the present tense now; the mirror-struct cost (about a hundred lines for a one-field invariant); the utoipa-without-serde build that was tried.
  • tests/spec_conformance.rs: the earlier comment's wrong claim about Tables 31, 38 and 47, and which tables' byte columns the markdown conversion garbled.
  • Smaller: why DataFormatIdentifier::new uses explicit range checks (? in a const fn); TryFrom<u32> over masking; new_with_alfid for fixed-ALFID bootloaders (one sentence stays); a review probe that sent 27 01; automotive-wire-codec finding SE-1.

Issue URL

No issue; the pass follows the standard agreed in #84.

Testing

  • python3 tools/prose_lint.py crates/uds_protocol --fail --show 50 exits 0 with every hard-fail row at 0; CI's Comment prose job now runs --strict crates/uds_protocol.
  • cargo fmt --all --check; cargo clippy -p uds_protocol --all-targets --all-features -- -D warnings; cargo nextest run -p uds_protocol --all-features (298 passed); cargo doc -p uds_protocol --all-features --no-deps with -D rustdoc::broken_intra_doc_links -D warnings.
  • git diff -U0 ... | grep -vE '^[-+]\s*(//|#|\*|/\*|$)' prints only the renamed test functions, the three code lines whose trailing comments went, and the two assertion strings.

🤖 Generated with Claude Code

@JustinKovacich JustinKovacich added documentation Improvements or additions to documentation No Issue PR has no linked issue; satisfies PR Description Lint labels Oct 20, 2026
@JustinKovacich JustinKovacich self-assigned this Oct 20, 2026
@JustinKovacich
JustinKovacich force-pushed the docs/uds_protocol-writing-pass branch 2 times, most recently from 9c784bc to fa0f024 Compare October 21, 2026 13:32
@JustinKovacich
JustinKovacich changed the base branch from docs/writing-standard to docs/uds_session-writing-pass October 21, 2026 13:32
@JustinKovacich
JustinKovacich force-pushed the docs/uds_protocol-writing-pass branch from fa0f024 to 16242c1 Compare October 21, 2026 13:41
@JustinKovacich
JustinKovacich force-pushed the docs/uds_protocol-writing-pass branch from 16242c1 to c8aac3b Compare October 21, 2026 13:47
@JustinKovacich
JustinKovacich force-pushed the docs/uds_protocol-writing-pass branch from c8aac3b to aee8f53 Compare October 21, 2026 14:00
@JustinKovacich
JustinKovacich added this pull request to stack #91 October 21, 2026 14:03
@JustinKovacich
JustinKovacich force-pushed the docs/uds_protocol-writing-pass branch from aee8f53 to 6b3a572 Compare October 21, 2026 14:03
@JustinKovacich
JustinKovacich force-pushed the docs/uds_protocol-writing-pass branch from 6b3a572 to 09401ba Compare October 21, 2026 14:09
@JustinKovacich
JustinKovacich force-pushed the docs/uds_protocol-writing-pass branch from 09401ba to 169b95a Compare October 21, 2026 14:11
@JustinKovacich
JustinKovacich force-pushed the docs/uds_protocol-writing-pass branch from 169b95a to e712f20 Compare October 21, 2026 14:13
@JustinKovacich
JustinKovacich force-pushed the docs/uds_protocol-writing-pass branch from e712f20 to 96f9592 Compare October 21, 2026 14:21
@JustinKovacich
JustinKovacich force-pushed the docs/uds_protocol-writing-pass branch 2 times, most recently from ca5ab70 to 56086e6 Compare October 21, 2026 14:54
Rewrite uds_protocol's rustdoc, comments and README to the standard in
CONTRIBUTING.md: each item states its contract in the present tense with at
most a sentence of rationale. Removed: incident narratives in test comments,
"previously"/"used to" history and "deliberately" voice in rustdoc, and the
notes to the next editor (load-bearing, must stay, measurement counts).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@JustinKovacich
JustinKovacich force-pushed the docs/uds_protocol-writing-pass branch from 56086e6 to eaacc7f Compare October 21, 2026 15:03
@JustinKovacich
JustinKovacich marked this pull request as ready for review October 21, 2026 15:07
@JustinKovacich
JustinKovacich merged commit f149dd0 into main Oct 21, 2026
27 checks passed
@JustinKovacich
JustinKovacich deleted the docs/uds_protocol-writing-pass branch October 21, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation No Issue PR has no linked issue; satisfies PR Description Lint

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants