Skip to content

fix(list): classify non-terminal GitLab and Azure pipeline statuses as running - #3740

Merged
max-sixty merged 3 commits into
mainfrom
nightly/clean-30983945484
Aug 5, 2026
Merged

max-sixty merged 3 commits into
mainfrom
nightly/clean-30983945484

Conversation

@worktrunk-bot

@worktrunk-bot worktrunk-bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Collaborator

Nightly sweep finding, extended after review to cover the same concept on Azure DevOps.

GitLab. parse_gitlab_status classifies a GitLab pipeline status into a CiStatus, and two of the values GitLab documents for that field had no arm: canceling and waiting_for_callback. Both fell to the _ fallback and mapped to CiStatus::NoCI, so wt list rendered an empty CI cell for a pipeline that was actively canceling or waiting on an external callback — the same cell a branch with no pipeline at all gets.

Both are non-terminal, so they join the existing running-family arm. That matches how every other non-terminal status is already grouped (created, waiting_for_resource, preparing, pending, scheduled, manual): the pipeline is still moving, whatever it's waiting on. canceling is specifically not the terminal canceled — that one already maps to Failed and is unchanged.

Azure DevOps. Review flagged that parse_azure_pipeline_status classified the same in-flight-cancellation concept the opposite way: Some("cancelling") => CiStatus::Failed. Azure's cancelling is a non-terminal run status exactly as GitLab's canceling is — the terminal form is completed with result canceled, which the arm above already maps to Failed — so a run whose cancellation was still in flight reported a red cell before anything had finished. postponed ("the build is inactive in the queue") is the same class of gap on the other side, falling through _ to an empty cell. Both now join inProgress/notStarted as Running, leaving completed as the only status that consults result.

BuildResult had a matching gap: partiallySucceeded ("completed compilation successfully but had other errors") fell through to NoCI, so a terminal build that carried a verdict rendered as no CI at all. It now groups with Failed, matching how parse_gitea_status_state already classifies Gitea's equivalent warning. none stays NoCI — a finished run with no result genuinely has nothing to show.

Both documented enums are now fully covered on each forge, so each fallback arm's only remaining job is a value the forge adds in the future; the new docstrings say so and name the API page each was checked against.

Verification

GitLab status values confirmed against the pipelines API, which lists the scope/status values as:

created, waiting_for_resource, preparing, waiting_for_callback, pending,
running, success, failed, canceling, canceled, skipped, manual, scheduled

Before this change, parse_gitlab_status handled 11 of those 13.

