feat(loader): INT-02 host-agnostic loader bridge — fix SAT-02 (Refs #179)#250
Merged
Conversation
) 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).
0a9fb3a to
4be8514
Compare
🔍 Hypatia Security ScanFindings: 44 issues detected
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
INT-02 — host-agnostic loader bridge (#179, Stage D substrate)
Fixes SAT-02:
packages/affine-jswas Deno-only andenv-import-only.fromFiledidDeno.readFile(new URL(path, import.meta.url).pathname)—url.pathnameis not a filesystem path (percent-encoded, drops Windowsdrive letters, meaningless for non-
file:URLs) andDeno.readFiledoesn't exist on Node/browser.
What landed
New
packages/affine-js/loader.js(mod.js consumes it):detectHost()— feature-detected Deno/Node/browserresolveUrl()— correct relative / POSIX / Windows / absolute-URL resolutionreadBytes()— host-agnostic byte reader (Deno.readFile / node:fs+fileURLToPath / fetch; Uint8Array/ArrayBuffer passthrough)buildImportObject()— full multi-namespace import object;envstays backward-compatible,options.modulescarries the cross-module imports INT-01 (INT-01: cross-module WASM import emission (substrate) #178) emits under the callee namespaceparseOwnershipSection()— accessor for theaffinescript.ownershipcustom section (typed-wasm contract carrier); binary format byte-identical toCodegen.build_ownership_section/Tw_verify.parse_ownership_section_payloadmod.jsrewired through the loader; newmod.ownershipgetter;LoadOptionsgainsbase+modules.types.d.ts(approvedTS-exemption public contract), README,
deno.jsonexport, anddocs/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 --force— 270/270tools/run_codegen_wasm_tests.sh— all passUnblocks INT-05 / INT-08 (#183) / INT-11. The
affinescript-dom-loadersatellite 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