Repository navigation
feat(workflow): show job/step progress in workflow approve --watch (#67) - #68
Merged
Merged
Conversation
approve --watch now lists the run's jobs on each poll and reports every job/step transition alongside the gate events, reusing view --watch's transition tracking. Text mode prints one line per transition; --json streams them as NDJSON (same kinds as view --watch --json) plus a leading watch_started event carrying the resolved run_id. A failed jobs fetch is supplementary and never stops the watch; the next poll catches up. Fixes the "Watching ... run 0" header and confirmation prompt when --run is omitted: both now use the resolved latest waiting run. Also fixes the shared diff reporting a job's job_completed before its own steps when the whole job finished between two polls (affects view --watch --json too).
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.
What / why
workflow approve --watchonly reported gate decisions and the final conclusion, so users had to runworkflow view --watchin a second terminal to see what the run was doing between gates. It now streams job/step progress inline with the gate events.Behaviour
Build / compile) so parallel jobs stay unambiguous.--json: NDJSON gainsjob_started,job_completed,step_started,step_completed(same shape asview --watch --json), plus a leading{"kind":"watch_started","run_id":N}so scripts learn which run was resolved when--runis omitted. Consumers that assumed only gate/run_donekinds should ignore unknown kinds (CHANGELOG notes this under Changed).viewWatchState.difffromview --watch; costs one extra API call (list jobs) per poll. A failed jobs fetch is logged at debug and never stops the watch; the next successful poll catches up because diff tracks state, not polls.view --watch: the per-gate confirmation prompt needs stdin.Fixes (found along the way)
--run, the "Watching … run N" header and the confirmation prompt printedrun 0; they now show the resolved run.job_completedbefore its own steps when the whole job finished between two polls. Now steps come first. This also changes the order within one poll forview --watch --json(CHANGELOG under Fixed).Docs
docs/commands.md(bullet, flags table, new two-gate watch example with sample output),docs/examples.md,approve --helptext, CHANGELOG (Changed + Fixed). Verified against--helpof a freshly built binary.Testing
watch_startedcarries the resolved run ID, cmd-level text output and resolved run ID in header + prompt, diff ordering (fails without the fix). Updated existing tests for the newwatch_startedevent.gofmt -l .clean,go mod verify,go build ./...,go vet ./...,./scripts/check-coverage.sh→ 93.7%.prady-github-api/public-repo(two-approval.yml,target=dev dry_run=true):--run,--yes -e approval-1 -e approval-2→ both gates approved, progress shown,success, exit 0 (this run surfaced the ordering bug above).--json, no--run→ resolved run reported inwatch_started, clean NDJSON, empty stderr, exit 0.--yes) prompt path, which needs a TTY (covered by unit tests).*_startedevents weren't observed live because the demo's jobs finish within one 5s poll (covered by unit tests).Closes #67