From 58953d3b60e0936d4c35ef59966bf0980574ec5e Mon Sep 17 00:00:00 2001 From: "Claude (engine)" Date: Thu, 2 Jul 2026 00:07:39 +0000 Subject: [PATCH 1/2] fix(goal-score): align GoalPriorityEntityType enum to deployed DB value 'feedback' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes Sentry PRODUCT-MANAGER-R: schema.prisma still declared the GoalPriorityEntityType member as 'checkpoint', but the production DB enum was renamed 'checkpoint'->'feedback' by migration 20260513100000_schema_drift_fix. Every goal-score read/write for a checkpoint-backed entity passed the literal 'checkpoint', hitting Postgres `invalid input value for enum GoalPriorityEntityType: "checkpoint"`. Direction A (chosen): align schema + code to the already-deployed DB value 'feedback'. No new DB migration is required (the DB already has 'feedback') and it matches the shipped /feedbacks API rename. Rejected Direction B: add a new prod migration reverting the enum to 'checkpoint' — heavier/riskier, must remap existing 'feedback' rows, and fights the shipped direction. Flag before merging if a reviewer prefers B. Scope guard: only the GoalPriorityEntityType / GoalPriorityScore.entityType surface changed. The internal domain discriminator 'checkpoint' (comments, attachments, mentions, notify-followers resourceType, phase-board item.type, sow/recommendations, the Checkpoint Prisma model/table, etc.) is untouched. - schema.prisma: enum member checkpoint -> feedback (+ prisma generate) - score-goal-priority.ts: fetchEntity/resolveEntityTitle cases -> 'feedback' (bodies still query db.checkpoint); normalize legacy 'checkpoint' payloads to 'feedback' so residual queued BullMQ jobs drain without re-raising the error - trigger-rescore, goal-scores routes, feedbacks routes, use-goal-score hook, goal-priority-badge, phase-board, item-detail-panel: 'checkpoint' -> 'feedback' on the goal-score surface only - tests updated + legacy-normalization case added No PM Agent config update needed (internal enum value; no tool/workflow change). Co-Authored-By: Claude Opus 4.8 (1M context) --- prisma/schema.prisma | 2 +- .../p/[projectSlug]/phases/phase-board.tsx | 2 +- .../[projectId]/feedbacks/[id]/route.ts | 4 +-- .../projects/[projectId]/feedbacks/route.ts | 4 +-- .../[entityType]/[entityId]/override/route.ts | 2 +- .../[entityType]/[entityId]/route.ts | 2 +- .../projects/[projectId]/goal-scores/route.ts | 2 +- src/components/goals/goal-priority-badge.tsx | 2 +- src/components/phases/item-detail-panel.tsx | 8 ++++- src/hooks/use-goal-score.test.ts | 6 ++-- src/hooks/use-goal-score.ts | 2 +- src/lib/goals/trigger-rescore.ts | 4 +-- src/worker/jobs/score-goal-priority.ts | 12 +++++-- tests/unit/api/feedbacks-route.test.ts | 2 +- .../worker/jobs/score-goal-priority.test.ts | 35 +++++++++++++++++-- 15 files changed, 66 insertions(+), 23 deletions(-) diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 05d5ba2de..4f01110d0 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -133,7 +133,7 @@ enum SyncDirection { enum GoalPriorityEntityType { task deliverable - checkpoint + feedback phase } diff --git a/src/app/(app)/o/[orgSlug]/p/[projectSlug]/phases/phase-board.tsx b/src/app/(app)/o/[orgSlug]/p/[projectSlug]/phases/phase-board.tsx index 700f2db5e..61c80bed0 100644 --- a/src/app/(app)/o/[orgSlug]/p/[projectSlug]/phases/phase-board.tsx +++ b/src/app/(app)/o/[orgSlug]/p/[projectSlug]/phases/phase-board.tsx @@ -750,7 +750,7 @@ function CheckpointCard({ onDelete={onDelete ? () => onDelete(item) : undefined} /> e.stopPropagation()}> - +