ReviewOS

home-lang/home

fix(ts): preserve re-export closure and declaration origins

#520
Closed chris opened this 8 days ago ·
8 days ago

Found while tracing source-owned export linkage for #487 (tracker #416).

Program.resolveImports and loadImportClosureImpl only visit top-level import_decl, not export_decl module references. With an entry-only tsconfig, re-exported files are not loaded/checked. The same invalid leaf is diagnosed when explicitly listed as a root. Repeated import resolution also appends duplicate graph edges instead of rebuilding the current dependency set.

Permanent fair audit: seven ordinary graph forms (imports, named/star/namespace/type-only re-exports, cycles, diamonds), each with entry-only/all-files roots and positive/negative pairs. Negative cases only append a wrong local assignment in the leaf. All compilers receive identical files, roots and strict/noEmit/noLib/skipLibCheck settings. Exact TS 6.0.3 and native TS 7.0.2 both pass 28/28; pre-change Home passes 13/28 (15 failures). Raw log: bench/vs_tsgo/results/reexport-discovery.rFhIvz/audit-before.log; frozen Home is the previous global-consumer.xZ8NXj/home-final binary.

The audit also exposes false TS2305 for locally re-exported imported bindings and false TS2308 when cycles/diamonds re-export the same original declaration. Those require real export-origin resolution, not suppressing ambiguity checks or accepting any duplicate name.

Required: load all static re-export targets; keep graph edges unique/current; preserve include provenance; follow aliases and cycles to actual owning declarations; distinguish same-origin duplicates from genuinely ambiguous exports. Add Program and shared CLI controls, retain all failures, and do not readmit typed graph timings merely because discovery is fixed. Actual generic/metadata linkage remains #487.

8 days ago

Progress checkpoint:

  • 8923583ef adds the fair entry-only/all-files discovery controls; d440dbee6 loads static re-export targets, rebuilds unique current edges, and preserves include provenance.
  • 5ff8a71a3 adds real-conflict controls so accepting same-origin diamonds cannot hide genuine TS2308 errors.
  • The export-origin audit now includes type-only function identity and runtime rejection, directly and through named/star barrels: 32/32 for TS 6.0.3 and native TS 7.0.2; pre-change Home 4/32. The original 28-case discovery baseline is 13/28 for Home and 28/28 for each TypeScript baseline.
  • A first candidate passes discovery 28/28 and the original 16/16 origin cases. Final expanded-audit and regression verification is in progress; no final 32-case Home result is claimed yet.
  • New resolver traversal uses owning declarations and a visited worklist for aliases, cycles and diamonds. It retains value-symbol identity through type-only paths and distinguishes import-type (TS1361) from export-type (TS1362) restrictions. This is declaration provenance, not transfer of checked generic/predicate/nominal metadata.

Raw logs: bench/vs_tsgo/results/reexport-discovery.rFhIvz. Failed candidates and pre-change results are retained. No new timings; both original typed graph admission failures remain excluded. Parent #487 and tracker #416 remain open.

8 days ago

Implemented and pushed in 2e1f795f9 (following discovery fix d440dbee6 and the small control commits).

The frozen final ReleaseFast binary passes discovery 28/28 (previously 13/28) and export-origin controls 32/32 (previously 4/32), matching TS 6.0.3 and native TS 7.0.2. Controls retain genuine ambiguity/missing-name errors, runtime type-only rejection through direct/named/star aliases, and local shadowing. The full checker passes 4,266/4,266, Program 117/117, and harness 41/41. The conformance/remaining regression run is still in progress.

No typed graph readmission: original graphs remain 0/2, globals 32/56, bound globals 44/56, imported owners 8/20. Overall Home admission remains 16/18, with only the two original graph failures; both TypeScript baselines pass 18/18. No new timings or speed claims.

Raw evidence: bench/vs_tsgo/results/reexport-discovery.rFhIvz/*-final.log. Binary SHA-256: bff8e072e39c79f0d44e360b0b36ed5b984fd71183debb8e8736efa1aa6e6e3c. Actual generic/predicate/nominal checked-semantic linkage remains #487/#480; this change supplies dependency closure and declaration provenance, not foreign local node IDs or imported any as completed type checking.

8 days ago

Final regression verification is complete and recorded in 3d3e6d95e: checker 4,266/4,266, conformance 1,417/1,417, Program 117/117, driver 187/187, CLI 69/69, harness 41/41. Final discovery/origin controls remain 28/28 and 32/32 for Home and both pinned TypeScript baselines.

This completes the static re-export discovery/declaration-origin prerequisite in #520, implemented in d440dbee6 and 2e1f795f9, with documentation/README in 89d634162. Exact final logs and binary remain in bench/vs_tsgo/results/reexport-discovery.rFhIvz.

It does not complete #487/#480 or tracker #416: imported generic/predicate/nominal checked-type consumption remains unresolved, both original graph controls still fail in Home, and no graph timing is readmitted. Existing global/owner counts and the 16/18 overall admission result are unchanged. No new speed claims.

Sign in to comment on this issue.