Azure status/result values confirmed against the Builds - Get REST API enums — BuildStatus: none, inProgress, completed, cancelling, postponed, notStarted, all (the page's own glosses: "cancelling" → "The build is cancelling", "postponed" → "The build is inactive in the queue"); BuildResult: none, succeeded, partiallySucceeded, failed, canceled.

Both regression tests are loops over the non-terminal statuses, and each fails against its old mapping. Reverting just the Azure production arms and re-running gives:

thread '...::test_parse_azure_pipeline_status' panicked at src/commands/list/ci_status/azure.rs:389:13:
assertion `left == right` failed: status=cancelling
  left: Failed
 right: Running

and the GitLab side:

thread '...::test_parse_gitlab_status' panicked at src/commands/list/ci_status/gitlab.rs:526:13:
assertion `left == right` failed: status=waiting_for_callback
  left: NoCI
 right: Running

cargo test --bins ci_status, cargo clippy --bins --all-features, and cargo fmt --check all pass with the fix in place. This is a pure classification change with no forge call or output-format impact, so no snapshots move.

Out of scope, tracked separately: aggregate_github_checks in github.rs has the same class of gap against GitHub's enums — CheckStatusState::{WAITING, REQUESTED} are missing from its in-flight list, StatusState::EXPECTED is matched against the wrong field, and CheckConclusionState::STARTUP_FAILURE contributes nothing. Different forge, different function, so it goes in its own PR rather than here.

@worktrunk-bot worktrunk-bot added the nightly-cleanup Issues found by nightly code quality sweep label Aug 5, 2026

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same in-flight-cancellation concept is classified the opposite way one file over. parse_azure_pipeline_status in src/commands/list/ci_status/azure.rs has Some("cancelling") => CiStatus::Failed, sitting right below the Some("completed") arm where result "failed" | "canceled" already maps to Failed. Azure's cancelling is the non-terminal run status exactly as GitLab's canceling is — the terminal form there is completed + result canceled — so this PR's rationale ("cancellation in flight, not yet the terminal form", report the present state and let the cell flip when it lands) applies verbatim, and Azure is now the outlier.

Not a blocker for this change, but the divergence is undocumented and a reader who follows the new docstring's reasoning will find the opposite conclusion next door. Either arm is defensible as long as one of them is; I'd align Azure to Running rather than the reverse, since the GitLab reading is the one that describes what the pipeline is doing rather than anticipating where it ends up. Happy to push that one-line change here, or leave it for a follow-up — it's outside this diff, so I haven't suggested it inline.

Aligns parse_azure_pipeline_status with the GitLab mapping in the same
change: completed is Azure's only terminal build status, so cancelling
(cancellation in flight) and postponed (inactive in the queue) join
inProgress/notStarted as Running rather than mapping to Failed/NoCI.
@worktrunk-bot worktrunk-bot changed the title fix(list): classify GitLab canceling and waiting_for_callback pipelines fix(list): classify in-flight GitLab and Azure pipeline statuses Aug 5, 2026

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GitLab and Azure status lists both check out against the upstream enums (GitLab's pipelines API documents exactly the 13 values the new docstring names; Azure's BuildStatus is none/inProgress/completed/cancelling/postponed/notStarted/all, so the four non-terminal ones are right). Two gaps in the same in-flight-classification class, one in the diff and one on the third platform.

BuildResult is not exhaustive either — inline below. The docstring now asserts that completed "alone consults result", but the result match itself drops partiallySucceeded to NoCI, so an Azure build that finished with errors renders as no CI at all — a stronger false signal than the cancelling one this PR fixes, since the run is terminal and has a verdict. gitea.rs already maps the analogous warning state to Failed (parse_gitea_status_state), which is the precedent I'd follow.

GitHub has the same shape, outside this diff. aggregate_github_checks in src/commands/list/ci_status/github.rs gates in-flight on matches!(s.as_str(), "in_progress" | "queued" | "pending" | "expected") against the CheckRun-only status field. CheckStatusState is REQUESTED, QUEUED, IN_PROGRESS, COMPLETED, WAITING, PENDING — WAITING and REQUESTED are missing, so a PR held by a deployment-protection rule with every other check green aggregates to Passed rather than Running. The "expected" arm in that list is also in the wrong field: EXPECTED belongs to StatusState, which only ever lands in check.state, and the state branch below it (if s == "pending") doesn't handle EXPECTED. Separately, CheckConclusionState::STARTUP_FAILURE isn't in the "failure" | "error" | "cancelled" | "timed_out" | "action_required" list, so a run that failed to start contributes nothing.

Happy to push a follow-up covering the GitHub side if you'd rather keep this PR to GitLab + Azure.

Enum sources

Confirmed by GraphQL introspection against the live schema rather than docs:

$ gh api graphql -f query='{ __type(name: "CheckStatusState") { enumValues { name } } }'
REQUESTED QUEUED IN_PROGRESS COMPLETED WAITING PENDING

$ gh api graphql -f query='{ __type(name: "StatusState") { enumValues { name } } }'
EXPECTED ERROR FAILURE PENDING SUCCESS

$ gh api graphql -f query='{ __type(name: "CheckConclusionState") { enumValues { name } } }'
ACTION_REQUIRED TIMED_OUT CANCELLED FAILURE SUCCESS NEUTRAL SKIPPED STARTUP_FAILURE STALE

Azure BuildResult: none, succeeded, partiallySucceeded ("completed compilation successfully but had other errors"), failed, canceled — Builds - Get. GitLab statuses: pipelines API.

cargo test --lib --bins passes (1471 + 970 unit tests), including both rewritten status tests.

Comment thread src/commands/list/ci_status/azure.rs Resolved
@worktrunk-bot worktrunk-bot changed the title fix(list): classify in-flight GitLab and Azure pipeline statuses fix(list): classify non-terminal GitLab and Azure pipeline statuses as running Aug 5, 2026
A completed build with non-compilation errors was falling through the
result match to NoCI, rendering an empty cell for a run that had a
verdict. Groups with Failed, matching parse_gitea_status_state's
handling of Gitea's equivalent "warning" state.
@worktrunk-bot

Copy link
Copy Markdown
Collaborator Author

Both taken. partiallySucceeded is applied here in 05070bf (reply inline); the GitHub side is #3741, kept out of this PR since it's a different forge and a different function.

I re-ran the three introspection queries rather than take the enum lists as given, and they come back as quoted — CheckStatusState has no EXPECTED, so the arm really was inert where it sat, and WAITING really is unhandled. Reverting each of the three fixes independently against the extended test confirms none of them is carried by another, and that every one produces the same user-visible shape: Passed where the answer is Running or Failed. A green CI cell on a PR parked by a deployment-protection rule is the worst of them — the aggregate reports a verdict for a run that hasn't executed.

One judgment call worth flagging, since it went the other way from the rest: I left the misplaced "expected" under status and the equally cross-field "error" under conclusion in place rather than deleting them. Neither combination occurs, but tolerating a mislabeled payload fails safe here, and #3741's docstring records that as deliberate so the next reader doesn't re-derive it as a bug. STALE also stays ignored — GitHub marks a result stale precisely when it no longer reflects the commit, so it isn't a verdict either way.

@max-sixty
max-sixty merged commit 1c578cb into main Aug 5, 2026
40 checks passed
@max-sixty
max-sixty deleted the nightly/clean-30983945484 branch August 5, 2026 16:09
max-sixty pushed a commit that referenced this pull request Aug 5, 2026
…#3741)

Follow-up to #3740, which fixed the same class of gap on GitLab and
Azure DevOps. `aggregate_github_checks` reads three fields, each drawn
from a different GitHub enum, and each list was missing values — with
the same consequence in every case: a check that is not terminal reads
as terminal, so the row settles on a verdict before CI has one.

**`CheckStatusState` was missing `WAITING` and `REQUESTED`.** The
in-flight gate matched `in_progress | queued | pending`, so neither
reached `has_running`. `WAITING` is where a deployment-protection rule
or a required reviewer parks a run — it can sit there for hours — and
with every other check green the aggregate returned `Passed`. `wt list
--full` showed a green CI cell for a PR that was blocked on an approval
gate and had run nothing.

**`StatusState::EXPECTED` was matched against the wrong field.**
`"expected"` sat in the `status` list, where it can never appear
(`CheckStatusState` has no `EXPECTED`), while the `state` branch tested
`s == "pending"` only. `EXPECTED` is a required context branch
protection knows about but nobody has posted yet — non-terminal, and it
now joins `pending` there. The stray `"expected"` under `status` is left
in place, as is the equally cross-field `"error"` under `conclusion`:
those combinations don't occur, but tolerating them costs nothing and
fails safe. The docstring records that this is deliberate rather than an
oversight.

**`CheckConclusionState::STARTUP_FAILURE` contributed nothing.** A run
that failed to start fell through the failure list to the ignore arm, so
it counted neither way — a PR whose only non-green check failed at
startup rendered `Passed`. It joins the failure list. `STALE` stays
ignored alongside `SKIPPED` and `NEUTRAL`, and the docstring now says
why: GitHub marks a result stale when it no longer reflects the commit,
so it isn't a verdict on this commit either way.

<details><summary>Verification</summary>

Enum values confirmed by GraphQL introspection against the live schema
rather than from docs:

```
$ gh api graphql -f query='{ __type(name: "CheckStatusState") { enumValues { name } } }'
REQUESTED QUEUED IN_PROGRESS COMPLETED WAITING PENDING

$ gh api graphql -f query='{ __type(name: "StatusState") { enumValues { name } } }'
EXPECTED ERROR FAILURE PENDING SUCCESS

$ gh api graphql -f query='{ __type(name: "CheckConclusionState") { enumValues { name } } }'
ACTION_REQUIRED TIMED_OUT CANCELLED FAILURE SUCCESS NEUTRAL SKIPPED STARTUP_FAILURE STALE
```

The three fixes were each reverted independently against the extended
test to confirm the test catches them and that none is carried by
another:

| Reverted | Failure |
|---|---|
| `waiting` / `requested` | `assertion failed: status=waiting` — `left:
Passed`, `right: Running` |
| `expected` in the `state` branch | `left: Passed`, `right: Running` |
| `startup_failure` | `assertion failed: conclusion=startup_failure` —
`left: Passed`, `right: Failed` |

Each reverted gap produces `Passed` where the correct answer is
`Running` or `Failed`, which is the shape of the user-visible bug: a
green cell on a PR that has not passed.

`cargo test --bins aggregate_github_checks`, `cargo clippy --bins
--all-features`, and `cargo fmt` all pass. Pure classification change —
no forge call and no output-format impact, so no snapshots move.

</details>

Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
worktrunk 0.72.0

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>## Release Notes

### Improved

- **A host carrying a forge's name anywhere resolves to that forge again**: 0.71.0 required `github`, `gitlab`, or `gitea` as a whole dot-separated label, which read as an ownership check but wasn't one — an attacker controls their own DNS — while shutting out self-hosters with hyphenated names. `github-enterprise.acme.com`, `myhub.lumenfield.work`, and the `github-personal` SSH alias classify again, so CI status, `wt switch --prs`, and `repo.provider` work with no config. ([#3673](max-sixty/worktrunk#3673))

- **One `[projects."…"]` entry can cover every repository on a host, and can set the forge**: A key containing `*` matches any run of characters, `/` included, so `[projects."git.company.example/*"]` covers a whole host; every matching entry applies, least- to most-specific. The table also gained `forge.platform` and `forge.hostname`, so a self-hosted host needs one entry here rather than a block in every repo. [Docs](https://worktrunk.dev/config/#user-project-specific-settings) ([#3701](max-sixty/worktrunk#3701), thanks @chrishas35 for the request and @witt-bit for the workspace-scoped case it partly serves)

- **`wt merge` and `wt step push` leave the target worktree's uncommitted changes in place**: The autostash that held a dirty target's changes restored them as unstaged; both now advance the target with a compare-and-swap `update-ref` and `read-tree -m -u`, which leaves uncommitted work untouched. (Breaking: the fast-forward path no longer runs `git push`, so `pre-push` and the receive-side hooks no longer fire, and a failed sync errors with the ref rolled back.) ([#3703](max-sixty/worktrunk#3703), [#3684](max-sixty/worktrunk#3684), [#3693](max-sixty/worktrunk#3693), thanks @gubasso for reporting)

- **Approval state and branch-removal outcomes are machine-readable**: `wt config approvals list --format=json` reports whether a non-interactive run would stop for approval. `wt remove` and `wt step prune` replace `branch_deleted` with `branch_outcome`: `deleted`, `deferred`, `not_attempted`, `retained_unmerged`, `retained_checked_out`, `retained_raced`, `retained_failed`. (Breaking.) ([#3710](max-sixty/worktrunk#3710), thanks @NathanaelRea for the requests)

- **Every commit hash worktrunk prints follows `core.abbrev`**: The `wt list` table, `wt switch --prs`'s `log` tab, and `wt config state`'s CI cache table sliced to 8 characters while `--format=json` carried git's `%h`. All now ask git how wide it abbreviates in this repo. ([#3676](max-sixty/worktrunk#3676), [#3677](max-sixty/worktrunk#3677))

- **`wt list --format=json` schema 2 has a published JSON Schema**: [worktrunk.dev/schema/list-v2.json](https://worktrunk.dev/schema/list-v2.json) holds the contract, and `wt list --print-schema` prints the same document. Four fields that were bare strings are now enumerated vocabularies; the emitted JSON is unchanged. ([#3747](max-sixty/worktrunk#3747))

- **A detached worktree is named by its commit, not `-`**: The Branch cell hardcoded `-`, which reads as missing data rather than a state; it now carries the row's abbreviated HEAD, and the picker and statusline name the worktree the same way. ([#3675](max-sixty/worktrunk#3675))

### Fixed

- **Piped output is plain and no longer panics**: `wt list | head -3` exited 101 with `failed printing to stdout: Broken pipe`, and `wt list` wrote ANSI to a pipe unconditionally. Every stdout surface now exits cleanly, and the human-read ones are plain when piped unless `CLICOLOR_FORCE=1`. ([#3746](max-sixty/worktrunk#3746), [#3766](max-sixty/worktrunk#3766))

- **A CI check that hasn't finished no longer reads as passed**: Each forge's status parser missed documented values, so a GitHub PR parked on an approval gate showed green, and GitLab's `canceling` and Azure DevOps's `postponed` read as no CI at all. ([#3741](max-sixty/worktrunk#3741), [#3740](max-sixty/worktrunk#3740))

- **The shell wrappers survive an `rm` alias and a failing `--execute`**: Aliases bake into the wrapper at parse time, so `alias rm='rm -v'` reached its cleanup — noise on zsh and bash, and on nushell an abort that leaked three temp files, as a failing `--execute` body also did. ([#3714](max-sixty/worktrunk#3714), thanks @Ar4l), ([#3732](max-sixty/worktrunk#3732), [#3734](max-sixty/worktrunk#3734))

- **An alias or hook wrapping `wt switch` or `wt remove` keeps your subdirectory**: The user's position came from the `wt` process's cwd, which inside an alias body is the worktree root, so an aliased `wt remove` from `feature/apps/gateway` landed at the primary worktree's root. Fixes [#3723](max-sixty/worktrunk#3723). ([#3724](max-sixty/worktrunk#3724), thanks @vivienm for reporting)

- **`wt merge` and `wt step push` refuse a target worktree parked mid-operation**: The two-tree sync refuses an unmerged index but not a stopped cherry-pick or rebase whose conflict was already staged, so the push range could land in a paused target and be committed by `--continue`. ([#3759](max-sixty/worktrunk#3759))

- **The Claude plugin's worktree-remove hook resolves against the worktree path**: The hook anchored at `CLAUDE_PROJECT_DIR`, which the `claude agents` view routinely leaves outside any repository, so `wt remove` died with `not a git repository` and the session became undeletable. Its guard now also requires a `.git` entry. ([#3754](max-sixty/worktrunk#3754), [#3767](max-sixty/worktrunk#3767), thanks @judewang for the fix and the report)

- **A Gitea API error is reported as one, not as a parse failure**: `tea api` exits 0 whatever the HTTP status, so both call sites guessed from the body's shape and blamed an API change for an API error. `--include` surfaces the status instead. ([#3713](max-sixty/worktrunk#3713), [#3600](max-sixty/worktrunk#3600))

- **`--print-schema` and the doc-generation help flags name the right command**: All three found the subcommand by scanning `argv` for a `/wt` suffix, which never matches `wt.exe` under a backslash path, so on Windows they read the binary's own path as the command. ([#3762](max-sixty/worktrunk#3762))

- **A multibyte shell name no longer panics**: `extract_filename_from_path` sliced at `len() - 4` to test for `.exe` with no char-boundary check: `SHELL=/bin/日本語 wt config show` panicked, and on macOS every process name goes through it during shell detection. ([#3727](max-sixty/worktrunk#3727))

- **`wt` installed under a dotted name generates shell integration for that name**: `binary_name` used `file_stem`, which cuts at the last dot, so `wt config shell init bash` under `wt.old` emitted a wrapper for `wt`. It now strips only the executable suffix. ([#3719](max-sixty/worktrunk#3719))

- **Concurrent `wt step prune` removals no longer race the worktree registry**: `git worktree remove` reads every sibling under `.git/worktrees/`, so two overlapping removals could have one read a sibling mid-teardown. Registry-mutating removals now serialize behind a second lock. ([#3692](max-sixty/worktrunk#3692))

- **The `wt switch` first-run offer previews the legacy files it removes**: Accepting "Install shell integration?" could delete a deprecated worktrunk-managed wrapper the prompt never named. What gets removed is unchanged. ([#3656](max-sixty/worktrunk#3656))

- **`wt config create --project` writes a resolvable link**: The comment it writes into `.config/wt.toml` carried a raw Zola target, because the link-conversion regex stopped at the first `]` — here the one closing a nested code span. ([#3731](max-sixty/worktrunk#3731))

- **`wt list --branches` counts a local branch containing `/` as local**: The summary tally classified branch-only rows by `branch.contains('/')`, so a local `feature/login` counted under "N remote branches". ([#3687](max-sixty/worktrunk#3687))

- **`wt step relocate`'s human summary counts template-error branches as skipped**: `--format=json` already folded them into `skipped`; the human tally undercounted by the number of branches whose `worktree-path` template failed to expand. ([#3688](max-sixty/worktrunk#3688))

### Documentation

- **SignPath attribution appears with the artifacts it describes**: The code-signing notice and a route to the policy now sit in the install section's Windows block on the README and the docs landing page, as SignPath Foundation's OSS program requires. ([#3709](max-sixty/worktrunk#3709))

- **`wt step copy-ignored`'s `--require-include` example renders as a terminal block**: It was the only `console` block in the command's long help missing the `$ ` prefix. ([#3706](max-sixty/worktrunk#3706))

### Internal

- **Library API rework** (Breaking library API): `cargo-semver-checks` fails five lints — `LegacyForgeAlias` and `Repository::legacy_forge_alias` removed with the forge-classification revert, `Repository::forge_platform_override` removed for one shared resolver, `stage_worktree_removal` gained two parameters, `UserProjectOverrides` gained a `forge` field, and the `real-repo-benches` feature was removed. ([#3673](max-sixty/worktrunk#3673), [#3694](htt

See merge request: Harmonybrew/homebrew-core!16275

This branch was previously deployed

1 inactive deployment
tend — 05070bf6 Deployed Aug 5, 2026 by worktrunk-bot via review #3708
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nightly-cleanup Issues found by nightly code quality sweep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants