refactor(gui): split the app core into update/commands/scroll/view - #14
Merged
Merged
Conversation
mod.rs was a 1449-line grab-bag holding every TEA layer at once; each concern now has exactly one home. update.rs carries the one flat update match (the app's dispatch table, deliberately not per-domain), shortcut, and the async toggle/auth effects. commands.rs owns Message→Command translation plus the shared bookkeeping (mark_dirty, num_in_bounds, revert_commands). scroll.rs owns one-page navigation: the measure operation, section jumps, scrollspy, and the two shared widget ids. view.rs owns the window composition (header, sidebar, status bar). mod.rs keeps the shell: Message, Gui, run, boot, subscribe, window settings, and the blocking send wrapper. Behavior-identical: every moved body is byte-verbatim (verified by mechanical extraction diff against the old file, modulo pub(super) visibility, rustfmt line-wrapping, and forced test-path edits). All 21 tests moved with their subjects — registry/section pins to fields.rs, command/revert pins to commands.rs, scrollspy pins to scroll.rs, brief_status pins to view.rs, navigation state-transition pins to update.rs — pins semantically identical. Visibility is minimal: Message and Gui stay private in mod.rs (descendant access is free by Rust privacy; the compiler proves it); pub(super) only on the items a sibling or the parent actually calls. picker.rs's update import now names the function inside the new update module.
Release PreviewNext version:
0.3.1 (2026-09-04) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Survey candidate C5, planned properly before running (user-approved shape):
src/gui/mod.rshad become a 1449-line catch-all — but ~353 lines of that were the unit-test module, and the heavy widget code already lived infields.rs/picker.rs/daemon.rs/theme.rs. This split gives every GUI concern exactly one home, following the tree's own submodule pattern and TEA layering:mod.rs(1449 → 287 L)Message,Gui,run/window_settings/platform_specific/boot/subscribe,sendupdate.rs(496)shortcut, the async effect helpers it consumes (run_toggle,apply_auth_credentials)commands.rs(218)scroll.rs(261)ContentMeasure,MeasureSections(Operation), section helpers, shared widget idsview.rs(191)Plus the moved test pins recorded into their subjects (
fields.rs+89 — the 7Field/FIELDS/search pins test what lives there).Design decisions (logged in spec, user-approved)
updatestays ONE flat function — the match is the app's dispatch table; splitting it fragments the vocabulary and buys nothing.MessageandGuistay private inmod.rs— Rust privacy grants descendants access; the compiler proves it (zeropub/pub(crate)added anywhere).pub(super)items, each with a verified cross-sibling consumer; nothing gui-internal is visible outside the subtree.mod commands;). Two independent token-level extractions confirm every moved body identical vse736601.Testing
code-layout.mdrows, one stale cross-reference) fixed and folded into this commit.daemon.rs/theme.rspair with the new modules.