Repository navigation
fix: knowledge_entries mutations throw ConvexError instead of raw Error (#2000) - #2201
Conversation
Desk Review — #2000 (ConvexError migration for
|
Desk Review — PR #2201 (Closes #2000)Verdict: READY TO MERGE. Reviewed the whole implementation (not just the diff) on branch CIAll required checks green — Type check, Lint, Format, Knip, Unit, Build convex/platform, Smoke test, all 16 Playwright (platform) shards, UI, Storybook, Analyze, Opengrep. The only non-green entries are normal skips ( TestsRan the project's own suite once: What was verified
Non-blocking suggestions (optional, do not gate merge)
READY TO MERGE. |
What
services/platform/convex/knowledge_entries/public mutations and their sharedvalidateTopicAndContenthelper threw rawError(...), which Convex redacts to an opaque "Server Error" in production — the message never reaches the client, so the Knowledge Entries UI shows no feedback when a mutation rejects.This replaces every raw
Errorthrow in the public surface with a structuredConvexError({ code: '...' }), matching the pattern already used intasks/mutations.ts,branding/file_actions.ts, and the existingKNOWLEDGE_ENTRY_DUPLICATEguard in this same file.Changes
helpers.ts—validateTopicAndContentnow throws:KNOWLEDGE_ENTRY_TOPIC_REQUIREDKNOWLEDGE_ENTRY_TOPIC_TOO_LONG(carriesmax)KNOWLEDGE_ENTRY_CONTENT_REQUIREDKNOWLEDGE_ENTRY_CONTENT_TOO_LONG(carriesmax)mutations.ts— create/update/delete now throw:UNAUTHENTICATED(matching the repo-wide convention)KNOWLEDGE_ENTRY_NOT_FOUNDKNOWLEDGE_ENTRY_NOT_ACTIVEThe helper is shared by both public and internal mutations;
ConvexErrorpropagates correctly through both paths, so this is safe.Tests
mutations.test.tswith a#2000suite asserting the structured codes for unauthenticated / blank-topic / blank-content / not-found / not-active.helpers.test.tsvalidation cases to assert the newConvexErrorcodes instead of the old raw message strings.bunx vitest --run --project server knowledge_entries→ 25 passed.bunx tsc --noEmit→ clean.bunx oxlint --type-aware→ 0 warnings / 0 errors.Closes #2000