refactor(store,tools): migrate IDs from UUID to bigserial int64
Some checks failed
CI / build-and-test (push) Failing after -31m12s
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:
@@ -52,7 +52,7 @@ func (t *ContextTool) Handle(ctx context.Context, req *mcp.CallToolRequest, in P
|
||||
}
|
||||
|
||||
limit := normalizeLimit(in.Limit, t.search)
|
||||
recent, err := t.store.RecentThoughts(ctx, &project.ID, limit, 0)
|
||||
recent, err := t.store.RecentThoughts(ctx, &project.NumericID, limit, 0)
|
||||
if err != nil {
|
||||
return nil, ProjectContextOutput{}, err
|
||||
}
|
||||
@@ -60,7 +60,7 @@ func (t *ContextTool) Handle(ctx context.Context, req *mcp.CallToolRequest, in P
|
||||
items := make([]ContextItem, 0, limit*2)
|
||||
seen := map[string]struct{}{}
|
||||
for _, thought := range recent {
|
||||
key := thought.ID.String()
|
||||
key := fmt.Sprint(thought.ID)
|
||||
seen[key] = struct{}{}
|
||||
items = append(items, ContextItem{
|
||||
ID: key,
|
||||
@@ -72,12 +72,12 @@ func (t *ContextTool) Handle(ctx context.Context, req *mcp.CallToolRequest, in P
|
||||
|
||||
query := strings.TrimSpace(in.Query)
|
||||
if query != "" {
|
||||
semantic, err := semanticSearch(ctx, t.store, t.embeddings, t.search, query, limit, t.search.DefaultThreshold, &project.ID, nil)
|
||||
semantic, err := semanticSearch(ctx, t.store, t.embeddings, t.search, query, limit, t.search.DefaultThreshold, &project.NumericID, nil)
|
||||
if err != nil {
|
||||
return nil, ProjectContextOutput{}, err
|
||||
}
|
||||
for _, result := range semantic {
|
||||
key := result.ID.String()
|
||||
key := fmt.Sprint(result.ID)
|
||||
if _, ok := seen[key]; ok {
|
||||
continue
|
||||
}
|
||||
@@ -97,7 +97,7 @@ func (t *ContextTool) Handle(ctx context.Context, req *mcp.CallToolRequest, in P
|
||||
lines = append(lines, thoughtContextLine(i, item.Content, item.Metadata, item.Similarity))
|
||||
}
|
||||
contextBlock := formatContextBlock(fmt.Sprintf("Project context for %s", project.Name), lines)
|
||||
_ = t.store.TouchProject(ctx, project.ID)
|
||||
_ = t.store.TouchProject(ctx, project.NumericID)
|
||||
|
||||
return nil, ProjectContextOutput{
|
||||
Project: *project,
|
||||
|
||||
Reference in New Issue
Block a user