diff --git a/docs/superpowers/specs/2026-05-01-v023-ollama-recovery-design.md b/docs/superpowers/specs/2026-05-01-v023-ollama-recovery-design.md index 5859436..f65199e 100644 --- a/docs/superpowers/specs/2026-05-01-v023-ollama-recovery-design.md +++ b/docs/superpowers/specs/2026-05-01-v023-ollama-recovery-design.md @@ -35,12 +35,17 @@ export interface HealthCheckerOptions { export type HealthTelemetryEvent = | { kind: 'ollama_unreachable'; reason: string } - | { kind: 'ollama_recovered'; downtimeMs: number }; + | { kind: 'ollama_recovered'; downtimeMs: number } + | { kind: 'ollama_recheck_manual' }; export class HealthChecker { constructor(private provider: InferenceProvider, private opts: HealthCheckerOptions = {}) {} - async runOnce(): Promise; // 기존 메서드 유지 (manual recheck + start 진입점) + /** + * @param opts.manual=true 일 때 결과와 무관하게 onTelemetry({kind:'ollama_recheck_manual'}) 1회 fire. + * IPC `inbox:ollamaRecheck` 가 호출 시 사용 — telemetry 가드를 service 레이어로 끌어 단위 테스트 가능. + */ + async runOnce(opts?: { manual?: boolean }): Promise; start(): void; // setInterval 시작 (idempotent — 2회 호출 시 1번만) stop(): void; // clearInterval (idempotent) lastStatus(): HealthResult; @@ -112,12 +117,11 @@ export function pushOllamaStatus(getWin: () => BrowserWindow | null, status: Hea } ``` -`inbox:ollamaRecheck` handler: +`inbox:ollamaRecheck` handler — telemetry emit 은 HealthChecker 의 onTelemetry hook 으로 위임 (testability): ```ts ipcMain.handle('inbox:ollamaRecheck', async () => { - await deps.health.runOnce(); // status 변경 시 onUpdate 자동 fire - void deps.telemetry.emit({ kind: 'ollama_recheck_manual', payload: {} }).catch(() => {}); + await deps.health.runOnce({ manual: true }); // status 변경 시 onUpdate + ollama_recheck_manual onTelemetry fire return deps.health.lastStatus(); }); ``` @@ -320,3 +324,4 @@ T7. closure (gates + roadmap mark + memory backlog) | 일자 | 변경 | |------|------| | 2026-05-01 | 초안 — Q1=A (60s), Q2=A (절대 중단 안 함), Q3=A (constant). HealthChecker.start/stop + delta-only onUpdate + 3 telemetry events + main → renderer push (`ollama:status`) + manual recheck (banner + tray). | +| 2026-05-01 | §2.1 / §3.2 보강 — `runOnce({ manual?: boolean })` 인자 추가, `ollama_recheck_manual` 도 onTelemetry hook 으로 통합 (IPC handler 가 직접 emit 안 함). 단위 테스트 가능. |