docs(spec): #1 ollama — runOnce({manual}) + ollama_recheck_manual via hook

§2.1 / §3.2 / §11 보강 — IPC handler 가 직접 telemetry.emit 안 하고
HealthChecker.runOnce({ manual: true }) 호출 → onTelemetry hook 으로
ollama_recheck_manual 발화. 단위 테스트 가능 (HealthChecker 레이어).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
altair823
2026-05-02 01:18:28 +09:00
parent f36b9ecb5b
commit 050e7f08f1

View File

@@ -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<HealthResult>; // 기존 메서드 유지 (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<HealthResult>;
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 안 함). 단위 테스트 가능. |