Skip to content

fix(forge): preserve debug traces when setUp reverts#14390

Open
IrshadKohl51 wants to merge 2 commits intofoundry-rs:masterfrom
IrshadKohl51:forge-debug-setup-revert-traces
Open

fix(forge): preserve debug traces when setUp reverts#14390
IrshadKohl51 wants to merge 2 commits intofoundry-rs:masterfrom
IrshadKohl51:forge-debug-setup-revert-traces

Conversation

@IrshadKohl51
Copy link
Copy Markdown

Motivation

forge test --debug currently only feeds Execution traces into the debugger.
When setUp() reverts, there is no execution trace, so debugger startup fails with Error: debug arena is empty and --dump cannot be used in this failure path (see #10322).

Solution

  • In forge test --debug, prefer Execution traces, but fall back to available Setup/Deployment traces when execution traces are empty.
  • Adjust setup tracing override logic in the runner so debug tracing is preserved for debug runs (while keeping the existing optimization for non-debug runs and invariant needs).
  • Add a regression test test_debug_with_dump_setup_revert to verify:
    • --debug --dump completes when setUp() reverts,
    • dump file is generated,
    • debug arena is empty is not emitted,
    • setup failure is still reported in output.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Copy link
Copy Markdown
Collaborator

@mablr mablr left a comment

Choose a reason for hiding this comment

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

sgtm, thanks

Copy link
Copy Markdown
Collaborator

@figtracer figtracer left a comment

Choose a reason for hiding this comment

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

should probably do the same for invariant runs too, everything else lgtm

@mablr
Copy link
Copy Markdown
Collaborator

mablr commented Apr 23, 2026

should probably do the same for invariant runs too, everything else lgtm

@figtracer follow-up ? Is this g2g ?

@figtracer
Copy link
Copy Markdown
Collaborator

should probably do the same for invariant runs too, everything else lgtm

@figtracer follow-up ? Is this g2g ?

would like to get another approval from @zerosnacks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants