Summary
Follow-up to #33. The mechanical parts of the code-structure cleanup landed in v1.3.1, but two files remain over the 600-line hard cap because they need design thought rather than a rote extraction:
| File |
Lines |
Why deferred |
Shellbee/Core/Store/AppStore.swift |
691 |
Single @Observable class. Splitting needs a domain partition (Devices / Groups / OTA / Notifications / Logs) realized as extension AppStore files. Stored properties have to stay in the main file (@Observable constraint), so the partition is methods-only. |
Shellbee/Core/Parsing/DeviceDocNormalizer.swift |
646 |
7 parsing helper types in one file. Some may be small enough to genuinely belong together; needs a read-through to confirm what's worth extracting and what reads better adjacent. |
Plan for AppStore
- Read
apply(_ event:) end to end (currently ~227 lines of switch). Identify per-domain handler clusters.
- Split methods into:
AppStore+Events.swift — the per-event handlers extracted from the giant apply switch.
AppStore+Notifications.swift — popNotification, popFastTrackNotification, enqueueNotification, notification(...), stripped(...).
AppStore+OTA.swift — otaStatus(for:), startOTAUpdate, startOTACheck, startOTASchedule, cancelOTASchedule.
AppStore+Logs.swift — clearLogs, insertLogEntry, insertRawLogEntry.
AppStore+Devices.swift — device(named:), state(for:), isAvailable, optimisticRename, revertOptimisticRename, recordFirstSeen, removeFirstSeen.
- Keep stored properties +
init + reset + apply dispatcher in the main file.
- Verify with the seeder mock + UI tests; the surface area is wide enough that visual review isn't enough.
Plan for DeviceDocNormalizer
- Read end to end. List the 7 types and their dependencies on each other.
- If any 3+ are tightly coupled (one calls into another and they're never used independently), keep them together in a sub-file.
- Otherwise split into one type per file under
Core/Parsing/Normalizer/.
- Verify with the doc-parsing tests.
Acceptance criteria
Notes
Lower priority than #33 because nothing in the codebase is blocked by these files being big — the rule violation is the only forcing function. Pick this up alongside other v2.0 / late-v1.x cleanup work, not before.
Summary
Follow-up to #33. The mechanical parts of the code-structure cleanup landed in v1.3.1, but two files remain over the 600-line hard cap because they need design thought rather than a rote extraction:
Shellbee/Core/Store/AppStore.swift@Observableclass. Splitting needs a domain partition (Devices / Groups / OTA / Notifications / Logs) realized asextension AppStorefiles. Stored properties have to stay in the main file (@Observableconstraint), so the partition is methods-only.Shellbee/Core/Parsing/DeviceDocNormalizer.swiftPlan for AppStore
apply(_ event:)end to end (currently ~227 lines of switch). Identify per-domain handler clusters.AppStore+Events.swift— the per-event handlers extracted from the giantapplyswitch.AppStore+Notifications.swift—popNotification,popFastTrackNotification,enqueueNotification,notification(...),stripped(...).AppStore+OTA.swift—otaStatus(for:),startOTAUpdate,startOTACheck,startOTASchedule,cancelOTASchedule.AppStore+Logs.swift—clearLogs,insertLogEntry,insertRawLogEntry.AppStore+Devices.swift—device(named:),state(for:),isAvailable,optimisticRename,revertOptimisticRename,recordFirstSeen,removeFirstSeen.init+reset+applydispatcher in the main file.Plan for DeviceDocNormalizer
Core/Parsing/Normalizer/.Acceptance criteria
ShellbeeTests/Unit/DeviceDocNormalizer*(if present) still passes.Notes
Lower priority than #33 because nothing in the codebase is blocked by these files being big — the rule violation is the only forcing function. Pick this up alongside other v2.0 / late-v1.x cleanup work, not before.