Skip to content

fix: cross-module stdlib imports (ADR-011) + module builtin seeding (#135)#172

Merged
hyperpolymath merged 1 commit into
mainfrom
fix/135-io-cross-module
May 18, 2026
Merged

fix: cross-module stdlib imports (ADR-011) + module builtin seeding (#135)#172
hyperpolymath merged 1 commit into
mainfrom
fix/135-io-cross-module

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

Implements the ruled ADR-011 model (explicit use module::{...}) and fixes the systemic resolver/typecheck bug that made any stdlib file with an import fail.

Root cause (3 coupled defects):

  1. resolve_and_typecheck_module built a bare context with no builtin seeding → imported modules failed resolution (UndefinedVariable "len"). Fixed by factoring seed_builtins and calling it there.
  2. Same path's manual check_decl fold skipped Typecheck.register_builtinsUnbound variable: len at typecheck. Now called.
  3. register_builtins missing eprint/eprintln (resolver seeds them).
    Plus pub on string.split/join + use string::{ split, join }; in io.

Result: io.affine's cross-module import now resolves end-to-end. io's remaining typecheck error is a separate pre-existing register_builtins drift (file-I/O family + read_line typed as String not Result) — out of scope here, documented for follow-up.

Verification: full suite 233/233, zero regression; stdlib sweep 12/19 (io advanced resolve→typecheck, no green file regressed).

Refs #128

…ng (#135)

The ruled ADR-011 model is explicit `use module::{...}`. io.affine
needs string.affine's split/join. Three coupled fixes:

1. resolve.ml: factor builtin seeding into `seed_builtins` and call it
   in `resolve_and_typecheck_module` — imported modules previously got
   a bare context, so resolving e.g. string.affine (pulled in by io's
   `use`) failed with UndefinedVariable "len".
2. resolve.ml: call `Typecheck.register_builtins` in the imported-module
   typecheck path (the manual check_decl fold skipped it, giving
   "Unbound variable: len" at the typecheck stage).
3. typecheck.ml: `register_builtins` was missing eprint/eprintln
   (resolver seeds them; typecheck did not).
Plus: `pub` on string.split/join; `use string::{ split, join };` in io.

Result: io.affine now passes resolution fully (ADR-011 cross-module
import works end to end). io's remaining typecheck failure is a
separate pre-existing register_builtins drift (file-I/O builtin family
+ read_line type), tracked separately. Full suite 233/233 green, zero
regression; stdlib 12/19 (unchanged count, io advanced resolve→tc).

Refs #128
@hyperpolymath hyperpolymath merged commit d23b71d into main May 18, 2026
11 of 12 checks passed
@hyperpolymath hyperpolymath deleted the fix/135-io-cross-module branch May 18, 2026 00:33
@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