Skip to content

Preserve caller locations in test assertions - #536

Open
leynos wants to merge 1 commit into
test-quality-sweep-io-code-emphasisfrom
test-quality-sweep-assert-locations
Open

leynos wants to merge 1 commit into
test-quality-sweep-io-code-emphasisfrom
test-quality-sweep-assert-locations

Conversation

@leynos

@leynos leynos commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

This branch makes shared test assertion failures point to the calling case and clarifies table-width failure messages. The assertions, inputs, and expected behaviour stay the same. It follows PR #535 in the test-quality sweep.

Review walkthrough

Validation

  • make check-fmt, make lint, make test, make typecheck, make markdownlint, make nixie, make verus, and make verus-selftest passed sequentially on current head 7f820c412920ee02dc583c484463f2b57f50fca5 against PR Clarify test-body extraction failures #535 head d9ee1130fa4238da07e33b75d5293a0ed72c2ba2. Logs: /tmp/mdtablefix-restack-after-529-20260924/536-<gate>-run1.out.
  • Range-diff and stable patch ID confirm the one-commit, three-file patch survived the parent replay unchanged; git diff --check and CodeScene CLI 1.0.33 found no issues.
  • Hosted CI (all six jobs), Verus, and CodeScene passed on this exact head. Managed CodeRabbit request 91e0cc76 remains queued; the automatic check skipped this stacked base and is not a review.

Notes

The proposed final lint baseline remains in later source-fix layers. Phase 0 measured at least 997 Clippy sites and eight rustdoc errors before remediation, with integration-test targets incompletely measured. The repository has no spelling gate yet.

References

@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Team

Run ID: d0e2a794-5eda-4cb3-8483-476fbd9bef7f

📥 Commits

Reviewing files that changed from the base of the PR and between d9ee113 and 7f820c4.

📒 Files selected for processing (3)
  • tests/table/uniform.rs
  • tests/wrap/spanning_code_spans.rs
  • tests/wrap_leading_spaces.rs
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • leynos/netsuke (auto-detected)
  • leynos/df12-dylint-builds (auto-detected)
  • leynos/typos-config-builder (auto-detected)
  • leynos/falcon-correlate (auto-detected)
  • leynos/msgspec-crockford (auto-detected)
  • leynos/vk (auto-detected)
  • leynos/simulacat-core (auto-detected)
  • leynos/agent-template-python (auto-detected)
  • leynos/shared-actions (auto-detected)
  • leynos/cuprum (auto-detected)

Included review availability: 4 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


Summary

  • Add #[track_caller] to shared assertion helpers so failures report the calling test location.
  • Improve uniform-table assertion messages for empty output and width mismatches. Include the column index and row contents for width mismatches.

These changes do not alter assertion inputs or expected behaviour.

Validation

The PR objectives report that local validation gates, hosted CI jobs, Verus, and CodeScene passed on the stated head. No current review severity counts were supplied.

Walkthrough

Test assertion helpers now report caller locations. Table width assertions also provide messages for empty output and width mismatches.

Changes

Test helper diagnostics

Layer / File(s) Summary
Improve assertion failure reports
tests/table/uniform.rs, tests/wrap/spanning_code_spans.rs, tests/wrap_leading_spaces.rs
Table width assertions provide messages for empty output and mismatches. Wrapping assertion helpers use #[track_caller].

Priority: ⬇️ Low

Change: Refactor

Merge Risk: ⚪ Minimal · up to 7f820

The diagnostic-only test changes preserve existing behavior and present no merge-blocking risk.

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: preserving caller locations in shared test assertions. No roadmap item or issue number is required by the provided context.
Description check ✅ Passed The description directly explains the caller-location changes, clearer table-width diagnostics, affected files, and validation results.
Docstring Coverage ✅ Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 3 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Testing (Overall) ✅ Passed PASS — The pull request changes only existing test helpers in three test files. It adds #[track_caller] and clearer panic messages; it does not add or change product functionality. Existing tests st…
User-Facing Documentation ✅ Passed The pull request changes only three internal test helper functions. It adds #[track_caller] and improves panic messages; it does not change user-facing functionality or behaviour. No user-guide upda…
Developer Documentation ✅ Passed Pass this check. The pull request changes only three private test-helper functions. It adds #[track_caller] and improves assertion messages. It does not change an internal API, architecture, design …
Module-Level Documentation ✅ Passed Pass the module-level documentation check. All three changed Rust modules already have //! module docstrings. They describe the regression-test purpose and function; `tests/wrap/spanning_code_spans.…
Testing (Unit And Behavioural) ✅ Passed Accept the testing changes. The patch only improves diagnostics in existing test helpers with #[track_caller] and clearer assertion messages. The surrounding tests exercise public reflow_table, `p…
Testing (Property / Proof) ✅ Passed Pass this check. The diff only adds #[track_caller] and improves assertion messages in test helpers. It does not introduce a new invariant, algorithm, state transition, or proof assumption. The exis…
Testing (Compile-Time / Ui) ✅ Passed The pull request changes only private test helpers in three Rust test files. It adds #[track_caller] and improves panic messages; it does not introduce compile-time behaviour, public API behaviour, …
Unit Architecture ✅ Passed Pass. The pull request changes only three test helper functions. It adds #[track_caller] and improves assertion messages. These changes do not add queries, commands, fallible operations, dependencie…
Domain Architecture ✅ Passed Pass the Domain Architecture check. The authoritative diff changes only three files under tests/. It adds #[track_caller] and clearer assertion messages to test helpers. It does not change domain …
Observability ✅ Passed Mark this check as passed. The pull request changes only three files under tests/. It adds #[track_caller] and clearer assertion messages to test helpers. It does not alter production behaviour or…

Add caller paths when failures appear
Show the column and row with care
Empty output gets a message, too
Let wrapping checks point back to you
Keep each assertion’s story clear

Comment @coderabbitai help to get the list of available commands.

@sourcery-ai

sourcery-ai Bot commented Sep 23, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR improves test failure localization by applying #[track_caller] to shared assertion helpers, while making uniform-table width failures more actionable with explicit diagnostics; assertion logic, inputs, and expected behavior remain unchanged.

File-Level Changes

Change Details Files
Preserve test-case locations when shared assertion helpers fail.
  • Annotate uniform-table and wrapping assertion helpers with #[track_caller].
  • Keep failures attributed to the calling test case rather than the helper implementation.
tests/table/uniform.rs
tests/wrap/spanning_code_spans.rs
tests/wrap_leading_spaces.rs
Clarify uniform-table assertion diagnostics without changing validation behavior.
  • Add a message for empty reflowed-table output.
  • Report the column index and row contents when column widths differ.
tests/table/uniform.rs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@leynos
leynos marked this pull request as ready for review September 23, 2026 21:44

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @leynos, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 13 hours and 1 minute by commenting @sourcery-ai review. Upgrade to get a review now.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-23T21:46:41.889486Z 1107885 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Mark shared assertion helpers as caller-tracked so failures point to
individual test cases. Clarify table-width assertion messages without
changing the assertions or their inputs.
@leynos
leynos force-pushed the test-quality-sweep-assert-locations branch from 1107885 to 7f820c4 Compare September 24, 2026 05:17
@pandalump

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

This branch has not been deployed

No deployments
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.

2 participants