Repository navigation
feat(task): task run --wait -o json emits the CompletionRecord (spawn#386) - #412
Merged
Merged
Conversation
…#386) Previously runTaskReal encoded the LaunchResult and returned before the --wait poll block, so 'task run --wait -o json' never emitted the terminal CompletionRecord — adapters had to launch, then separately poll 'task status <id> -o json'. Restructure so --wait + json polls and encodes the CompletionRecord (exit code, state, timings, logs) and exits with the task's exit code; without --wait, json still emits the LaunchResult; human output unchanged in both modes. This gives workflow adapters (cwl-spawn et al.) a one-shot: build a TaskSpec, 'spawn task run --spec f --wait -o json', parse the record. De-risks the adapter-migration work (spawn#386). Refs #386
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Small enabling change for the workflow-adapter migration (spawn#386). Makes
spawn task run --wait -o jsonemit the CompletionRecord so an adapter can launch-and-collect in one call.Before:
runTaskRealencoded theLaunchResult(instance id) and returned before the--waitpoll block — sotask run --wait -o jsonnever emitted the terminal record. The CompletionRecord was only reachable via a separatespawn task status <id> -o json.After:
--wait+-o json→ poll, then encode the CompletionRecord (exit code, state, timings, logs), exit with the task's exit code.--wait+ human → unchanged (printCompletion).--wait+-o json→ LaunchResult (unchanged).So an adapter does: build TaskSpec →
spawn task run --spec f --wait -o json→ parse the record. This is the one-shot the cwl-spawn port (and the other three adapters) will use — landing it first de-risks all of them.Testing
pkg/taskproto/completion_test.go(round-trip + wrapper-shape); the poll path is AWS-bound and validated by the gated real-AWS smoke tests already run fortask run.go build ./...,go vet, gofmt clean;TestFlagConventions/TestTier0pass; no docs-gen drift (no flag/command change); Semgrep clean. Only the pre-existingTestCatalogValidfails incmd(unrelated, fails on main too).Refs #386