Skip to content

fix: type-check src/gui instead of excluding it - #159

Merged
arthurpanhku merged 1 commit into
mainfrom
fix/typecheck-src-gui
Aug 8, 2026
Merged

fix: type-check src/gui instead of excluding it#159
arthurpanhku merged 1 commit into
mainfrom
fix/typecheck-src-gui

Conversation

@arthurpanhku

Copy link
Copy Markdown
Owner

Summary

src/gui was listed in tsconfig.json's exclude and has no tests, yet it imports from src/core/guiUpdate.js, src/core/selfUpdate.js, and src/version.js. Nothing checked it, so a signature change in core would only surface when release-gui.yml runs — which was three weeks ago.

It cannot just join the main tsconfig: it runs under Bun, using Bun, import.meta.path, and webview-bun's FFI types, and Bun resolves modules like a bundler rather than like Node. So it gets tsconfig.gui.json, wired into npm run check as typecheck:gui.

Two things the check found once it was actually running

The first version of this config checked nothing. exclude is inherited from the base config and beats the include in the derived one, so src/gui stayed excluded — the check reported success with a deliberate type error sitting in src/gui/index.ts. Restating exclude fixes it, and the comment says why so it does not get "simplified" back later. A check that cannot fail is worse than no check: it manufactures confidence.

resolveUrl tripped TS2454 (used before assigned). A Promise executor runs synchronously, so it is assigned before the reader can reach it — this is a false positive, and a definite assignment assertion states what TypeScript cannot infer. Not a behaviour change.

Testing

Verified the check can actually fail, twice: planted const __p: number = "x" in src/gui/index.ts, confirmed typecheck:gui reports the error, removed it, confirmed the check passes. Without that step this PR would have looked identical while doing nothing.

npm run check green: typecheck, typecheck:gui, and 323 tests across 49 files.

Security and AI Governance

  • This change does not expand file, shell, network, model, or approval permissions.
  • If it changes agent behavior, prompts, policy, providers, audit logging, or release/build security, I updated the relevant governance evidence in docs/.
  • If it introduces a new model/provider/tool or new data flow, I completed docs/governance/AI-CHANGE-IMPACT-ASSESSMENT.md.

Second and third boxes: this adds a type check and one ! assertion. No runtime behaviour, no new model, provider, tool, or data flow. @types/bun is added as a devDependency.

Notes

Found while auditing which workflow steps have never executed under real conditions. The other finding from that audit is not fixed here and needs your decision: the macOS binaries ship ad-hoc signed and Gatekeeper-rejected — verified on the actual v0.15.0 download with codesign (Signature=adhoc, TeamIdentifier=not set) and spctl (rejected). Four signing and notarization steps across release.yml and release-gui.yml have never run because none of the six Apple secrets are configured. That needs an Apple Developer account, so it is a product decision, not a patch.

src/gui was listed in tsconfig.json's `exclude` and has no tests, yet it
imports from src/core and src/version. Nothing checked it, so a signature
change in core would only surface when release-gui.yml runs — which was
three weeks before this commit.

It cannot simply join the main tsconfig: it runs under Bun, using `Bun`,
`import.meta.path`, and webview-bun's FFI types, and Bun resolves modules
like a bundler rather than like Node. It gets its own tsconfig.gui.json,
wired into `npm run check`.

Two things the check found once it was actually running:

- `exclude` is inherited from the base config and beats the `include` in
  the derived one. The first version of tsconfig.gui.json therefore checked
  nothing at all — it reported success with a deliberate type error sitting
  in src/gui/index.ts. Restated `exclude` fixes it; the comment says why so
  it is not "simplified" back.
- `resolveUrl` tripped TS2454. A Promise executor runs synchronously, so it
  is assigned before the reader can reach it; a definite assignment
  assertion states what TypeScript cannot infer.

Verified twice by planting a type error in src/gui and confirming the check
fails, then confirming it passes once removed — a check that cannot fail is
worse than no check.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​types/​bun@​1.3.141001004887100

View full report

@arthurpanhku
arthurpanhku merged commit 18a002d into main Aug 8, 2026
12 checks passed
@arthurpanhku
arthurpanhku deleted the fix/typecheck-src-gui branch August 8, 2026 01:25
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