ReviewOS

home-lang/home

fix(ts): continue project discovery after config-option diagnostics

#866
Closed glennmichael123 opened this 8 days ago ·
8 days ago

Problem

home-tsc treats TsConfig.validate diagnostics as a fatal preflight error. Native TypeScript 7 attaches these option diagnostics to the Program instead, so project discovery and the selected command mode still run.

Pinned differential using TypeScript 7.0.2 and upstream fixture projectOption/DefaultExcludeOnlyNodeModules (target: es5):

  • --noEmit --listFiles: TS7 prints TS5108, lists the library/source graph (including a.ts), and exits 1; Home prints TS5108 only and exits 2.
  • --noEmit --listFilesOnly: same TS7 behavior; Home exits before discovery.
  • --showConfig: TS7 prints resolved config and exits 0; Home prints TS5108 and exits 2.
  • normal emit: TS7 emits dist/a.js and exits 2 (DiagnosticsPresent_OutputsGenerated).
  • --build --dry: TS7 prints only the dry-build status; Home leaks TS5108 from dry status calculation.

Root cause

packages/ts_cli/src/tsc_main.zig calls printConfigValidationDiagnostics immediately after parsing and exits before root discovery. The same validator is also invoked from dry-build status calculation.

Required behavior

  • Carry config-option diagnostics into normal Program reporting without aborting discovery.
  • Preserve TypeScript's output-sensitive exit statuses: 1 when output is skipped, 2 when output is generated in the presence of diagnostics.
  • Let --listFiles and --listFilesOnly report the discovered graph.
  • Keep --showConfig and dry-build status free of Program option diagnostics.
  • Preserve fatal config-read/parse/no-input failures.
  • Add focused unit/conformance coverage and differential verification against pinned TS7.
8 days ago

Landed on main in 0cc5e409475c01fed032f91e00f4990887223536 (fix(ts): preserve program flow after config diagnostics (#866)).

What changed:

  • config-option diagnostics now participate in Program reporting instead of aborting before root discovery;
  • syntax diagnostics retain precedence, while option errors suppress semantic diagnostics as in TypeScript's emitFilesAndReportErrors flow;
  • --listFiles / --listFilesOnly run discovery and use output-skipped exit status 1;
  • ordinary emit with diagnostics uses output-generated exit status 2;
  • --showConfig bypasses Program option diagnostics and emits valid JSON;
  • --build --dry no longer leaks Program option diagnostics;
  • non-dry build preserves output-generated/output-skipped status.

Verification (all guarded at HOME_RUN_MAX_MB=3840, one process at a time):

  • zig build test -Dfilter=tsc_main — pass, peak 2,200 MB;
  • zig build test -Dfilter=ts_cli — pass;
  • fresh zig build home-tsc -Doptimize=Debug — pass, peak 2,156 MB;
  • seven focused CLI assertions — 7/7 pass (listFiles, listFilesOnly, showConfig, dry build, invalid-config noEmit, semantic emit, semantic listFilesOnly);
  • all ten upstream tests/cases/projects/projectOption/* fixtures — Home and pinned TS7 agree on selected project roots and exit status (10/10);
  • direct controls confirm emit+diagnostic exits 2 and writes dist/a.js, while --noEmit exits 1.

The commit contains exactly three files and was pushed directly to origin/main under glennmichael123 <gtorregosa@gmail.com> with no coauthor trailer.

8 days ago

Follow-up parity fix pushed directly to as 8b96e97 ().\n\nThe CLI now merges and into the effective config before Program validation, resolver construction, checking, and emit. This removes the stale TS5108 that previously survived valid command-line overrides.\n\nVerification:\n- \n- \n- \n- fresh \n- unchanged upstream : no override still reports TS5108; only reports TS5110; matching Node16 module/resolution overrides reach the expected TS2322 semantic error.\n\nAll heavy commands ran sequentially under the 3,840 MB guard; peak build footprint was 2.2 GB.

8 days ago

Follow-up parity fix pushed directly to main as 8b96e97 (fix(ts): apply CLI module overrides before validation (#866)).

The CLI now merges --module and --moduleResolution into the effective config before Program validation, resolver construction, checking, and emit. This removes the stale TS5108 that previously survived valid command-line overrides.

Verification:

  • zig build test -Dfilter=ts_cli
  • zig build test -Dfilter=tsc_main
  • zig build test -Dfilter=ts_driver
  • fresh zig build home-tsc -Doptimize=Debug
  • unchanged upstream NodeModulesSearch/importHigher: no override still reports TS5108; only --moduleResolution node16 reports TS5110; matching Node16 module/resolution overrides reach the expected TS2322 semantic error.

All heavy commands ran sequentially under the 3,840 MB guard; peak build footprint was 2.2 GB.

Sign in to comment on this issue.