fix: Make coords_3d optional in schema to support UMAP workflow

The proper architecture is:
1. Nodes are created with coords_3d = NONE
2. User manually triggers /api/calculate-graph
3. UMAP calculates 3D coordinates from embeddings
4. Coordinates are updated in batch

Changed coords_3d TYPE from array<number> to option<array<number>>
to allow NONE values. This fixes production error:
"Found NONE for field coords_3d but expected array<number>"

Schema has been deployed to production.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-09 19:48:56 +00:00
parent 49b12a2933
commit 12d26c9d14
2 changed files with 4 additions and 3 deletions

View File

@@ -229,7 +229,7 @@ export async function POST(request: NextRequest) {
atp_uri: atp_uri, atp_uri: atp_uri,
title: title, title: title,
body: body, // Store the raw text body body: body, // Store the raw text body
coords_3d: [0, 0, 0], // Required by schema - origin coordinates for new nodes // coords_3d will be calculated when user runs /api/calculate-graph
}; };
// Only include embedding if it was successfully generated // Only include embedding if it was successfully generated

View File

@@ -62,8 +62,9 @@ DEFINE FIELD body ON TABLE node TYPE string;
DEFINE FIELD embedding ON TABLE node TYPE array<number>; DEFINE FIELD embedding ON TABLE node TYPE array<number>;
-- The 3D coordinates calculated by UMAP. -- The 3D coordinates calculated by UMAP.
DEFINE FIELD coords_3d ON TABLE node TYPE array<number> -- Nodes start with NONE and get coordinates when user runs calculate-graph.
-- Must be a 3-point array [x, y, z] or empty. DEFINE FIELD coords_3d ON TABLE node TYPE option<array<number>>
-- Must be NONE or a 3-point array [x, y, z].
ASSERT $value = NONE OR array::len($value) = 3; ASSERT $value = NONE OR array::len($value) = 3;
-- Define the vector search index. -- Define the vector search index.