Spec: Fowler-style refactoring review (cloud agent, 2026-08-05). Refactor only — no behavior change.
What to change
About ten browser-side client modules repeat the same two blocks:
- the auth-headers builder including the
x-walking-thoughts-test-user bypass: lib/sync/client.ts, lib/sync/trash-client.ts, lib/sync/threads-client.ts, lib/sync/split-client.ts, lib/sync/review-client.ts, lib/sync/media-client.ts, lib/enrichment/client.ts, lib/enrichment/thread-view.ts, lib/artifacts/client.ts, lib/push/client.ts — plus hand-rolled copies in components/daily-digest-panel.tsx (digestHeaders) and components/interview-panel.tsx (interviewHeaders)
- the 401/403/503 →
{ unavailable: true } response mapping
Extract syncAuthHeaders() and asUnavailable(response) (or a tiny fetchSync(path, init)) into one module (e.g. lib/sync/http.ts) and route every client through it.
Out of scope: retry/timeout behavior; the transports' public interfaces.
Acceptance criteria
Spec: Fowler-style refactoring review (cloud agent, 2026-08-05). Refactor only — no behavior change.
What to change
About ten browser-side client modules repeat the same two blocks:
x-walking-thoughts-test-userbypass:lib/sync/client.ts,lib/sync/trash-client.ts,lib/sync/threads-client.ts,lib/sync/split-client.ts,lib/sync/review-client.ts,lib/sync/media-client.ts,lib/enrichment/client.ts,lib/enrichment/thread-view.ts,lib/artifacts/client.ts,lib/push/client.ts— plus hand-rolled copies incomponents/daily-digest-panel.tsx(digestHeaders) andcomponents/interview-panel.tsx(interviewHeaders){ unavailable: true }response mappingExtract
syncAuthHeaders()andasUnavailable(response)(or a tinyfetchSync(path, init)) into one module (e.g.lib/sync/http.ts) and route every client through it.Out of scope: retry/timeout behavior; the transports' public interfaces.
Acceptance criteria
digestHeaders/interviewHeadersin components are deleted in favor of the shared helpermise run lintandmise run testpass