Goal
Complete the pinned Home/Bun exception projection immediately downstream of #249 by implementing JSC__JSValue__toZigException, ZigException__collectSourceLines, and ZigException__fromException against exact extern layouts and ownership rules.
Parent tracking: #134, #140, #163, #164.
Why this is one slice
#249 intentionally implemented the upstream OnlyPosition stack pass. Home then performs a second OnlySourceLines pass over the same retained frames, while full exception projection owns error classification, name/message/system fields, frame storage, and the stable exception-cell pointer. Splitting those paths would duplicate layout and ownership logic or leave a misleading half-usable ABI.
Required implementation
- Pin
ZigException,ZigStackTrace, frame, string, error-code, and runtime-type layouts with compile-time offsets/sizes. - Project Error, DOMException, primitive throws, and error-like objects without parsing the formatted
.stacktext when retained frames exist. - Preserve exact name/message/type/runtime type plus non-observable
errno,syscall,code,path, andfdfields where applicable. - Populate caller-owned frame buffers with owned strings and stable exception-cell identity; preserve first pending exceptions and reject foreign VMs.
- Implement the second source-line pass from retained script/module source, honoring
source_lines_to_collect, line numbers, UTF-8/UTF-16 safety, truncation, and provider lifetime semantics. - Implement by-value
ZigException__fromExceptionwith explicit zero/owned-field behavior despite having no caller frame buffer. - Cover syntax/runtime/primitive/DOM/system-like errors, empty and capped buffers, sibling realms, foreign VMs, GC, ownership/deinit, and source lines near file boundaries.
- Promote both inventories and update README/API/Home integration evidence.
Evidence gate
- Home and Bun audits retain zero unclassified declarations.
- The compiled Home consumer checks exact layouts and runtime projection/source-line behavior.
- Targeted exception/stack/module/GC validation passes with zero leaks.
- The broad suite is batched with adjacent slices.
- The current benchmark artifact remains linked unless measured code changes.