Skip to content

Refactor: extract shared Knowledge API client#36

Merged
RuneLind merged 2 commits into
mainfrom
refactor/extract-knowledge-api-client
Mar 16, 2026
Merged

Refactor: extract shared Knowledge API client#36
RuneLind merged 2 commits into
mainfrom
refactor/extract-knowledge-api-client

Conversation

@RuneLind
Copy link
Copy Markdown
Owner

Summary

  • Extracts shared fetchKnowledgeApi() and knowledgeApiHandler() helpers from ~20 duplicated AbortController+timeout+error patterns
  • New file: src/dashboard/routes/knowledge-api-client.ts
  • Updated: search-routes.ts, youtube-routes.ts, research-routes.ts (net -62 lines)
  • All route paths, response shapes, status codes, and timeouts preserved exactly

Test plan

  • All 731 tests pass
  • TypeScript compiles cleanly (tsc --noEmit)
  • /simplify review: added missing 502 error logging + path context
  • Verify Knowledge API proxy endpoints work (search, youtube, research pages)

Consolidate ~15 identical AbortController+timeout+error handling patterns
across research-routes, search-routes, and youtube-routes into a shared
knowledge-api-client.ts helper with two functions:

- fetchKnowledgeApi(): low-level fetch with timeout and typed errors
- knowledgeApiHandler(): Hono handler returning proper 502/503 responses

Removes ~150 lines of duplicated boilerplate. No behavior changes.
@RuneLind RuneLind merged commit 68946d1 into main Mar 16, 2026
@RuneLind RuneLind deleted the refactor/extract-knowledge-api-client branch March 16, 2026 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant