Skip to content

refactor: remove dead step functions, embed config structs, add fmt.Print archtest#103

Merged
fullstackjam merged 3 commits into
mainfrom
refactor/code-review-fixes
May 25, 2026
Merged

refactor: remove dead step functions, embed config structs, add fmt.Print archtest#103
fullstackjam merged 3 commits into
mainfrom
refactor/code-review-fixes

Conversation

@fullstackjam
Copy link
Copy Markdown
Collaborator

Summary

Three code-quality fixes from a review pass:

  • Dead step functions removedstepGitConfig, stepPresetSelection, stepPackageCustomization were orphaned by the step→Plan/Apply refactor. They existed in production files but were never called by production code — only by tests. Removed the functions and the 8 test functions that covered these dead paths.

  • Config struct duplication eliminatedConfig previously duplicated every field from InstallOptions and InstallState. Config now embeds both types; each field is defined exactly once. Adding a field now requires editing one struct, not three. Updated all composite literals to use embedded-struct syntax (Config{InstallOptions: InstallOptions{...}}).

  • fmt.Print archtest rule added — Production code has ~177 raw fmt.Print* calls that should eventually go through ui.* helpers (convention in CLAUDE.md). Without a mechanical check, every PR adds more. New rule in internal/archtest/fmtprint_test.go baselines existing violations and fails on any new ones added to non-exempt packages.

Test plan

  • go vet ./... clean
  • make test-unit passes (all L1 including new archtest rule)
  • Verified archtest synthetic-violation detection (add fmt.Println → fail, revert → green)
  • grep stepGitConfig|stepPresetSelection|stepPackageCustomization returns zero results

…, add fmt.Print archtest rule

- Delete stepGitConfig, stepPresetSelection, stepPackageCustomization
  (orphaned from step→Plan/Apply refactor; only called by tests)
- Remove the 8 corresponding test functions that covered dead paths
- Embed InstallOptions and InstallState in Config so each field is
  defined once; adding a field now touches one struct, not three
- Update all composite literals (snapshot_import, install_test,
  snapshot_test) to use embedded-struct syntax
- Add internal/archtest/fmtprint_test.go: blocks new fmt.Print* calls
  to stdout in production code; 177 existing violations baselined
@github-actions github-actions Bot added installer Package installation logic tests Tests only labels May 25, 2026
…ing Config

plan.go writes opts.Preset during interactive preset selection.
With embedding, returning &c.InstallOptions would let that mutation
bleed back into the caller's Config. Return a copy instead — same
semantics as before the refactor, embedding still eliminates field
duplication in types.go.
@fullstackjam fullstackjam merged commit 4c622c4 into main May 25, 2026
12 checks passed
@fullstackjam fullstackjam deleted the refactor/code-review-fixes branch May 25, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

installer Package installation logic tests Tests only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant