Context
projects.status is deprecated (comment at src/server/db/schema.ts:71: "Deprecated: use desired_status instead. Kept for backward compatibility") in favor of desiredStatus + observedStatus (schema.ts:86-96), but at commit 3531916 the old column is still read and written in at least:
src/server/projects/projects.db.ts:61 — ne(projects.status, "deleting") filter; :97-101 — updateProjectStatus() dual-writes status and desiredStatus.
src/server/projects/sessionDescription.ts:37 — reads project.status === "deleting".
src/server/reconciliation/reconcile.ts:151,156 — groups metrics by projects.status.
src/pages/api/system/health.ts:22-29 — groups project counts by projects.status and reports old-enum buckets (starting, stopping, error) in the health payload.
The dual model means every writer must keep two fields coherent, and consumers disagree on which is authoritative.
What to do
- Migrate each reader to
desiredStatus/observedStatus semantics (the mapping for "deleting" filters is desiredStatus = "deleting"). For the health/reconcile metric groupings, decide which dimension is actually wanted (probably both: desired and observed counts).
- Remove the dual-write in
updateProjectStatus() once no readers remain.
- Drop the
status column via a Drizzle migration (pnpm drizzle:generate → migration file in drizzle/; the repo uses generated migrations — check drizzle/ for the existing pattern). Note any external consumers of /api/system/health's JSON shape (the monitor UI in src/components/monitor/) and update them together.
Search command to find all remaining usages
grep -rn "projects.status\|project.status\|\.status ===" src/ --include='*.ts' --include='*.astro' --include='*.tsx'
(Filter out unrelated .status hits on jobs/responses.)
Acceptance criteria
- No source file reads or writes
projects.status; column dropped by a migration.
/api/system/health and the monitor page still render correct project counts.
- Reconciliation summary logs still report per-status counts.
pnpm check passes.
Risk
Behavioral drift between old status and new fields during the transition — migrate readers one PR-reviewable group at a time and verify the "deleting" exclusion still hides deleting projects from the dashboard.
Context
projects.statusis deprecated (comment atsrc/server/db/schema.ts:71: "Deprecated: use desired_status instead. Kept for backward compatibility") in favor ofdesiredStatus+observedStatus(schema.ts:86-96), but at commit3531916the old column is still read and written in at least:src/server/projects/projects.db.ts:61—ne(projects.status, "deleting")filter;:97-101—updateProjectStatus()dual-writesstatusanddesiredStatus.src/server/projects/sessionDescription.ts:37— readsproject.status === "deleting".src/server/reconciliation/reconcile.ts:151,156— groups metrics byprojects.status.src/pages/api/system/health.ts:22-29— groups project counts byprojects.statusand reports old-enum buckets (starting,stopping,error) in the health payload.The dual model means every writer must keep two fields coherent, and consumers disagree on which is authoritative.
What to do
desiredStatus/observedStatussemantics (the mapping for "deleting" filters isdesiredStatus = "deleting"). For the health/reconcile metric groupings, decide which dimension is actually wanted (probably both: desired and observed counts).updateProjectStatus()once no readers remain.statuscolumn via a Drizzle migration (pnpm drizzle:generate→ migration file indrizzle/; the repo uses generated migrations — checkdrizzle/for the existing pattern). Note any external consumers of/api/system/health's JSON shape (the monitor UI insrc/components/monitor/) and update them together.Search command to find all remaining usages
(Filter out unrelated
.statushits on jobs/responses.)Acceptance criteria
projects.status; column dropped by a migration./api/system/healthand the monitor page still render correct project counts.pnpm checkpasses.Risk
Behavioral drift between old
statusand new fields during the transition — migrate readers one PR-reviewable group at a time and verify the "deleting" exclusion still hides deleting projects from the dashboard.