Skip to content

refactor(gui): split the app core into update/commands/scroll/view - #14

Merged
FAZuH merged 1 commit into
v0.3.1from
refactor/gui-app-core-split
Sep 4, 2026
Merged

FAZuH merged 1 commit into
v0.3.1from
refactor/gui-app-core-split

Conversation

@FAZuH

@FAZuH FAZuH commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Summary

Survey candidate C5, planned properly before running (user-approved shape): src/gui/mod.rs had become a 1449-line catch-all — but ~353 lines of that were the unit-test module, and the heavy widget code already lived in fields.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:

Module Owns
mod.rs (1449 → 287 L) App shell: Message, Gui, run/window_settings/platform_specific/boot/subscribe, send
update.rs (496) The flat dispatch table (ONE function — no per-domain split), shortcut, the async effect helpers it consumes (run_toggle, apply_auth_credentials)
commands.rs (218) Message→Command translation, dirty-tracking, bounds, revert
scroll.rs (261) Measure/jump/scrollspy: ContentMeasure, MeasureSections (Operation), section helpers, shared widget ids
view.rs (191) Window composition: view/header/sidebar/status_bar/daemon_toggle/brief_status

Plus the moved test pins recorded into their subjects (fields.rs +89 — the 7 Field/FIELDS/search pins test what lives there).

Design decisions (logged in spec, user-approved)

  • update stays ONE flat function — the match is the app's dispatch table; splitting it fragments the vocabulary and buys nothing.
  • Message and Gui stay private in mod.rs — Rust privacy grants descendants access; the compiler proves it (zero pub/pub(crate) added anywhere).
  • Exactly 13 pub(super) items, each with a verified cross-sibling consumer; nothing gui-internal is visible outside the subtree.
  • Tests moved with their subjects (privacy forces it); all pins semantically identical; repo-wide test counts match baseline.
  • Discipline per user decision: reviewability-agnostic — polish sanctioned and logged (12 deviation-log entries), but zero logic edits and zero new traits/types (the only new symbol is mod commands;). Two independent token-level extractions confirm every moved body identical vs e736601.

Testing

  • Remote CI-exact check green before and after (fmt --all / clippy --all-features --all-targets --no-deps / test --workspace --all-features; 13/13 suites, 169 lib tests).
  • Two-axis review: approve-with-nits, zero required findings; placement calls 4/4 endorsed by call-graph evidence; minors (stale code-layout.md rows, one stale cross-reference) fixed and folded into this commit.
  • CI build matrix compile-verifies the untouched daemon.rs/theme.rs pair with the new modules.

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.
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

Release Preview

Next version: v0.3.1

Note: CHANGELOG.md has no ## [Unreleased] section. An empty one was created for this preview — add your entries under it to preview the release body.

0.3.1 (2026-09-04)

@FAZuH
FAZuH merged commit d0a4a58 into v0.3.1 Sep 4, 2026
7 checks passed
@FAZuH
FAZuH deleted the refactor/gui-app-core-split branch September 4, 2026 08:01
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