60%

Section 06: Typeck var-mapping residual sub-root

Goal

Close the small genuine typeck sub-root: 8 ‘could not map callee var to caller scheme var’ + 4 UnresolvedTypeVar + 2 ‘Tag::Var in JIT pre-mono’. These are the real var-mapping misses in the recorder (resolve_scheme_var None-drop -> record_deferred_mono_call), distinct from ROOT A/B. Fix the mapping so these instances record + resolve.

Implementation Sketch

Investigate monomorphization.rs build_mono_var_subst:681 / resolve_scheme_var:720 / extract_indirect_scheme_var:743 + the deferred-resolution path in check/exports.rs (try_resolve_deferred_call). Fix the cases where the scheme-var resolution drops to None and the instance never records. Dual-exec parity; do NOT touch arc.md §STOP RC surface.

Spec References

ori_types/src/infer/expr/calls/monomorphization.rs:681/720/743/769; check/exports.rs (try_resolve_deferred_call); plans/aot-mono-completeness s-0a67b346 §09 (var-mapping context); layer-coverage.md §3.1.

Work Items

  • TDD-first: reproduce + pin the 8 could-not-map + 4 UnresolvedTypeVar + 2 Tag::Var cases as failing spec tests on the production path.
  • Fix the scheme-var resolution drops in monomorphization.rs (build_mono_var_subst/resolve_scheme_var/extract_indirect_scheme_var) + the deferred-resolution path; the instances record + resolve; interp==LLVM parity; zero leaks.
  • Layer-matrix closure (L1-L12); the 14 var-mapping/UnresolvedTypeVar/Tag::Var signatures absent from the test-all mono grep; debug+release; dual-exec; leak.

Fresh intel (regenerated)

{ “schema_version”: 1, “target”: { “kind”: “plan-section”, “ref”: “aot-mono-stdlib-completeness/s-2c948b84” }, “generated_at”: “2026-06-25T14:11:03.265986+00:00”, “graph_state”: { “head_sha”: “b74d6b9a”, “last_code_import_at”: “2026-06-25T14:06:45.587Z”, “embedding_stale”: false, “insights_stale”: false, “cpg_stale”: false }, “surfaces”: {}, “summary”: “intel-package[plan-section:aot-mono-stdlib-completeness/s-2c948b84] agent-authored dossier”, “degraded”: false, “dossier”: { “objective_symbols”: [], “tiers”: {}, “agent_authored”: true, “difficulty”: { “class”: “routine”, “research_online”: false, “research_mode”: “auto”, “signals”: [], “plan_dir”: “/home/eric/projects/ori_lang/plans/aot-mono-stdlib-completeness” } } }

(full dossier: typeck-var-mapping-residual—s-2c948b84.intel.json)

HISTORY

  • 2026-06-25 — §06 var-mapping recorder fix delivered; criterion scoped to the could-not-map signal; capability-dispatch residuals re-attributed to BUG-04-168: The genuine var-mapping recorder None-drops (emitting could not map callee var to caller scheme var) are delivered by recording transient HAS_VAR && !HAS_ERROR mono instances through a deferred-binding path (DeferredVarBinding::DeferredType), re-resolving them against the fully-linked pool at finish time, and setting current_function for test bodies (which act as a non-generic caller for monomorphization but were not setting it). Landed as compiler_repo d17f7eecc. The BUG-02-070 is_recordable poison gate is UNTOUCHED — error-poison is still dropped; BUG-02-070’s assert_eq/debug/equals missing-mono stays 0 (verified whole-corpus). could not map count: 12 → 0 whole-corpus.
  • An INITIAL attempt (reverted, not committed) instead narrowed the is_recordable poison gate itself to has_errors-only — empirically INERT on the §06 metric (the 18-signal count was unchanged) AND it edited the recorder basin the §05/§09 dossiers flag as what-NOT-to-touch, modifying the just-landed BUG-02-070 gate. Reverted per the dossier guidance; the deferred-binding path above is the kept fix.
  • The 4 UnresolvedTypeVar + 2 Tag::Var in JIT pre-mono residuals were RE-ATTRIBUTED away from var-mapping: they are PC-2 contract violations at jit_pre_mono inside capability-handler functions (tests/spec/capabilities/propagation.ori, capability-trait-dispatch monomorphization), a DISTINCT root from the recorder var-mapping None-drop. Tracked as BUG-04-168. §06’s deliverable is the could not map recorder signal only; criterion sc-18bb7f9c was amended from the original 3-signal grep to that owned signal. The whole-corpus zero-mono (including the capability-dispatch residuals) remains gated at §07 sc-c5309edf + plan-wide sc-7ab4c58c — not dodged, routed to its owning gate.

Items

  • TDD-first: reproduce + pin every ‘could not map callee var to caller scheme var’, ‘UnresolvedTypeVar’, and ‘Tag::Var in JIT pre-mono’ instance still emitted by a fresh ./test-all.sh (source the live count + the offending callees from the captured log grep; at HEAD 7b26a7fc8 = 12 could-not-map + 4 UnresolvedTypeVar + 2 Tag::Var-in-JIT-pre-mono, but pin the SIGNATURE classes not a hardcoded count) as failing spec tests on the production (LLVM+AOT) path.
  • Layer-matrix closure (L1-L12): all three §06 signature classes — ‘could not map callee var to caller scheme var’, ‘UnresolvedTypeVar’, ‘Tag::Var in JIT pre-mono’ — absent from a fresh ./test-all.sh mono grep (grep -cE of the three phrases == 0, not a hardcoded count); debug+release builds; interp==LLVM dual-exec parity; ORI_CHECK_LEAKS=1 zero leaks.