Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions proposals/MIGRATION-PLAN.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,12 @@ Heuristic:
| C2 wave 2a | DONE | Scalar multiply/divide (2026-06-05, Opus). `Mul`/`Div` turned out to be pure *scalar* value-transforms (not memory ops), so they need *no* array ABI — split out of "wave 2" and landed now. *1 kernel* `VmMulDiv` (11 exports) under `proposals/idaptik/migrated/`. Brain = the reversible ancilla multiply (`c := c + a*b`, inverse `c := c - a*b`) + the quotient/remainder divide whose dividend is reconstructable (`q*b + r == a` for all b incl. 0); the intentional-flaw in-place/simple variants migrated as value transforms with no rt==id claim. *Four gates green:* 1/1 compile, *3322/3322 parity* (incl. mul reversibility roundtrip + div reconstruction), G3 n/a (numeric transform), 1/1 assail-clean. *2 new i32 ABI facts:* (a) JS `a*b` loses precision >2^53 → oracle must use `Math.imul` to match `i32.mul`; (b) `i32.div_s` TRAPS on `b==0` and `INT_MIN/-1` (ReScript wraps the latter) → brain guards both (nested-`if`, avoiding the unverified `&&` codegen path) so the wasm is total. Evidence: `migrated/EVIDENCE-C2-wave2a.adoc`. NEXT: C2 wave 2b.
| C2 wave 2b | DONE | Memory/stack/port/control opcodes (2026-06-05, Opus). *The "needs an array/linear-memory ABI" premise was WRONG and re-decomposition overturned it:* reading the sources, the VM's memory/stack/port buffers are not arrays in the brain — `VmState.res` stores every one as string-keyed dict slots (`_mem:N`, `_s:N`, `_pin:port`), i.e. host-side STATE (senses). The integer brains are all scalar. *4 kernels* `VmMemory` (LOAD/STORE), `VmStack` (PUSH/POP), `VmPort` (RECV/SEND), `VmControl` (IF_POS/IF_ZERO/LOOP) covering *9 opcodes*. *Four gates green:* 4/4 compile, *1568/1568 parity* (incl. load/store/sp/recv/send round-trips), G3 n/a (transforms/predicates), 4/4 assail-clean. No-kernel senses (classified, not migrated): Call (orchestration), CoprocessorCall (tombstone — never implemented), State/VmState/VM/SubroutineRegistry/VmStateCoprocessor/InstructionCoprocessor (state containers / bridges). Evidence: `migrated/EVIDENCE-C2-wave2b.adoc`. *No array ABI was required* (the blocker was a triage-bucket artefact). *Cluster C2 COMPLETE.* NEXT: C3.
| C3 | DONE | Coprocessor wiring layer (2026-06-05, Opus) — *classified, no new brains to extract.* C3's 17 `src/shared/` files are the host-side bridge layer that exposes C1's already-migrated wasm brains to the game engine. Verified de-dup (by constant, not name): the integer cores C3 needs (`compute_gate`/`data_limit_for_domain` 513/16/259/1024, `max_concurrent_compute` 10, `is_transient` 503/504/429, policy table, DeviceType/GameEvent ordinals) are *all* already migrated + 4-gate-verified in C1. The 12 `*Coprocessor.res` are pure-FFI passthrough (0 logic lines); `Kernel_Compute`/`RetryPolicy` (src/shared) are async/float wrappers over C1 brains; `DeviceType`/`GameEvent` add string-gated ops (string wall, Phase F). No 4-gate run (nothing new to verify). Bridges stay host-side as the essential wasm-loading glue (ADDITIVE, FeaturePacks-flagged); their ReScript→glue fate is a Phase-Ω cutover decision. Evidence: `migrated/EVIDENCE-C3.adoc`. NEXT: C5.
| C5 | DONE | Engine coprocessors (2026-06-05, Opus). *2 integer brains extracted + 9 senses classified.* `Maths` (clamp/lerp-milli/dist_sq — float-wall convention, sqrt host-side) and — the strategic one — `Random`, the deterministic **xmur3 + mulberry32 PRNG**, the multiplayer-reproducibility backbone (host iterates the seed string + does the final u32→[0,1) float div; brain owns the i32 mixing). *Four gates green:* 2/2 compile, *2108/2108 parity* (Random **bit-exact** vs the JS source over the full i32 domain + UTF-16 code units, incl. the `>>>` emulation + signed-i32 multiplier constants), G3 n/a (transforms/mixing), 2/2 assail-clean. Senses (classified, not migrated): 5 `*Coprocessor` FFI bridges, Resize/GetResolution (float+DOM), Audio (Pixi), Navigation (screen-stack orchestration + async asset load, effect-gated), WaitFor (timing). Evidence: `migrated/EVIDENCE-C5.adoc`. NEXT: C11.
| C9..C12 | TODO | Remaining clusters per `migration-map.json`: *C11 (10, "pure integer presentation state" — font scaling/keyboard-nav/popup logic)* next (highest brain-yield); then C9 (16, game-loop/AffineTEA/VeriSim types — mixed) and C10 (21, utils/tools/companions/narrative/proven — mixed); C12 (43, render-glue screens/PixiJS bindings — senses-heavy, migrated last). Established scalar/enum/predicate recipe. Genuine compiler gates remain: string wall (52 non-test .res — note the `[len:i32][utf8]` layout is already in `codegen.ml:375`, only the *ops* are missing), effect wall (110); unary-`~` codegen bug is a candidate Phase-F fix.
| F+ | TODO | Compiler walls (string backend, then effects).
| C5 | DONE | Engine coprocessors (2026-06-05, Opus). *2 integer brains extracted + 9 senses classified.* `Maths` (clamp/lerp-milli/dist_sq — float-wall convention, sqrt host-side) and — the strategic one — `Random`, the deterministic **xmur3 + mulberry32 PRNG**, the multiplayer-reproducibility backbone (host iterates the seed string + does the final u32→[0,1) float div; brain owns the i32 mixing). *Four gates green:* 2/2 compile, *2108/2108 parity* (Random **bit-exact** vs the JS source over the full i32 domain + UTF-16 code units, incl. the `>>>` emulation + signed-i32 multiplier constants), G3 n/a (transforms/mixing), 2/2 assail-clean. Senses (classified, not migrated): 5 `*Coprocessor` FFI bridges, Resize/GetResolution (float+DOM), Audio (Pixi), Navigation (screen-stack orchestration + async asset load, effect-gated), WaitFor (timing). Evidence: `migrated/EVIDENCE-C5.adoc`. NEXT: C11 (done below).
| C11 | DONE | UI and accessibility coprocessors (2026-06-05) — *classified, NO_NEW_BRAINS.* All 10 files are host-side senses. `DualAlert.res` integer core (alert-level ordinals, escalation, trigger-milli, scrub, overall-threat, dispatch predicates) was already extracted in C6 (`DualAlert.affine`, 613/613 parity, LOSSLESS boundary proof). `DualAlertCoprocessor.res` is the existing ReScript FFI bridge to that wasm. `ForceLayoutCoprocessor.res` wraps `forcelayout.wasm`, a float-only physics kernel (euclidean/repulsion/attraction/velocity/alpha — f64 throughout; float-wall: brain stays host-side). Remaining 7 files (`Button`, `HubButton`, `NavButton`, `Label`, `VolumeSlider`, `InventoryUI`, `HardwareWiring`) are pure PixiJS/PixiUI senses with zero separable integer computation. No 4-gate run. Evidence: `migrated/EVIDENCE-C11.adoc`. NEXT: C9.
| C9 | DONE | Game-loop / AffineTEA / VeriSim types (2026-06-05) — *classified, NO_NEW_BRAINS.* All 16 files are host-side senses. *4 bridge files* wrap already-live wasm brains: `AffineTEA.res` → `titlescreen.wasm` (TEA title-screen state machine), `AffineTEARouter.res` → `router.wasm` (affine nav back-stack), `PixiCoprocessor.res` → `pixi.wasm` (AffineScript PixiJS scene driver), `VmCoprocessor.res` → `vmcoprocessor.wasm` (C2). *8 VeriSimDB/Burble HTTP clients* (`SaveGame`, `VeriSimDrift`, `VeriSimFederation`, `VeriSimHexad`, `VeriSimProvenance`, `VeriSimSearch`, `VeriSimVcl`, `BurbleIntegration`) are async `fetch` wrappers — effect-gated throughout. `VeriSimTypes.res` enum variants (`modality`/`hexadStatus`/`driftLevel`) appear integer-clean but `modalityToString`/`modalityFromString` use string literals and all enums are used only in string-bearing records — string-wall gated, no standalone computation. `VeriSimError.res` constructors all carry `string` payloads — string-wall gated. `Main.res` / `GameLoop.res` are effect-gated orchestration; GameLoop integer counters are trivial increments interleaved with float physics and mutable JS objects. No 4-gate run. Evidence: `migrated/EVIDENCE-C9.adoc`. NEXT: C10.
| C10 | DONE | Utils/tools/companions/narrative/proven (2026-06-05) — *classified, NO_NEW_BRAINS.* All 21 files are host-side senses. *9 bridge files* wrap already-live wasm brains: `moletairecoprocessors.wasm` (Moletaire behaviour FSM), `moletairehunger.wasm` (hunger ordinals), `missionbriefing.wasm` (mission briefing state machine), `safefloat.wasm` (safe-float arithmetic), `passwordcracker.wasm` (password-crack score), `portscanner.wasm` (port-scan classifier), `colorpalette.wasm` (color lookup), `fontscale.wasm` (font-scale arithmetic), `gamei18n.wasm` (plural-form + language-cycle). Float-wall: `MoletaireHunger.res` (f64 gravity/hunger physics — integer enum functions already in `moletairehunger.wasm`), `SafeAngle.res` (Math.atan2/cos/sin/mod_float, all f64). String-wall: `ProvenError.res` (all constructors carry string fields), `MoletairePersistence.res` (equipmentToString/FromString), `Locales.res` (5-language translation dicts, ~650 string pairs), `PolyglotI18n.res` (String.replaceAll, async fetch of locale JSON). Effect-gated: `Announcer.res` (AccessibilitySettings + DomA11y), `DomA11y.res` (%raw DOM), `ColorPalette.res` (AccessibilitySettings mutable refs; color tables already in wasm), `KeyboardNav.res` (%raw window events), `PanicHandler.res` (Console.error), `UserSettings.res` (Storage/Audio/DesktopIntegration; stance enum string-serialized). No 4-gate run. Evidence: `migrated/EVIDENCE-C10.adoc`. NEXT: C12.
| C12 | DONE | Render-glue screens/PixiJS bindings (2026-06-05) — *classified, NO_NEW_BRAINS.* All 43 files are host-side senses. *12 bridge files* wrap already-live wasm brains (companionsrenderlogic, devicesrenderlogic, enemiesrenderlogic, toolspickupsrenderlogic, playerrenderlogic, narrativepopupsrenderlogic, balanceanalyser, locationdata, screenglitchfx, screensrunlooplogic, uirenderlogic, verisimprovenrenderlogic). *23 screen/popup files* are effect-gated PixiJS rendering orchestrators (GameI18n string calls, Motion.animate, mutable refs, Navigation APIs). *4 binding files* (Motion, Pixi, PixiSound, PixiUI) are pure `external` FFI declarations wrapping host-side JS libraries. *Phase Ω cluster sequence (C11→C9→C10→C12) complete.* Genuine compiler gates remain: string wall (71 corpus files — `[len:i32][utf8]` layout already in `codegen.ml:375`, only ops missing), effect wall (111 corpus files). Evidence: `migrated/EVIDENCE-C12.adoc`.
| F+ | TODO | Compiler walls (string backend, then effects). *Cluster migration complete; these are the next milestones.*
| Ω | TODO (access-gated) | Cutover + ReScript extinction.
|===

Expand Down
Loading
Loading