feat(core): run native Sessions and whole-function Turns

Draft
CH
1mo ago
+2603-1017

Stack and scope

Refs #182; specification #180 / delivery map #174.

Draft intermediate replacement slice — not full-repository green or merge/release-ready.

Stack: #205 → #206 (#181) → #207 (partial #170 contracts) → this PR.
Immediate base: docs/effect-native-170-contract at d3d967c84333fd1774fd08b53af19d838a7721f2.
Reviewed head: fbcc4dc54bc606925fcd02419a6dff08ed7b071b.

Changes

  • Replace the Session kernel in place with fresh scoped native Sessions and whole-function Turns; remove the Promise Session facade rather than preserve a second engine.
  • Preserve direct Effect A/E/R and identity, explicit Message staging, busy/released rejection, confirmed-save publication, and complete-Cause uncertainty fencing.
  • Drain program and cleanup-created children before publication. Preserve the owner's selected native LIFO finalizer ordering: finalizers join children that still need resources later finalizers release. No Scope proxy or stronger unjoined-child failure policy.
  • Add typed owner-local non-durable receipts, ambient owning Session access, and caller-bounded passive observations with sequence gaps.
  • Preserve observer-failure regression intent and meaningful native ownership/type coverage. No dependency or compiler changes in this slice.

Verification

Independent Standards, Spec and Ponytail follow-ups found no remaining issues at the reviewed head. Parent verification at that exact head passed:

  • Approved compiler 7.0.2+effect-tsgo.0.36.5.
  • Focused kernel and positive type fixtures; stripped negative fixture exited 1 with exactly 14 intended diagnostics.
  • Core Session runtime suite: 26/26.
  • Scoped lint, repository formatting, root typecheck, Core/SDK builds and uncached docs build.
  • Four independent public-seam probes covering native child drain, compound/empty save Causes, receipt invalidation during release, final observation gaps and owner-approved cleanup ordering.
  • Whitespace, clean unchanged tree and evidence hashes.

Worker evidence additionally records 17 behavioral mutation reds and 14 type-mutation reds. One memory-retention mutation is explicitly unobservable through the released public API, not claimed killed; outcome deletion remains implemented. Historical failed candidates and parent harness setup failures are retained.

Known red gates and remaining limits

Full-repository check, test and build remain red at known legacy consumers awaiting #183/#184/#185/#186/#187/#201/#202. The worker compared failing task/test/type-error sets with prior candidates; these are not hidden with compatibility shims. Focused evidence does not make whole-repository CI green.

The store is a test seam, not a qualified durable backend. This PR claims no SQLite production integration, restart/power-loss, HTTP/TUI/Provider, Node-floor or native-target qualification. A hung save still blocks release pending #170's deadline/recovery contracts. Live outcomes remain owner-local, non-durable and unavailable during/after release.

#182 is stack-satisfied at this reviewed/tested SHA for descendant development only; the issue remains open and nothing is merged.

Local durable evidence: /home/cyan/.local/state/mitome/effect-native-stack/182-parent-validation-fbcc4dc-rRmLaEet/, 182-final-{standards,spec,ponytail}.md, and 182-evidence/policy-close/. Parent reproduction: bash /home/cyan/.local/state/mitome/effect-native-stack/validate-182-final-parent.sh on this machine.