Skip to content

refactor(view): decompose dialogs/bom + annotate under the 800-line cap (ADR-0001 #164)#224

Merged
hkngln merged 2 commits into
trunkfrom
refactor/dialogs-bom-annotate-800cap
Jul 11, 2026
Merged

refactor(view): decompose dialogs/bom + annotate under the 800-line cap (ADR-0001 #164)#224
hkngln merged 2 commits into
trunkfrom
refactor/dialogs-bom-annotate-800cap

Conversation

@hkngln

@hkngln hkngln commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #223. The two dialog files that exceeded the 800-line cap after the folder move are now decomposed under it. Behaviour-preserving — dialogs render pixel-identically.

dialogs/annotate.rs (816) → annotate/ folder

File Lines Concern
annotate/mod.rs 675 dialog + reset-confirm builders (methods on Signex)
annotate/controls.rs 159 trailing widget free fns (check_pip, order_preview, order_radio, bordered_style) — pure code motion, byte-identical

dialogs/bom.rs (889) → bom/ folder

File Lines Concern
bom/mod.rs 230 entry methods + the view_bom_preview_body_inner orchestrator
bom/sidebar.rs 365 Properties sidebar + its controls
bom/table.rs 349 the BOM data grid

The ~848-line view_bom_preview_body_inner was decomposed by extracting the sidebar and table sub-Element trees into bom_sidebar() / bom_table() helper methods, called from the original positions. Child-push order is preserved — the final column![header, title_separator, toolbar_strip, main_row, footer] and main_row = row![container(body), divider, container(sidebar)] are unchanged, so z-order/layout is identical; only construction order (side-effect-free) differs.

No consumer edits

dialogs/mod.rs untouched (mod bom;/mod annotate; resolve to the new folders). Entry methods keep pub(in crate::app::view); new helpers pub(super). controls.rs named to avoid confusion with the pre-existing distinct annotate_preview.rs.

Verify

  • cargo build -p signex-app 0 errors, 52 warnings = baseline (0 new); cargo test -p signex-app 334 pass; cargo clippy -p signex-app 231 = baseline (delta 0); git grep -niE 'kicad' -- crates/** = 0; diff touches only app/view/dialogs/.
  • Behaviour proof: moved slices diff byte-identical to the trunk original line ranges; independently, every string literal and every Message::/PanelMsg:: reference in bom is identical old→new.

Crates affected

  • signex-app (view dialogs)

hkngln added 2 commits July 11, 2026 21:00
… the 800-line cap (ADR-0001 #164)

annotate.rs (816 lines) exceeded the 800-line hard cap. Convert it to a
folder and move the trailing free helper fns into a controls module — pure
code motion, the rendered UI is pixel-identical.

  dialogs/annotate.rs (816)  ->  dialogs/annotate/mod.rs      (675)
                                 dialogs/annotate/controls.rs (159)

- controls.rs holds check_pip / order_preview / order_radio / bordered_style,
  moved verbatim (byte-for-byte) and narrowed to pub(super).
- mod.rs keeps the view_annotate_dialog / view_annotate_reset_confirm method
  families unchanged; entry points keep pub(in crate::app::view).

Behaviour preservation: the four moved fns diff byte-identical against the
originals; the impl block is an unbroken slice of the original file.
…0-line cap (ADR-0001 #164)

bom.rs (889 lines) exceeded the 800-line hard cap. Decompose the ~848-line
view_bom_preview_body_inner into section-builder methods and split the file
into a folder by concern — pure code motion, the rendered modal is
pixel-identical.

  dialogs/bom.rs (889)  ->  dialogs/bom/mod.rs     (230)  shell + orchestrator
                            dialogs/bom/table.rs   (349)  data grid
                            dialogs/bom/sidebar.rs (364)  Properties sidebar + controls

- mod.rs builds header / toolbar / footer / separator inline, then calls
  self.bom_table() and self.bom_sidebar(); the final
  column![header, title_separator, toolbar_strip, main_row, footer] and
  main_row are unchanged.
- bom_table / bom_sidebar are pub(super) helper methods on impl Signex.
- Entry points view_bom_preview / view_bom_preview_body keep
  pub(in crate::app::view).

Behaviour preservation: every child-pushing block was moved verbatim.
Reassembled in call order they diff byte-identical against the original:
  table.rs   == bom.rs 267-589
  sidebar.rs == bom.rs 81-214 ++ 216-265 ++ 666-818
  mod.rs     == bom.rs 43-79 ++ 591-664 ++ 820-841 ++ 843-867 ++ 869-877 ++ 879-887
  (plus the two injected self.bom_table()/self.bom_sidebar() calls)
Column/row child order is unchanged, so z-order and layout are preserved.
@hkngln hkngln requested a review from alpCaner as a code owner July 11, 2026 19:02
@hkngln hkngln added ui/ux Panels, menus, dock, preferences type: refactor Internal restructuring, no behavior change labels Jul 11, 2026
@github-actions github-actions Bot added the area: app signex-app shell — menus, dock, panels, chrome, tabs label Jul 11, 2026
@hkngln hkngln merged commit 4672229 into trunk Jul 11, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: app signex-app shell — menus, dock, panels, chrome, tabs type: refactor Internal restructuring, no behavior change ui/ux Panels, menus, dock, preferences

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant