fix: cross-module stdlib imports (ADR-011) + module builtin seeding (#135)#172
Merged
Conversation
…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
🔍 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.
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):
resolve_and_typecheck_modulebuilt a bare context with no builtin seeding → imported modules failed resolution (UndefinedVariable "len"). Fixed by factoringseed_builtinsand calling it there.check_declfold skippedTypecheck.register_builtins→Unbound variable: lenat typecheck. Now called.register_builtinsmissingeprint/eprintln(resolver seeds them).Plus
pubonstring.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_builtinsdrift (file-I/O family +read_linetyped 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