Skip to content

Refactor: decouple config, remove unused fields, and narrow UI dependencies#120

Merged
babarot merged 2 commits intomainfrom
babarot/refactor-phase3-config-decoupling
Apr 4, 2026
Merged

Refactor: decouple config, remove unused fields, and narrow UI dependencies#120
babarot merged 2 commits intomainfrom
babarot/refactor-phase3-config-decoupling

Conversation

@babarot
Copy link
Copy Markdown
Owner

@babarot babarot commented Apr 4, 2026

WHAT

Remove unused trash.Config fields and replace the full *config.Config parameter in the UI layer with a minimal RenderOptions struct containing only the fields the UI actually uses.

This PR includes all Phase 1-3 refactoring commits (concurrency safety, structural improvements, and config decoupling).

WHY

A code review identified that trash.Config had 3 fields defined but never referenced (SkipMountPointFind, PreservePaths, UseCompression), and the UI layer received the entire application config when it only needed config.UI and a single bool (DeleteEnabled). Passing the full config creates unnecessary coupling between the UI and unrelated config sections (trash strategy, logging, history), making it harder to reason about what the UI actually depends on.

babarot added 2 commits April 4, 2026 11:59
SkipMountPointFind, PreservePaths, and UseCompression were defined
but never referenced anywhere in the codebase. Remove them to
reduce the config surface area.
Replace *config.Config parameter in Render() and NewModel() with
RenderOptions struct containing only the fields the UI actually
uses (config.UI and DeleteEnabled bool). The CLI restore handler
now constructs RenderOptions at the boundary.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

Code Metrics Report

main (7d45896) #120 (ba42cbb) +/-
Coverage 44.5% 44.2% -0.4%
Code to Test Ratio 1:1.5 1:1.5 +0.0
Test Execution Time 3s 3s 0s
Details
  |                     | main (7d45896) | #120 (ba42cbb) |  +/-  |
  |---------------------|----------------|----------------|-------|
- | Coverage            |          44.5% |          44.2% | -0.4% |
  |   Files             |             24 |             24 |     0 |
  |   Lines             |           1809 |           1822 |   +13 |
  |   Covered           |            806 |            806 |     0 |
+ | Code to Test Ratio  |          1:1.5 |          1:1.5 |  +0.0 |
  |   Code              |           2775 |           2772 |    -3 |
  |   Test              |           4248 |           4248 |     0 |
  | Test Execution Time |             3s |             3s |    0s |

Code coverage of files in pull request scope (36.4% → 35.7%)

Files Coverage +/- Status
internal/trash/config.go 45.8% -45.9% modified
internal/trash/legacy/storage.go 32.7% +0.7% affected
internal/trash/manager.go 42.7% -0.7% affected
internal/trash/xdg/storage.go 31.1% -0.3% affected

Reported by octocov

@babarot babarot marked this pull request as ready for review April 4, 2026 03:03
@babarot babarot merged commit b7d1d1f into main Apr 4, 2026
6 checks passed
@babarot babarot deleted the babarot/refactor-phase3-config-decoupling branch April 4, 2026 03:03
@babarot babarot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, issues, etc. label Apr 4, 2026
@github-actions github-actions bot mentioned this pull request Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/cleanup Categorizes issue or PR as related to cleaning up code, issues, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant