Files
multica/server/migrations
Naiyuan Qing 0127d6a258 fix(issues): address MUL-2314 reviewer notes 1-4
#1 sort default: missing sort_by, unknown sort_by, and illegal
sort_direction all collapse to created_at DESC, id DESC (was ASC).
Order-asserting test cases added for every degenerate input.

#2 onboarding position: extract nextIssuePosition helper. Welcome
issue + sub-issues + the existing CreateIssue path all route through
it instead of inheriting Go's Position=0 default. This consolidates
the three create call-sites so a fourth path cannot regress.

#3 rebalance hot path: replace full-bucket scan with a neighbor-only
SQL query (GetIssueNeighborGap) used by MaybeEnqueueRebalance. Hot
path stays O(1); worker still does the full bucket scan when actually
rebalancing. Bucket-edge issues use COALESCE sentinels so missing
neighbours never trigger spurious rebalances.

#4 migration: up is now order-preserving (position ASC, created_at
DESC, id DESC) and idempotent (skips buckets that are already sparse).
down drops only the index; data restore is per runbook snapshot so a
destructive UPDATE issue SET position = 0 cannot wipe drag edits.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>
2026-05-18 13:58:45 +08:00
..