Decompose FleetCockpit.mjs below the 1k-LOC app-file bar
Problem Scope
Operator verdict, live session 2026-08-18, on the sentence "FleetCockpit.mjs ist mit 3327 Zeilen der Monolith": it is NOT ok — severe architectural debt. The reference bar: apps/portal; app files should sit below ~1k LOC.
Measured (2026-08-18):
| Surface |
Number |
apps/agentos/view/fleet/FleetCockpit.mjs @ dev |
3,327 LOC |
| same file after the latest feature PR (memories pop-out) |
3,487 LOC — the trajectory: every cockpit feature grows the one class |
apps/portal |
97 files, 12,599 LOC total; view-layer maximum 485 LOC; two ≥1k outliers are canvas-worker classes (1,454 / 1,148) — a different execution realm, and still under half the cockpit's size |
apps/agentos files ≥ 1k |
FleetCockpit 3,487 · childapps/dockdemo/view/DemoBWorkspace.mjs 4,480 — already owned elsewhere: relocation out of the product app #16322, decomposition #15614 (phase 1 shipped) |
What the one class owns today (the god-object inventory): the dock-document commit loop (reducer + view-sync) · TWO vessel pathways (the click-detail state machine with generations/timers/failure edges AND the generic gesture tear-out family: capture/adopt/reparent/reintegrate/placements) · window connect/disconnect lifecycle · six source/bridge verb families with owner-held snapshots, generation fences and degradation vocabulary (roster, activity, brain-health, memories, catch-up, wake-routes, operator inbox/compose) · chrome sync (control bar, spine banner, viewer-wake telltale, fleet-start summary) · pane materialization for every dock item · perspective store + preset switching.
The measured tax, from this same session: the memories pop-out PR needed FOUR sibling-suite stub repairs, because the unit idiom drives real prototype methods over stub cockpits — every addition to the class surface costs N stub updates across suites (fleetCockpit.spec.mjs builders ×2, composition-root stub, memoriesOwnerSeam stub). The stub-growth tax is a direct function of the class's surface area. Reviewer cost compounds the same way: a reviewer of any cockpit PR loads a 3.5k-LOC context to judge a 150-line delta.
Why an Epic: the decomposition is several behavior-frozen extraction cuts, each independently landable and revertible as its own PR, plus a mechanical guard — multi-sub coordination by construction, never one PR.
Intended Solution Shape
Continue the pattern the folder already proves. view/fleet/ is ALREADY a leaf architecture everywhere except its center: spineBanner.mjs, telltale.mjs, sourceHealth.mjs, fleetStartPlan.mjs, agentFreshness.mjs, configIntentRoundTrip.mjs, fleetLifecycleIntentAdapter.mjs are extracted leaves; FleetCockpitController.mjs is a thin (323-LOC) intent-relay. The epic's shape is: pull the remaining responsibility families out of the class along their EXISTING seams, into siblings of the same kind, until the class is the dock-shell core and composition root — nothing else.
The natural seams, visible in the code today (prose orientation, NOT the sub registry — subs are linked incrementally via the relationship graph):
- the vessel/tear-out lifecycle family (both pathways converge on one substrate; the recent pop-out work made the seam explicit);
- the source-read family (generation-fenced bridge verbs + owner-held snapshots + the phase-blind pane accessors — one uniform discipline, currently repeated per source);
- the chrome-sync family (banner/telltale/control-bar sync over owner state);
- the dock commit loop stays — that IS the class.
Behavior-frozen discipline per cut: zero semantic changes; the FULL agentos unit tree green before and after; spec stubs SHRINK (an extracted family takes its stub surface with it into a focused suite). A cut that wants to also fix behavior is two PRs.
The invariant gets teeth: a mechanical file-size guard for apps/** (the existing check-* lint family; warn → error ladder, budget ~1k LOC) so the bar survives the epic — the debt class regressed once precisely because no gate watched it. Demo childapps' budget (or explicit exemption with rationale) is that sub's decision, made visibly.
Out of Scope
Behavior changes or features riding extraction PRs · the engine-side dock visual language (#17241, @neo-opus-grace — coordinates, never absorbed) · the navigation-model implementation (#17269 — lands INTO the decomposed shape; ordering coordinated) · ai/ substrate weight (a different debt axis with its own lane) · portal canvas-class sizes (named for honesty; portal is the reference, not the patient) · the dockdemo childapp: #16322 owns its relocation out of the product app, #15614 owns DemoBWorkspace's decomposition — this epic tracks the PRODUCT surface only, and the file-size guard sub should align its scope with #16322's landing (a relocated demo leaves apps/agentos entirely).
Avoided Traps
- Big-bang rewrite — rejected: serial, behavior-frozen, individually-revertible cuts only.
- Premature engine graduation — extraction stays app-side; anything generic enough for
src/dashboard goes through #17241's path when IT proves the need.
- Splitting by line-count instead of responsibility — the bar is the SYMPTOM threshold; the cut lines are the responsibility seams above. A 900-LOC file with three unrelated jobs still fails the intent.
- Re-owning already-ticketed debt — DemoBWorkspace at 4,480 LOC nearly became this epic's decision; the sweep found #16322 + #15614 already own it (operator caught the overlap at filing time). The epic references, never duplicates.
Related
Epic #14560 (parent) · #17269 / #17268 (design work landing into the decomposed shape) · #17333 (its implementation should land in the extracted vessel/source families — the natural first consumer) · #17241 (engine-side dock language, @neo-opus-grace) · #16322 / #15614 (dockdemo relocation + DemoBWorkspace decomposition — the demo surface's own owners) · D#17326 (the sibling debt-census discussion, doc-density axis).
Creation notes: structure-map gate executed this session (ai/services/fleet cited for sibling work; this epic's placement claims are apps/agentos-internal and follow the proven view/fleet leaf-sibling pattern). Live latest-open sweep: latest 10 re-checked 2026-08-18T09:4xZ + keyword search, no equivalent; A2A herd window clean.
Origin Session ID: ca3c67ac-a3d6-4e93-98e0-c5f7f65011ee
Retrieval Hint: query_raw_memories("FleetCockpit decompose god object leaf extraction file size bar stub growth tax")
Decompose FleetCockpit.mjs below the 1k-LOC app-file bar
Problem Scope
Operator verdict, live session 2026-08-18, on the sentence "FleetCockpit.mjs ist mit 3327 Zeilen der Monolith": it is NOT ok — severe architectural debt. The reference bar:
apps/portal; app files should sit below ~1k LOC.Measured (2026-08-18):
apps/agentos/view/fleet/FleetCockpit.mjs@ devapps/portalapps/agentosfiles ≥ 1kchildapps/dockdemo/view/DemoBWorkspace.mjs4,480 — already owned elsewhere: relocation out of the product app #16322, decomposition #15614 (phase 1 shipped)What the one class owns today (the god-object inventory): the dock-document commit loop (reducer + view-sync) · TWO vessel pathways (the click-detail state machine with generations/timers/failure edges AND the generic gesture tear-out family: capture/adopt/reparent/reintegrate/placements) · window connect/disconnect lifecycle · six source/bridge verb families with owner-held snapshots, generation fences and degradation vocabulary (roster, activity, brain-health, memories, catch-up, wake-routes, operator inbox/compose) · chrome sync (control bar, spine banner, viewer-wake telltale, fleet-start summary) · pane materialization for every dock item · perspective store + preset switching.
The measured tax, from this same session: the memories pop-out PR needed FOUR sibling-suite stub repairs, because the unit idiom drives real prototype methods over stub cockpits — every addition to the class surface costs N stub updates across suites (
fleetCockpit.spec.mjsbuilders ×2, composition-root stub,memoriesOwnerSeamstub). The stub-growth tax is a direct function of the class's surface area. Reviewer cost compounds the same way: a reviewer of any cockpit PR loads a 3.5k-LOC context to judge a 150-line delta.Why an Epic: the decomposition is several behavior-frozen extraction cuts, each independently landable and revertible as its own PR, plus a mechanical guard — multi-sub coordination by construction, never one PR.
Intended Solution Shape
Continue the pattern the folder already proves.
view/fleet/is ALREADY a leaf architecture everywhere except its center:spineBanner.mjs,telltale.mjs,sourceHealth.mjs,fleetStartPlan.mjs,agentFreshness.mjs,configIntentRoundTrip.mjs,fleetLifecycleIntentAdapter.mjsare extracted leaves;FleetCockpitController.mjsis a thin (323-LOC) intent-relay. The epic's shape is: pull the remaining responsibility families out of the class along their EXISTING seams, into siblings of the same kind, until the class is the dock-shell core and composition root — nothing else.The natural seams, visible in the code today (prose orientation, NOT the sub registry — subs are linked incrementally via the relationship graph):
Behavior-frozen discipline per cut: zero semantic changes; the FULL agentos unit tree green before and after; spec stubs SHRINK (an extracted family takes its stub surface with it into a focused suite). A cut that wants to also fix behavior is two PRs.
The invariant gets teeth: a mechanical file-size guard for
apps/**(the existingcheck-*lint family; warn → error ladder, budget ~1k LOC) so the bar survives the epic — the debt class regressed once precisely because no gate watched it. Demo childapps' budget (or explicit exemption with rationale) is that sub's decision, made visibly.Out of Scope
Behavior changes or features riding extraction PRs · the engine-side dock visual language (#17241, @neo-opus-grace — coordinates, never absorbed) · the navigation-model implementation (#17269 — lands INTO the decomposed shape; ordering coordinated) ·
ai/substrate weight (a different debt axis with its own lane) · portal canvas-class sizes (named for honesty; portal is the reference, not the patient) · the dockdemo childapp: #16322 owns its relocation out of the product app, #15614 owns DemoBWorkspace's decomposition — this epic tracks the PRODUCT surface only, and the file-size guard sub should align its scope with #16322's landing (a relocated demo leavesapps/agentosentirely).Avoided Traps
src/dashboardgoes through #17241's path when IT proves the need.Related
Epic #14560 (parent) · #17269 / #17268 (design work landing into the decomposed shape) · #17333 (its implementation should land in the extracted vessel/source families — the natural first consumer) · #17241 (engine-side dock language, @neo-opus-grace) · #16322 / #15614 (dockdemo relocation + DemoBWorkspace decomposition — the demo surface's own owners) · D#17326 (the sibling debt-census discussion, doc-density axis).
Creation notes: structure-map gate executed this session (
ai/services/fleetcited for sibling work; this epic's placement claims areapps/agentos-internal and follow the provenview/fleetleaf-sibling pattern). Live latest-open sweep: latest 10 re-checked 2026-08-18T09:4xZ + keyword search, no equivalent; A2A herd window clean.Origin Session ID: ca3c67ac-a3d6-4e93-98e0-c5f7f65011ee
Retrieval Hint:
query_raw_memories("FleetCockpit decompose god object leaf extraction file size bar stub growth tax")