Skip to content

Show assertion source locations and golden diffs by default - #67

Merged
helly25 merged 1 commit into
mainfrom
fix/assertion-diagnostics
Oct 25, 2026
Merged

helly25 merged 1 commit into
mainfrom
fix/assertion-diagnostics

Conversation

@helly25

@helly25 helly25 commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Failed expectations now identify their source file and line, and golden-file failures show the unified diff without requiring --verbose. Both diagnostics appear in captured stderr and JUnit reports, so CI can explain a failure directly.

AG;DR

  • Add a private assertion-failure helper that records durable failure state and finds the first source frame outside the framework using Bash's source/line arrays. This points to the assertion itself, including assertions inside user helpers, subshells, and command substitutions; paths with spaces remain intact.
  • Keep raw strict-command bookkeeping separate. Bash 3.2 experiments show ERR trap metadata can identify the function declaration instead of the failing command. Those diagnostics retain command/status without claiming an inaccurate source line.
  • Always print content-mismatch diffs on stderr. Preserve the complete <result>.diff artifact and golden-update behavior. Verbose mode prints the failure diff once; its previous diff stdout now consistently uses stderr with other failure diagnostics.
  • Add report/stream/line regressions for equality/inequality, command assertions, invalid regexes, user helper files with spaces, and subshells. Check that normal and verbose golden failures each include one diff in stderr, with the decoded text in JUnit and the complete sidecar artifact. The portable files fixture verifies the exact source line and default diff through the Bazel macro on all platforms.
  • Document source-frame selection, stderr/JUnit behavior, and the raw-command location boundary.

Validation on published head 279e5580c36d4ecdc638266857d176f48e418ea6: focused pre-commit (all 76 Python tests), bazel test //..., bazel test --enable_runfiles=no //..., and external consumer integration. Local tests use macOS Bash 3.2; the Windows-only runtime target is incompatible locally. All checks passed in CI run 40220320804, including Linux, macOS, and managed Windows integration.

Dependencies: PR #66 is merged and main CI run 40217519049 passed every check. No open PR dependencies. This is the assertion-location/golden-diff part of the diagnostics plan; live output capture and interruption diagnostics follow after this PR merges.

@helly25
helly25 requested a review from Fab-Cat as a code owner October 25, 2026 18:14
@helly25
helly25 merged commit 6ad59b0 into main Oct 25, 2026
6 checks passed
@helly25
helly25 deleted the fix/assertion-diagnostics branch October 25, 2026 18:26
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.

1 participant