ReviewOS

home-lang/home

Native FileHandle structured-clone transfer and descriptor ownership

#895
Open chris opened this 8 days ago ·
8 days ago

Native FileHandle structured-clone implementation is published on main through f5b1af9. Source 79dcb3d01 and 1,628 audited evidence artifacts replace the public-string marker/graph-rewriting workaround.

Implemented: native wrapper/backend branding, serialized-value descriptor tickets, alias identity, validation before ownership commit, receiver adoption, failed serialization rollback, dropped-message/unused-list cleanup, and unconsumed workerData cleanup before worker exit notification. The native codec serves workerData, MessagePort and structuredClone. FileHandle stream methods preserve virtual dispatch/reference counting/public-fd I/O; native descriptor state governs close and ownership. Ordinary marker-shaped user data remains ordinary data. SDK class/global-object layouts are unchanged.

Verified on Darwin arm64:

  • Build 56/56.
  • Final Node and Home controls pass identity through cycles/arrays/Maps/Sets, receiver I/O, duplicate/in-use rejection, rollback, direct clone, channel transport, plain data, discarded messages, unused transfer entries, fd override semantics and early worker termination closure.
  • All 21 unchanged FileHandle originals/validators pass as 21 process checks, with zero skips/failures/filtering/retries, including the formerly crashing worker-read original.
  • Five affected build-generation/ABI/FS ownership checks and Pickier pass.

The wider 119-file filesystem batch retains three fs.test.ts failures under host pressure. An unchanged complete-file recheck retains two recursive sync x100 deadline failures. These are tracked in #896 and are not presented as passing filesystem acceptance.

Remaining acceptance: dedicated GC/ASAN lifecycle coverage and other-platform transfer behavior; broader directory timing/ownership acceptance is tracked in #896/#878. #66 remains the full suite/independent-build acceptance tracker. Successful and failed development runs, launch-report conflicts and the separate full-file recheck are retained in the evidence.

8 days ago

Native implementation is in progress and retained locally. WorkerData no longer uses the public string marker or JavaScript graph rewriting. Structured clone brands real FileHandle wrappers, retains native descriptor tickets, preserves aliases, adopts received owners, and releases dropped/unreferenced payloads. Stream adapters now delegate through FileHandle methods; native descriptor access governs close/ownership while public-fd I/O semantics are compared against Node.

Initial native validation passed all 21 unchanged FileHandle originals and their validators, including the previously crashing worker-read original, with 21 process checks and no skips/failures/filtering/retries. The initial broader 119-file filesystem regression, affected ownership checks and Pickier also passed.

Expanded Node/Home controls verified graph identity, receiver I/O, rollback, duplicate/in-use rejection, direct structuredClone, MessagePort transport, preservation of ordinary marker-shaped objects, queued-message discard and unused transfer cleanup. Further Node comparisons exposed public-fd/stream/close semantics; those are corrected. The latest Home control reached early worker termination and found an unconsumed workerData descriptor ticket retained by the Worker. The native exit path now explicitly releases those tickets before parent notification.

The final shutdown rebuild is queued behind a confirmed-live machine-wide compiler corpus job. Final-version control/regression evidence and publication remain pending; prior passing versions are not substituted for that acceptance. Full #66 suite/platform acceptance remains open.

8 days ago

Native FileHandle handoff checkpoint (2026-10-14): #895 replaces workerData public-string markers/graph rewriting with native structured-clone branding, descriptor tickets, receiver adoption, aliases, rollback and discarded/unused payload cleanup. Native worker exit releases unconsumed tickets before parent notification. FileHandle streams delegate through handle methods; Node's public-fd I/O behavior is preserved while ownership/close uses the native descriptor. Source 79dcb3d01 and 1,628 Git-verified evidence artifacts are on main through f5b1af966. Build 56/56, final Node/Home lifecycle controls, all 21 unchanged FileHandle originals/validators (21 process checks, no skips/failures), five affected ownership checks and Pickier passed. The final wider 119-file batch had 390 passing cases/105 process checks, three fs.test.ts failures, 36 case skips and three complete-file skips. The unchanged full-file recheck passed 260 cases/seven skips with two recursive readdirSync x100 deadline failures; the prior fd-count failure did not recur. Those failures and host resource-probe logs are retained in #896; they receive no pass credit and are not resolved by the passing transfer subset. Full suite/all-platform acceptance, remaining skips, independent builds, #894 Temporal harness, #893/#878 callback traces and #891 integration remain open.

Sign in to comment on this issue.