← Back to Pull requests

fix(node,bun): module frame for handled reports of a failed import (BWD-38 follow-up) #241

Closed
unknown closed this pull request without merging on Nov 29, 2026 18:12 UTC
View on GitHub
unknown unknown commented on Nov 28, 2026 08:41 UTC
Author

Follow-up to #240 (browser, webview, webworker). Independent of it: different packages.

Problem


@bugsee/node already has a module-load enricher (#219: Bun ResolveMessage, and a BuildMessage only when it carries a position (one without a position yields no frame), Node ERR_MODULE_NOT_FOUND & co.), but it was applied only inside the uncaught-error providers (crashOf). A failed import reported through client.logException (every framework adapter's error boundary) bypassed it:
  • Bun: ResolveMessage has no stack frames, so crash.json had frames: [] ("Unknown location").

  • Node: only node:internal/modules/esm/* loader frames.
  • Fix


    withModuleLoadFrames(enrichFrames?) in module-load-failure.ts is the single definition of "configured enrichers (locals, source context), then the failed module last". Both the providers' crashOf and the client's enrichFrames use it (the client previously got only the optional locals/source enrichers). @bugsee/bun and the Electron main process inherit it through @bugsee/node; no Bun-specific code was needed.

    Result


    crash.json leads with an import() frame whose file is the failed module. Node keeps its loader frames after it.

    Verification


  • Tests first (failed before the wiring): node launch (Bun-shaped stackless error, Node ERR_MODULE_NOT_FOUND, an ordinary-error control), bun launch, and a unit test pinning the helper's order.

  • Mutations (swap order, drop the configured enricher, unwire the client in node and in bun, break the providers' use) are all caught.

  • node 1213, bun 50, electron 648, nestjs 98, express 60 tests pass; 100% line coverage; typecheck (101 packages), lint, cycles clean.

  • Convergent multi-agent review not yet run.
  • 🤖 Generated with Claude Code

    https://claude.ai/code/session_01WeiJxRnbk1iC7HPhhoC2Cr

    Diff: 232 lines (+174 / -58) across 2 files Reviewer: krassx Review duration: 2010m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 232 lines diff across 2 files
    0.37
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.326
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #241"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 37.1% (MEDIUM) · Higher = larger blast radius
    37.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 14.6% · Safe to merge
    14.6%