mirror of
https://github.com/devvmhq/ciwatch.git
synced 2026-12-01 06:13:17 -10:00
A run that drops out of gh run list is kept at its last listed state, but its jobs were still fetched with gh run view. A run last seen in_progress could then show an in_progress row above jobs that GitHub now reports as completed. ciwatch now skips the jobs fetch for a run that the latest list doesn't have and that was last seen in any status other than completed. Its table row has no job rows under it, and in --json its jobs array is empty with no jobs_error. The existing "no longer listed" warning still explains it, and the exit code is still 4. A kept run last seen completed is fetched at its reported attempt as before, and so are runs that never drop out, runs that come back before the last list, and every run under --once. The rule is a small method on listed, keptUnfinished, and docs/json.md says when jobs is empty for this reason. The new tests cover the table for in_progress, queued, waiting, requested and pending, the --json output, and a rerun's new attempt that drops out. The test for a kept run that passed now checks the full table with its job rows, so a skip that is too broad would fail it. Backlog: TestWatchRunVanishesInProgressJSON checks only in_progress. It could loop over the same five statuses as the table test. It is off this feature's path because the behaviour works and the table subtests already cover every status that isn't completed, so it only makes the test stricter. Spec: acceptance cases 1. AC-1: A run last seen `in_progress` drops out and is still missing at the last list (`ciwatch <sha>`). The table shows its row `CI in_progress` with no job rows under it. `gh run view` isn't called for it. Stderr has the existing `ciwatch: run <id> (CI) is no longer listed for this commit` line once. Exit code is 4. 2. AC-2: Same as AC-1 with `--json`. That run's `jobs` is `[]` and it has no `jobs_error`. Its other fields come from its last listed state. Exit code is 4. 3. AC-3: Under `--rerun-failed`, a run's new attempt is last seen `in_progress` and then drops out for good. Its row is `CI in_progress` with no job rows, and there's no `gh run view` for it. The warning ends with `; not waiting for it`. Exit code is 4. 4. AC-4: A kept run last seen `completed` (failure or success) gets its jobs fetched and shown exactly as today. That includes failure blocks, `--go-tests` and crash hints. Exit codes are 1 and 0, as today. 5. AC-5: A run that drops out and comes back before the last list is reported with its jobs, exactly as today. 6. AC-6: Runs that never drop out, including in `--once` mode, which never tracks dropped runs, report their jobs exactly as today. All existing golden files stay byte-for-byte the same. 7. AC-7: Statuses other than `in_progress` that aren't completed (`queued`, `waiting`, `requested`, `pending`) on a kept run are treated like AC-1. Spec: non-goals - Looking up the missing run by ID to get its real current state. - Marking the run as kept in `--json`, or adding any new field. - A new stderr line, or a table note such as "(jobs not shown)". The existing "no longer listed" warning is the explanation. - Changing how a kept completed run's jobs are fetched, or what attempt they're fetched at. - Kept runs' artifacts, timeouts and crash lookups. These already skip runs that aren't completed. Spec: inference none. The rule rests only on two facts ciwatch already has: whether the run was missing from the last list (`listed.missing`), and the status from its last listing. **Behaviour.** No new flags, and exit codes are unchanged. Example: CI was `in_progress` when it dropped out, and Docs passed: ``` $ ciwatch abc1234 ciwatch: run 111 (CI) is no longer listed for this commit WORKFLOW STATUS CONCLUSION CI in_progress Docs completed success build completed success $ echo $? 4 ``` Today, rows such as ` test completed failure` would appear under `CI in_progress`. Spec: approved with Approved under CJ's standing delegation: no inference, and the choice removes the mismatch from both the table and --json. Your answers are accepted: no placeholder line, and kept completed runs are still fetched at their reported attempt. Built in steps: - test(cli): no job rows under a kept run that wasn't completed - feat(cli): don't fetch jobs for a kept run that wasn't completed Co-Authored-By: Claude Sonnet 5.5 <[email protected]>