Skip to content

GD-1088: Introduce structured stack trace and error model for assertion failures#1099

Open
MikeSchulze wants to merge 3 commits intomasterfrom
GD-1088
Open

GD-1088: Introduce structured stack trace and error model for assertion failures#1099
MikeSchulze wants to merge 3 commits intomasterfrom
GD-1088

Conversation

@MikeSchulze
Copy link
Copy Markdown
Collaborator

Why

Assertion failures previously only captured a line number via an ad-hoc
stack scan in GdUnitAssertions.get_line_number(). This made it impossible
to inspect or verify the full call stack when a failure occurred, limiting
diagnostics and making failure assertions (assert_failure) unable to
verify stack context.

What

  • Introduce three new types: GdStackTraceElement (single frame), GdUnitStackTrace (filtered test-side call stack), and GdUnitError (bundles message, line number, and stack trace). These replace the ad-hoc GdUnitAssertions.get_line_number() static helper which only extracted a single line number from the raw get_stack() result.
  • Propagate GdUnitError through the full reporting pipeline: assert impls construct it at failure time, GdAssertReports.report_error() stores it on the execution context and attaches it to GdUnitReport, making the complete stack trace retrievable after the fact — not just the message.

@MikeSchulze MikeSchulze self-assigned this Apr 9, 2026
@MikeSchulze MikeSchulze linked an issue Apr 9, 2026 that may be closed by this pull request
4 tasks
…on failures

  # Why
  Assertion failures previously only captured a line number via an ad-hoc
  stack scan in `GdUnitAssertions.get_line_number()`. This made it impossible
  to inspect or verify the full call stack when a failure occurred, limiting
  diagnostics and making failure assertions (`assert_failure`) unable to
  verify stack context.

# What
  - Introduce three new types: `GdStackTraceElement` (single frame), `GdUnitStackTrace`
    (filtered test-side call stack), and `GdUnitError` (bundles message, line number,
    and stack trace). These replace the ad-hoc `GdUnitAssertions.get_line_number()`
    static helper which only extracted a single line number from the raw `get_stack()`
    result.
  - Propagate `GdUnitError` through the full reporting pipeline: assert impls construct
    it at failure time, `GdAssertReports.report_error()` stores it on the execution
    context and attaches it to `GdUnitReport`, making the complete stack trace
    retrievable after the fact — not just the message.
@MikeSchulze MikeSchulze added the enhancement New feature or improvement label Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[GD-1088] Add an option to include the stack trace for failed assertions

1 participant