Skip to content

docs: document the 1.1.0 error semantics in README - #333

Open
mikemiles-dev wants to merge 1 commit into
fix/ipfix-skip-undecodable-setfrom
docs/document-1.1.0-error-semantics
Open

mikemiles-dev wants to merge 1 commit into
fix/ipfix-skip-undecodable-setfrom
docs/document-1.1.0-error-semantics

Conversation

@mikemiles-dev

Copy link
Copy Markdown
Owner

Stacked on #332 — base is fix/ipfix-skip-undecodable-set, because this documents NoTemplateReason, which that PR introduces. GitHub will retarget this to main once #332 merges.

README.md is the crate's top-level rustdoc via #![doc = include_str!("../README.md")], so it is what lands on docs.rs. None of the four 1.1.0 entries in RELEASES.md were reflected in it, and two of the gaps made the existing text actively wrong rather than merely incomplete.

What was wrong

parse_bytes() error semantics. README said "Error after {} packets". Both halves of that are now misleading: a malformed IPFIX message is discarded on its own and parsing resumes at the next one, so packets can appear both before and after the reported error — and when several messages fail, error holds the first, not the last.

iter_packets() continuation. The example showed an Err arm and said nothing about whether iteration continued. That is exactly the question #330 changed the answer to. Now documented: it resumes when a discarded message locates the next one, and stops only when no trustworthy boundary remains — a length below the 16-octet Message Header, one leaving nothing behind it, or a filtered version. v5, v7 and v9 always stop, since none can locate the next message after a failure.

Chained messages were undocumented. The word "chained" appeared nowhere in README, despite being the subject of two 1.1.0 fixes (#329, #330). New section covering RFC 7011 §9.1 discard semantics and AutoScopedParser::parse_from_source re-deriving the scope per surviving message.

NoTemplateReason was undocumented. The pending-flow section said NoTemplate flowsets are cached and replayed, without qualification. An UndecodableBody flowset deliberately never is — no template arriving later changes its octets. A table now distinguishes the two reasons and points at is_replayable().

Two error variants were missing from the list. MalformedSetFraming (new in 1.1.0) and DecodedOutputLimitExceeded (already used in an earlier section but never listed). The former now also describes what it carries and why it is distinct from Partial.

Note on the sync check

./scripts/check-readme-sync.sh passed throughout and caught none of this. It compares section headers against a lib.rs that has none — because lib.rs is the include_str! attribute — so that comparison is vacuous and it only ever verifies that doc tests compile and a ToC exists. Not fixed here, but worth knowing it is not the safety net its name suggests.

Docs only; no code changes. ./scripts/check-all.sh passes all 7 checks.

README is the crate's top-level rustdoc via include_str!, so it is what
lands on docs.rs. None of the four 1.1.0 entries were reflected in it, and
two of the gaps made the existing text actively wrong rather than merely
incomplete.

parse_bytes no longer stops at the first message-level error: a malformed
IPFIX message is discarded on its own and parsing resumes at the next one,
so packets can appear both before and after the reported error, and the
reported error is the first rather than the last. README said "Error after
N packets", which now misleads on both counts.

iter_packets likewise continues past a recoverable error instead of ending
the stream. Its example showed an Err arm and said nothing about whether
iteration continued, which is precisely the question the change altered
the answer to. Document when it resumes and when it still stops, and that
v5, v7 and v9 always stop because none of them can locate the next message.

Add a Chained messages and error recovery section covering RFC 7011
section 9.1 discard semantics and AutoScopedParser::parse_from_source
re-deriving the scope per surviving message, since "chained" appeared
nowhere in README despite being the subject of two 1.1.0 fixes.

Document NoTemplateReason: the pending-flow section claimed NoTemplate
flowsets are cached and replayed without qualification, but an
UndecodableBody flowset deliberately never is, because no template
arriving later changes its octets. A table now distinguishes the two
reasons and points at is_replayable().

List MalformedSetFraming and DecodedOutputLimitExceeded among the error
types, and describe what the former carries and why it is distinct from
Partial. DecodedOutputLimitExceeded was already used in an earlier section
but had never been listed.

check-readme-sync.sh passed throughout and caught none of this; it
compares section headers against a lib.rs that has none, since lib.rs is
just the include_str! attribute.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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