4.4 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec |
|---|---|---|---|---|---|---|
| 01-resolutions-table | clarification_resolutions table and claim repository | done | 1 | plan.md | ../../specs/integrations/requirements/external-question-answering.md |
Task 01: clarification_resolutions table and claim repository
Create the durable claim row that makes bundle resolution exactly-once, plus the repository methods that write and read it. Nothing consumes it yet — this task is the persistence floor.
-
Acceptance:
clarification_resolutionsexists on a fresh database (viainitSchema) and on an existing one (viarunMigrations), withpending_idas primary key andtask_idcascading fromtasks(id).InsertClarificationResolutionreturnsclaimed=truefor the first insert andclaimed=falseplus the stored row for every later insert of the samepending_id, with the stored row unmodified.- Deleting the owning task removes its resolution rows.
-
Verification:
cd apps/backend && \ gofmt -l internal/task/repository/sqlite internal/task/models && \ go test -race ./internal/task/repository/sqlite/... && \ go build ./...Postgres coverage (skipped without a DSN, run it if one is available):
cd apps/backend && KANDEV_TEST_POSTGRES_DSN="$KANDEV_TEST_POSTGRES_DSN" \ go test -race -run 'Clarification' ./internal/task/repository/sqlite/... -
Files likely touched:
apps/backend/internal/task/repository/sqlite/base_schema.go(newclarificationResolutionsSchemaDDL,initClarificationResolutionsSchemastep appended to theinitSchema()step table afterr.initTaskReviewSchema; third index inensureMessageMetadataIndexesat:92)apps/backend/internal/task/repository/sqlite/base_migrations.go(migrateClarificationResolutions, called fromrunMigrations())apps/backend/internal/task/models/clarification_resolution.go(new)apps/backend/internal/task/repository/sqlite/clarification_resolution.go(new)apps/backend/internal/task/repository/interface.goapps/backend/internal/task/repository/sqlite/clarification_resolution_test.go(new)apps/backend/internal/task/repository/sqlite/schema_replay_test.go
-
Dependencies: None.
-
Parallelism:
parallel-safewith task 06 (internal/mcp/handlers) and task 08 (apps/web/lib/settings) — no shared files. Not parallel with 02, which extends the same repository package and reads this table. -
Inputs:
- Spec § Data model (
clarification_resolutions), D4, R1, R2, R6. - Plan § Backend → Schema for the exact DDL, including the
resumecolumn the spec's table omits; also update the spec's data-model table to carry it. apps/backend/AGENTS.md§ Schema & migrations — the init-before-migrations ordering rule and the replay-test requirement.- Pattern to copy:
taskReviewSchemaDDL/initTaskReviewSchema(base_schema.go:925-978) for a task-cascading table;attachment.gofor a conflict-tolerant write. dialect.JSONExtract+r.ro.Rebindare mandatory for the index expression; do not hand-write SQLite JSON syntax.
- Spec § Data model (
-
Output contract: summary, files changed, tests run with counts, blockers, risks, and the task/plan status update in the same conversation.
Results
Implemented in commit a29c998e0. Added clarification_resolutions (PK pending_id, task_id
cascading from tasks(id)) to both initSchema (base_schema.go) and runMigrations
(base_migrations.go), plus InsertClarificationResolution in
internal/task/repository/sqlite/clarification_resolution.go returning claimed=false and the
stored row on every insert after the first.
Verified in this session's final gauntlet (Wave 10): go test ./internal/task/repository/sqlite/...
passes, including clarification_resolution_test.go (first-insert-wins semantics, task-cascade
delete) and schema_replay_test.go (fresh-DB vs migrated-DB schema parity). go build ./...
succeeds. gofmt -l reports no files. The one wave-1-specific case not independently re-run in this
session is the optional Postgres-DSN coverage (KANDEV_TEST_POSTGRES_DSN), which requires an external
Postgres instance not available in this environment — SQLite coverage (the required path) is green.
No external side effects. No cleanup/teardown artifacts beyond normal test databases in t.TempDir().