Skip to content

feat(migration/modules): port 11 module-config files (megaport STEP 8 — first compilable batch)#72

Open
hyperpolymath wants to merge 1 commit into
mainfrom
feat/megaport-step8-modules-scaffold
Open

feat(migration/modules): port 11 module-config files (megaport STEP 8 — first compilable batch)#72
hyperpolymath wants to merge 1 commit into
mainfrom
feat/megaport-step8-modules-scaffold

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

Summary

  • Ports the 11 panll src/modules/ files that share the capability-declaration shape (capability sum + config record + hasCapability + capabilityLabel helpers) into migration/modules/*.affine.
  • All 11 files pass affinescript check — first compilable Mode-A batch in panll's STEP 8 megaport.
  • Total: 715 LoC of .res ported.

Files

.affine Source LoC
ServiceEndpoints.affine 39
TsdmModule.affine 57
TangleVizModule.affine 57
LanguageForgeModule.affine 60
PanicAttackModule.affine 63
FarmModule.affine 66
MassPanicModule.affine 66
VerificationDashboardModule.affine 67
SpecBrowserModule.affine 68
PlazaModule.affine 79
CloudGuardModule.affine 93

See migration/modules/STATUS.md for the per-file table + replacement plan + blocker analysis for the rest of src/modules/ and src/components/, src/update/, etc.

Depends on

affinescript#505prelude::contains (used by every hasCapability body) was indirectly affected; the broader stdlib pub gap was unblocked there. Without #505 some translation choices (e.g. using string::starts_with for similar prefix matches in other modules) would have to be hand-rolled.

What this PR is NOT

This does not replace any src/modules/*.res file in the build. The .res files still own the runtime contract (compile to src/modules/*.res.mjs via root rescript.json, consumers import from there). Replacement requires .affine.mjs codegen + consumer migration — both separate slices, tracked under standards#279.

What this PR IS

The 11 .affine files are the verified-correct future shape. When AffineScript gains source-to-ESM codegen for non-stdlib modules, promoting these 11 files to in-build status becomes a one-PR cutover instead of an 11-PR rewrite — the design risk is already discharged here.

Translation pattern (same for all 11)

  • type x = | A | B → unchanged + semicolons
  • array<T>[T], option<T>Option<T>
  • let r = {f: v}const r: T = #{ f: v }; (AS records need #{...})
  • let f = (x): T => bodyfn f(x) -> T { body }
  • arr->Array.includes(x)contains(arr, x) (prelude)
  • switch x { | A => ... }match x { A => ..., }

Campaign refs

  • standards#279 — STEP 8 MEGAPORT (idaptik + panll)
  • standards#252 — full ReScript→AffineScript campaign UMBRELLA
  • affinescript#406 — AS-side estate migration tracker

Test plan

  • Each of 11 .affine files passes affinescript check locally (against feat/stdlib-pub-visibility-megaport-unblock of affinescript = affinescript#505)
  • No source-file changes — only migration/modules/ additions
  • After affinescript#505 merges, re-verify against main AffineScript
  • Future: in-tree CI gate that runs affinescript check migration/**/*.affine (separate PR — adds AS toolchain dep to panll CI)

… — first compilable batch)

Ports the 11 panll src/modules/ files that share the capability-
declaration shape (capability sum + config record + hasCapability +
capabilityLabel helpers) — all pure data + pure functions, no
Tea_ / Pixi / Gossamer / Promise / FFI surface.

All 11 files pass `affinescript check`:
  ServiceEndpoints.affine        (39 LoC)
  TsdmModule.affine              (57)
  TangleVizModule.affine         (57)
  LanguageForgeModule.affine     (60)
  PanicAttackModule.affine       (63)
  FarmModule.affine              (66)
  MassPanicModule.affine         (66)
  VerificationDashboardModule    (67)
  SpecBrowserModule.affine       (68)
  PlazaModule.affine             (79)
  CloudGuardModule.affine        (93)

Total: 715 LoC of .res successfully ported to Mode-A
compilable AffineScript.

Translation pattern (same for all 11):
- `type x = | A | B` → unchanged + semicolons
- `array<T>` → `[T]`
- `option<T>` → `Option<T>`
- `let r = {f: v}` → `const r: T = #{ f: v };` (AS record literal)
- `let f = (x): T => body` → `fn f(x) -> T { body }`
- `arr->Array.includes(x)` → `contains(arr, x)` (prelude)
- `switch x {| A => ...}` → `match x { A => ...,}`

Depends on affinescript#505 — `contains` / other prelude fns being `pub`.

This PR ships the verified-correct future shape; does NOT replace
the .res files in the build (separate slice — needs .affine→.mjs
codegen + consumer migration). See migration/modules/STATUS.md for
detailed parity table + replacement plan + blocker analysis for the
other subsystems (TEA framework, Gossamer IPC, JSX) where the
remaining ~715 .res files live.

Refs standards#279 (megaport STEP 8), standards#252 (campaign UMBRELLA)
@hyperpolymath hyperpolymath enabled auto-merge (squash) May 31, 2026 07:27
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant