Skip to content

Reduce duplication, fix compile errors, harden tests#9

Merged
paddo merged 2 commits intomainfrom
refactor/simplify-codebase
Apr 5, 2026
Merged

Reduce duplication, fix compile errors, harden tests#9
paddo merged 2 commits intomainfrom
refactor/simplify-codebase

Conversation

@paddo
Copy link
Copy Markdown
Contributor

@paddo paddo commented Apr 4, 2026

Summary

  • Extract sha256_hex() utility replacing 34 duplicate inline calls across 9 files
  • Extract App::spawn_sync() (5 sites) and App::reload_state() (9 sites) in dashboard
  • Consolidate 4 identical confirm popup renders into single render_confirm_popup()
  • Remove redundant App::syncing bool (was always sync_child.is_some())
  • Fix known_profile_names() calling Config::load() from disk on every render pass
  • Add DEFAULT_PROFILE constant replacing scattered "dev" string literals
  • Add missing add_profile_dotfile / remove_profile_dotfile functions (compile fix)
  • Add installing parameter to status bar render (compile fix)
  • Fix matches!() without assert!() in secret scanner tests (type checks were no-ops)
  • Add tests for sha256_hex, canonical_project_file_path path traversal rejection
  • Tighten weak/fragile test assertions

Net: -77 lines across 18 files. 214 tests pass, zero clippy warnings.

Test plan

  • cargo clippy --all-targets -- -D warnings passes
  • cargo test -- --include-ignored — 214 tests pass
  • cargo build succeeds (previously had 3 compile errors)

paddo added 2 commits April 4, 2026 14:43
- Extract sha256_hex() utility to lib.rs, replacing 34 inline calls
- Extract App::spawn_sync() and App::reload_state() in dashboard
- Consolidate 4 identical confirm popup renders into render_confirm_popup()
- Remove redundant App::syncing bool (equivalent to sync_child.is_some())
- Fix known_profile_names() re-reading Config from disk on every render
- Add DEFAULT_PROFILE constant, replace scattered "dev" literals
- Add missing add_profile_dotfile/remove_profile_dotfile functions
- Add installing indicator to dashboard status bar
- Fix matches!() without assert!() in secret scanner tests
- Add tests for sha256_hex and canonical_project_file_path traversal
- Tighten weak test assertions
@paddo
Copy link
Copy Markdown
Contributor Author

paddo commented Apr 4, 2026

/songify

@diffbeats
Copy link
Copy Markdown

diffbeats bot commented Apr 4, 2026

🎵 DiffBeats just dropped a track for this PR!

"Reduce duplication, fix compile errors, harden tests"

🎧 Listen now →

Lyrics
[Verse]
Thirty-four shas, a tangled mess
Nine files now feel less stressed
Spawn sync and reload, a refactor's quest
Confirm popups, finally blessed

[Chorus]
Seventy-seven lines, a mighty feat,
Two hundred fourteen tests, can't be beat
Clippy's silent, the compiler's sweet,
Our code's now clean, can't be beat!

[Verse 2]
"Dev" strings got a brand new name,
Dotfiles fixed, it's not a game
Installing status, no more shame
Tests are stronger, winning the fame

[Chorus]
Seventy-seven lines, a mighty feat,
Two hundred fourteen tests, can't be beat
Clippy's silent, the compiler's sweet,
Our code's now clean, can't be beat!

@paddo paddo merged commit 59289f7 into main Apr 5, 2026
1 check passed
@paddo paddo deleted the refactor/simplify-codebase branch April 5, 2026 13:57
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