Skip to content

Fix goal-scores enum drift: GoalPriorityEntityType rejects legacy 'checkpoint' entityType (Sentry PRODUCT-MANAGER-R)#1666

Open
pulzzejason wants to merge 2 commits into
mainfrom
goal/4f5c5a81
Open

Fix goal-scores enum drift: GoalPriorityEntityType rejects legacy 'checkpoint' entityType (Sentry PRODUCT-MANAGER-R)#1666
pulzzejason wants to merge 2 commits into
mainfrom
goal/4f5c5a81

Conversation

@pulzzejason

Copy link
Copy Markdown
Contributor

Integration PR for this goal — its tasks commit onto this branch (one PR per goal). Opened automatically by the engine on first push; left as a draft until the goal completes.

…ue 'feedback'

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) <noreply@anthropic.com>
@psdjungpulzze psdjungpulzze marked this pull request as ready for review July 2, 2026 00:08
The reconcileRepos orphan-sweep (repos.ts) reads the workspace root via
readdirSync + statSync, but repos.test.ts mocked node:fs WITHOUT stubbing
those two. So the two reconcileRepos rmSync-assertion tests enumerated the
REAL /workspace and rm-rf'd any sibling directory found there (e.g. other
checked-out repos in a CI/dev container), firing spurious rmSync calls that
broke:
  - 'adopts a valid checkout ... does NOT attempt a clone' (expected 0 rmSync)
  - 'rm-rf's a non-matching dir then re-clones exactly once' (expected 1 rmSync)

These failed deterministically in any container with sibling workspace dirs,
which made the whole 'npm run test' / coverage run exit non-zero and blocked
the goal-score task's review gates (test-suite-failed + coverage-report-not-
found, both fail-closed on a non-green suite).

Fix is test-only: mock readdirSync -> [] and statSync -> {mtimeMs:0} so the
sweep sees an empty workspace and only the intended rmSync calls fire. The
orphan sweep itself remains covered by the pure sweepOrphanWorkspaceDirs
tests (injected deps). No daemon source/runtime behavior changes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant