Skip to content

refactor(cli): inject shared StatusUseCase/RestoreUseCase/UpdateOneToolUseCase - #507

Merged
blafourcade merged 1 commit into
fix/e3-02-restore-plugin-scope-dedupfrom
refactor/e1-shared-instance-dedup
Jul 24, 2026
Merged

blafourcade merged 1 commit into
fix/e3-02-restore-plugin-scope-dedupfrom
refactor/e1-shared-instance-dedup

Conversation

@blafourcade

Copy link
Copy Markdown
Contributor

🎯 What & why

StatusAllUseCase, RestoreAllUseCase, and UpdateAllUseCase each rebuilt their own duplicate of a collaborator deps.ts already constructs and shares with ai.ts/ide.ts (deps.statusUseCase, deps.restoreUseCase, deps.updateOneToolUseCase, consumed directly by those commands). Two of the four duplicate sites rebuilt on every execute() call.

🛠️ How it works

Confirmed all 3 target classes are stateless before sharing them as singletons — no memo maps, no accumulator fields; BulkConflictState is passed as an execute() parameter by the caller, never stored on UpdateOneToolUseCase. Each class now receives the real instance by constructor injection; every now-dead raw-sub-dependency param was removed rather than left unused (e.g. UpdateAllUseCase drops from 9 constructor params to 5).

grep -rn "new StatusUseCase\|new RestoreUseCase\|new UpdateOneToolUseCase" src/ finds only the 3 original construction sites in deps.ts.

Pure DI wiring — zero behavior change. 2048/2048 tests pass unmodified.

🧪 How to verify

pnpm --filter cli test

⚠️ Heads-up

Stacked on #506 (touches restore-all-use-case.ts right after it) — this PR's base is that branch, not next. Needs #506 merged first, then this one retargeted to next.

Originally planned in the (now-archived) standalone aidd-cli repo before the framework migration (#462); implemented fresh here since the source repo no longer accepts pushes.

…olUseCase

StatusAllUseCase, RestoreAllUseCase, and UpdateAllUseCase each rebuilt their
own duplicate of a collaborator deps.ts already constructs and shares with
ai.ts/ide.ts (deps.statusUseCase, deps.restoreUseCase, deps.updateOneToolUseCase
consumed directly by those commands). Two of the four duplicate sites rebuilt
on every execute() call, not just once.

Confirmed all 3 target classes stateless before sharing them as singletons
(no memo maps, no accumulator fields — BulkConflictState is passed as an
execute() parameter, never stored on UpdateOneToolUseCase). Each class now
receives the real instance by constructor injection; every now-dead
raw-sub-dependency param removed rather than left unused.

grep confirms zero remaining "new StatusUseCase/RestoreUseCase/
UpdateOneToolUseCase" outside deps.ts's 3 original construction sites.
2048/2048 tests pass unmodified — zero behavior change, pure DI wiring.

Stacked on fix/e3-02-restore-plugin-scope-dedup (touches the same
restore-all-use-case.ts) — needs that branch merged first.

Ported/implemented fresh from the archived aidd-cli repo's plan
(SPIKE-E1-01 + BUG-E1-02, pre-migration) — original work predates the
framework migration (PR #462).
@blafourcade
blafourcade merged commit 7ba7154 into fix/e3-02-restore-plugin-scope-dedup Jul 24, 2026
13 checks passed
@blafourcade
blafourcade deleted the refactor/e1-shared-instance-dedup branch July 24, 2026 04:54
blafourcade added a commit that referenced this pull request Jul 24, 2026
…olUseCase (#507) (#508)

StatusAllUseCase, RestoreAllUseCase, and UpdateAllUseCase each rebuilt their
own duplicate of a collaborator deps.ts already constructs and shares with
ai.ts/ide.ts (deps.statusUseCase, deps.restoreUseCase, deps.updateOneToolUseCase
consumed directly by those commands). Two of the four duplicate sites rebuilt
on every execute() call, not just once.

Confirmed all 3 target classes stateless before sharing them as singletons
(no memo maps, no accumulator fields — BulkConflictState is passed as an
execute() parameter, never stored on UpdateOneToolUseCase). Each class now
receives the real instance by constructor injection; every now-dead
raw-sub-dependency param removed rather than left unused.

grep confirms zero remaining "new StatusUseCase/RestoreUseCase/
UpdateOneToolUseCase" outside deps.ts's 3 original construction sites.
2048/2048 tests pass unmodified — zero behavior change, pure DI wiring.

Stacked on fix/e3-02-restore-plugin-scope-dedup (touches the same
restore-all-use-case.ts) — needs that branch merged first.

Ported/implemented fresh from the archived aidd-cli repo's plan
(SPIKE-E1-01 + BUG-E1-02, pre-migration) — original work predates the
framework migration (PR #462).
blafourcade added a commit that referenced this pull request Jul 31, 2026
…olUseCase (#507) (#508)

StatusAllUseCase, RestoreAllUseCase, and UpdateAllUseCase each rebuilt their
own duplicate of a collaborator deps.ts already constructs and shares with
ai.ts/ide.ts (deps.statusUseCase, deps.restoreUseCase, deps.updateOneToolUseCase
consumed directly by those commands). Two of the four duplicate sites rebuilt
on every execute() call, not just once.

Confirmed all 3 target classes stateless before sharing them as singletons
(no memo maps, no accumulator fields — BulkConflictState is passed as an
execute() parameter, never stored on UpdateOneToolUseCase). Each class now
receives the real instance by constructor injection; every now-dead
raw-sub-dependency param removed rather than left unused.

grep confirms zero remaining "new StatusUseCase/RestoreUseCase/
UpdateOneToolUseCase" outside deps.ts's 3 original construction sites.
2048/2048 tests pass unmodified — zero behavior change, pure DI wiring.

Stacked on fix/e3-02-restore-plugin-scope-dedup (touches the same
restore-all-use-case.ts) — needs that branch merged first.

Ported/implemented fresh from the archived aidd-cli repo's plan
(SPIKE-E1-01 + BUG-E1-02, pre-migration) — original work predates the
framework migration (PR #462).
blafourcade added a commit that referenced this pull request Jul 31, 2026
…olUseCase (#507) (#508)

StatusAllUseCase, RestoreAllUseCase, and UpdateAllUseCase each rebuilt their
own duplicate of a collaborator deps.ts already constructs and shares with
ai.ts/ide.ts (deps.statusUseCase, deps.restoreUseCase, deps.updateOneToolUseCase
consumed directly by those commands). Two of the four duplicate sites rebuilt
on every execute() call, not just once.

Confirmed all 3 target classes stateless before sharing them as singletons
(no memo maps, no accumulator fields — BulkConflictState is passed as an
execute() parameter, never stored on UpdateOneToolUseCase). Each class now
receives the real instance by constructor injection; every now-dead
raw-sub-dependency param removed rather than left unused.

grep confirms zero remaining "new StatusUseCase/RestoreUseCase/
UpdateOneToolUseCase" outside deps.ts's 3 original construction sites.
2048/2048 tests pass unmodified — zero behavior change, pure DI wiring.

Stacked on fix/e3-02-restore-plugin-scope-dedup (touches the same
restore-all-use-case.ts) — needs that branch merged first.

Ported/implemented fresh from the archived aidd-cli repo's plan
(SPIKE-E1-01 + BUG-E1-02, pre-migration) — original work predates the
framework migration (PR #462).
@aidd-bot aidd-bot Bot mentioned this pull request Jul 31, 2026