refactor(store,tools): migrate IDs from UUID to bigserial int64
Some checks failed
CI / build-and-test (push) Failing after -31m12s

All internal entity lookups now use bigserial primary keys (int64) while
GUIDs are retained for external/public identification. Updated store
functions (TouchProject, UpdateThoughtMetadata, AddThoughtAttachment) to
query by id instead of guid, added GetThoughtByID, changed semanticSearch
and all tool helpers to use *int64 project IDs, and updated retry/backfill
workers to use int64 thought IDs throughout.
This commit is contained in:
2026-05-03 11:43:34 +02:00
parent 9e6d05e055
commit 91239bcf4b
58 changed files with 1208 additions and 2774 deletions

View File

@@ -2,6 +2,7 @@ package tools
import (
"context"
"fmt"
"strings"
"github.com/modelcontextprotocol/go-sdk/mcp"
@@ -97,9 +98,9 @@ func (t *LinksTool) Related(ctx context.Context, _ *mcp.CallToolRequest, in Rela
}
related := make([]RelatedThought, 0, len(linked)+t.search.DefaultLimit)
seen := map[string]struct{}{thought.ID.String(): {}}
seen := map[string]struct{}{fmt.Sprint(thought.ID): {}}
for _, item := range linked {
key := item.Thought.ID.String()
key := fmt.Sprint(item.Thought.ID)
seen[key] = struct{}{}
related = append(related, RelatedThought{
ID: key,
@@ -117,12 +118,12 @@ func (t *LinksTool) Related(ctx context.Context, _ *mcp.CallToolRequest, in Rela
}
if includeSemantic {
semantic, err := semanticSearch(ctx, t.store, t.embeddings, t.search, thought.Content, t.search.DefaultLimit, t.search.DefaultThreshold, thought.ProjectID, &thought.ID)
semantic, err := semanticSearch(ctx, t.store, t.embeddings, t.search, thought.Content, t.search.DefaultLimit, t.search.DefaultThreshold, thought.ProjectID, &thought.GUID)
if err != nil {
return nil, RelatedOutput{}, err
}
for _, item := range semantic {
key := item.ID.String()
key := fmt.Sprint(item.ID)
if _, ok := seen[key]; ok {
continue
}