Copy architecture docs, ADRs, storage domain specs, research, reviews, and 56 storage architecture tasks from the alkhub_ts monorepo. Adapt for standalone @alkdev/hub repo structure (src/ not packages/hub/). Sanitize all sensitive information: - Replace private IPs (10.0.0.1) with localhost defaults - Remove internal server hostnames (dev1, ns528096) - Replace /workspace/ private paths with npm package references - Remove hardcoded credentials from examples - Rewrite infrastructure.md without private network details Add Deno project scaffolding: deno.json (pinned deps), .gitignore, AGENTS.md, entry point. Migrate existing code stubs (crypto, config types, logger) with updated import paths.
37 lines
1.4 KiB
Markdown
37 lines
1.4 KiB
Markdown
---
|
|
id: specify-task-body-append-concurrency
|
|
name: Specify concurrency model for hub.task.addNote
|
|
status: completed
|
|
depends_on: []
|
|
scope: single
|
|
risk: high
|
|
impact: component
|
|
level: implementation
|
|
---
|
|
|
|
## Description
|
|
|
|
`hub.task.addNote` appends a timestamped note section to `body`. In a multi-agent system, read-modify-write is a race condition: Agent A reads body, Agent B reads body, both append, Agent A writes, Agent B overwrites A's addition.
|
|
|
|
The review recommends specifying: `hub.task.addNote` must use DB-level concatenation (`UPDATE tasks SET body = body || $note WHERE id = $taskId`), not a read-modify-write cycle. Or use optimistic locking with `updatedAt`.
|
|
|
|
## Acceptance Criteria
|
|
|
|
- [ ] `tasks.md` specifies the concurrency model for `hub.task.addNote` explicitly
|
|
- [ ] The recommended approach is DB-level concatenation: `UPDATE tasks SET body = body || $note WHERE id = $taskId`
|
|
- [ ] If optimistic locking is offered as an alternative, it is documented with the `updatedAt` check pattern
|
|
- [ ] The spec notes that the append-only approach (no read-modify-write) eliminates the race condition
|
|
- [ ] A note on `body` being nullable is addressed: `COALESCE(body, '') || $note`
|
|
|
|
## References
|
|
|
|
- docs/reviews/storage-architecture-review-2026-04-21.md#C08
|
|
- docs/architecture/storage/tasks.md:249-266
|
|
|
|
## Notes
|
|
|
|
> To be filled by implementation agent
|
|
|
|
## Summary
|
|
|
|
> To be filled on completion |