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

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