Skip to content

fix(matters): repoint KB link/unlink to the project attach/detach endpoints - #124

Open
sergiomaldo wants to merge 1 commit into
LegalQuants:mainfrom
sergiomaldo:fix/kb-link-endpoints
Open

fix(matters): repoint KB link/unlink to the project attach/detach endpoints#124
sergiomaldo wants to merge 1 commit into
LegalQuants:mainfrom
sergiomaldo:fix/kb-link-endpoints

Conversation

@sergiomaldo

Copy link
Copy Markdown

Problem

Linking a knowledge base to a matter from the UI silently does nothing. The ?/linkKb / ?/unlinkKb actions in src/routes/(app)/matters/[id]/+page.server.ts call the legacy single-project shape PATCH /api/v1/knowledge-bases/{kb_id} with {project_id}, which the api no-ops; per backend.d.ts, attach/detach moved to POST/DELETE /api/v1/projects/{project_id}/knowledge-bases[/{kb_id}]. Net effect: project_knowledge_bases stays empty, no request errors anywhere, and users cannot persistently attach a KB to a matter at all (the read path works, which makes the silence more confusing).

Fix

Repoint both actions to the project attach/detach endpoints (POST with {knowledge_base_id}; DELETE treating 204/404 as success). Tests rewritten to assert the new endpoints plus a regression test that the legacy PATCH is never issued.

Testing

npm run check / lint green; vitest suite passing. Verified live: linking now persists across reloads on our deployment.

Found operating a production self-hosted legal deployment (law firm running Donna v0.6.2 fully local).

🤖 Generated with Claude Code

…points

?/linkKb and ?/unlinkKb still called the legacy
PATCH /api/v1/knowledge-bases/{kb_id} with {project_id}, which the backend
silently no-ops — the UI reported success but the KB was never linked.
Use the Wave D.1 T3 project-side endpoints instead:
  attach: POST /api/v1/projects/{project_id}/knowledge-bases {knowledge_base_id}
  detach: DELETE /api/v1/projects/{project_id}/knowledge-bases/{kb_id}
Tests updated to assert the new endpoints, plus a regression guard that the
legacy PATCH is never issued.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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