Skip to content

feat(loader): INT-02 host-agnostic loader bridge — fix SAT-02 (Refs #179) - #250

Merged
hyperpolymath merged 1 commit into
mainfrom
int02-179-loader
May 19, 2026
Merged

feat(loader): INT-02 host-agnostic loader bridge — fix SAT-02 (Refs #179)#250
hyperpolymath merged 1 commit into
mainfrom
int02-179-loader

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

INT-02 — host-agnostic loader bridge (#179, Stage D substrate)

Fixes SAT-02: packages/affine-js was Deno-only and env-import-only.
fromFile did Deno.readFile(new URL(path, import.meta.url).pathname)
url.pathname is not a filesystem path (percent-encoded, drops Windows
drive letters, meaningless for non-file: URLs) and Deno.readFile
doesn't exist on Node/browser.

What landed

New packages/affine-js/loader.js (mod.js consumes it):

  • detectHost() — feature-detected Deno/Node/browser
  • resolveUrl() — correct relative / POSIX / Windows / absolute-URL resolution
  • readBytes() — host-agnostic byte reader (Deno.readFile / node:fs+fileURLToPath / fetch; Uint8Array/ArrayBuffer passthrough)
  • buildImportObject() — full multi-namespace import object; env stays backward-compatible, options.modules carries the cross-module imports INT-01 (INT-01: cross-module WASM import emission (substrate) #178) emits under the callee namespace
  • parseOwnershipSection() — accessor for the affinescript.ownership custom section (typed-wasm contract carrier); binary format byte-identical to Codegen.build_ownership_section / Tw_verify.parse_ownership_section_payload

mod.js rewired through the loader; new mod.ownership getter;
LoadOptions gains base + modules. types.d.ts (approved
TS-exemption public contract), README, deno.json export, and
docs/ECOSYSTEM.adoc (roadmap row + satellite registry) truthed.

Verification

  • packages/affine-js/loader_test.js — 14 Deno tests, all green (incl. the Windows-path SAT-02 regression guard)
  • dune test --force270/270
  • tools/run_codegen_wasm_tests.sh — all pass
  • Zero regression.

Unblocks INT-05 / INT-08 (#183) / INT-11. The affinescript-dom-loader
satellite shell is downstream of this primitive.

Refs #179 (delivered; satellite shell + downstream INT items are
separate — owner closes per ISSUE-CLOSURE).

🤖 Generated with Claude Code

@hyperpolymath
hyperpolymath enabled auto-merge (squash) May 19, 2026 16:18
)

packages/affine-js was Deno-only and env-import-only: `fromFile` did
`Deno.readFile(new URL(path, import.meta.url).pathname)`. `url.pathname`
is not a filesystem path (percent-encoded, drops the Windows drive
letter, meaningless for non-`file:` URLs) and `Deno.readFile` does not
exist on Node or in the browser. That was SAT-02.

New `packages/affine-js/loader.js` (consumed by mod.js):

* detectHost() — feature-detected Deno / Node / browser.
* resolveUrl() — correct relative/POSIX/Windows/absolute-URL resolution
  (replaces the broken `.pathname` mangling).
* readBytes() — host-agnostic: Deno.readFile / node:fs+fileURLToPath /
  fetch; passthrough for Uint8Array/ArrayBuffer.
* buildImportObject() — full multi-namespace import object; `env` stays
  backward-compatible, `options.modules` carries the cross-module
  imports INT-01 (#178) emits under the callee module's namespace.
* parseOwnershipSection() — accessor for the `affinescript.ownership`
  custom section (the typed-wasm contract carrier); binary format kept
  byte-identical to Codegen.build_ownership_section /
  Tw_verify.parse_ownership_section_payload.

mod.js: `fromFile`/`fromBytes` rewired through the loader; new
`mod.ownership` getter; `LoadOptions` gains `base` + `modules`.
types.d.ts (approved TS-exemption public contract) + README + deno.json
export + ECOSYSTEM.adoc roadmap/registry truthed.

Tests: packages/affine-js/loader_test.js (14 Deno tests, all green).
Gates: dune test --force 270/270; tools/run_codegen_wasm_tests.sh all
pass. Zero regression.

Refs #179 (loader bridge delivered; satellite shell + INT-05/08/11 are
downstream — owner closes).
@hyperpolymath
hyperpolymath merged commit b9db675 into main May 19, 2026
12 of 13 checks passed
@hyperpolymath
hyperpolymath deleted the int02-179-loader branch May 19, 2026 16:19
@github-actions

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 44 issues detected

Severity Count
🔴 Critical 12
🟠 High 21
🟡 Medium 11

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Stray AI.a2ml in root -- use 0-AI-MANIFEST.a2ml only",
    "type": "banned",
    "file": "AI.a2ml",
    "action": "delete",
    "rule_module": "root_hygiene",
    "severity": "high"
  },
  {
    "reason": "Superseded by 0-AI-MANIFEST.a2ml",
    "type": "banned",
    "file": "AI.djot",
    "action": "delete",
    "rule_module": "root_hygiene",
    "severity": "high"
  },
  {
    "reason": "Issue in quality.yml",
    "type": "missing_workflow",
    "file": "quality.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in security-policy.yml",
    "type": "missing_workflow",
    "file": "security-policy.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action hyperpolymath/standards/.github/workflows/governance-reusable.yml@main needs attention",
    "type": "unpinned_action",
    "file": "governance.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-deno-test/example/smoke_driver.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-deno-test/cli.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-deno-test/mod.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-deno-test/lib/compile.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  },
  {
    "reason": "TypeScript file detected -- banned language",
    "type": "banned_language_file",
    "file": "/home/runner/work/affinescript/affinescript/affinescript-deno-test/lib/runner.ts",
    "action": "flag",
    "rule_module": "cicd_rules",
    "severity": "critical"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

hyperpolymath added a commit that referenced this pull request May 31, 2026
… (Refs #179, #489)

INT-02 substrate (host-agnostic loader bridge) shipped in #250 + proven
in #267 back on 2026-05-19, but the issue (#179) stayed open under the
PR-body convention "Refs not Closes — owner-gated; the
`affinescript-dom-loader` satellite shell is downstream".

Re-verified on `main` @ efa0339 2026-05-31 (14/14 unit + e2e harness on
real compiler-emitted wasm both green); closed #179; the satellite-shell
scope question (separate repo vs. fold into `packages/affine-js`) is now
runtime (#183) unblocks (#255).

Truthed:
- ECOSYSTEM.adoc satellite-registry row → `scope-deferred` with the
  #489 / #183 / #255 back-pointer.
- ECOSYSTEM.adoc INT-02 ledger row → "#179 CLOSED 2026-05-31"; clarified
  "unblocked INT-05/08/11"; satellite-shell pointer → #489.
- ECOSYSTEM.adoc INT-05 row → INT-02 dep cleared; flagged as next-up
  candidate for issue-spinout (no other blockers).
- ECOSYSTEM.adoc INT-11 row → INT-02 dep cleared; still blocked by
  INT-08 runtime via #255; satellite-repo question pointer → #489.
- TECH-DEBT.adoc INT-02 row → matched closure language; satellite-repo
  pointer → #489.

No code change. Pure ledger truthing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
hyperpolymath added a commit that referenced this pull request May 31, 2026
… (Refs #179, #489) (#492)

INT-02 substrate (host-agnostic loader bridge) shipped in #250 + proven
in #267 back on 2026-05-19, but the issue (#179) stayed open under the
PR-body convention *\"Refs not Closes — owner-gated; the
`affinescript-dom-loader` satellite shell is downstream\"*.

Re-verified on `main` @ `efa0339` 2026-05-31 — 14/14 unit tests via
`deno task test` + e2e harness `tests/modules/loader-bridge/run.sh` on
real compiler-emitted xmod wasm both green. Closed #179.

The *satellite-shell scope question* (separate
`hyperpolymath/affinescript-dom-loader` repo vs. fold into
`packages/affine-js` vs. defer until INT-08 runtime unblocks) is now
**#489** with A/B/C options + recommendation pending owner call.

## Ledger updates

| Doc | Row | Change |
|---|---|---|
| `ECOSYSTEM.adoc` | satellite-registry `affinescript-dom-loader` |
`scaffold` → `scope-deferred`; back-pointer to #489 / #183 / #255 |
| `ECOSYSTEM.adoc` | INT-02 | added \"#179 CLOSED 2026-05-31\";
satellite-shell pointer → #489 |
| `ECOSYSTEM.adoc` | INT-05 | \"blocked by INT-02\" → INT-02 dep
cleared; flagged next-up for issue-spinout |
| `ECOSYSTEM.adoc` | INT-11 | INT-02 dep cleared; still blocked by
INT-08 runtime via #255; satellite-repo pointer → #489 |
| `TECH-DEBT.adoc` | INT-02 | matched closure language; satellite-repo
pointer → #489 |

`SAT-02` row in TECH-DEBT was already marked FIXED + Proven + locked —
left as-is.

No code change. Pure ledger truthing.

Refs #179, #489.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant