2.2 KiB
2.2 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec | |
|---|---|---|---|---|---|---|---|
| 02-implement-atomic-overflow-placement | Implement atomic overflow placement | completed | 2 |
|
plan.md | ../../specs/tasks/system-design/wip-limit-pull-system.md |
Task 02: Implement Atomic Overflow Placement
Acceptance
- Creation into an available limited step admits the task normally.
- Creation into a full step with no feeder succeeds as same-step queued work.
- Creation into a full step with an available feeder succeeds in that feeder and records the requested destination.
- A full configured feeder causes a typed WIP conflict and no partial insert.
- Destination and feeder capacity checks plus insertion are one transaction, with stable row-lock order for PostgreSQL and serialized SQLite writes.
- Concurrent WIP-2 creation persists every no-feeder request while admitting exactly two; feeder creation never exceeds either step's admitted capacity.
- Unlimited and ephemeral task creation remain compatible.
TDD sequence
- Replace the old concurrent rejection expectation with a failing admit-two/queue-rest test.
- Add failing explicit-step and resolved-start-step tests for same-step and feeder overflow.
- Add failing full-feeder rollback and concurrent-dialect tests.
- Implement the repository admission result and task-service placement.
- Keep conflict mapping for the full-feeder terminal case.
Verification
cd apps/backend
go test -tags fts5 -race ./internal/task/repository ./internal/task/service -run 'Test.*(OverflowPlacement|SameStepQueue|FeederQueue|ConcurrentWIP|FullFeeder)' -count=1
Files likely touched
apps/backend/internal/task/repository/interface.goapps/backend/internal/task/repository/sqlite/task.goapps/backend/internal/task/service/service_tasks.goapps/backend/internal/workflow/models/errors.go- repository and service WIP tests
Dependencies
- Task 01 supplies persisted admission state and admitted-count queries.
Parallelism
sequential
Output contract
Record the final repository API, transaction/lock order for both dialects, concurrency evidence, and exact verification result. Do not implement launch or watcher behavior in this task.