Files
multica/server/pkg
Bohan-J 485184819a fix(issue-status): close status-API review blockers — locks, presence, gates (MUL-4809)
Address the status-management API review (comment e5db7038).

P0:
- CreateCustomIssueStatus now takes a FOR KEY SHARE workspace existence gate
  (mirrors Ensure), so a create that races a workspace delete inserts zero
  rows instead of leaving an orphan status. Zero rows -> pgx.ErrNoRows -> 404.
- Extract issuestatus.LockWorkspaceForStatusWrite / WorkspaceLockKey as the
  single canonical lock protocol, keyed on the canonical workspace UUID (not
  the raw request string), so differently-cased UUIDs can no longer take
  distinct advisory locks and bypass mutual exclusion. All catalog writes
  route through it; the archive census/reassign/archive stays under it.

P1:
- Reserved-alias rule applies to custom statuses only; a built-in may be
  renamed back to its reserved default name ("Todo", ...).
- Immutable fields (category/system_key/workspace_id) are rejected on field
  presence in the raw JSON, so an explicit null is a 400, not a silent 200.
- include_archived=true is gated to owner/admin (rejects agents); the active
  catalog stays readable by any member/agent.

Tests: create-after-delete orphan gate, canonical-key equality, controlled-
concurrency lock serialization + archive/assignment closure (no issue
stranded on an archived status), immutable-null 400, built-in reserved
rename, admin-only archived view, cross-workspace 404. Scope unchanged:
status_id still not read on machine paths, no issue-write path is locked.

Co-authored-by: multica-agent <github@multica.ai>
2026-07-16 15:12:54 +08:00
..