feat(coordinator): complete tasks with an artifact_id, not a URI (CTX-05, part 3)
Task results are now coordinator-owned artifacts end to end.
- domain.Task carries ResultArtifactID instead of ResultURI/ResultSHA256;
CompleteWith and its idempotency key are keyed on the artifact id.
- CompleteTask verifies the referenced artifact was stored for this exact
task (rule 10): a worker cannot finish task B with task A's artifact, nor
name an id that isn't a partial_result. Mismatch → 409.
- POST /tasks/{id}/result takes {result:{artifact_id,...}}; ListResults and
ResultManifest follow.
- migration 0004 drops result_uri/result_sha256 and requires a completed task
to reference its result_artifact_id.
- smoke and requests.http exercise upload → complete-by-id → replay → conflict.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE tasks DROP CONSTRAINT IF EXISTS ck_tasks_completed_result;
|
||||
ALTER TABLE tasks ADD COLUMN result_uri text;
|
||||
ALTER TABLE tasks ADD COLUMN result_sha256 text;
|
||||
|
||||
ALTER TABLE tasks ADD CONSTRAINT ck_tasks_completed_result CHECK (
|
||||
status <> 'completed' OR (result_uri IS NOT NULL AND result_sha256 IS NOT NULL)
|
||||
);
|
||||
|
||||
COMMIT;
|
||||
@@ -0,0 +1,14 @@
|
||||
BEGIN;
|
||||
|
||||
-- Results are now coordinator-owned artifacts, not worker-supplied URIs.
|
||||
-- Drop the URI-based completion guard and columns, and require a completed task
|
||||
-- to reference its result artifact instead (PLAN.md §6.2).
|
||||
ALTER TABLE tasks DROP CONSTRAINT IF EXISTS ck_tasks_completed_result;
|
||||
ALTER TABLE tasks DROP COLUMN IF EXISTS result_uri;
|
||||
ALTER TABLE tasks DROP COLUMN IF EXISTS result_sha256;
|
||||
|
||||
ALTER TABLE tasks ADD CONSTRAINT ck_tasks_completed_result CHECK (
|
||||
status <> 'completed' OR result_artifact_id IS NOT NULL
|
||||
);
|
||||
|
||||
COMMIT;
|
||||
Reference in New Issue
Block a user