refactor: drop two over-engineered seams (enum + stdlib Base64)#5945
Conversation
Two small simplifications surfaced by a repo-wide complexity audit, both behavior-preserving and verified by spotless/detekt + allTests on every touched module. - ScrollToTopEvent: a sealed class whose only members were two stateless `data object`s is exactly an enum. Converted; the two `is` checks become `==`. - Base64Factory: a two-method object that only forwarded to the stdlib `kotlin.io.encoding.Base64.Default`, with a single call site. Deleted the file and inlined `Base64.Default.encode(...)` (opt-in folded into the existing @OptIn on the caller). Net -15 lines, -1 file. Three other audit candidates were left in place after checking: MqttClientSession backs a real test fake, AndroidServiceRepository is the @single annotation-DI anchor matching every other androidMain class, and the desktop Noop* stubs aren't worth the churn. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
🖼️ Preview staleness check — advisoryThis PR modifies UI composables but does not update any
Changed UI files: What to check:
Adding previews checklist:
If this PR does not require preview updates (e.g., logic-only change, non-visual refactor), add the |
📄 Docs staleness check — advisoryThis PR modifies user-facing UI source files but does not update any page under
Changed source files: What to check:
New page checklist (if adding a new doc page):
If this PR does not require a doc update (e.g., internal refactor, bug fix, test change), add the
|
Why
A repo-wide complexity audit surfaced two abstractions that exist only as ceremony. Both are behavior-preserving deletions — fewer lines, same semantics, no new dependency.
🧹 Cleanup
ScrollToTopEvent→enum. It was asealed classwhose only members were two statelessdata objects — which is precisely anenum. Converted, and the twoif (event is ScrollToTopEvent.X)checks become==.Base64Factory. A two-methodobjectthat only forwarded to the stdlibkotlin.io.encoding.Base64.Default, with a single call site. InlinedBase64.Default.encode(...)inNodeDetailsSection; the experimental opt-in folds into the@OptInalready on the caller.Net -15 lines, -1 file.
Left in place (audit candidates rejected after checking)
MqttClientSession— backs a realFakeMqttClientSessiontest seam.AndroidServiceRepository— the@Singleannotation-DI anchor; matches every otherandroidMainclass.Noop*stubs — converting toobjectis 8 edit sites for -4 lines and no behavior change. Not worth the churn.Testing Performed
./gradlew spotlessCheck detekt+allTestson every touched module (:core:ui,:feature:node,:feature:messaging,:core:common) — all pass.:core:common87 tests green.