ReviewOS

home-lang/home

fix(ts): preserve declared global interface types

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

Found during the async admission audit (#473, #475, tracker #416), independently of the receiver/callback fix #479.

With the same strict/noEmit/noLib/skipLibCheck project and minimal declarations, TS 6.0.3 and native TS 7.0.2 report TS2322, TS2345 and TS2339 for this global script. Home accepts it without diagnostics:

interface Methods { identity(value: string): string; }
declare var methods: Methods;
const good: string = methods.identity('ok');
const bad: number = methods.identity('ok');
methods.identity(1);
methods.missing();

Adding export {}; makes Home report the same three diagnostic codes as both baselines. The global-script input must be fixed as-is, not changed into a module to make it pass.

A generic static interface reproduces the same erasure without Promise-specific names:

interface DeferredConstructor { identity<T>(value: T): T; }
declare var Deferred: DeferredConstructor;
const good: string = Deferred.identity('ok');
const bad: number = Deferred.identity('ok');

Both baselines report TS2322 in either scope; Home reports it only in module scope.

The checker’s bare type-reference branch returns any when programHasGlobalTypeName succeeds, before consulting the actual local type_names declaration. Program-wide name collection must not erase an available typed declaration. Preserve forward references, declaration merging, genuine global declarations across files and module-local isolation. Add shared positive/negative CLI and program-level regressions; do not implement name-specific exceptions for standard-library globals. This is a prerequisite for checking real PromiseConstructor/Promise.all declarations rather than accepting their results as any.

8 days ago

The first root-cause fix is under validation: resolve available local/forward/merged type declarations before using the program-wide name-only fallback. This also fixes a module-local interface being erased when a sibling global script happens to declare the same name.

The program regression matrix covers ordinary and generic methods, forward declarations, same-file interface merging, aliases, valid calls, and module-local isolation. All 100 program tests and 173 driver tests pass; checker and ReleaseFast validation are still running. No timing claim yet.

The cross-file audit confirms that this is not the complete fix for #480. Four unchanged shared projects produce these baseline diagnostics in both TS 6.0.3 and native TS 7.0.2:

Declarations split between real filesExpected diagnostics
Methods interface in sibling .d.ts, variable and calls in appTS2322, TS2345, TS2339
Generic DeferredConstructor interface in sibling .d.tsTS2322
Methods interface and declared variable both in sibling .d.tsTS2322, TS2345, TS2339
Methods interface merged across sibling .d.ts and appTS2322, TS2345, TS2339

Home's pre-fix binary accepts the first, second, and fourth projects without diagnostics; the third reports unresolved-value TS2304 instead of checking the declared type. The local audit is bench/vs_tsgo/results/global-audit.TExK7j.

Keep this issue open for cross-file declaration resolution. Program currently passes name arrays, while individual compilations own separate type/string interners and discard checker-owned generic signature metadata. Sharing only a TypeId or recreating shallow method-name shapes would not preserve the required semantics. The remaining work needs real declaration/type ownership, including generics, merging, and file-order independence. Async remains excluded under #473.

8 days ago

Progress pushed to main: 9817696 resolves actual/forward declarations before name-only fallback; 6cba2f2 keeps runtime value narrowing out of type lookup. The type/value collision also reproduced on the pre-turn binary, so it was an additional existing bug, not solely a regression of the first change.

The durable audit is in 50abd82. python3 bench/vs_tsgo/audit_globals.py gives 132 checks and 14 failures: all 72 same-file checks pass; both baselines pass all 20 cross-file cases, while Home passes 6/20. Declaration-before/after-app root orders expose the same failures. Valid/invalid cases, including module isolation and a same-named runtime value, are retained without known-failure skips.

Final source gates: 4,232 checker, 101 program, 173 driver, 69 CLI, and 25 harness/report tests pass. All 72 existing callback CLI checks and 18 path checks pass. The final ReleaseFast binary hash is 7fd2c7e10e2471de753e474fca44abba8f00cfe4bf851284fe1b114653c756ce.

Keep #480 open: sibling interfaces/generic static methods still erase results; sibling declared variables produce TS2304; cross-file interface merging misses members. Real cross-file type/declaration ownership remains necessary. No source concatenation, shallow benchmark-specific type facades, or name-specific exceptions were added.

The audit also discovered unsupported imported graph types (#487); those historical speed claims are withdrawn and new graph timing is gated. Full results and reproduction commands: https://github.com/home-lang/home/blob/2e146e71e/docs/docs/TS_PERFORMANCE.md#global-declaration-and-graph-admission-audit-untimed . No new timings under concurrent machine load.

8 days ago

Pushed three small conventional commits to main under the configured user identity, without coauthors:

  • 134a910: assertion signatures return void, fixing #489.
  • 091f151: core checked metadata is retained with Compilation; the retained relation engine no longer points into a destroyed Checker.
  • 97ab7d4: results, README link, and explicit remaining ownership work.

The ownership work is a prerequisite, not completed cross-file linkage. #488 remains open after auditing interpretation tables still owned by Checker (including NoInfer/this markers, readonly/pattern indexes, and tuple/array origins). Equal numeric TypeIds from separate compilations are not interchangeable. #480/#487 still require actual owner-aware type transfer and resolution.

Validation: 4,236 checker, 175 driver, 101 program, 69 CLI, and 25 harness/report tests pass. All 36 shared assertion controls and 72 earlier callback controls match TS 6.0.3 and native TS 7.0.2. The global audit remains at 14 Home failures out of 132 checks. Sixteen workload gates pass, both graph gates fail, and no benchmark is readmitted. No new timing run or speed claim; published observations and frozen sources are unchanged.

Details: https://github.com/home-lang/home/blob/97ab7d4e4/docs/docs/TS_PERFORMANCE.md#checked-type-ownership-and-assertion-returns-untimed .

8 days ago

Pushed three small conventional commits to origin/main as the configured user, without coauthors:

  • 304fd5d: retained semantic interpretation metadata and transactional borrowed-leaf capture (closes #488).
  • cbc757d: mandatory variadic-tuple rejection gate, schema 3, and legacy-report qualification (closes #492).
  • 4e50814: detailed results and brief README correctness table.

The ownership boundary is now covered for the audited semantic tables, but types are still owner-relative. Actual cross-file transfer/resolution, merging, cycles, and file-order behavior remain under #480/#487. All 18 positive workloads pass; 16 workload gates pass and both graph gates still fail. Global declaration controls remain 44/44 per TypeScript baseline and 30/44 for Home: 14 failures in 132 total checks. No graph is readmitted.

Validation: 4,237 checker, 178 driver, 101 program, 69 CLI, and 29 benchmark-harness/report tests pass. All 42 tuple controls and 36 assertion controls agree across Home, TS 6.0.3, and native TS 7.0.2. No new timing run under concurrent workstation load. Historical tuple observations are provisional because they predate the new gate; frozen sources and timing observations are unchanged.

Details: https://github.com/home-lang/home/blob/4e50814e7/docs/docs/TS_PERFORMANCE.md#semantic-metadata-ownership-and-tuple-admission-untimed .

8 days ago

Payload-layer prerequisite #494 is complete in e4c0a4caa, with initialization error-path cleanup in 99a8b7866 (#498). The transfer canonicalizes structural keys and preserves distinct declaration identities across owners; focused relation and exhaustive allocation-failure tests pass.

Documentation and the README link are pushed in 1b83d1fa1.

This does not resolve this issue: program checking does not call the new primitive. Real source/HIR provenance and checked semantic metadata must accompany remapped types. Blindly merging the retained string-keyed metadata tables could collapse declarations from different owners; signature semantics also cannot be inferred from structural TypeId equality alone. Typed resolution must address cyclic/forward imports, declaration merging, and owner-aware invalidation without any fallbacks or fabricated source nodes.

Fresh ReleaseFast admission remains unchanged against verified TS 6.0.3 and native TS 7.0.2: eighteen positive workloads pass, Home passes sixteen gates but fails both graph rejection gates, and the global audit has fourteen Home failures across 132 checks. Tuple controls (42) and assertion controls (36) pass. Full suites: 4,246 checker / 178 driver / 101 program / 69 CLI / 29 harness tests. No new timings, no graph readmission, and no new speed claim. See the documented checkpoint and README table; local evidence is in bench/vs_tsgo/results/type-transfer.FHPXSf.

8 days ago

This checkpoint is pushed to origin/main in four conventional commits, using Chris Breuer as author without coauthors:

  • 778597026: owner-scoped checked semantic transfer with exhaustive field classification, deep ownership, invalid-reference/collision checks, and allocation-failure tests.
  • 84dc71ca5: independently compiled owner-isolation regression, including shared canonical guard signatures with distinct predicates and real source-owner/node references.
  • 50ff4add4: permanent imported-owner positive/negative audit in both root orders.
  • 3026742a0: results, reproduction commands, limitations, and linked README table.

Final tests: 4,249/4,249 checker; 179/179 driver; 101/101 program; 69/69 CLI; 33/33 harness/report. The focused transfer runner passes 4/4 including its module root. The ReleaseFast retry completed successfully; the final binary SHA-256 is 4ad8003e751e1471db6f7ea855c3bf8a3822063e89ddb793b85d3714efe93393. The first release attempt did not produce a verified artifact while disk space was low; it is not used as evidence.

Fresh CLI checks against version-verified TS 6.0.3 and native TS 7.0.2 confirm:

  • All eighteen positive workloads pass; Home passes sixteen workload gates and fails both graph rejection gates.
  • All 42 tuple and 36 assertion controls pass.
  • Global audit: TS 6 and TS 7 each 44/44; Home 30/44 (fourteen failures across 132 checks).
  • Imported-owner audit: TS 6 and TS 7 each 20/20; Home 8/20 (twelve failures across sixty checks), unchanged from the preceding binary. These include false acceptance, rejected valid predicate narrowing, and wrong diagnostic codes for private-origin assignments; the docs distinguish them.

#500 is complete for semantic cloning, not program integration. Neither transfer operation is called by program checking. #480/#487 remain open for source-aware typed lookup, merging, cycles, owner-specific caching/invalidation, and coordinated publication of payloads plus metadata. A metadata clone failure does not undo a previously committed payload transfer. Registry handles must not be treated as local HIR nodes, and name-keyed semantic records must not be blindly merged across owners.

No graph is readmitted and no timing run or speed claim was made. Frozen tuple/predicate inputs are unchanged. See the documented checkpoint; local evidence is retained in bench/vs_tsgo/results/checked-transfer.IO4A4Q.

8 days ago

Pushed three conventional commits to origin/main as Chris Breuer, without coauthors:

  • 9d8be00d7: staged payload transfer and atomic checked-semantic publication.
  • 202f24b9a: production source-owner/provenance registry, coordinated rollback, stale revision invalidation, and checked-source readiness guards.
  • 53dbc4796: verified results, reproduction commands, limitations, and README link.

Full tests pass: 4,252 checker, 183 driver, 101 program, 69 CLI, 33 benchmark-harness/report. Fourteen focused transfer tests include cancellation, existing-key/enum preservation, exhaustive allocation faults, and metadata failures after full payload preparation. Registry tests cover real source text/HIR, same-path replacement, invalid/stale nodes, rollback after a declaration mapping was prepared, and successful retry. The compiled-owner test now uses the production registry rather than a test mapper. Bind-only compilation is rejected as an unchecked owner; completed checking with diagnostics remains distinguishable from unchecked state.

Fresh ReleaseFast binary SHA-256: 6d6b278c9df4db5a67171436def69c720fbe4d91e3171e8221c6d9cb161f4134. Against verified TS 6.0.3 and native TS 7.0.2, results are unchanged: eighteen positive workloads pass; Home passes sixteen workload gates but fails both graph gates; all 42 tuple and 36 assertion controls pass; global audit Home 30/44 versus each baseline 44/44; imported-owner audit Home 8/20 versus each baseline 20/20. Thus fourteen global and twelve owner-audit Home cases still fail. Frozen tuple/predicate inputs are unchanged. No timing run or new speed claim.

#504 is complete for atomic publication/provenance. #480/#487 remain open: Program lookup does not consume these records yet. The shared transfer pool must use one registry's declaration handles for all declaration-bearing types, including the local owner; handles are not local HIR IDs. Readiness means phase completion, not semantic parity. Source-aware lookup, merging, cycles, imported-record caching, and dependent invalidation still need integration. Unregistering invalidates provenance but does not implement program-wide dependency invalidation.

See the documented checkpoint. Local evidence is retained in bench/vs_tsgo/results/owner-publication.xWNTr8. Neither graph is readmitted, and the remaining timing rows stay provisional.

8 days ago

Source preparation and final-graph checking are now integrated in 4693c62 and 83d1459 (Refs #505). The real CLI two-hop reference probe no longer reports false TS6053/TS7017, but global property assignment typing still erases to any. Permanent controls now include sibling ambient let/const and globalThis reads with both declaration orders. Fresh TS 6.0.3/native TS 7.0.2 each pass 56/56; Home passes 32/56 (24 failures). The original 44 cases retain their previous results. No failures are waived; owner-aware typed global linkage and merging remain open. Release SHA-256 a3eddac96fe1b07d7876defc63a2cda06b9f13210b333e8dc57e2b38e8a0ea12; logs in bench/vs_tsgo/results/prepared-program.Wx2zap.

8 days ago

Concrete remaining path from the new globalThis control: packages/ts_checker/src/check.zig around line 110399 handles memberAccessObjectIsGlobalThisThis by returning Primitive.any when globalThisHasProperty succeeds. The latter only proves name presence (including program_global_var_names), not the declaration type. The fix must resolve the actual source-owned declaration/type, not extend the name whitelist. Differential comparison confirms all original 44 global-control statuses/diagnostic multisets are unchanged, as are all 20 imported-owner controls.

8 days ago

Callable-owner prerequisite #507 is fixed in 15f050f (audit d4e63ff, docs 770834343). The fresh 56-case callable audit passes against TS 6.0.3/native TS 7.0.2, and full checker/conformance suites pass. This does not implement typed cross-file globals: the global audit remains 32/56 with exactly unchanged per-case diagnostic-code outcomes; the transitive reference probe remains 2/3. This issue stays open for actual source-owned global resolution, including lexical bindings, globalThis property types, and declaration merging.

8 days ago

Prerequisite callable relation work is now merged in 7d16f7a (#511), with evidence in 150655867. The final binary passes the new 256-case callable-union audit and all checker/conformance tests. The full global audit was rerun without waivers: Home remains 32/56; TS 6.0.3 and native TS 7.0.2 each pass 56/56. The transitive-reference probe remains 2/3 for Home versus 3/3 for both baselines. Typed cross-file global declarations are still unresolved; this issue remains open. Evidence: bench/vs_tsgo/results/callable-unions.2pCgVc/globals-v5.log and discovery-v5.log.

8 days ago

Owner-preserving prerequisite #515 is complete via ac52b62, 0a296c1, and 347693b, with audit/docs in 3f1c34e and 0e3049c. Program files now share name identity and global discovery retains actual bound source owners and meaning spaces. The new fair audit improves Home 22/56 to 44/56, but its 12 wrong-type controls all still fail. The original global audit remains 32/56. Therefore #480 remains open: foreign declaration TypeIds are not linked, and no type-correctness or performance claim was made.

8 days ago

Checked-owner / typed-global consumer checkpoint, pushed to origin/main:

  • 33d8c15c5: register checked source revisions, serialize parallel publication, and tombstone owners before replacement/destruction.
  • 76d6a8b2d: keep scanner recovery without typed storage unregistered.
  • a142705f1: receiving-checker value/type lookup contract, preserving local declaration precedence and globalThis lexical exclusions; tests cover structural types, calls, member/argument/assignment errors, and local shadowing.
  • e3d244bfa: full checkpoint and linked README summary.

This does not enable automatic cross-file type publication. Owner-aware generic/predicate/nominal metadata, declaration merging, and resolution independent of source order and cycles are still required. Program compilation still supplies presence-only names; this issue stays open.

Unchanged untimed controlsTS 6.0.3Native TS 7.0.2Home
Global declarations56/5656/5632/56
Bound-global discovery56/5656/5644/56
Imported owners20/2020/208/20
Import/re-export graph admission2/22/20/2

Full admission passes 16/18 workloads; both graph gates still fail and neither is readmitted for timing. No new timings or speedup claim. The installed versions are exactly TS 6.0.3 and native TS 7.0.2; the harness explicitly rejects 7.0.0-dev.20260707.2.

Validation: checker 4,264/4,264, conformance 1,417/1,417, program 110/110, driver 187/187, harness 38/38. ReleaseFast and Zig formatting pass. Targeted Pickier has no errors and one pre-existing README fragment warning. Local frozen evidence: bench/vs_tsgo/results/global-consumer.xZ8NXj, binary SHA-256 f401735aa016d571c2aa4def48f47f4ff435a100af98c3d37c5d61afab392f09.

8 days ago

While validating #645's skipLibCheck diagnostic boundary, a negative consumer control reproduced this tracker independently of declaration checking.

// types.d.ts
interface SharedValue { value: string }
declare const sharedValue: SharedValue;
declare const brokenDeclaration: MissingType;

// consumer-invalid.ts
/// <reference path="./types.d.ts" />
const invalidConsumer: number = sharedValue.value;

Exact command for all three compilers:

<compiler> --ignoreConfig --noEmit --skipLibCheck consumer-invalid.ts
  • TypeScript 6.0.3: TS2322 at invalidConsumer
  • native TypeScript 7.0.2: TS2322 at invalidConsumer
  • Home #645 candidate: TS2304, cannot find sharedValue

The #645 driver control proves the declaration compilation still completes checked metadata capture while its semantic TS2304 is suppressed; the remaining failure is the existing cross-file declared-global ownership/visibility path tracked here. I removed the conflated two-file assertion from #645 rather than weakening it or treating this TS2304 as acceptable.

8 days ago

Typed cross-file global publication is now on origin/main in 592b9ff3a (authored by Chris Breuer, no coauthors). Program checking now relocates real checked owner types and node-independent generic/tuple/array metadata, preserves structural interface merging and type/value namespace separation, publishes lexical plus globalThis bindings, and shares the same provider ordering across serial, parallel, and streaming modes. Top-level destructuring retains correctly widened declaration-slot types without leaking flow narrows.\n\nFresh ReleaseFast differential results against verified TypeScript 6.0.3 and native TypeScript 7.0.2: global audit 168/168 and bound-global audit 168/168, with no skips or timing claims. Source gates: checker 4,348/4,348; program 179/179; driver 187/187; CLI 69/69; audit harness 6/6.\n\nKeeping #480 open for the next small chunk. A new fair three-file cyclic-owner probe exposed a transitive provenance defect when a checked owner itself contains relocated foreign declaration IDs: those IDs currently share the numeric domain with local HIR NodeIds and can be reinterpreted as local declarations on the next import. The probe is not being waived or documented as passing; the next change will give registry declaration handles an unambiguous representation and then retain the cyclic CLI control in both explicit root orders.

8 days ago

Completed on origin/main in four small conventional commits, all authored by Chris Breuer without coauthors: 592b9ff3a publishes real checked cross-file global types; af08e7e61 preserves tagged declaration provenance through transitive/cyclic owners; 6ec121877 adds the permanent cyclic audit; 6b1368502 documents the results and README summary.\n\nFinal verified results against pinned TypeScript 6.0.3 and native TypeScript 7.0.2: global audit 180/180, including 60/60 per compiler and both cyclic root orders; bound-global audit 168/168, 56/56 per compiler. Home moved from 8/32 to 32/32 on the existing cross-file family and from 44/56 to 56/56 on bound-global visibility. The unchanged pinned Zod 4.5.2 graph remains 600 diagnostics. No timing or speed claim was made under concurrent workstation load.\n\nFull gates pass: checker 4,348/4,348; Program 179/179; driver 187/187; CLI 69/69; modified audit tests 6/6; ReleaseFast; Zig formatting; scoped Pickier. Repository-wide Pickier debt (20,869 findings) and three unrelated stale export-list harness expectations are recorded in the docs rather than hidden. Adjacent remaining gaps are explicit: imported owners 16/20 and nominal origins 44/52.\n\nDetailed evidence and reproduction commands: https://github.com/home-lang/home/blob/6b13685024dd32118ed08e5e337e36828423a5ed/docs/docs/TS_PERFORMANCE.md#typed-cross-file-global-ownership-and-cyclic-provenance-untimed

Sign in to comment on this issue.