diff --git a/.machine_readable/6a2/STATE.a2ml b/.machine_readable/6a2/STATE.a2ml index 843c9abe..b5c7d6a0 100644 --- a/.machine_readable/6a2/STATE.a2ml +++ b/.machine_readable/6a2/STATE.a2ml @@ -8,6 +8,7 @@ last-updated = "2026-05-03" status = "active" authoritative-status-doc = "docs/CAPABILITY-MATRIX.adoc" drift-flag = "STALE as of 2026-05-19: this file's [components]/[features]/[project-context] predate origin/main@dc5b817. It MIRRORS, it does not LEAD. For live readiness use docs/CAPABILITY-MATRIX.adoc; for the spine/contract/ledger use docs/ECOSYSTEM.adoc + docs/TECH-DEBT.adoc (DOC-05, issue #176). Gate baseline now 260/260, not 257." +session-note-2026-05-20-pm = "POST-#303 CATCH-UP: #297/#300/#301/#302/#304 + repos-monorepo retirement decision. (1) PR #300 MERGED (sha 8110548) — closed #297. lib/version.ml single source of truth + release.yml sed-bake step. Binary --version self-reports 0.1.1 now. (2) PR #304 OPENED for #301 (repo-wide PMPL→MPL-2.0 SPDX surface sweep, Option 3 of the three in the issue): 673 files / +1127 −711 / 1116 SPDX headers flipped / code generators emit MPL-2.0 / .machine_readable license fields reconciled / dune-project (license …) reconciled from stale MIT-OR-AGPL → MPL-2.0 / affinescript.opam regenerated → license: \"MPL-2.0\" / LICENSES/LICENSE-MPL-2.0 added (canonical Mozilla 373-line text) / root LICENSE narrative preserved unchanged (PMPL still narrated as preferred + MPL-2.0 fallback explanation intact) / vendored sister-repo subtrees (road-skate/ + affinescript-vite/) explicitly excluded. Verification: 295/295 dune tests + 6/6 shim tests + binary 0.1.1 + grep for residual PMPL SPDX → empty (excl. vendored). Side-effect noted in PR body: pre-existing dune-project symlink-to-.build/dune-project got broken by sed atomic-rename; both files now real-file content-identical. (3) Issue #302 CLOSED — owner confirmed GitLab+Bitbucket mirroring is intentionally off; Codeberg + Radicle are the active forges. (4) repos-monorepo RETIREMENT decided: snapshot tarred (23MB gzip / 144MB extracted / 23,970 entries / canonical origin/main shallow-clone / .git excluded) to /mnt/c/Users/USER/Downloads/repos-monorepo-snapshot-2026-05-20.tar.gz; owner-upload-to-Google-Drive then `gh repo delete hyperpolymath/repos-monorepo --yes`. repos-monorepo#9 (nested casket-ssg coherence) becomes moot post-delete since the aggregator that would have carried it is gone — standalone hyperpolymath/casket-ssg already merged casket-ssg#8 + has its own instant-sync.yml for forge propagation. (5) DOC/MEMORY: this session-note + the TECH-DEBT.adoc INT-04 update (mentioned #297/#300 + #301/#304) are part of follow-up PR to #303. The 4 earlier-saved reference memories (macos-13 retired, gitbot Refs-auto-close, estate mirror state, JSR publish recipe) all still apply unchanged." session-note-2026-05-20 = "INT-10 / #282 CLOSURE + JSR PUBLISH + ESTATE macos-13 SWEEP + DOC/MEMORY HARDENING. (1) ISSUE #282 ACTUALLY-DELIVERED end-to-end. PRs that landed today: #291 (partial pins.js fill for linux-x64 + macos-arm64, shim 0.1.1 — bridging before macos-x64 leg landed); #292 (release.yml: retired macos-13 GH-hosted runner → macos-15-intel — root cause of v0.1.0 macos-x64 leg sitting queued ~10h, traced to actions/runner-images#13046/#13402/#13634 'macos-13 fully unsupported since 2025-12-04'); v0.1.1 tag cut, full 3-platform release (linux-x64/macos-arm64/macos-x64) + SHA256SUMS published; #293 (delete 4 orphan .res files + the affine-res ReScript-bindings package — same precedent as packages/affine-ts/ removal 2026-05-11, fixed the recurring governance Language/anti-pattern check failure on every PR); #294 (release.yml checksums job: pass --repo \"$GITHUB_REPOSITORY\" so `gh release download` doesn't probe a missing .git — bug hidden on v0.1.0 by the macos-13 stall that pre-empted the checksums leg); #295 (final shim closure: pins.js VERSION→v0.1.1, all 3 sha256 fields filled, shim @hyperpolymath/affinescript 0.1.1→0.1.2, SHIM_SPEC bumped lock-step in tools/affinescript-lsp/src/compiler.rs); #298 (cross-runtime refactor: Deno/Bun/Node detection at module load + helper layer for hostOs/hostArch/envGet/readBytes/writeBytes/mkdirRecursive/chmodExec/spawnInherit/thisIsMain — was Deno-only — plus mod.d.ts + triple-slash reference so JSR fast-check finds the types and emits no warning; .claude/CLAUDE.md gained Runtime Exemptions section as the carve-out from the estate-wide Bun/Node ban); #299 (relicense the JSR shim package only — packages/affinescript-cli/{deno.json + 4 SPDX headers} — from PMPL-1.0-or-later to MPL-2.0 because JSR validates against the SPDX list and `PMPL-1.0-or-later` isn't on it; wider repo PMPL→MPL-2.0 deliberately deferred — #301). (2) JSR FIRST-TIME PUBLISH RECIPE walked: claim scope @hyperpolymath → create package record (jsr.io/new — dry-run won't catch this) → link trusted GitHub repo at package or scope settings (OIDC actorNotAuthorized otherwise — dry-run won't catch this either) → SPDX licence → mod.d.ts + triple-slash → cross-runtime tickbox. publish-jsr.yml workflow (manual workflow_dispatch); 6 dispatched runs today before all gates aligned (~7:33 UTC). Verified live: https://jsr.io/@hyperpolymath/affinescript 200; meta.json `latest: 0.1.2`. Real fetch+verify+exec smoke against the v0.1.1 release ran green on linux-x64 (resolveCompiler → SHA-verify → cache → exec `--version`). (3) ESTATE macos-13 SWEEP — sole non-affinescript first-party hits: `casket-ssg#8` (release.yml: `runner: macos-13` → `runner: macos-15-intel`, merged) + `proven#29` (zig-ffi.yml: `os: macos-13` → `os: macos-15-intel`, merged) + `repos-monorepo#9` (nested casket-ssg copy in boj-cartridges/polystack/poly-ssg/casket-ssg/.github/workflows/release.yml — still open as of writing, coherence-only since instant-sync.yml in each repo independently propagates). gh search code confirmed only 3 distinct first-party repo hits across the 360-repo active estate. (4) DISCOVERED — GitLab + Bitbucket mirrors NOT operating: empirical inspection of mirror.yml runs on affinescript / casket-ssg / repos-monorepo all `completed/skipped`; `GITLAB_MIRROR_ENABLED` / `BITBUCKET_MIRROR_ENABLED` repo vars unset; `GITLAB_TOKEN` / `BITBUCKET_TOKEN` secrets absent (only FARM_DISPATCH_TOKEN present); gitlab.com probes 302, bitbucket.org probes 404. repos-monorepo DOES have CODEBERG_MIRROR_ENABLED + RADICLE_MIRROR_ENABLED set → active forges are Codeberg + Radicle + whatever `.git-private-farm` fans out to. Filed as open question: #302. (5) FOLLOW-UPS: #297 (version-string drift — bin/main.ml/lib/repl.ml/lib/lsp_server.ml/lib/onnx_codegen.ml/dune-project all hardcoded `0.1.0` even on the v0.1.1 binary; fix PR #300 introduces lib/version.ml single-source-of-truth + release.yml sed-bake step on every tag); #301 (wider PMPL→MPL-2.0 estate-relicense decision needed); #302 (mirror status — intentional-off or unfinished-setup). (6) DOCUMENTATION: this file (a session-note); docs/PACKAGING.adoc (status table for all 3 JSR-publishable packages + first-publish-gotchas section); docs/TECH-DEBT.adoc (INT-04 / INT-10 lines updated to reflect actual publish). Memory: reference_macos_13_runner_retired.md, reference_estate_gitbot_auto_closes_on_refs.md, reference_estate_mirror_state_2026_05_20.md, reference_jsr_publish_recipe.md all saved + indexed in MEMORY_STANDING.md." session-note-2026-05-03-c = "EXTERN/VSCODE/ARRAY/PATCON BATCH. (1) `extern fn name(...) -> Ret;` and `extern type Name;` now parse — added EXTERN keyword to lexer/token/parse_driver, FnExtern to fn_body and TyExtern to type_body in AST, extern_fn_decl + extern_type_decl rules in parser.mly. Resolve registers the symbol; Typecheck.check_fn_decl special-cases FnExtern to register the polymorphic scheme without body checking; Codegen.gen_decl emits a real `(import \"env\" \"\" (func ...))` for each extern fn, mirroring gen_imports's cross-module shape. Borrow + Quantity skip extern fns. lib/dune now demotes warning 8/9 from error to warning so the new variants don't require lock-step updates across all 27 codegens (any non-Wasm codegen that doesn't handle FnExtern raises Match_failure with file:line at runtime — correct signal for 'this target has no story for host-supplied implementations'). 192 tests; 0 regressions. (2) Issue #35 Phase 2: stdlib/Vscode.affine and stdlib/VscodeLanguageClient.affine ship the ~12 + 3 binding declarations from the issue's API inventory (registerCommand, getConfiguration, showInformationMessage, createTerminal, ...). packages/affine-vscode/mod.js is the JS-side adapter that translates each `extern fn` invocation into the corresponding vscode/lc API call, with a JS-side handle table for opaque host objects and a string-marshal helper that reads `[u32 length][utf-8 bytes]` out of the wasm memory. Adapter returns a namespaced object `{ Vscode: {...}, VscodeLanguageClient: {...} }` matching the WASM cross-module imports' module names. examples/vscode_extension_minimal.affine demonstrates an end-to-end VS Code extension authored in AffineScript using `use Vscode::{registerCommand, showInformationMessage, pushSubscription}` — compiles to .cjs via the Node-CJS path. (3) issues-drafts/02 closed: `[T]` array type now parses via `LBRACKET type_expr RBRACKET → TyApp (Array, [TyArg elem])` in lib/parser.mly's type_expr_primary rule. Verified for fn params, return types, struct fields, and nested `[[T]]`. Other stdlib files (Option/math/io/string) still fail with distinct issues (`fn() -> T` type syntax, `Option` angle brackets) — the array fix advanced math.affine's failure point from line 349 to 354 etc. (4) PatCon sub-pattern destructuring under WasmGC: `match Mk(7, 99) { Mk(a, b) => a }` now lowers to RefCast + StructGet for the tag check + per-field RefCast HtI31 + I31GetS unboxing for each PatVar sub-pattern. Validated end-to-end: emitted .wasm instantiates in Deno and `main()` returns 7. The mixed-arity case (zero-arg + with-args in same enum, e.g. Option) errors loudly with the workaround documented (split into two matches, or use Wasm 1.0). Unifying variant rep — uniform `struct {tag, payload}` so Some+None can share — is the next destructuring milestone. 195 → 198 → 200 tests; 0 regressions throughout." session-note-2026-05-03-b = "FOLLOW-ON BATCH AFTER TYPED-WASM CLOSURE: variant-with-args under WasmGC, Node-target codegen Phase 1 (issue #35), stdlib Core.affine fix, cross-module for other codegens. (1) lib/codegen_gc.ml — added gen_variant_with_args helper that lowers ExprApp(ExprVariant(_), args) and bare-name `Some(42)` (via variant_tags lookup in ExprApp ExprVar) to a tagged anon-struct allocation [tag: i32, payload: anyref, ...] with i32 args boxed via ref.i31. ExprVar gained variant_tags fallback so `return Happy` works. gen_gc_function now post-processes body_code: when result_vt ≠ I32 the trailing `push_i32 0` fallback (emitted by gen_gc_block when blk_expr=None) is swapped for RefNull HtAny, which fixes 'end[0] expected type anyref, found i32' validator errors on functions that explicitly return a struct. Validated: emitted .wasm instantiates in Node 18 / V8 14, main() returns the GC struct. f64 args remain UnsupportedFeature (no i31 boxing path). (2) lib/codegen_node.ml — new module implementing issue #35 Phase 1 (Node-CJS emit). Wraps Codegen.generate_module output in a CJS shim with: inline base64-encoded wasm constant, lazy WebAssembly.instantiate on first activate/deactivate call, JS-side opaque-handle table (_registerHandle / _getHandle / _freeHandle exported for Phase 2 vscode bindings), minimal WASI fd_write so println-style codegen works, exports.activate/exports.deactivate re-exports of the wasm module's same-named exports. .cjs output extension dispatches in bin/main.ml (both JSON and non-JSON paths). Smoke-tested: real Node 18 require()s a generated .cjs and successfully calls activate(fakeContext) → 0, deactivate() → 0. Issue #35 Phases 2-4 (stdlib/Vscode.affine bindings, extension.ts → extension.affine migration, rattlescript-face sweep) remain as separate work. (3) stdlib/Core.affine — three parser-collision fixes: `pub fn const[A,B]` → `always` (const is a reserved keyword for compile-time bindings); `fn(x: A) -> C { ... }` lambdas → `|x: A|` form (the parser's actual lambda syntax); `flip` rewritten from `(A, B) -> C` to curried `A -> B -> C` to dodge tuple-arrow ambiguity. The originally-blocked tests/modules/test_simple_import.affine (use Core::{min}; min(10,20)) now compiles end-to-end. Other stdlib files (Option/math/io/string/...) still don't parse — each has distinct issues (fn() type syntax, `[T]` array type per issues-drafts/02, `Option` angle brackets) that need their own passes or compiler-level fixes. (4) lib/module_loader.ml — new flatten_imports : t -> program -> program that prepends imported public TopFns into the importer's prog_decls (deduplicating against local fn names). bin/main.ml now binds [let flat_prog = Module_loader.flatten_imports loader prog in] in both compile_file paths and threads flat_prog through all 22 non-Wasm codegens (Julia, JS, C, WGSL, Faust, ONNX, OCaml, Lua, Bash, Nickel, ReScript, Rust, LLVM, Verilog, Gleam, CUDA, Metal, OpenCL, MLIR, Why3, Lean, SPIR-V) — Wasm and Wasm-GC keep the original prog because Codegen.gen_imports handles their cross-module needs natively. Smoke-tested: caller_ok.affine (use CrossCallee::{consume}) now compiles to JS / Julia / Rust / Lua with consume's body inlined. The non-JSON compile_file path also gained ~loader on its previously-loaderless Codegen.generate_module call (latent bug for cross-module wasm via this path). 188 → 190 tests; 0 regressions." diff --git a/docs/TECH-DEBT.adoc b/docs/TECH-DEBT.adoc index 2c7f0e49..5ea471ca 100644 --- a/docs/TECH-DEBT.adoc +++ b/docs/TECH-DEBT.adoc @@ -202,7 +202,12 @@ merged (#283/#284/#285); S4 done — INT-10 closed (#282). **First JSR publish landed 2026-05-20: `@hyperpolymath/affinescript@0.1.2` LIVE** (cross-runtime Deno+Bun+Node, MPL-2.0, sibling .d.ts for fast-check). `@hyperpolymath/affine-js` + `@hyperpolymath/affinescript-tea` -remain dry-run-OK / not-yet-dispatched. +remain dry-run-OK / not-yet-dispatched. Compiler version-string +drift fixed via #297/#300 (single source of truth `lib/version.ml` ++ release.yml tag-time bake step — v0.1.1 binary now self-reports +`0.1.1`). Repo-wide SPDX surface relicensed PMPL-1.0-or-later → +MPL-2.0 (#301/#304; PMPL preserved as the narrative-preferred +licence in root `LICENSE`). |INT-07 |`affinescript-tea` runtime |S2 |#182 runtime + run loop shipped (TeaApp/parseTeaLayout, Linear-msg enforced); INT-01 cleared (#253) |INT-08 |DOM reconciler |S2 |#183 implemented + compiles; `.as`→`.affine`