Background
PR #303 added tracing instrumentation to the inline-wrapping token- and fragment-classification pipeline. A post-merge review identified two testing gaps that are out of scope for that PR.
Raised by @leynos.
Gap 1 — find_footnote_end branch coverage (error)
find_footnote_end emits three distinct trace! events:
prefix_mismatch — input does not begin with [^
footnote_label_span_recognised — closing ] found; span computed
unterminated_bracket — bracket never closed
The existing tracing_tests module in src/wrap/tokenize/parsing.rs covers only the prefix_mismatch path. Add #[traced_test] tests for the remaining two branches, asserting the expected event messages are emitted:
- Call
find_footnote_end with a well-formed [^label] input and assert logs_contain("footnote label span recognised").
- Call
find_footnote_end with an unterminated [^label input (no closing ]) and assert logs_contain("unterminated_bracket").
Gap 2 — end-to-end tracing tests through the public API (warning)
All current tracing tests exercise internal helpers directly. Add at least one integration-level test that:
- Calls
wrap_text (the library's public entry point) with content that contains a footnote reference, e.g. "Some text.[^1]".
- Uses
#[traced_test] so a subscriber is installed.
- Asserts that the expected classification debug event (e.g.
logs_contain("fragment classified") and logs_contain("FootnoteRef")) is emitted during the wrapping pipeline.
This confirms that the instrumentation is reachable through the public API and not accidentally gated away.
References
Background
PR #303 added tracing instrumentation to the inline-wrapping token- and fragment-classification pipeline. A post-merge review identified two testing gaps that are out of scope for that PR.
Raised by @leynos.
Gap 1 —
find_footnote_endbranch coverage (error)find_footnote_endemits three distincttrace!events:prefix_mismatch— input does not begin with[^footnote_label_span_recognised— closing]found; span computedunterminated_bracket— bracket never closedThe existing
tracing_testsmodule insrc/wrap/tokenize/parsing.rscovers only theprefix_mismatchpath. Add#[traced_test]tests for the remaining two branches, asserting the expected event messages are emitted:find_footnote_endwith a well-formed[^label]input and assertlogs_contain("footnote label span recognised").find_footnote_endwith an unterminated[^labelinput (no closing]) and assertlogs_contain("unterminated_bracket").Gap 2 — end-to-end tracing tests through the public API (warning)
All current tracing tests exercise internal helpers directly. Add at least one integration-level test that:
wrap_text(the library's public entry point) with content that contains a footnote reference, e.g."Some text.[^1]".#[traced_test]so a subscriber is installed.logs_contain("fragment classified")andlogs_contain("FootnoteRef")) is emitted during the wrapping pipeline.This confirms that the instrumentation is reachable through the public API and not accidentally gated away.
References