Skip to content

fix(resolve): remove b895374 seed band-aid; recursive cross-module resolution (#138)#193

Merged
hyperpolymath merged 1 commit into
mainfrom
fix/138-remove-seed-bandaid
May 18, 2026
Merged

fix(resolve): remove b895374 seed band-aid; recursive cross-module resolution (#138)#193
hyperpolymath merged 1 commit into
mainfrom
fix/138-remove-seed-bandaid

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

Closes the #138 cleanup at root cause (part of #128).

The b895374/#122 band-aid seeded Some/None/Ok/Err as flat builtins so files resolved without importing prelude — entrenching the interpreter-era flat namespace. It was masking the real gap: resolve_and_typecheck_module (used when a module is pulled in via use) resolved a dependency's decls but never its own imports.

  • resolve.ml: drop Some/None/Ok/Err from seed_builtins (keep RuntimeError — genuine interpreter exception variant, no module home); make resolve_and_typecheck_module/resolve_imports_with_loader mutually recursive so an imported module resolves its own use prelude::{...}/use string::{...} through the loader (stdlib import graph is an acyclic DAG, max depth io→string→prelude)

  • typecheck.ml: drop the mirrored builtin schemes (keep RuntimeError + opt/res type-ctor helpers); remove the stray If without else returns… debug eprintf

  • string/io/testing.affine: add the proper use prelude::{...} imports they relied on the seed for (ADR-011)

  • test_e2e: de-couple the nested-generic return-position test from the seed (like its param-position siblings)

  • stdlib 19/19 via the proper module path

  • dune test 233/233, zero regression

Refs #128
Refs #138

…ecursively (#138)

The b895374/#122 band-aid seeded Some/None/Ok/Err as flat builtins so
files resolved without importing prelude — entrenching the interpreter-
era flat namespace (#138, part of #128).

Root cause it masked: resolve_and_typecheck_module (the path used when a
module is pulled in via `use`) resolved a dependency's decls but never
its OWN imports, so an imported module couldn't reach prelude
constructors / sibling modules on its own. The global seed hid this.

- resolve.ml: drop Some/None/Ok/Err from seed_builtins (keep
  RuntimeError — genuine interpreter exception variant, no module home).
- resolve.ml: make resolve_and_typecheck_module / resolve_imports_with_loader
  mutually recursive so an imported module resolves its own
  `use prelude::{...}` / `use string::{...}` through the loader. The
  stdlib import graph is an acyclic DAG (max depth io->string->prelude).
- typecheck.ml: drop the mirrored Some/None/Ok/Err builtin schemes
  (keep RuntimeError, keep opt/res type-ctor helpers for builtin sigs);
  remove the stray "If without else returns…" debug eprintf.
- string/io/testing.affine: add the proper `use prelude::{...}`
  imports they were relying on the seed for (ADR-011).
- test_e2e: de-couple the nested-generic return-position test from the
  seed (exercise the type syntax without constructing Ok/None), like
  its param-position siblings.

stdlib 19/19 via the proper module path; 233/233 dune test; zero regression.

Refs #128
Refs #138

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@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