Skip to content

fix(runtime): materialize error stacks during inspect - #9933

Closed
proggeramlug wants to merge 1 commit into
PerryTS:mainfrom
proggeramlug:fix/9202-util-inspect-error-stacks
Closed

fix(runtime): materialize error stacks during inspect#9933
proggeramlug wants to merge 1 commit into
PerryTS:mainfrom
proggeramlug:fix/9202-util-inspect-error-stacks

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

util.inspect(new Error("outer", { cause })) and AggregateError inspection lost their stack/body layout after Error stacks became lazy in #9486. The formatter read ErrorHeader.stack directly, saw the pre-materialization null slot, and emitted the property body on a standalone { line; the node-suite/util/inspect/error-cause-and-aggregate parity row consequently failed.

Route inspection through the shared lazy stack materializer before selecting the displayed frame. This preserves captured frames until inspection actually consumes them and restores Node-compatible formatting for Error causes and AggregateError entries.

Tracked by #9202.

Validation:

  • ./run_parity_tests.sh --suite node-suite --module util --filter error-cause-and-aggregate (1/1)
  • ./run_parity_tests.sh --suite node-suite --module util (88/88)
  • cargo test --profile perry-dev -p perry-runtime -- --test-threads=1 (3,256 passed, 4 ignored; doc tests 8 ignored)
  • ./scripts/run_lint_gates.sh (all 64 local gates passed; 2 CI-only expressions skipped)

Summary by CodeRabbit

  • Bug Fixes
    • Fixed error inspection so lazily generated stack traces are materialized correctly.
    • Improved formatting for errors with causes and aggregate errors, preserving the expected stack and body layout.

@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 699c0f64-c061-4036-8ad3-984442c08ea3

📥 Commits

Reviewing files that changed from the base of the PR and between 87dc334 and dd4a1a1.

📒 Files selected for processing (2)
  • changelog.d/9933-util-inspect-lazy-error-stack.md
  • crates/perry-runtime/src/builtins/formatting/errors.rs

Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

util.inspect() now materializes lazy Error stacks before formatting Errors with a cause or AggregateError with errors. The changelog documents the Node-compatible stack and body layout fix.

Changes

Lazy Error inspection

Layer / File(s) Summary
Stack materialization during formatting
crates/perry-runtime/src/builtins/formatting/errors.rs, changelog.d/9933-util-inspect-lazy-error-stack.md
format_error_stack_frame materializes the Error stack before reading it. The changelog records the fix for cause and AggregateError formatting.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to dd4a1

Error inspection now preserves lazy stack frames when displaying causes and AggregateError entries, restoring expected stack and body formatting. No current merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main runtime change: materializing lazy error stacks during inspection.
Description check ✅ Passed The description explains the issue, implementation, tracked issue, and validation results. It does not reproduce every template heading, but it provides the required substantive information.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@proggeramlug

Copy link
Copy Markdown
Contributor Author

Landed on main via merge train #9939. Validated as a tree: 66/66 lint gates, and perry-runtime/codegen/hir/stdlib all green (5,966 tests, 0 failures). Thanks!

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