Skip to content

fix(lint): remove redundant default case from exhaustive override-field switch - #7451

Closed
tomdebres wants to merge 1 commit into
stablyai:mainfrom
tomdebres:fix/source-control-override-note-exhaustive-switch
Closed

tomdebres wants to merge 1 commit into
stablyai:mainfrom
tomdebres:fix/source-control-override-note-exhaustive-switch

Conversation

@tomdebres

@tomdebres tomdebres commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

pnpm lint currently fails on main:

src/renderer/src/components/settings/SourceControlActionRepoOverrideNote.tsx:35:5: error typescript(switch-exhaustiveness-check): The switch statement is exhaustive, so the default case is unnecessary.

Introduced by #7386. The switch in getRecipeOverrideFieldLabel covers every variant of SourceControlActionRecipeOverrideField, and config/oxlint-switch-exhaustiveness.json sets allowDefaultCaseForExhaustiveSwitch: false, so the hand-rolled never-guard default case is rejected.

This PR removes the default case. The dedicated lint:switch-exhaustiveness rule already fails the build if the union grows a new variant, so the compile-time guard it replaced is redundant — this matches the convention everywhere else in the renderer (no other component uses the _exhaustive pattern). No user-visible change.

Screenshots

No visual change.

Testing

  • pnpm lint (fails on main, passes on this branch)
  • pnpm typecheck
  • pnpm test (24,518 passed / 32 skipped)
  • pnpm build
  • Existing coverage: SourceControlActionRepoOverrideNote.test.tsx (5/5 passing) exercises all three override-field labels; the switch-exhaustiveness-check lint rule itself is the regression guard if the union grows a new variant, so no new tests were needed for a dead-code removal.

AI Review Report

Reviewed with Claude Code. Main risks checked: (1) whether removing the default case could introduce an implicit-undefined return path — it cannot, TypeScript proves the switch exhaustive over the union and tsgo --noEmit passes on all three tsconfigs; (2) whether the exhaustiveness safety net is weakened — it is not, typescript/switch-exhaustiveness-check (type-aware, allowDefaultCaseForExhaustiveSwitch: false) errors at lint time if SourceControlActionRecipeOverrideField gains a variant this switch does not handle; (3) convention alignment — no other renderer component uses the _exhaustive never-guard pattern. Cross-platform compatibility (macOS, Linux, Windows) was explicitly considered: the change is pure TypeScript control flow with no shortcuts, labels, paths, shell behavior, or Electron platform differences involved.

Security Audit

No security surface touched: the change removes an unreachable dead-code branch from a pure label-mapping function in the renderer. No input handling, command execution, path handling, auth, secrets, dependency, or IPC changes. No follow-up needed.

Notes

No platform-specific behavior. Zero runtime behavior change — the removed branch was unreachable for every value of the union type.

@coderabbitai

coderabbitai Bot commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: faabdc46-c4db-4319-855a-af0a04bacb5c

📥 Commits

Reviewing files that changed from the base of the PR and between e6342109ad2e55206bdc49def919442446168f93 and 76b72d9.

📒 Files selected for processing (1)
  • src/renderer/src/components/settings/SourceControlActionRepoOverrideNote.tsx
💤 Files with no reviewable changes (1)
  • src/renderer/src/components/settings/SourceControlActionRepoOverrideNote.tsx

📝 Walkthrough

Walkthrough

getRecipeOverrideFieldLabel in SourceControlActionRepoOverrideNote.tsx no longer includes a default branch in its switch over SourceControlActionRecipeOverrideField. The removed branch previously used a never assignment for exhaustiveness checking and returned that value. The function can now fall through without an explicit fallback for unexpected variants.

Changes

File Change Summary
SourceControlActionRepoOverrideNote.tsx Removed the switch default branch that performed a never exhaustiveness check

Related Issues: None specified.

Related PRs: None specified.

Suggested labels: None

Suggested reviewers: None

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately describes the main change: removing the redundant exhaustive-switch default case.
Description check ✅ Passed The description follows the required template and includes summary, screenshots, testing, AI review, security audit, and notes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…ld switch

pnpm lint fails on main since stablyai#7386: the override-field switch in
SourceControlActionRepoOverrideNote covers every union variant, and the
switch-exhaustiveness config sets allowDefaultCaseForExhaustiveSwitch:
false, so the hand-rolled never-guard default is rejected. The lint rule
itself already fails the build if the union grows a new variant, so the
guard is redundant — remove it.
@tomdebres
tomdebres force-pushed the fix/source-control-override-note-exhaustive-switch branch from e634210 to 76b72d9 Compare July 5, 2026 22:18
@tomdebres

Copy link
Copy Markdown
Contributor Author

Superseded by #7472, which included the same fix on main — closing. Thanks!

@tomdebres tomdebres closed this Jul 6, 2026
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