Skip to content

Add insta snapshot tests for structured tracing event output #305

Description

@coderabbitai

Background

PR #303 (closes #296) added comprehensive tracing instrumentation to the inline-wrapping token- and fragment-classification pipeline, including #[traced_test] event-emission tests and a proptest for UTF-8 safety.

The Testing (Compile-Time / Ui) check from the PR review identified one remaining gap: no insta snapshot tests assert the stable structure of the emitted tracing events (field names, message strings, level) for the token, fragment, and footnote classification paths.

Required work

Add snapshot tests (using insta) that capture and assert the structured output of at least the following tracing call sites:

  • Fragment classification (fragment classified debug event in src/wrap/inline/fragment.rs)
  • Footnote reference parsing (footnote reference parsed debug event in src/wrap/tokenize/parsing.rs)
  • Link/image parsing (link or image parsed trace event in src/wrap/tokenize/parsing.rs)
  • Span promotion (token_span trace events in src/wrap/inline/token_span.rs)

The snapshots should assert at minimum the event message string and the structured field names (token, kind, start, end, width) so that accidental removal of instrumentation is caught at review time.

Constraints

  • Do not install a global tracing subscriber in library code.
  • Use #[traced_test] (already a dev-dependency) combined with insta's assert_snapshot! for capture.
  • Snapshots must be committed to the repository under snapshots/.

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions