[dashboards] pro dashboard: handle UUID thought ids#47
Open
alanshurafa wants to merge 2 commits into
Open
Conversation
The pro dashboard was ported from a bigint-id codebase and typed thought ids as `number`, guarding route ids with positive-integer checks. On Open Brain, where thoughts use UUID primary keys, that breaks at runtime: the thought-detail page ran parseInt(id) and 404'd on every UUID, and the connections, duplicates-resolve, and audit-delete routes rejected every UUID with a positive-integer guard. Convert every thought-id field from number to string and replace the positive-integer guards with a UUID regex (the same one smart-ingest PR #36 uses). The ingest flow — IngestionJob/Item ids, job_id, and the ingest/[id] routes — is left as-is; those are integer job ids owned by #36, and converting them here would conflict. Brings the pro dashboard to parity with the next dashboard, which already types thought ids as string. Verified with tsc --noEmit, eslint, and next build (all clean). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
AddToBrainResult.thought_id and job_id are both UUID strings, matching every other thought_id/job_id in lib/types.ts. #47 brought thought_id -> string; main brought job_id -> string; the merge keeps both string. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The
prodashboard typed thought ids asnumberand validated route ids with positive-integer guards. Open Brain uses UUID primary keys for thoughts, so on a real install this breaks at runtime:parseInt(id)and 404'd on every UUID;connections,duplicates/resolve, andaudit/deleteroutes rejected every UUID with aNumber.isInteger(id) && id > 0guard.The
nextdashboard already types thought ids asstring; this bringsproto parity.Changes
All under
dashboards/open-brain-dashboard-pro/(8 files, +46/-37):lib/types.ts,lib/api.ts):Thought.id,CaptureResult.thought_id,AddToBrainResult.thought_id,DuplicatePair.thought_id_a/b,DuplicateResolveResult.survivor_id/loser_id, and thefetchThought/updateThought/deleteThought/resolveDuplicateid params and returns becomestring.thoughts/[id]/connections,duplicates/resolve,audit/delete) and the thought-detail page: positive-integer checks become a UUID regex, forwarding the raw id. The regex matches the one smart-ingest [integrations] smart-ingest: handle UUID thought/job ids #36 uses.ConnectionsPanel,audit/page):Connection.id, thethoughtIdprop, and the audit selectionSet<number>become string-typed.Out of scope (intentional)
The ingest flow (
IngestionJob/IngestionItemids,job_id,matched_thought_id/result_thought_id, and theapp/api/ingest/[id]/**routes) staysnumber. Those are integer job ids owned by the smart-ingest PR #36; converting them here would conflict at merge. With #36 also on this base, both flows end up consistent.Verification
tsc --noEmit,npm run lint, andnext buildall clean (17/17 pages build)."1e3","0x10", trailing-newline path injection, and similar), and the bulk-delete cap, audit quality re-verification, and duplicate-pair re-verification are unchanged.Follow-up (not in this PR)
duplicates/page.tsxrenders#{thought_id_a}, which now shows the full UUID instead of a short integer. Cosmetic only; truncating to a short prefix is a separate UX tweak.🤖 Generated with Claude Code