Extend tracing-test coverage for footnote branches and public API (#306) - #417
Conversation
Close two post-merge testing gaps identified after PR #303 added tracing instrumentation to the inline-wrapping classification pipeline. - Add a direct `#[traced_test]` for `find_footnote_end`'s `footnote_label_span_recognized` branch, asserting the emitted event and structured fields while upholding the content-free logging convention. - Add the first integration-level tracing test driving the public `wrap_text` API with a footnote reference, proving the `fragment classified` / `FootnoteRef` DEBUG event survives through the pipeline. Enable `tracing-test`'s `no-env-filter` feature so the integration test crate captures events emitted from the `mdtablefix` library crate; the default per-crate env filter would otherwise hide the library's instrumentation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThe change enables crate-wide tracing capture in tests and adds assertions for footnote label recognition and ChangesTracing coverage
Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: Poem
Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error, 2 warnings)
✅ Passed checks (17 passed)
📋 Issue PlannerBuilt with CodeRabbit's Coding Plans for faster development and fewer bugs. View plan used: ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/wrap/tokenize/parsing_tests.rs`:
- Around line 281-282: In the test covering find_footnote_end("[^4] tail", 0),
replace the broad logs_contain checks for "start=" and "end=" with exact
assertions for "start=0" and "end=4", preserving the existing log validation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: d0d1332f-aaf3-448f-8043-05a595b66bba
📒 Files selected for processing (3)
Cargo.tomlsrc/wrap/tokenize/parsing_tests.rstests/wrap_unit/footnotes.rs
| assert!(logs_contain("start=")); | ||
| assert!(logs_contain("end=")); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Assert the exact span boundaries.
logs_contain("start=") and logs_contain("end=") only verify that the fields exist. For find_footnote_end("[^4] tail", 0), assert start=0 and end=4 so the test catches incorrect span metadata.
As per coding guidelines, tests must be substantive and fail for plausible incorrect implementations.
Suggested assertion tightening
- assert!(logs_contain("start="));
- assert!(logs_contain("end="));
+ assert!(logs_contain("start=0"));
+ assert!(logs_contain("end=4"));🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/wrap/tokenize/parsing_tests.rs` around lines 281 - 282, In the test
covering find_footnote_end("[^4] tail", 0), replace the broad logs_contain
checks for "start=" and "end=" with exact assertions for "start=0" and "end=4",
preserving the existing log validation.
Source: Coding guidelines
Address post-review feedback on the tracing-test additions. - Assert exact span metadata (`start=0`, `end=4`) in the `find_footnote_end` label-span traced test so an incorrect offset fails the test, rather than only checking the fields are present. - Document in the developers' guide why `tracing-test` is enabled with the `no-env-filter` feature: the default per-crate filter hides library events from integration tests under `tests/`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary
Closes #306.
Post-merge review of PR #303 (which added tracing instrumentation to the
inline-wrapping token- and fragment-classification pipeline) identified two
testing gaps that were out of scope for that PR. This change closes both.
Gap 1 —
find_footnote_endbranch coveragefind_footnote_endemits three distincttrace!events; the existingtracing_testsmodule insrc/wrap/tokenize/parsing.rsonly covered theprefix_mismatchpath directly, and theunterminated_bracketpath wasalready covered. This adds a direct
#[traced_test]for the remainingfootnote_label_span_recognizedbranch, callingfind_footnote_endwith awell-formed
[^4]input and asserting the emitted event message plus thestructured
start=/end=/token_length=4fields, while upholding thecontent-free logging convention (
!logs_contain("[^4]")).The assertion uses the exact emitted spelling
recognized(Oxford-ize),matching production code, rather than the
-isedvariant.Gap 2 — end-to-end tracing through the public API
All prior tracing tests exercised internal helpers directly. This adds the
first integration-level tracing test, in
tests/wrap_unit/footnotes.rs, thatdrives the public
wrap_textAPI with"Some text.[^1]"and asserts thefragment classified/kind=FootnoteRefDEBUG event fires. This confirmsthe instrumentation is reachable through the public API and not accidentally
gated away.
Note on
tracing-testconfigurationEnabling
tracing-test'sno-env-filterfeature was required for Gap 2: bydefault
#[traced_test]installs a per-crate env filter that only records thetest crate's own events, which would silently hide events emitted from the
mdtablefixlibrary crate in an integration test. This was not anticipated inthe coding plan but is necessary for the end-to-end test to observe the
library's instrumentation.
Validation
make check-fmt,make lint,make typecheck,make test— all green(lib 707/707,
wrap_unit84/84 including both new tests).coderabbit review --agent— 0 findings.References
🤖 Generated with Claude Code