Skip to content

fix(inspect): Runtime safety, exhaustive switch cases (Phase 1+3) - #231

Merged
David-Noble-at-work merged 1 commit into
developfrom
fix/runtime-safety
Mar 16, 2026
Merged

David-Noble-at-work merged 1 commit into
developfrom
fix/runtime-safety

Conversation

@David-Noble-at-work

Copy link
Copy Markdown
Contributor

Summary

  • Fix 27 GoLand inspection issues from the goland-inspection-cleanup plan
  • Phase 1 (Runtime Bugs): Prevent nil dereferences via t.Fatal upgrades, nil guards after PhaseByID()/Next()/Parse(), delete tautological const tests (16 issues)
  • Phase 3 (Missing Switch Cases): Add exhaustive case coverage for StepType, ResultStatus, upgradeResult, SessionState, reflect.Kind, and gitignore.MatchResult (11 issues)

Files changed (15)

File Change
internal/cli/selfinstall_test.go t.Error → t.Fatal before nil err.Error()
internal/console/console_test.go Nil guards after session.Next()
internal/execution/phase_test.go Nil guards after graph.PhaseByID()
pkg/op/provider/starcomplexity/provider.go Nil guard after opts.Parse()
pkg/op/provider/starindex/provider.go Nil guard after opts.Parse()
internal/cli/output_test.go Delete tautological DefaultFormat test
internal/writ/segment/segment_test.go Delete tautological EnvVarPrefix test
internal/cli/output.go default: in both reflect.Kind switches
internal/console/model.go StepProgress + exhaustive StepType cases
internal/execution/executor.go ResultPending, ResultRunning cases
internal/writ/commands.go upgradeResultError case with error return
internal/writ/migrate/session.go Missing SessionState cases
internal/writ/migrate/session_test.go default: for StepType switch
pkg/op/provider/file/gitignore/tracker.go gitignore.NoMatch case
docs/plans/goland-inspection-cleanup.md Phase 1+3 marked complete

Test plan

  • make vet passes
  • make test passes — all packages green
  • gofmt -l reports no formatting issues on all changed files

Fix 27 GoLand inspection issues across runtime safety and missing
switch case categories:

Phase 1 — Potential Runtime Bugs (16 issues):
- Use t.Fatal instead of t.Error before nil dereference (selfinstall_test)
- Add nil guards after session.Next() calls (console_test)
- Add nil guards after graph.PhaseByID() calls (phase_test)
- Add nil guard after opts.Parse() (starcomplexity, starindex providers)
- Delete tautological const-value tests (output_test, segment_test)

Phase 3 — Missing Switch Cases (11 issues):
- Add default case to reflect.Kind switches (output.go)
- Add StepProgress case and exhaustive StepType coverage (model.go)
- Add ResultPending/ResultRunning cases (executor.go)
- Add upgradeResultError case with error reporting (commands.go)
- Add missing SessionState cases (session.go)
- Add default case to test switch (session_test.go)
- Add gitignore.NoMatch case (tracker.go)

Update plan status: Phase 1 complete, Phase 3 complete.
@David-Noble-at-work
David-Noble-at-work merged commit 7c6de27 into develop Mar 16, 2026
2 checks passed
@David-Noble-at-work
David-Noble-at-work deleted the fix/runtime-safety branch March 16, 2026 16:55
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