Add tracing event snapshots (#305) - #411
Conversation
|
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:
WalkthroughAdd test-only tracing snapshot support, normalize captured event lines, and assert stable Insta snapshots for inline fragment classification, date-span detection, footnote parsing, and link-or-image parsing. ChangesTracing snapshot coverage
Possibly related issues
Possibly related PRs
Suggested labels: Poem
Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error, 1 warning)
✅ Passed checks (18 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5ae4ebded3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai resume |
✅ Action performedReviews resumed. |
Capture stable tracing output for inline fragment, parser, and date-span\nclassification events. The snapshots preserve level, target, message, and\nstructured fields while excluding volatile prefixes.
Move the fragment-classification snapshot test out of the oversized `fragment.rs` (which had grown past the 400-line limit) into a dedicated `fragment_tracing_snapshots.rs`, wired as a `#[path]` submodule to mirror the tokenizer snapshot layout. Add a usage example to the shared `normalise_event_lines` helper showing the `tracing-test` line format and its normalized output. Document the tracing-event snapshot-testing workflow and record the shared helper's ownership boundaries, permitted call-sites, and composition rules in docs/developers-guide.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
abc3376 to
c55f13f
Compare
Respond to review feedback that the tracing snapshot tests only pinned internal trace output. The snapshot and event tests now also assert the observable parsing, classification, and span-grouping results (link/footnote atomicity, plain-fragment classification, date-sequence grouping and width, and the declined-coupling edge case), keeping the trace snapshots supplementary rather than primary. Add proptest coverage for the shared normalisation helper: prove `stable_event_start` returns an idempotent suffix and strips a synthetic volatile prefix while preserving the event level and fields, and that `normalise_event_lines` keeps exactly the matching lines without trailing whitespace. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@coderabbitai Have the following failed checks now been resolved? If further work is required, please provide an AI agent prompt for the remaining work to be done to address these failures. Do not treat warnings as optional or aspirational. Where a change is out of scope for this PR, propose a GitHub issue unless one exists already. (Treat documentation and validation coverage as in scope). ❌ Failed checks (2 warnings)
|
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '=== PR metadata ==='
gh pr view 411 --repo leynos/mdtablefix --json number,state,headRefName,baseRefName,commits,files \
--jq '{number,state,headRefName,baseRefName,commitCount:(.commits|length),changedFiles:[.files[].path]}'
printf '%s\n' '=== Changed files ==='
git diff --name-status "$(git merge-base HEAD origin/HEAD)" HEAD 2>/dev/null || git diff --name-status HEAD~1 HEAD
printf '%s\n' '=== Relevant Rust module outlines ==='
for f in \
src/wrap/tracing_snapshot_support.rs \
src/wrap/inline/fragment_tracing_snapshots.rs \
src/wrap/inline/span_helper_tracing_tests.rs \
src/wrap/tokenize/parsing_tracing_snapshots.rs \
src/wrap/inline/fragment.rs \
src/wrap/tokenize/parsing.rs \
Cargo.toml
do
if [ -f "$f" ]; then
printf '\n--- %s ---\n' "$f"
case "$f" in
*.rs) ast-grep outline "$f" --items all || true ;;
*) sed -n '1,240p' "$f" ;;
esac
fi
done
printf '%s\n' '=== Test and proptest-related declarations/usages ==='
rg -n -i -C 3 \
'(proptest|quickcheck|arbitrary|normalise_event_lines|stable_event_start|parse_link_or_image|InlineFragment|determine_token_span)' \
-g '*.rs' -g 'Cargo.toml' -g 'Cargo.lock' .
printf '%s\n' '=== Candidate existing follow-up issues ==='
gh issue list --repo leynos/mdtablefix --state all --limit 100 \
--search 'tracing snapshot normalise normalise_event_lines proptest test' \
--json number,state,title,url \
--jq '.[] | "#\(.number) [\(.state)] \(.title) \(.url)"'Length of output: 117410 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '=== Exact PR diff for test and support changes ==='
git diff "$(git merge-base HEAD origin/HEAD)" HEAD -- \
src/wrap/tracing_snapshot_support.rs \
src/wrap/inline/fragment_tracing_snapshots.rs \
src/wrap/inline/span_helper_tracing_tests.rs \
src/wrap/tokenize/parsing_tracing_snapshots.rs \
src/wrap.rs \
src/wrap/inline/fragment.rs \
src/wrap/tokenize/parsing.rs
printf '%s\n' '=== Full normalisation helper, including properties ==='
cat -n src/wrap/tracing_snapshot_support.rs
printf '%s\n' '=== Public wrapping and processing entrypoints ==='
ast-grep outline src/wrap.rs src/wrap/inline.rs src/process.rs --items all 2>/dev/null || true
rg -n -C 4 \
'pub\s+(?:\(crate\)\s+)?fn\s+(wrap_text|wrap_preserving_code|process_stream|process_with_frontmatter)|\b(wrap_text|wrap_preserving_code|process_stream|process_with_frontmatter)\s*\(' \
src tests -g '*.rs'
printf '%s\n' '=== Existing public-boundary coverage for target cases ==='
rg -n -i -C 5 \
'(date|footnote|link|image|plain).{0,100}(wrap_text|wrap_preserving_code|process_stream)|(?:wrap_text|wrap_preserving_code|process_stream).{0,100}(date|footnote|link|image|plain)' \
tests src/wrap -g '*.rs'Length of output: 201522
Do not create a follow-up issue or perform further implementation work for these two warnings. The repository inspection confirms the coverage exists; execute the Rust test suite in CI or a Rust-enabled environment to validate runtime success, since this inspection environment did not run tests. |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/inline/span_helper_tracing_tests.rs`:
- Around line 89-95: Strengthen the assertions after
determine_token_span(&tokens, 0) so the declined-coupling case verifies the
expected non-empty end and _width values, while retaining the assertion that
tokens[..end] excludes "[^note]". Use the expected span and width for this
fixture rather than only checking the slice contents.
In `@src/wrap/tracing_snapshot_support.rs`:
- Around line 97-106: Strengthen the property assertions around
normalise_event_lines by comparing each output segment in order with its
corresponding matching input line after stable-prefix selection and
trailing-whitespace trimming. Keep the existing count and trim checks, and
ensure the assertions validate normalized content rather than only the number of
segments.
🪄 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: a0732a2c-6ba7-4ceb-877d-7f987bc9bc7d
📒 Files selected for processing (4)
src/wrap/inline/fragment_tracing_snapshots.rssrc/wrap/inline/span_helper_tracing_tests.rssrc/wrap/tokenize/parsing_tracing_snapshots.rssrc/wrap/tracing_snapshot_support.rs
Verify the declined-coupling edge case asserts the expected span ("word") and
width (4) for both fixtures, retaining the footnote-exclusion check. Strengthen
the `normalise_event_lines` property test to compare each output segment in
order against the independently derived stable-prefix, trimmed normalisation of
its matching line, keeping the existing count and trim checks.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Assert `end == 1` explicitly in the declined-coupling case so the test can no longer pass with an empty span, alongside the existing span/width checks. Rework the `normalise_event_lines` property to pair each output segment with its matching input line: assert the segment equals the prefix-stripped, trimmed line and is a trailing slice of that line, so the property validates normalised content rather than only segment count and trimming. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary
instasnapshots for inline fragment, token parsing, and date-span tracing events.Closes #305
References