ReviewOS

zig-utils/zig-js

ABI: implement Bun process warnings and rejection event hooks

#239
Closed chris opened this 9 days ago ·
9 days ago

Parent: #134 Related: #140, #163, #164, #236

Build the process-warning/event foundation required to implement Bun's pending unhandled-rejection and uncaught-exception private ABI as observable runtime behavior rather than isolated no-ops.

Scope

  • Bun__Process__emitWarning
  • Bun__promises__emitUnhandledRejectionWarning
  • Bun__emitHandledPromiseEvent
  • Bun__handleUnhandledRejection
  • Bun__handleUncaughtException
  • Bun__wrapUnhandledRejectionErrorForUncaughtException
  • the directly required Process__dispatch* event hooks

Acceptance

  • Add a selected-realm process event/warning model with listener ordering, once/removal behavior, exact arguments, and reentrant mutation semantics needed by the pinned consumers.
  • Reproduce Bun's two-warning unhandled-rejection path, including own-stack classification, throwing stack access, pure fallback stringification, warning name/stack descriptors, and exception clearing between emissions.
  • Implement handled/unhandled rejection and uncaught-exception return codes, capture-callback precedence, monitor/listener ordering, origin strings, and fatal fallback boundaries.
  • Preserve Promise/reason identity, sibling-VM behavior, first-pending exceptions, and deterministic behavior when listeners throw.
  • Add focused runtime/differential fixtures and update both pinned inventories, README/docs evidence, and parent issues from committed artifacts.

This issue is intentionally a cluster: none of these exports should be counted complete until their shared process event semantics exist.

Child issues

  • #240 — realm-owned process EventEmitter semantics
  • #241 — process warning emission
  • #242 — rejection and uncaught-exception dispatch
9 days ago

Cluster complete on main. #240 established realm-owned process EventEmitter behavior; #241 added exact warning normalization and queued rejection warnings; #242 added fatal/rejection dispatch plus automatic exactly-once late-handled tracking. Published evidence is 065ce4f, with Home 239/431, Bun 233/421, and the combined runtime consumer passing 238/238. The broader private-profile and README-removal umbrellas remain open for their remaining inventory.

Sign in to comment on this issue.