Skip to content

feat(s3): seedable spore.host task-completion outcomes (#360) - #361

Merged
scttfrdmn merged 2 commits into
mainfrom
feat/360-spawn-task-completion
Jul 26, 2026
Merged

scttfrdmn merged 2 commits into
mainfrom
feat/360-spawn-task-completion

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

Implements #360 — a seedable, clock-aware completion signal for spore.host spawn task run, so the workflow adapters (nf-spawn, miniwdl-spawn, cwl-spawn, snakemake-executor-plugin-spawn, airflow-spawn, pegasus-spawn) can run engine-composition CI against Substrate with only the completion outcome seeded.

What

A GET of tasks/<task_id>/completion.json against a bucket resolves a seedable completion record — task_id, exit_code, state (completed/failed), started_at, ended_at — matching taskproto.CompletionRecord.

New control-plane endpoints, mirroring /v1/ssm/command-invocation (#345):

  • POST /v1/spawn/task-completion — {task_id, exit_code, state, started_at, ended_at}
  • DELETE /v1/spawn/task-completion?taskId=... (one) / no query (all)

Behaviour

  • Clock gate: before a seed's ended_at (on the simulated clock via TimeController) the GET returns NoSuchKey ("still running"); at/after, the record is served — so a consumer's real poll loop is exercised deterministically.
  • Nominal path: no seed + a matching tasks/*/completion.json key → exit_code:0 / completed (per the seeding philosophy).
  • Real object wins: a staged object at the key (the interim aws s3 cp path) is served verbatim — the resolver only runs when the key is genuinely absent.
  • No over-reach: any non-tasks/*/completion.json key stays a normal 404 — this never turns a bare miss into a fake success.

Per the #360 discussion: completion.json is the only object the spawn CLI's fetchCompletion() reads (.exitcode is unread, so not synthesized); state ∈ {completed, failed}.

Scope

Substrate does not execute the task — this is the seedable completion observation only, exactly the category of #345 / SageMaker / Bedrock seeds. In-scope per docs/scope.md.

Tests

emulator/spawn_control_test.go: nominal success, seeded failure, clock-gate (future ended_at → NoSuchKey), real-object-wins, non-matching-key-stays-404, seed+targeted-clear+clear-all+missing-task_id-400. Full race suite + lint clean.

Closes #360.

A GET of tasks/<task_id>/completion.json now resolves a seedable, clock-aware
spore.host `spawn task run` completion record (task_id, exit_code, state,
started_at, ended_at), matching taskproto.CompletionRecord. New control-plane
endpoints POST/DELETE /v1/spawn/task-completion seed by task id, mirroring the
/v1/ssm/command-invocation (#345) pattern.

- Before a seed's ended_at (simulated clock) the GET is NoSuchKey ("still
  running"); at/after, the record is served -- exercises a consumer's real
  poll loop deterministically.
- No seed + matching key -> nominal exit_code:0/completed; a real staged object
  at the key always wins; any non-tasks/*/completion.json key stays a normal 404.
- Substrate does not execute the task; this is the seedable completion
  observation only, per the scope boundary.

Closes #360.
@codecov

codecov Bot commented Jul 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.25000% with 23 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
emulator/spawn_control.go 69.33% 14 Missing and 9 partials ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 18a7919 into main Jul 26, 2026
9 of 10 checks passed
@scttfrdmn
scttfrdmn deleted the feat/360-spawn-task-completion branch July 26, 2026 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simulate spore.host task completion: write completion.json/.exitcode to emulated S3 after a spawn-launched instance goes running

1 participant