ReviewOS

home-lang/home

fix(ts): preserve repeated CommonJS whole-export union members

#967
Closed glennmichael123 opened this 5 days ago ·
5 days ago

TypeScript 5.7.3 differential

With allowJs, checkJs, strict, noEmit, and CommonJS mode, a JS owner that assigns module.exports twice ({ Baz: class {} }, then { Quack: 2 }) while also writing exports.Bar and exports.Quid produces a unioned imported shape. In the exact real-file control, TypeScript reports only a duplicate Foo typedef/class pair (two TS2300) and TS18048 on new mod.Baz() because Baz is optional after the second whole assignment. Home instead reports its linked TS2300s and TS2339 on mod.Baz, losing the unioned member and the TS18048.

This is separate from #965's single inferred whole-export expando path and #966's function-constructor contextual this gap. Acceptance: preserve assignment alternatives and optional members in the checked owner schema; match exact owner/importer TypeScript 5.7.3 streams in checkJs on/off modes and Program revisions. No fabricated namespace fallback or diagnostic suppression. Related #846, #965, #66.

4 days ago

The repeated whole-export reproducer is committed on origin/main as e8efae7c9. It remains an open TypeScript 5.7.3 differential: the current #965 single-whole-export fix does not model the assignment-alternative union or optional Baz member.

4 days ago

2026-10-29 checkpoint on origin/main: 55bc87775 and c797c9e51, authored as glennmichael123 without coauthors.

The checked owner schema now transports inline-class construct signatures. The CommonJS importer keeps repeated whole-object assignment alternatives, gives absent branch members optional undefined types, and carries named exports on each branch. The clean real-file control reports the same two TS18048 diagnostics as TypeScript 5.7.3 under checkJs; both compilers exit cleanly with --checkJs false. The exact auditor now passes 120/120 stdout/stderr/exit streams. Guarded full Program and checker suite commands both exited 0; the focused schema test, zig fmt --check, and targeted Pickier lint passed. The largest observed guarded Zig peak was 2,412 MB under the approved 3,840 MB ceiling.

Keeping this issue open: the original fixture's duplicate Foo TS2300 diagnostics still carry extra TS6203 related lines in Home's plain CLI output, so its complete stream is not exact. Program revision and LSP invalidation controls for this repeated-export shape remain to be added. Related #846 and #66.

4 days ago

Follow-up on origin/main: ae4efd3f4 fixes the remaining original-fixture stream difference and adds an owner-revision control. TypeScript 5.7.3's same-file JSDoc typedef/class collision has two TS2300 primaries without TS6203 related information; cross-file collisions retain TS6203. Home now follows that source-file boundary. The original repeated-export fixture and the clean fixture both match TypeScript in checkJs on/off modes. The exact auditor passes 122/122 stdout/stderr/exit streams.

The new Program control checks both whole assignments (TS18048), Baz alone (clean), Quack alone (TS2339), and the restored union (TS18048). Focused same-file and cross-file diagnostic tests passed. Full guarded Program and checker suite commands exited 0; the final checker run peaked at 2,251 MB under the authorized 3,840 MB cap, with host low-water 44%. zig fmt --check, targeted Pickier, and git diff --check passed. All three commits in this tranche are on origin/main as glennmichael123 without coauthors.

Keeping #967 open for an editor/LSP invalidation control and overlapping named-write/whole-branch cases; the current normalization deliberately leaves that assignment-order case on the pre-existing path. Related #846 and #66.

4 days ago

Pushed two direct-to-main commits as glennmichael123 without coauthors: 7aff9c03d merges named CommonJS writes into every repeated whole-object branch and requires all union constituents to provide a primitive prototype member; 20ac00a9c adds real-file controls for named writes before, between, and after whole-object assignments.

In all three orders, Home now emits the six TypeScript diagnostic codes at the correct positions. The remaining mismatch is diagnostic type display: TypeScript 5.7.3 calls the overlap 1 | typeof Baz, while Home currently prints union type in TS2351 and {} in TS2339. The new overlap fixture is deliberately outside the exact auditor until that source-owned class identity is transported. The prior admitted-JavaScript audit remains 122/122 exact CLI streams. zig fmt --check and git diff --check passed; the full guarded checker command exited 0 (peak 2,296 MB under the 3,840 MB cap), although its output contained a failed command line that needs investigation. Keeping #967 open for exact overlap prose and LSP invalidation. Related #846 and #66.

4 days ago

Follow-up: d0418fa4f is pushed directly to origin/main as glennmichael123, without coauthors. The checked Program schema now transports an inferred class constructor's name on the class value expression itself, including when nested inside a union, and the consumer gives each static value a distinct identity. Union construction rejects a branch without a construct signature; TS2339 carries the missing constituent detail; canonical union display applies when no source-order metadata exists.

The before/between/after #967 overlap project now matches TypeScript 5.7.3 line for line in checkJs mode. It is included in the exact auditor for both checkJs modes, raising the admitted-JavaScript result to 124/124 exact stdout/stderr/exit streams. A guarded home-tsc build succeeded with peak 2,191 MB below the authorized 3,840 MB cap; the focused schema and checker tests exited 0 before the final stronger diagnostic assertions were added. The final assertion rerun remains pending: the guard refused admission at 28% host free memory, and I did not override it. zig fmt --check and git diff --check passed. Keeping #967 open for LSP invalidation and any further overlap shapes. Related #846 and #66.

4 days ago

Implemented and pushed directly to origin/main in 7aff9c03d, 20ac00a9c, d0418fa4f, and 983bfdd12 (all authored by glennmichael123 <gtorregosa@gmail.com>, no coauthors).

The checked owner now retains the alternatives from repeated module.exports assignments, merges named writes into each branch, and preserves imported class value identity. The real-file TypeScript 5.7.3 differential is 124/124 exact CLI streams (stdout, stderr, exit) across the admitted-JavaScript controls, including the overlap fixture in both checkJs modes. Program revision coverage and the dedicated LSP edit/revert test exercise repeated -> class-only -> Quack-only -> repeated owners and the expected TS2351 -> clean -> TS2339 -> TS2351 sequence in both modes. The dedicated guarded test-ts-lsp step and guarded Program suite passed; focused checker tests passed.

The guarded full checker zig build test -Dfilter=ts_checker -j1 command exited 0 at a 2,372 MB peak, but its output included an internal failed command: .../test --listen=- line. I am recording that ambiguity explicitly and will investigate it separately when host memory permits. Host free memory is currently 29%, so no further Zig run is being launched now. This issue's exact owner/importer and revision acceptance is met; broader admitted-JavaScript work remains tracked in #846 and #66.

Sign in to comment on this issue.