fix: clear all 31 Dependabot alerts + make the renderer typecheck clean - #101
Open
imajeetyadav wants to merge 2 commits into
Open
fix: clear all 31 Dependabot alerts + make the renderer typecheck clean#101imajeetyadav wants to merge 2 commits into
imajeetyadav wants to merge 2 commits into
Conversation
Security-only dependency bumps, all within existing semver ranges — no major-version upgrades and no application code changes. npm: - electron 41.2.0 -> 41.10.6 (closes 12 alerts). 41.10.x also swaps extract-zip@^2.0.1 for @electron-internal/extract-zip, which drops the vulnerable extract-zip out of the tree entirely — that alert was flagged "no patched version available" and now needs no dismissal. - electron-builder 26.8.2 -> 26.15.3 (app-builder-lib 26.15.3) - electron-updater 6.8.3 -> 6.8.9 (builder-util-runtime 9.7.0) - js-yaml 4.3.0 -> 4.3.1, postcss 8.5.14 -> 8.5.26, undici 7.28.0 -> 7.29.0 - overrides: dompurify ^3.4.11 -> ^3.4.13 (monaco-editor pins it), minimatch/brace-expansion ^5.0.6 -> ^5.0.7 - ip-address and socks fell out of the tree with the transitive refresh - tmp 0.2.5 -> 0.2.7, superseding dependabot PR #85 go-core: - google.golang.org/grpc v1.80.0 -> v1.82.1 (xDS RBAC + HTTP/2 advisory); go mod tidy pruned otel indirects that grpc no longer pulls in Verified: npm audit clean (0 vulnerabilities), 630 vitest tests pass, go build + go test ./... pass, and electron-builder --dir packages successfully against electron 41.10.6. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The renderer had 175 pre-existing TypeScript errors across 39 files. They
went unnoticed because electron-vite builds through esbuild, which strips
types without checking them, and there was no tsc step anywhere in CI.
Root causes, in order of size:
1. jest-dom matchers (~92 errors). Component tests register matchers at
runtime with `expect.extend(matchers)`, but nothing told TypeScript.
Added src/renderer/vitest.d.ts, a types-only import of the package's
vitest subpath that augments vitest's Assertion interface. No runtime
change.
2. AppStore had drifted from its slices (~40 errors). It hand-duplicated
the Cluster and Resource slice members instead of extending them, and
the copies fell behind: sectionLoadedAt, lastRefreshedAt, metricsError,
allowedVerbs, fetchAllowedVerbs, resourcequotas and limitranges were all
missing, so every set()/get() touching them was unchecked. AppStore now
extends ClusterSlice and ResourceSlice like it already did the other
five; only `init` (composed in store/index.ts) is declared locally.
3. Two window signatures were wrong, which the above exposed:
- kubectl.streamLogs declared 6 params; the preload takes 7. Both call
sites (UnifiedLogs, PodDetail) were correctly passing the 7th onError
callback against a type that said it did not exist.
- kubectl.getAllowedVerbs was missing entirely.
4. PodscapeSettings was defined twice — once in main/settings and once
inline on window.settings, minus pluginsEnabled/gitopsEnabled/
networkEnabled. Moved to common/constants.ts so both sides share one
definition; SettingsPanel's near-identical SettingsForm now uses it too.
5. The tail: appVersion (a vite `define` global) was undeclared, dead
locals and imports, an implicit-undefined return in ExecPanel's effect,
a recharts formatter typed narrower than Formatter allows, and test
mocks typed as bare vi.fn() that rejected their own implementations.
The operationSlice onPortForwardReady mock also disagreed with the
preload about whether the callback receives a message — it does.
Prevention: added `npm run typecheck` (both tsconfig projects) and a
Typecheck step in ci.yml ahead of Build. Also fixed the paths-filter,
which watched a nonexistent `electron-vite.config.ts` — the real file is
`electron.vite.config.ts`, so config changes never triggered the job.
Verified: typecheck clean on both projects, 630 vitest tests pass,
npm run build and go build + go test ./... all pass.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two commits on this branch. The first is the security work that was asked for; the second is a typecheck cleanup found while verifying it.
1.
fix(deps)— 31 open Dependabot alerts → 0Security-only dependency bumps, all inside existing semver ranges. No major-version upgrades.
The linchpin: electron 41.2.0 → 41.10.6
Closes 12 alerts on its own, and resolves alert #130 (
extract-zip, high) which Dependabot flagged as "no patched version available" — electron 41.10.x replacedextract-zip@^2.0.1with@electron-internal/extract-zip@^1.0.1, so the vulnerable package leaves the tree entirely rather than needing a dismissal.electronextract-zipbuilder-util-runtimeelectron-updater6.8.9)app-builder-libelectron-builder26.15.3)js-yamlpostcssundiciip-addresssocks)brace-expansiondompurifygoogle.golang.org/grpcpackage.jsonchanges are confined to theoverridesblock —dompurifyandbrace-expansionwere pinned by those overrides, sonpm updatealone could not move them.go mod tidypruned two otel indirects grpc 1.82 no longer pulls in.tmpalso went 0.2.5 → 0.2.7 in the lockfile refresh, superseding Dependabot PR #85 — that can be closed once this merges.2.
fix(types)— 175 pre-existing type errors → 0, enforced in CIThe renderer had 175 TypeScript errors across 39 files, all pre-existing on
main(this branch changed nosrc/file in commit 1, and no type-providing package moved). They went unnoticed because electron-vite builds through esbuild, which strips types without checking them, and there was notscstep anywhere in CI.What was wrong
jest-dom matchers (~92 errors). Component tests register matchers at runtime via
expect.extend(matchers), but nothing told TypeScript. Addedsrc/renderer/vitest.d.ts— a types-only import of the package's vitest subpath. No runtime change.AppStorehad drifted from its slices (~40 errors). It hand-duplicated the Cluster and Resource slice members instead of extending them, and the copies fell behind:sectionLoadedAt,lastRefreshedAt,metricsError,allowedVerbs,fetchAllowedVerbs,resourcequotasandlimitrangeswere all missing — so everyset()/get()touching them was unchecked. It now extendsClusterSliceandResourceSlicelike it already did the other five; onlyinitstays declared locally.Two
windowsignatures were wrong, which the above exposed:kubectl.streamLogsdeclared 6 params; the preload takes 7. Both call sites (UnifiedLogs,PodDetail) were correctly passing the 7thonErrorcallback against a type that said it did not exist.kubectl.getAllowedVerbswas missing entirely.PodscapeSettingswas defined twice — once inmain/settings, once inline onwindow.settingsminuspluginsEnabled/gitopsEnabled/networkEnabled. Moved tocommon/constants.tsso both sides share one definition;SettingsPanel's near-identicalSettingsFormnow uses it too.The tail.
appVersion(a vitedefineglobal) was undeclared; dead locals and imports; an implicit-undefined return in anExecPaneleffect; a recharts formatter typed narrower thanFormatterallows; and test mocks typed as barevi.fn()that rejected their own implementations. TheoperationSliceonPortForwardReadymock also disagreed with the preload about whether the callback receives a message — it does.Prevention
npm run typecheck(plus:node/:web) covering both tsconfig projectsci.ymlahead of Buildelectron-vite.config.ts— the real file iselectron.vite.config.ts, so config changes never triggered the electron job. Also addedvitest.config.tsand widenedtsconfig.json→tsconfig*.json.Verification (both commits)
npm run typecheck→ clean on both projectsnpm run test→ 630 tests, 45 files, all passnpm run build→ succeedsgo build ./cmd/...+go test ./...→ all passnpx electron-builder --dir→ packages successfully against electron 41.10.6, exercising the release-CI path throughapp-builder-lib26.15.3npm audit→ 0 vulnerabilitiesElectron stays on ABI 145, so no native-module rebuild concerns.
Out of scope
electron 43.4.1 and jsdom 30.0.1 (majors) aren't needed for any alert and would add breaking-change risk. Worth a separate tracked upgrade.
🤖 Generated with Claude Code