[dashboards] Link Next.js dashboard to open-brain-rest dependency#130
[dashboards] Link Next.js dashboard to open-brain-rest dependency#130alanshurafa wants to merge 3 commits intoNateBJones-Projects:mainfrom
Conversation
REST API gateway providing 12+ endpoints for the Open Brain thoughts database. Required backend for the Next.js dashboard (issue NateBJones-Projects#124). Includes: - Deno/Hono Edge Function with search, capture, browse, CRUD, stats, reflections, duplicates, and ingest endpoints - 5 SQL migrations: schema extensions with serial_id surrogate key (supports both UUID and BIGSERIAL base schemas), reflections table, ingestion tables, 8 RPCs, and full-text search index - Utility modules for embedding, classification, and sensitivity detection - README with step badges, credential tracker, and troubleshooting Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds the Deno/Hono REST API handler (index.ts) and shared utility modules for embedding, classification, and sensitivity detection. Files placed under function/ (not supabase/) to avoid the root .gitignore rule that excludes supabase/ directories. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add cross-reference link to ../../integrations/open-brain-rest/ as the required backend in prerequisites - Fix cd path typo (open-brain-dashboard → open-brain-dashboard-next) - Declare open-brain-rest Edge Function in metadata.json services Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Code reviewFound 4 issues:
SQL: OB1/integrations/open-brain-rest/sql/04-rpcs.sql Lines 67 to 69 in bd6e477 TypeScript: OB1/integrations/open-brain-rest/function/index.ts Lines 327 to 329 in bd6e477
SQL: OB1/integrations/open-brain-rest/sql/04-rpcs.sql Lines 251 to 262 in bd6e477 TypeScript: OB1/integrations/open-brain-rest/function/index.ts Lines 642 to 650 in bd6e477
OB1/integrations/open-brain-rest/function/index.ts Lines 58 to 60 in bd6e477 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
|
@claude review this PR |
1 similar comment
|
@claude review this PR |
|
Claude finished @matthallett1's task in 2m 5s —— View job PR Review
Thanks for this contribution. The integration is well-structured and the README is clear and followable. @shansen3 already caught four real issues — I'll confirm those and add a few more I found while reading through the files. Confirmed Issues (from @shansen3's review)1. PR title is misclassified ( The 2,500+ lines of new code are all under 2. Both SQL functions return
Fix: change the SQL to return 3. The SQL RETURNS TABLE at The SQL does return 4. Auth bypass when if (MCP_ACCESS_KEY && !isAuthorized(req)) {When The fix is to require the key to be set and reject all requests if it isn't: if (!MCP_ACCESS_KEY) {
return json({ error: "Service misconfigured: MCP_ACCESS_KEY not set" }, 503);
}
if (!isAuthorized(req)) {
return json({ error: "Unauthorized" }, 401);
}Additional Issues Found5. The SQL function returns keys RETURN jsonb_build_object('total_count', v_total, 'types', v_types, 'topics', v_topics);But the TypeScript handler reads parseAggregateCounts(aggregate.top_types, "type") // always undefined → []
parseAggregateCounts(aggregate.top_topics, "topic") // always undefined → []The 6. No Row Level Security on new tables The ALTER TABLE reflections ENABLE ROW LEVEL SECURITY;
-- and a policy allowing service_role full accessWithout RLS, these tables are accessible to Minor NitThe Overall AssessmentThe integration is well thought-out, clearly documented, and OB1-aligned. It's a legitimate REST gateway over the However, issues 2–6 above are blocking: two produce silent data bugs (stats always empty, captures always say "Updated"), one is a schema/security gap (no RLS), and the auth bypass (issue 4) is a real security concern. Please fix these before merge. |
Contribution Type
/recipes)/schemas)/dashboards)/integrations)What does this do?
Updates the Next.js dashboard to explicitly reference the new
open-brain-restintegration as its required backend:../../integrations/open-brain-rest/README.mdin prerequisitesopen-brain-dashboard→open-brain-dashboard-next)open-brain-rest Edge Functioninmetadata.jsonservicesRequirements
No additional requirements — this is a docs-only update to an existing dashboard contribution.
Checklist
README.mdwith prerequisites, step-by-step instructions, and expected outcomemetadata.jsonhas all required fieldsCompanion to #129. Together they close #124.