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

@@ -4,7 +4,6 @@ import (
"context"
"strings"
"github.com/google/uuid"
"github.com/modelcontextprotocol/go-sdk/mcp"
"git.warky.dev/wdevs/amcs/internal/ai"
@@ -17,13 +16,13 @@ import (
// EmbeddingQueuer queues a thought for background embedding generation.
type EmbeddingQueuer interface {
QueueThought(ctx context.Context, id uuid.UUID, content string)
QueueThought(ctx context.Context, id int64, content string)
}
// MetadataQueuer queues a thought for background metadata retry. Both
// MetadataRetryer and EnrichmentRetryer satisfy this.
type MetadataQueuer interface {
QueueThought(id uuid.UUID)
QueueThought(id int64)
}
type CaptureTool struct {
@@ -66,7 +65,7 @@ func (t *CaptureTool) Handle(ctx context.Context, req *mcp.CallToolRequest, in C
Metadata: rawMetadata,
}
if project != nil {
thought.ProjectID = &project.ID
thought.ProjectID = &project.NumericID
}
created, err := t.store.InsertThought(ctx, thought, t.embeddings.PrimaryModel())
@@ -74,7 +73,7 @@ func (t *CaptureTool) Handle(ctx context.Context, req *mcp.CallToolRequest, in C
return nil, CaptureOutput{}, err
}
if project != nil {
_ = t.store.TouchProject(ctx, project.ID)
_ = t.store.TouchProject(ctx, project.NumericID)
}
if t.retryer != nil {