feat(data): add task numbers schema, allocator, and backfill migration
TaskEntity.Number is a global, monotonically increasing, never-reused integer (displayed as #123), allocated from AppSettingsEntity.NextTaskNumber via a single UPDATE...RETURNING statement rather than MAX(number)+1, which would reissue a deleted task's number. Both insert paths (TaskRepository. AddAsync and CreateChildAsync) route through the new TaskNumberAllocator, with a bounded retry on a unique-index collision. One migration adds the columns, backfills existing rows in creation order, and creates the unique index afterwards. Data-layer only; MCP/UI wiring is later slices.
This commit is contained in:
@@ -22,6 +22,7 @@ public sealed class QueueStateMcpToolsTests : IDisposable
|
||||
private readonly ListRepository _listRepo;
|
||||
private readonly WorkerConfig _cfg;
|
||||
private readonly string _tempDir;
|
||||
private int _numberSeed;
|
||||
|
||||
public QueueStateMcpToolsTests()
|
||||
{
|
||||
@@ -86,6 +87,7 @@ public sealed class QueueStateMcpToolsTests : IDisposable
|
||||
IsManual = isManual,
|
||||
BlockedByTaskId = blockedByTaskId,
|
||||
ScheduledFor = scheduledFor,
|
||||
Number = ++_numberSeed,
|
||||
};
|
||||
// Bypass TaskRepository.AddAsync, which overwrites SortOrder with max(listId)+1 --
|
||||
// these tests need to control SortOrder directly to exercise queue pick order.
|
||||
|
||||
Reference in New Issue
Block a user