Skip to content

Main process and app files under strictNullChecks - #412

Merged
jtklein-agents merged 1 commit into
spec/406-strict-typescriptfrom
409-main-process-and-app-files-under-strictnullchecks
Nov 27, 2026
Merged

jtklein-agents merged 1 commit into
spec/406-strict-typescriptfrom
409-main-process-and-app-files-under-strictnullchecks

Conversation

@jtklein-agents

Copy link
Copy Markdown
Owner

Closes #409

Summary

 // src/main/processHelpers.ts
+// execFile always opens stdout and stderr pipes; the optional chain only satisfies their nullable type.
-proc.stdout.on( 'data', … )
+proc.stdout?.on( 'data', … )
-proc.stderr.on( 'data', … )
+proc.stderr?.on( 'data', … )

 // src/main/modelSelection.ts  (inside the existing try/catch)
-const modelRaxml = /-m (\S+)/.exec( cmdRaxml )[1];
-const modelRaxmlNG = /--model (\S+)/.exec( cmdRaxmlNG )[1];
+const modelRaxml = /-m (\S+)/.exec( cmdRaxml )?.[1];
+const modelRaxmlNG = /--model (\S+)/.exec( cmdRaxmlNG )?.[1];
+if ( !modelRaxml || !modelRaxmlNG ) throw new Error( … );

 // src/app/paths.ts
-const baseName = chunks.pop();
+const baseName = chunks.pop() ?? '';   // split() always returns ≥ 1 chunk

 // src/app/bootstrap.ts  (dev/e2e only)
-const useFiles = [].concat( useFastaFiles, usePhylipFiles );   // never[]
+const useFiles = [ ...useFastaFiles, ...usePhylipFiles ];

No ! added. Before this change, a missing modeltest-ng match threw a TypeError on null[1]. Now it throws an explicit Error. Both land in the same catch, so the user sees the same "Couldn't parse best models" error. Only the console log text changes.

Evidence

tsc --noEmit -p tsconfig.json --strict:

  • Before: 149 errors total. 7 of them are in the touched files: processHelpers.ts (2× TS18047), modelSelection.ts (2× TS2531), paths.ts (TS2322, TS2345), bootstrap.ts (TS2769).
    After: 142 errors total, 0 in the touched files.

yarn verify: lint, typecheck and 72 files / 497 tests pass.

Merge Danger

Door: two-way

Blast Radius: none

The changes only narrow types. The model-selection failure message and the run output streaming behave the same as before.

🤖 Generated with Claude Code

processHelpers optional-chains the stdout/stderr pipes, modelSelection
throws explicitly on a missing best-model match (same catch, same user
message), paths falls back on pop(), bootstrap spreads instead of
[].concat. --strict errors: 149 -> 142, zero in these files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jtklein-agents
jtklein-agents merged commit 4e12a35 into spec/406-strict-typescript Nov 27, 2026
7 of 10 checks passed
@jtklein-agents
jtklein-agents deleted the 409-main-process-and-app-files-under-strictnullchecks branch November 27, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant