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:
@@ -5,7 +5,6 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/modelcontextprotocol/go-sdk/mcp"
|
||||
|
||||
"git.warky.dev/wdevs/amcs/internal/config"
|
||||
@@ -27,15 +26,15 @@ func NewPlansTool(db *store.DB, sessions *session.ActiveProjects, cfg config.Sea
|
||||
// --- I/O types ---
|
||||
|
||||
type CreatePlanInput struct {
|
||||
Title string `json:"title" jsonschema:"plan title"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Status string `json:"status,omitempty" jsonschema:"draft|active|blocked|completed|cancelled|superseded"`
|
||||
Priority string `json:"priority,omitempty" jsonschema:"low|medium|high|critical"`
|
||||
Project string `json:"project,omitempty" jsonschema:"project name or id; falls back to active session project"`
|
||||
Owner string `json:"owner,omitempty"`
|
||||
DueDate string `json:"due_date,omitempty" jsonschema:"RFC3339 timestamp"`
|
||||
SupersedesPlanID *uuid.UUID `json:"supersedes_plan_id,omitempty"`
|
||||
Tags []string `json:"tags,omitempty"`
|
||||
Title string `json:"title" jsonschema:"plan title"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Status string `json:"status,omitempty" jsonschema:"draft|active|blocked|completed|cancelled|superseded"`
|
||||
Priority string `json:"priority,omitempty" jsonschema:"low|medium|high|critical"`
|
||||
Project string `json:"project,omitempty" jsonschema:"project name or id; falls back to active session project"`
|
||||
Owner string `json:"owner,omitempty"`
|
||||
DueDate string `json:"due_date,omitempty" jsonschema:"RFC3339 timestamp"`
|
||||
SupersedesPlanID *int64 `json:"supersedes_plan_id,omitempty"`
|
||||
Tags []string `json:"tags,omitempty"`
|
||||
}
|
||||
|
||||
type CreatePlanOutput struct {
|
||||
@@ -43,7 +42,7 @@ type CreatePlanOutput struct {
|
||||
}
|
||||
|
||||
type GetPlanInput struct {
|
||||
ID uuid.UUID `json:"id" jsonschema:"plan id"`
|
||||
ID int64 `json:"id" jsonschema:"plan id"`
|
||||
}
|
||||
|
||||
type GetPlanOutput struct {
|
||||
@@ -51,21 +50,21 @@ type GetPlanOutput struct {
|
||||
}
|
||||
|
||||
type UpdatePlanInput struct {
|
||||
ID uuid.UUID `json:"id" jsonschema:"plan id"`
|
||||
Title string `json:"title,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Status string `json:"status,omitempty" jsonschema:"draft|active|blocked|completed|cancelled|superseded"`
|
||||
Priority string `json:"priority,omitempty" jsonschema:"low|medium|high|critical"`
|
||||
Owner *string `json:"owner,omitempty" jsonschema:"empty string clears the owner"`
|
||||
DueDate string `json:"due_date,omitempty" jsonschema:"RFC3339; omit to keep, 'clear' to remove"`
|
||||
ClearDueDate bool `json:"clear_due_date,omitempty"`
|
||||
CompletedAt string `json:"completed_at,omitempty" jsonschema:"RFC3339; omit to keep, 'clear' to remove"`
|
||||
ClearCompletedAt bool `json:"clear_completed_at,omitempty"`
|
||||
ReviewedBy *string `json:"reviewed_by,omitempty" jsonschema:"empty string clears the reviewer"`
|
||||
MarkReviewed bool `json:"mark_reviewed,omitempty" jsonschema:"set last_reviewed_at to now"`
|
||||
SupersedesPlanID *uuid.UUID `json:"supersedes_plan_id,omitempty"`
|
||||
ClearSupersedesPlanID bool `json:"clear_supersedes_plan_id,omitempty"`
|
||||
Tags *[]string `json:"tags,omitempty" jsonschema:"replaces all tags when provided; pass [] to clear"`
|
||||
ID int64 `json:"id" jsonschema:"plan id"`
|
||||
Title string `json:"title,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Status string `json:"status,omitempty" jsonschema:"draft|active|blocked|completed|cancelled|superseded"`
|
||||
Priority string `json:"priority,omitempty" jsonschema:"low|medium|high|critical"`
|
||||
Owner *string `json:"owner,omitempty" jsonschema:"empty string clears the owner"`
|
||||
DueDate string `json:"due_date,omitempty" jsonschema:"RFC3339; omit to keep, 'clear' to remove"`
|
||||
ClearDueDate bool `json:"clear_due_date,omitempty"`
|
||||
CompletedAt string `json:"completed_at,omitempty" jsonschema:"RFC3339; omit to keep, 'clear' to remove"`
|
||||
ClearCompletedAt bool `json:"clear_completed_at,omitempty"`
|
||||
ReviewedBy *string `json:"reviewed_by,omitempty" jsonschema:"empty string clears the reviewer"`
|
||||
MarkReviewed bool `json:"mark_reviewed,omitempty" jsonschema:"set last_reviewed_at to now"`
|
||||
SupersedesPlanID *int64 `json:"supersedes_plan_id,omitempty"`
|
||||
ClearSupersedesPlanID bool `json:"clear_supersedes_plan_id,omitempty"`
|
||||
Tags *[]string `json:"tags,omitempty" jsonschema:"replaces all tags when provided; pass [] to clear"`
|
||||
}
|
||||
|
||||
type UpdatePlanOutput struct {
|
||||
@@ -73,7 +72,7 @@ type UpdatePlanOutput struct {
|
||||
}
|
||||
|
||||
type DeletePlanInput struct {
|
||||
ID uuid.UUID `json:"id" jsonschema:"plan id"`
|
||||
ID int64 `json:"id" jsonschema:"plan id"`
|
||||
}
|
||||
|
||||
type DeletePlanOutput struct {
|
||||
@@ -95,13 +94,13 @@ type ListPlansOutput struct {
|
||||
}
|
||||
|
||||
type PlanDependencyInput struct {
|
||||
PlanID uuid.UUID `json:"plan_id" jsonschema:"the plan that depends on another"`
|
||||
DependsOnPlanID uuid.UUID `json:"depends_on_plan_id" jsonschema:"the plan that must complete first"`
|
||||
PlanID int64 `json:"plan_id" jsonschema:"the plan that depends on another"`
|
||||
DependsOnPlanID int64 `json:"depends_on_plan_id" jsonschema:"the plan that must complete first"`
|
||||
}
|
||||
|
||||
type PlanRelatedInput struct {
|
||||
PlanAID uuid.UUID `json:"plan_a_id"`
|
||||
PlanBID uuid.UUID `json:"plan_b_id"`
|
||||
PlanAID int64 `json:"plan_a_id"`
|
||||
PlanBID int64 `json:"plan_b_id"`
|
||||
}
|
||||
|
||||
type PlanLinkOutput struct {
|
||||
@@ -109,12 +108,12 @@ type PlanLinkOutput struct {
|
||||
}
|
||||
|
||||
type PlanSkillInput struct {
|
||||
PlanID uuid.UUID `json:"plan_id"`
|
||||
SkillID uuid.UUID `json:"skill_id"`
|
||||
PlanID int64 `json:"plan_id"`
|
||||
SkillID int64 `json:"skill_id"`
|
||||
}
|
||||
|
||||
type ListPlanSkillsInput struct {
|
||||
PlanID uuid.UUID `json:"plan_id"`
|
||||
PlanID int64 `json:"plan_id"`
|
||||
}
|
||||
|
||||
type ListPlanSkillsOutput struct {
|
||||
@@ -122,12 +121,12 @@ type ListPlanSkillsOutput struct {
|
||||
}
|
||||
|
||||
type PlanGuardrailInput struct {
|
||||
PlanID uuid.UUID `json:"plan_id"`
|
||||
GuardrailID uuid.UUID `json:"guardrail_id"`
|
||||
PlanID int64 `json:"plan_id"`
|
||||
GuardrailID int64 `json:"guardrail_id"`
|
||||
}
|
||||
|
||||
type ListPlanGuardrailsInput struct {
|
||||
PlanID uuid.UUID `json:"plan_id"`
|
||||
PlanID int64 `json:"plan_id"`
|
||||
}
|
||||
|
||||
type ListPlanGuardrailsOutput struct {
|
||||
@@ -157,7 +156,7 @@ func (t *PlansTool) Create(ctx context.Context, req *mcp.CallToolRequest, in Cre
|
||||
Tags: normalizeStringSlice(in.Tags),
|
||||
}
|
||||
if project != nil {
|
||||
plan.ProjectID = &project.ID
|
||||
plan.ProjectID = &project.NumericID
|
||||
}
|
||||
if v := strings.TrimSpace(in.DueDate); v != "" {
|
||||
t, err := time.Parse(time.RFC3339, v)
|
||||
@@ -249,7 +248,7 @@ func (t *PlansTool) List(ctx context.Context, req *mcp.CallToolRequest, in ListP
|
||||
Query: strings.TrimSpace(in.Query),
|
||||
}
|
||||
if project != nil {
|
||||
filter.ProjectID = &project.ID
|
||||
filter.ProjectID = &project.NumericID
|
||||
}
|
||||
|
||||
plans, err := t.store.ListPlans(ctx, filter)
|
||||
|
||||
Reference in New Issue
Block a user