Split dashboard-viewer-session.ts: a 1857-line file whose 1354-line closure holds every concern
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 42/100
- issue の種類
- リファクタリング
- 明瞭さ
- 明確に書かれている
- 活発さ
- 静か
- 技術スタック
- typescript
- 領域
- frontend, testing-qa
調査の方向性
#447 のフェーズ 1 を待ってから、提案されている runtime と state の境界と併せて src/dashboard/application/dashboard-viewer-session.ts および tests/unit/dashboard-viewer-session.test.ts を読みます。まず既存の unit test を実行し、tests/vitest.config.ts の coverage 設定を確認します。モジュールが明示的な入力で分割され、動作と公開 API が変更されず、各新規ファイルが coverage を満たし、npm run check:arch がパスすれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Found while planning #447 phase 1. Deferred: doing it now would relocate code that #447 phase 1 deletes.
What
src/dashboard/application/dashboard-viewer-session.ts is 1857 lines, of which
1354 are a single factory closure — createDashboardViewerSession starts at line 503 and runs
to the end of the file. tests/unit/dashboard-viewer-session.test.ts is 3441 lines.
The closure holds ~65 members with no internal boundary: tile runtime construction, the parameter
analysis, target resolution, the option-source/provider wave engine, published-state assembly, the
execution pool, the commit API, and the session lifecycle all capture the same scope.
That has three concrete costs:
- Review surface. Any change to one concern reads as a change to the whole session.
- The 90% branch floor (
tests/vitest.config.ts,perFile: true, 100/95/90/100) is enforced
over the whole 1857-line file, so a defensive branch in one concern can only be covered through
the public session API, via a fixture that sets up every other concern too. That is a large part
of why the spec is 3441 lines. - Closure capture instead of parameters. Members read
tiles,filters,analysis,
documentRefand friends directly from scope, so there is no stated contract between concerns.
Why after #447, not before
#447 phase 1 removes the curated-filter/provider infrastructure, which accounts for roughly
500 lines (~27%) of this file:
| Region | Lines | What |
|---|---|---|
FilterSourceRuntime |
405-424 | provider record |
filterInitialActive / filterDefaultValue |
458-468 | persisted-default readers |
sourceBackedParams, filterSources |
610-640 | provider index |
curatedControls, staticFilterDiagnostics, mergeControls |
730-807 | provider/control merge |
optionsSignature … runFilterSourceWave |
1105-1466 | the whole option-source wave engine |
Splitting first would mean carefully extracting code that is about to be deleted, and would put two
large diffs on the same file back to back. After phase 1 the file is ~1350 lines with a clearer set
of responsibilities, and the extraction boundaries below fall out of what remains.
Proposed split (post-#447)
| File | Contents |
|---|---|
dashboard-viewer-session.ts |
public facade + lifecycle: start/refresh/refreshTile/syncDocument/destroy/setTileSearch/cancelTile/setGridRenderMode/setDashboardStyle/preflight |
viewer-tile-runtime.ts |
TileRuntime, buildTileRuntime, runTile, tileResultMeta, markTextAndErrorTiles, runnableTiles, isRunnableTileRuntime, runPool, supersede |
viewer-variable-runtime.ts |
variable runtime records, rawValues/activeMap/committedRootValues/prepareBatch, the commit API (setFilter/applyFilter/applyFilters/clearFilter/clearAllFilters/resetFilters), commitAndRerun/runAffectedWave/reserveAffected |
viewer-state.ts |
ViewerTileState/ViewerFilterState/DashboardViewState + buildState/publish |
dashboard-viewer-session.types.ts |
DashboardViewerDeps, ViewerExecutor, ViewerConnection, ViewerReadRequest (type-only seam contract, per ADR-0002 phase 0) |
tests/unit/dashboard-viewer-session.test.ts splits alongside, one spec per new module.
Acceptance
- No behaviour change; the existing session public API is byte-identical to callers
(src/ui/dashboard.tsis the only consumer). - Each new file independently meets 100/95/90/100. This is the real work — extracted
collaborators must take explicit inputs rather than capture closure scope, and each one must be
reachable from its own spec without standing up the whole session. npm run check:archstill passes:src/dashboard/applicationmay not importsrc/ui,
src/editor,src/application,src/state.ts,src/net,src/dashboard/ui
(build/check-boundaries.mjs), and the new siblings inherit that rule.- No new runtime dependency; no seam changes.
Non-goals
- Changing the session's public API or the published
DashboardViewStateshape. - Splitting
src/ui/dashboard.ts(2641 lines) — related, but a separate call.
- 主要言語
- TypeScript
- スター
- 8
- フォーク
- 2
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Altinity/altinity-sql-browser のほかの issue
-
inbox
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Altinity/altinity-sql-browser#605 ·
-
inbox
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Altinity/altinity-sql-browser#509 ·
-
inbox
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Altinity/altinity-sql-browser#489 ·
-
flamegraphオープンenhancement
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
Altinity/altinity-sql-browser#684 ·
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
Altinity/altinity-sql-browser#680 · コメント 2 件 ·
Altinity/altinity-sql-browser の issue をすべて見る
似ている issue
-
bug DUP Reservations
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
bcgov/reserve-rec-public#952 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
daufderheide/racecoordinator_ai#948 ·
メンテナーはふだん 1 日以内に返信
-
Bug pulumi/pulumi
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
bug priority:high
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
api bug claude
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
diegosouzapw/OmniRoute#15764 ·
メンテナーはふだん 2 日以内に返信