`upsert_project_tx` defaulted a missing `[project].name` to the slug and then `ON CONFLICT (slug) DO UPDATE SET name = EXCLUDED.name` wrote that fabricated value unconditionally — so a re-apply from a clone whose manifest omits `name` silently clobbered the stored display name back to the slug (visible in `pic projects ls` / `pic groups ls`). Bind the raw optional name once and guard both sides on it: `VALUES ($1, COALESCE($2, $1), $3)` (first apply falls back to the slug for the NOT NULL column) and `DO UPDATE SET name = COALESCE($2, projects.name)` (a re-apply updates the name only when the manifest actually declares one). An omitted optional field now preserves persisted data instead of mutating it. Pinned by a new `reapply_without_name_preserves_project_name` journey. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
17 KiB
17 KiB