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/config"
@@ -31,11 +30,11 @@ type AddLearningInput struct {
SourceType string `json:"source_type,omitempty"`
SourceRef string `json:"source_ref,omitempty"`
Project string `json:"project,omitempty" jsonschema:"project name or id; falls back to active session project"`
RelatedThoughtID *uuid.UUID `json:"related_thought_id,omitempty"`
RelatedSkillID *uuid.UUID `json:"related_skill_id,omitempty"`
ReviewedBy *string `json:"reviewed_by,omitempty"`
DuplicateOfLearningID *uuid.UUID `json:"duplicate_of_learning_id,omitempty"`
SupersedesLearningID *uuid.UUID `json:"supersedes_learning_id,omitempty"`
RelatedThoughtID *int64 `json:"related_thought_id,omitempty"`
RelatedSkillID *int64 `json:"related_skill_id,omitempty"`
ReviewedBy *string `json:"reviewed_by,omitempty"`
DuplicateOfLearningID *int64 `json:"duplicate_of_learning_id,omitempty"`
SupersedesLearningID *int64 `json:"supersedes_learning_id,omitempty"`
Tags []string `json:"tags,omitempty"`
}
@@ -44,7 +43,7 @@ type AddLearningOutput struct {
}
type GetLearningInput struct {
ID uuid.UUID `json:"id" jsonschema:"learning id"`
ID int64 `json:"id" jsonschema:"learning id"`
}
type GetLearningOutput struct {
@@ -105,7 +104,7 @@ func (t *LearningsTool) Add(ctx context.Context, req *mcp.CallToolRequest, in Ad
learning.ActionRequired = *in.ActionRequired
}
if project != nil {
learning.ProjectID = &project.ID
learning.ProjectID = &project.NumericID
}
created, err := t.store.CreateLearning(ctx, learning)
@@ -147,7 +146,7 @@ func (t *LearningsTool) List(ctx context.Context, req *mcp.CallToolRequest, in L
Query: strings.TrimSpace(in.Query),
}
if project != nil {
filter.ProjectID = &project.ID
filter.ProjectID = &project.NumericID
}
items, err := t.store.ListLearnings(ctx, filter)