Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

refactor: stop refining failed forge calls and missing nu/pwsh (#4436)

Maximilian Roos397136ea31a6
diff --git a/docs/src/content/docs/list.md b/docs/src/content/docs/list.md
index 817152de6..0066c01a0 100644
--- a/docs/src/content/docs/list.md
+++ b/docs/src/content/docs/list.md
@@ -119,7 +119,7 @@ The CI column shows the branch's open PR/MR — `#3035` on GitHub, Gitea, and Az
| <span style='color:#a00'>#</span> red | `"failed"` | One or more checks failed |
| <span style='color:#a60'>#</span> yellow | `"conflicts"` | Merge conflicts with the target branch |
| <span style='color:#888'>#</span> gray | `"no-ci"` | No PR/MR, or no checks configured |
-| <span style='color:#a60'>⚠</span> yellow | `"error"` | CI status could not be fetched (rate limit, network, etc.) |
+| <span style='color:#a60'>⚠</span> yellow | `"error"` | CI status could not be fetched (not logged in, rate limit, network, etc.) |
| <span style='color:#a0a'>#</span> magenta | `"changes_requested"` | A reviewer requested changes |
| <span style='color:#0aa'>#</span> cyan | `"pending"` | A review is required (e.g. branch protection) but not yet given |
| (blank) | `pr` and `checks` absent | Branch never pushed, or no PR/MR and no branch workflow |
diff --git a/plugins/worktrunk/skills/worktrunk/reference/list.md b/plugins/worktrunk/skills/worktrunk/reference/list.md
index 6dc1c9193..e76e7ecf0 100644
--- a/plugins/worktrunk/skills/worktrunk/reference/list.md
+++ b/plugins/worktrunk/skills/worktrunk/reference/list.md
@@ -105,7 +105,7 @@ The CI column shows the branch's open PR/MR — `#3035` on GitHub, Gitea, and Az
| `#` red | `"failed"` | One or more checks failed |
| `#` yellow | `"conflicts"` | Merge conflicts with the target branch |
| `#` gray | `"no-ci"` | No PR/MR, or no checks configured |
-| `⚠` yellow | `"error"` | CI status could not be fetched (rate limit, network, etc.) |
+| `⚠` yellow | `"error"` | CI status could not be fetched (not logged in, rate limit, network, etc.) |
| `#` magenta | `"changes_requested"` | A reviewer requested changes |
| `#` cyan | `"pending"` | A review is required (e.g. branch protection) but not yet given |
| (blank) | `pr` and `checks` absent | Branch never pushed, or no PR/MR and no branch workflow |
diff --git a/skills/worktrunk/reference/list.md b/skills/worktrunk/reference/list.md
index 6dc1c9193..e76e7ecf0 100644
--- a/skills/worktrunk/reference/list.md
+++ b/skills/worktrunk/reference/list.md
@@ -105,7 +105,7 @@ The CI column shows the branch's open PR/MR — `#3035` on GitHub, Gitea, and Az
| `#` red | `"failed"` | One or more checks failed |
| `#` yellow | `"conflicts"` | Merge conflicts with the target branch |
| `#` gray | `"no-ci"` | No PR/MR, or no checks configured |
-| `⚠` yellow | `"error"` | CI status could not be fetched (rate limit, network, etc.) |
+| `⚠` yellow | `"error"` | CI status could not be fetched (not logged in, rate limit, network, etc.) |
| `#` magenta | `"changes_requested"` | A reviewer requested changes |
| `#` cyan | `"pending"` | A review is required (e.g. branch protection) but not yet given |
| (blank) | `pr` and `checks` absent | Branch never pushed, or no PR/MR and no branch workflow |
diff --git a/src/cli/mod.rs b/src/cli/mod.rs
index 5688a43da..b75208329 100644
--- a/src/cli/mod.rs
+++ b/src/cli/mod.rs
@@ -911,7 +911,7 @@ The CI column shows the branch's open PR/MR — `#3035` on GitHub, Gitea, and Az
| `#` red | `"failed"` | One or more checks failed |
| `#` yellow | `"conflicts"` | Merge conflicts with the target branch |
| `#` gray | `"no-ci"` | No PR/MR, or no checks configured |
-| `⚠` yellow | `"error"` | CI status could not be fetched (rate limit, network, etc.) |
+| `⚠` yellow | `"error"` | CI status could not be fetched (not logged in, rate limit, network, etc.) |
| `#` magenta | `"changes_requested"` | A reviewer requested changes |
| `#` cyan | `"pending"` | A review is required (e.g. branch protection) but not yet given |
| (blank) | `pr` and `checks` absent | Branch never pushed, or no PR/MR and no branch workflow |
diff --git a/src/commands/config/show.rs b/src/commands/config/show.rs
index b4629689a..e5c6c495f 100644
--- a/src/commands/config/show.rs
+++ b/src/commands/config/show.rs
@@ -1189,7 +1189,7 @@ fn render_zsh_compinit_warning(out: &mut String) -> anyhow::Result<()> {
/// Returns whether the file is missing, so it counts toward the section's
/// single trailing `wt config shell install` hint.
fn render_fish_completion_status(out: &mut String, cmd: &str) -> anyhow::Result<bool> {
- let Ok(completion_path) = Shell::Fish.completion_path(cmd) else {
+ let Ok(completion_path) = worktrunk::shell::fish_completion_path(cmd) else {
return Ok(false);
};
let completion_display = format_path_for_display(&completion_path);
diff --git a/src/commands/configure_shell.rs b/src/commands/configure_shell.rs
index 43660c3be..12c182cb0 100644
--- a/src/commands/configure_shell.rs
+++ b/src/commands/configure_shell.rs
@@ -1204,8 +1204,7 @@ pub(crate) fn preview_shell_completions(
continue;
}
- let completion_path = shell
- .completion_path(cmd)
+ let completion_path = shell::fish_completion_path(cmd)
.map_err(|e| format!("Failed to get completion path for {shell}: {e}"))?;
let (action, preimage) = match fs::read(&completion_path) {
diff --git a/src/commands/list/ci_status/azure.rs b/src/commands/list/ci_status/azure.rs
index 62f1ddf53..d9ff05bde 100644
--- a/src/commands/list/ci_status/azure.rs
+++ b/src/commands/list/ci_status/azure.rs
@@ -9,7 +9,7 @@ use worktrunk::git::{GitRemoteUrl, Repository};
use super::{
CiBranchName, CiSource, CiStatus, PrRef, PrStatus, branch_remote_url, non_interactive_cmd,
- parse_json, retriable_pr_error,
+ parse_json,
};
/// Resolve the Azure DevOps context (host, org, project, repository, `--org`
@@ -119,7 +119,7 @@ pub(super) fn detect_azure_pr(
};
if !output.status.success() {
- return retriable_pr_error(&output);
+ return Some(PrStatus::error());
}
let pr_list: Vec<AzPrListEntry> =
@@ -212,7 +212,7 @@ pub(super) fn detect_azure_pipeline(
};
if !output.status.success() {
- return retriable_pr_error(&output);
+ return Some(PrStatus::error());
}
let runs: Vec<AzPipelineRun> =
diff --git a/src/commands/list/ci_status/gitea.rs b/src/commands/list/ci_status/gitea.rs
index aae9bff9a..e319fbd94 100644
--- a/src/commands/list/ci_status/gitea.rs
+++ b/src/commands/list/ci_status/gitea.rs
@@ -10,7 +10,7 @@ use worktrunk::git::{Repository, parse_owner_repo};
use super::{
CiBranchName, CiSource, CiStatus, MAX_PRS_TO_FETCH, PrRef, PrStatus, branch_owner_repo,
- is_retriable_error, non_interactive_cmd, output_error_text, parse_json,
+ non_interactive_cmd, parse_json,
};
/// Run `tea api --include <path>` from the worktree root.
@@ -31,49 +31,23 @@ fn tea_api(repo: &Repository, path: &str) -> Option<Output> {
.ok()
}
-/// Whether a `tea api` call failed, and if so whether a later `wt list` could
-/// get an answer where this one didn't. `None` when the response carries the
-/// resource.
+/// Whether a `tea api` call failed rather than returning the resource.
///
-/// Neither failure is an exit code. `tea api` exits 0 for every HTTP response,
-/// so a non-zero exit means `tea` itself failed and every HTTP error arrives as
-/// a successful spawn carrying a body in place of the resource — which
-/// [`api_status`] identifies. Branching on the exit code alone would let that
-/// body through as data: every field of [`GiteaCombinedStatus`] defaults, so a
-/// 500 would deserialize as "no statuses" and paint a blank CI cell.
-///
-/// Retriability then comes from whichever channel knows:
-///
-/// - **`tea` itself failed** — no response, so its own stderr is the only
-/// account of why (transport error, no login configured), and
-/// [`is_retriable_error`] reads it as it does for every other backend's CLI.
-/// - **the API answered** — the status settles it outright: 429 and 5xx are the
-/// server saying "later", while every other 4xx is a token or a missing
-/// resource that repeating the call won't change. Gitea is the only backend
-/// that can answer this way; `gh` and `glab` leave the status inside prose,
-/// which is why they still sniff for it.
-/// - **no status line from an exit-0 `tea`** — the response never arrived, and
-/// a call that can't be classified won't classify on a retry either.
-///
-/// Gitea's message is read nowhere here. It reached the user only through this
-/// sniff, and the status answers better than the sniff did: a 500 whose message
-/// Gitea blanked for a non-admin token used to leave nothing to match, so a
-/// server error painted the same blank cell as a healthy branch with no CI.
-fn tea_api_failure_is_retriable(output: &Output) -> Option<bool> {
- if !output.status.success() {
- return Some(is_retriable_error(&output_error_text(output)));
- }
- match api_status(&output.stderr) {
- Some(status) if status < 400 => None,
- Some(status) => Some(status == 429 || status >= 500),
- None => Some(false),
- }
+/// `tea api` exits 0 for every HTTP response, so a non-zero exit means `tea`
+/// itself failed, and an HTTP error arrives as a successful spawn carrying a
+/// body in place of the resource, which [`api_status`] identifies. Branching on
+/// the exit code alone would let that body through as data: every field of
+/// [`GiteaCombinedStatus`] defaults, so a 500 would deserialize as "no
+/// statuses" and paint a blank CI cell. A missing status line means the
+/// response never arrived.
+fn tea_api_failed(output: &Output) -> bool {
+ !output.status.success() || api_status(&output.stderr).is_none_or(|status| status >= 400)
}
/// Fetch the combined CI status for a commit SHA.
///
-/// Returns `Some(CiStatus::Error)` for retriable failures (rate limit, network),
-/// `None` when the commit has no statuses or the call fails non-retriably.
+/// Returns `Some(CiStatus::Error)` when the call fails, `None` when the commit
+/// has no statuses.
fn fetch_combined_status(
repo: &Repository,
owner: &str,
@@ -82,10 +56,8 @@ fn fetch_combined_status(
) -> Option<CiStatus> {
let path = format!("repos/{owner}/{repo_name}/commits/{sha}/status");
let output = tea_api(repo, &path)?;
- if let Some(retriable) = tea_api_failure_is_retriable(&output) {
- // The PR-status warning from `retriable_pr_error` is the wrong shape
- // here (this returns just CiStatus).
- return retriable.then_some(CiStatus::Error);
+ if tea_api_failed(&output) {
+ return Some(CiStatus::Error);
}
let combined: GiteaCombinedStatus = parse_json(&output.stdout, "tea api commit status", sha)?;
if combined.total_count == 0 {
@@ -116,8 +88,8 @@ pub(super) fn detect_gitea_pr(
let path =
format!("repos/{query_owner}/{query_repo}/pulls?state=open&limit={MAX_PRS_TO_FETCH}");
let output = tea_api(repo, &path)?;
- if let Some(retriable) = tea_api_failure_is_retriable(&output) {
- return retriable.then(PrStatus::error);
+ if tea_api_failed(&output) {
+ return Some(PrStatus::error());
}
let prs: Vec<GiteaPr> = parse_json(&output.stdout, "tea api pulls", &branch.full_name)?;
@@ -182,6 +154,9 @@ pub(super) fn detect_gitea_commit_status(
branch: &CiBranchName,
local_head: &str,
) -> Option<PrStatus> {
+ if !branch.head_on_remote(repo, local_head) {
+ return None;
+ }
let (owner, repo_name) = branch_owner_repo(repo, branch)?;
let ci_status = fetch_combined_status(repo, &owner, &repo_name, local_head)?;
Some(PrStatus {
@@ -301,12 +276,10 @@ mod tests {
assert_eq!(pr(Some(2)).comment_count(), Some(2));
}
- /// The status line answers both questions the exit code can't: whether the
- /// call failed, and whether repeating it could help. The body is not read —
- /// each case below pairs a status with a body that would have said something
- /// different, so a sniff surviving anywhere would show up here.
+ /// The status line, not the exit code or the body, says whether an exit-0
+ /// `tea api` call failed.
#[test]
- fn test_tea_api_failure_is_retriable_reads_the_http_status() {
+ fn test_tea_api_failed_reads_the_http_status() {
// `ExitStatus::default()` is success on every platform, so these all
// exercise the exit-0 path — the one the exit code can't classify.
let response = |status: &str, stdout: &str| Output {
@@ -315,50 +288,22 @@ mod tests {
stderr: format!("HTTP/1.1 {status}\r\nContent-Type: application/json\r\n\r\n")
.into_bytes(),
};
- let retriable =
- |status: &str, stdout: &str| tea_api_failure_is_retriable(&response(status, stdout));
+ let failed = |status: &str, stdout: &str| tea_api_failed(&response(status, stdout));
- // 2xx is the resource, whatever it holds — an `APIError` body served
- // with a 200 is a Gitea API change, not an API error.
- assert_eq!(retriable("200 OK", "[]"), None);
- assert_eq!(retriable("200 OK", r#"{"message":"nope"}"#), None);
+ // 2xx is the resource, whatever it holds.
+ assert!(!failed("200 OK", "[]"));
+ assert!(!failed("200 OK", r#"{"message":"nope"}"#));
- // The server saying "later".
- assert_eq!(
- retriable("500 Internal Server Error", r#"{"message":""}"#),
- Some(true)
- );
- assert_eq!(
- retriable("502 Bad Gateway", "<html>Bad Gateway</html>"),
- Some(true)
- );
- assert_eq!(retriable("429 Too Many Requests", "{}"), Some(true));
+ assert!(failed("500 Internal Server Error", r#"{"message":""}"#));
+ assert!(failed("429 Too Many Requests", "{}"));
+ assert!(failed("404 Not Found", r#"{"message":"does not exist"}"#));
- // A token or a missing resource: repeating the call changes nothing,
- // even when the message reads like a network fault.
- assert_eq!(
- retriable("401 Unauthorized", r#"{"message":"token is required"}"#),
- Some(false)
- );
- assert_eq!(
- retriable("403 Forbidden", r#"{"message":"connection timeout"}"#),
- Some(false)
- );
- assert_eq!(
- retriable("404 Not Found", r#"{"message":"does not exist"}"#),
- Some(false)
- );
-
- // No status line from an exit-0 `tea`: a failure, never the resource,
- // and nothing a retry would classify differently.
- assert_eq!(
- tea_api_failure_is_retriable(&Output {
- status: Default::default(),
- stdout: b"[]".to_vec(),
- stderr: Vec::new(),
- }),
- Some(false)
- );
+ // No status line: the response never arrived.
+ assert!(tea_api_failed(&Output {
+ status: Default::default(),
+ stdout: b"[]".to_vec(),
+ stderr: Vec::new(),
+ }));
}
#[test]
diff --git a/src/commands/list/ci_status/github.rs b/src/commands/list/ci_status/github.rs
index 0f2b1ec2b..527745f79 100644
--- a/src/commands/list/ci_status/github.rs
+++ b/src/commands/list/ci_status/github.rs
@@ -7,7 +7,7 @@ use worktrunk::git::Repository;
use super::{
CiBranchName, CiSource, CiStatus, MAX_PRS_TO_FETCH, PrRef, PrStatus, ReviewState,
- branch_owner_repo, non_interactive_cmd, parse_json, retriable_pr_error,
+ branch_owner_repo, non_interactive_cmd, parse_json,
};
// CI detection primes the picker's on-disk comments cache: this `gh pr list`
// call already transfers the comment thread (we count it for `comment_count`),
@@ -99,7 +99,7 @@ pub(super) fn detect_github(
};
if !output.status.success() {
- return retriable_pr_error(&output);
+ return Some(PrStatus::error());
}
// gh pr list returns an array - find the first PR from our origin
@@ -202,6 +202,9 @@ pub(super) fn detect_github_commit_checks(
branch: &CiBranchName,
local_head: &str,
) -> Option<PrStatus> {
+ if !branch.head_on_remote(repo, local_head) {
+ return None;
+ }
let repo_root = repo.current_worktree().root().ok()?;
let (owner, repo_name) = branch_owner_repo(repo, branch)?;
@@ -235,7 +238,7 @@ pub(super) fn detect_github_commit_checks(
};
if !output.status.success() {
- return retriable_pr_error(&output);
+ return Some(PrStatus::error());
}
let checks: Vec<GitHubCheck> = parse_json(&output.stdout, "gh api check-runs", local_head)?;
diff --git a/src/commands/list/ci_status/gitlab.rs b/src/commands/list/ci_status/gitlab.rs
index 8c9f6c757..5f027ad1d 100644
--- a/src/commands/list/ci_status/gitlab.rs
+++ b/src/commands/list/ci_status/gitlab.rs
@@ -22,7 +22,7 @@ use worktrunk::git::Repository;
use super::{
CiBranchName, CiSource, CiStatus, MAX_PRS_TO_FETCH, PrRef, PrStatus, ReviewState,
- is_retriable_error, non_interactive_cmd, parse_json,
+ non_interactive_cmd, parse_json,
};
/// Project IDs already resolved in this process, keyed by the worktree root
@@ -141,13 +141,7 @@ pub(super) fn detect_gitlab(
};
if !output.status.success() {
- let stderr = String::from_utf8_lossy(&output.stderr);
- // Return error status for retriable failures (rate limit, network) so they
- // surface as warnings instead of being cached as "no CI"
- if is_retriable_error(&stderr) {
- return Some(PrStatus::error());
- }
- return None;
+ return Some(PrStatus::error());
}
// Step 1: Parse mr list output to find matching MR.
@@ -287,13 +281,7 @@ pub(super) fn detect_gitlab_pipeline(
};
if !output.status.success() {
- let stderr = String::from_utf8_lossy(&output.stderr);
- // Return error status for retriable failures (rate limit, network) so they
- // surface as warnings instead of being cached as "no CI"
- if is_retriable_error(&stderr) {
- return Some(PrStatus::error());
- }
- return None;
+ return Some(PrStatus::error());
}
let pipelines: Vec<GitLabPipeline> = parse_json(&output.stdout, "glab ci list", branch)?;
diff --git a/src/commands/list/ci_status/mod.rs b/src/commands/list/ci_status/mod.rs
index c0b5e7002..c5fb5cd45 100644
--- a/src/commands/list/ci_status/mod.rs
+++ b/src/commands/list/ci_status/mod.rs
@@ -12,8 +12,6 @@ mod github;
mod gitlab;
mod platform;
-use std::process::Output;
-
use super::layout::LinkStyle;
use anstyle::{AnsiColor, Color, Style};
use schemars::JsonSchema;
@@ -80,6 +78,24 @@ impl CiBranchName {
pub fn has_upstream(&self, repo: &Repository) -> bool {
self.is_remote() || repo.branch(&self.name).upstream().ok().flatten().is_some()
}
+
+ /// Whether `local_head` is on a remote, so a forge lookup by commit SHA can
+ /// find it. A remote branch's head is; a local branch's is when any
+ /// remote-tracking ref contains it. A commit that only exists locally gets
+ /// no lookup by SHA, which the forge would answer with an error.
+ pub(super) fn head_on_remote(&self, repo: &Repository, local_head: &str) -> bool {
+ self.is_remote()
+ || repo
+ .run_command(&[
+ "for-each-ref",
+ "--count=1",
+ "--format=%(refname)",
+ "--contains",
+ local_head,
+ "refs/remotes/",
+ ])
+ .is_ok_and(|out| !out.trim().is_empty())
+ }
}
// Re-export public types
@@ -137,26 +153,6 @@ fn parse_json<T: DeserializeOwned>(stdout: &[u8], command: &str, branch: &str) -
.ok()
}
-/// Combine stderr and stdout for retriable-error sniffing.
-///
-/// Some CLIs (notably `tea`) report API errors as JSON on stdout while
-/// transport errors land on stderr — checking both avoids missing retriable
-/// errors when the tool routes them differently.
-fn output_error_text(output: &Output) -> String {
- format!(
- "{}{}",
- String::from_utf8_lossy(&output.stderr),
- String::from_utf8_lossy(&output.stdout)
- )
-}
-
-/// If a non-success `Output` indicates a retriable failure, surface it as a
-/// PR-status warning. Returns `None` for non-retriable failures so callers
-/// can `?` it to fall through to "no CI status".
-fn retriable_pr_error(output: &Output) -> Option<PrStatus> {
- is_retriable_error(&output_error_text(output)).then(PrStatus::error)
-}
-
/// Resolve `(owner, repo)` for a branch's effective remote.
///
/// Thin wrapper over [`branch_remote_url`] + [`parse_owner_repo`]. The
@@ -195,22 +191,6 @@ fn branch_remote_url(repo: &Repository, branch: &CiBranchName) -> Option<String>
}
}
-/// Check if stderr indicates a retriable error (rate limit, network issues)
-fn is_retriable_error(stderr: &str) -> bool {
- let lower = stderr.to_ascii_lowercase();
- [
- "rate limit",
- "api rate",
- "403",
- "429",
- "timeout",
- "connection",
- "network",
- ]
- .iter()
- .any(|p| lower.contains(p))
-}
-
/// Status of CI tools availability
#[derive(Debug, Clone, Copy)]
pub struct CiToolsStatus {
@@ -581,7 +561,7 @@ impl PrStatus {
}
}
- /// Create an error status for retriable failures (rate limit, network errors)
+ /// The status for a forge CLI call that failed.
fn error() -> Self {
Self {
ci_status: CiStatus::Error,
@@ -770,30 +750,6 @@ mod tests {
use super::*;
use worktrunk::testing::TestRepo;
- #[test]
- fn test_is_retriable_error() {
- // Rate limit errors
- assert!(is_retriable_error("API rate limit exceeded"));
- assert!(is_retriable_error("rate limit exceeded for requests"));
- assert!(is_retriable_error("Error 403: forbidden"));
- assert!(is_retriable_error("HTTP 429 Too Many Requests"));
-
- // Network errors
- assert!(is_retriable_error("connection timed out"));
- assert!(is_retriable_error("network error"));
- assert!(is_retriable_error("timeout waiting for response"));
-
- // Case insensitivity
- assert!(is_retriable_error("RATE LIMIT"));
- assert!(is_retriable_error("Connection Reset"));
-
- // Non-retriable errors
- assert!(!is_retriable_error("branch not found"));
- assert!(!is_retriable_error("invalid credentials"));
- assert!(!is_retriable_error("permission denied"));
- assert!(!is_retriable_error(""));
- }
-
#[test]
fn test_ci_status_color() {
use anstyle::AnsiColor;
@@ -1098,54 +1054,6 @@ mod tests {
);
}
- /// Build a synthetic non-success `Output` with the given stderr/stdout
- /// bodies — `Command::output()` is the only "real" constructor and
- /// would require spawning a process. Status uses `ExitStatus::default()`
- /// (success), but the retriable-error helpers ignore status and only
- /// look at the bytes.
- fn fake_output(stderr: &str, stdout: &str) -> Output {
- Output {
- status: Default::default(),
- stdout: stdout.as_bytes().to_vec(),
- stderr: stderr.as_bytes().to_vec(),
- }
- }
-
- /// `output_error_text` must combine both streams — `tea` routes API
- /// errors to stdout while transport errors land on stderr, so a
- /// stderr-only sniff would miss rate-limit messages from the JSON body.
- #[test]
- fn test_output_error_text_combines_streams() {
- let out = fake_output("transport: connection reset", r#"{"message":"rate limit"}"#);
- let text = output_error_text(&out);
- assert!(text.contains("transport: connection reset"));
- assert!(text.contains("rate limit"));
- }
-
- /// `retriable_pr_error` returns `Some(PrStatus::error())` when either
- /// stream contains a retriable marker, and `None` otherwise — the
- /// fall-through case where `?` propagates "no CI status".
- #[test]
- fn test_retriable_pr_error_routing() {
- // Retriable from stderr.
- let out = fake_output("HTTP 429 Too Many Requests", "");
- let status = retriable_pr_error(&out).expect("retriable should yield Some");
- assert_eq!(status.ci_status, CiStatus::Error);
-
- // Retriable from stdout — a tool that copies the server's error body
- // through rather than writing its own message to stderr.
- let out = fake_output("", r#"{"message":"rate limit exceeded"}"#);
- assert!(retriable_pr_error(&out).is_some());
-
- // Non-retriable failure → None, so caller's `?` falls through.
- let out = fake_output("not found", "");
- assert!(retriable_pr_error(&out).is_none());
-
- // No body at all → None.
- let out = fake_output("", "");
- assert!(retriable_pr_error(&out).is_none());
- }
-
fn passed_pr_status(number: Option<u64>) -> PrStatus {
PrStatus {
ci_status: CiStatus::Passed,
diff --git a/src/git/remote_ref/gitea.rs b/src/git/remote_ref/gitea.rs
index c7b18f6ed..1ffe771f0 100644
--- a/src/git/remote_ref/gitea.rs
+++ b/src/git/remote_ref/gitea.rs
@@ -1,7 +1,6 @@
//! Gitea PR backend using the `tea` CLI. It also hosts the `tea`-facing helpers
-//! other modules share: [`api_status`] (how
-//! every caller separates a failed request from a resource, and decides whether
-//! a retry could help), [`is_authed_for`], and [`has_any_login`] — read by the
+//! other modules share: [`api_status`] (how every caller separates a failed
+//! request from a resource), [`is_authed_for`], and [`has_any_login`] — read by the
//! switch dispatcher and the CI-status backend, so a change to one of them is
//! not local.
//!
diff --git a/src/shell/mod.rs b/src/shell/mod.rs
index 2b433c7f3..005593323 100644
--- a/src/shell/mod.rs
+++ b/src/shell/mod.rs
@@ -17,8 +17,8 @@ pub use detection::{
is_shell_integration_line_for_uninstall_any_cmd, scan_for_detection_details,
};
pub use paths::{
- fish_config_dir, home_dir_required, line_based_config_paths, nushell_autoload_candidates,
- profile_query_interruption,
+ fish_completion_path, fish_config_dir, home_dir_required, line_based_config_paths,
+ nushell_autoload_candidates, profile_query_interruption,
};
pub use utils::{
AncestorShell, ZshStartupScope, ancestor_shell, current_shell, current_shell_name,
@@ -154,18 +154,6 @@ impl Shell {
paths::legacy_fish_conf_d_path(cmd)
}
- /// Returns the path to the native completion directory for this shell.
- ///
- /// The `cmd` parameter affects the completion filename (e.g., `wt.fish` or `git-wt.fish`).
- ///
- /// Note: Bash and Zsh use inline lazy completions in the init script.
- /// Only Fish uses a separate completion file at ~/.config/fish/completions/
- /// (installed by `wt config shell install`) that uses $WORKTRUNK_BIN to bypass
- /// the shell function wrapper.
- pub fn completion_path(&self, cmd: &str) -> Result<std::path::PathBuf, std::io::Error> {
- paths::completion_path(*self, cmd)
- }
-
/// Returns the line to add to the config file for shell integration.
///
/// The `cmd` parameter specifies the command name (e.g., `wt` or `git-wt`).
@@ -458,14 +446,10 @@ mod tests {
#[test]
fn test_shell_config_paths_returns_paths() {
- // All shells should return at least one config path
- let shells = [
- Shell::Bash,
- Shell::Zsh,
- Shell::Fish,
- Shell::Nushell,
- Shell::PowerShell,
- ];
+ // Shells whose paths don't depend on querying an installed shell.
+ // Nushell and Unix PowerShell paths come from `nu` and `pwsh`, and are
+ // empty without them.
+ let shells = [Shell::Bash, Shell::Zsh, Shell::Fish];
for shell in shells {
let result = shell.config_paths("wt");
assert!(result.is_ok(), "Failed to get config paths for {:?}", shell);
@@ -478,32 +462,6 @@ mod tests {
}
}
- #[test]
- fn test_shell_completion_path_returns_path() {
- // All shells should return a completion path
- let shells = [
- Shell::Bash,
- Shell::Zsh,
- Shell::Fish,
- Shell::Nushell,
- Shell::PowerShell,
- ];
- for shell in shells {
- let result = shell.completion_path("wt");
- assert!(
- result.is_ok(),
- "Failed to get completion path for {:?}",
- shell
- );
- let path = result.unwrap();
- assert!(
- !path.as_os_str().is_empty(),
- "Empty completion path for {:?}",
- shell
- );
- }
- }
-
#[test]
fn test_shell_config_paths_with_custom_prefix() {
// Test that custom prefix affects the paths where appropriate
@@ -540,37 +498,11 @@ mod tests {
}
#[test]
- fn test_shell_completion_path_with_custom_prefix() {
- let prefix = "my-prefix";
-
- // Bash completion should include prefix in path
- let bash_path = Shell::Bash.completion_path(prefix).unwrap();
+ fn test_fish_completion_path_with_custom_prefix() {
+ let fish_path = fish_completion_path("my-prefix").unwrap();
assert!(
- bash_path
- .file_name()
- .and_then(|n| n.to_str())
- .is_some_and(|n| n.contains("my-prefix")),
- "Bash completion should include prefix"
- );
-
- // Fish completion should include prefix in filename
- let fish_path = Shell::Fish.completion_path(prefix).unwrap();
- assert!(
- fish_path
- .file_name()
- .and_then(|n| n.to_str())
- .is_some_and(|n| n.contains("my-prefix.fish")),
- "Fish completion should include prefix in filename"
- );
-
- // Zsh completion should include prefix
- let zsh_path = Shell::Zsh.completion_path(prefix).unwrap();
- assert!(
- zsh_path
- .file_name()
- .and_then(|n| n.to_str())
- .is_some_and(|n| n.contains("_my-prefix")),
- "Zsh completion should include underscore prefix"
+ fish_path.ends_with("completions/my-prefix.fish"),
+ "{fish_path:?}"
);
}
diff --git a/src/shell/paths.rs b/src/shell/paths.rs
index 985e84036..e4297f90f 100644
--- a/src/shell/paths.rs
+++ b/src/shell/paths.rs
@@ -55,9 +55,9 @@ fn parse_nu_path(line: &str) -> Option<PathBuf> {
/// once per process (memoised).
///
/// Returns [`NuDirs::default`] (all `None`) when `nu` is not in PATH or the
-/// query fails. A single `wt config shell install` resolves both the write
-/// target (`completion_path`) and the installed-state candidates
-/// (`config_paths`), which would otherwise each spawn `nu` for the same answer.
+/// query fails. A single `wt config shell install` or `wt config show` resolves
+/// the Nushell candidates (`config_paths`, the uninstall scan, detection) more
+/// than once, which would otherwise each spawn `nu` for the same answer.
fn nu_dirs() -> NuDirs {
static CACHE: OnceLock<NuDirs> = OnceLock::new();
CACHE
@@ -92,46 +92,6 @@ fn nu_dirs() -> NuDirs {
.clone()
}
-/// Fallback for Nushell's `$nu.data-dir` when `nu` can't be queried.
-///
-/// Mirrors Nushell's own `resolve_xdg_base` (`crates/nu-config/src/resolve.rs`):
-/// `XDG_DATA_HOME` wins on every platform when it is absolute, otherwise
-/// `dirs::data_dir()` (`~/Library/Application Support` on macOS, `%APPDATA%` on
-/// Windows, `~/.local/share` on Linux). Nushell appends `nushell`.
-///
-/// The one XDG read worktrunk still spells out, because it is Nushell's rule
-/// rather than the spec's: etcetera's `Xdg::data_dir()` applies the same
-/// absolute-only filter but falls back to `~/.local/share` everywhere, which is
-/// the wrong directory on macOS and Windows, and the native strategies that get
-/// those right ignore `XDG_DATA_HOME`.
-fn nushell_data_dir_fallback(home: &std::path::Path) -> PathBuf {
- if let Some(xdg) = std::env::var_os("XDG_DATA_HOME")
- .map(PathBuf::from)
- .filter(|path| path.is_absolute())
- {
- return xdg.join("nushell");
- }
- dirs::data_dir()
- .unwrap_or_else(|| home.join(".local").join("share"))
- .join("nushell")
-}
-
-/// The Nushell vendor-autoload directory worktrunk writes its wrapper to.
-///
-/// Prefers the path `nu` reports (`$nu.vendor-autoload-dirs | last`); otherwise
-/// reconstructs `<data-dir>/vendor/autoload`.
-fn nushell_vendor_autoload_dir(
- home: &std::path::Path,
- queried: Option<&std::path::Path>,
-) -> PathBuf {
- match queried {
- Some(dir) => dir.to_path_buf(),
- None => nushell_data_dir_fallback(home)
- .join("vendor")
- .join("autoload"),
- }
-}
-
/// Legacy `<config-dir>/vendor/autoload` directories where older worktrunk
/// versions wrongly installed the Nushell wrapper (issue #2878).
///
@@ -165,21 +125,16 @@ fn legacy_nushell_autoload_dirs(
/// Nushell autoload directories to check for an installed wrapper, in priority
/// order.
///
-/// The first entry is the canonical write target (the current vendor-autoload
-/// dir); the rest are the data-dir fallback and the legacy config-dir locations
-/// kept so install/uninstall can clean up stranded files.
+/// The first entry is the canonical write target (the vendor-autoload dir `nu`
+/// reports); the rest are the legacy config-dir locations kept so
+/// install/uninstall can clean up stranded files. Empty when `nu` can't be
+/// queried: without `nu` there is no Nushell to integrate with.
pub fn nushell_autoload_candidates(home: &std::path::Path) -> Vec<PathBuf> {
let dirs = nu_dirs();
- let mut candidates = vec![nushell_vendor_autoload_dir(
- home,
- dirs.vendor_autoload.as_deref(),
- )];
- // New-style fallback, in case `nu` was queryable at install time but not now.
- candidates.push(
- nushell_data_dir_fallback(home)
- .join("vendor")
- .join("autoload"),
- );
+ let Some(target) = dirs.vendor_autoload else {
+ return Vec::new();
+ };
+ let mut candidates = vec![target];
candidates.extend(legacy_nushell_autoload_dirs(
home,
dirs.default_config.as_deref(),
@@ -313,10 +268,8 @@ pub fn profile_query_interruption(error: &std::io::Error) -> Option<i32> {
///
/// On Windows, returns both PowerShell Core (7+) and Windows PowerShell (5.1) paths.
/// On Unix, returns the current-user, current-host profile the installed `pwsh`
-/// reports — PowerShell honors `$XDG_CONFIG_HOME` — falling back to the
-/// conventional `~/.config/powershell` location when `pwsh` can't be queried.
-/// Errors only when the query was cancelled, so no caller writes a fallback
-/// profile after Ctrl-C.
+/// reports, and nothing when `pwsh` can't be queried: without `pwsh` there is
+/// no PowerShell to integrate with. Errors only when the query was cancelled.
pub fn powershell_profile_paths(home: &std::path::Path) -> std::io::Result<Vec<PathBuf>> {
#[cfg(windows)]
{
@@ -333,16 +286,12 @@ pub fn powershell_profile_paths(home: &std::path::Path) -> std::io::Result<Vec<P
}
#[cfg(not(windows))]
{
+ let _ = home;
#[cfg(unix)]
let queried = queried_powershell_profile()?;
#[cfg(not(unix))]
let queried = None;
- let profile = queried.unwrap_or_else(|| {
- home.join(".config")
- .join("powershell")
- .join("Microsoft.PowerShell_profile.ps1")
- });
- Ok(vec![profile])
+ Ok(queried.into_iter().collect())
}
}
@@ -360,7 +309,7 @@ pub fn powershell_profile_paths(home: &std::path::Path) -> std::io::Result<Vec<P
/// everywhere else.
///
/// Every path fish itself reads goes through this one function — the wrapper
-/// (`config_paths`) and the completion (`completion_path`) — because they have
+/// (`config_paths`) and the completion (`fish_completion_path`) — because they have
/// to agree. Resolving the wrapper's directory separately from the completion's
/// put the wrapper under `~/.config/fish` whenever `$XDG_CONFIG_HOME` pointed
/// anywhere else, which fish never reads, while the completion landed in the
@@ -378,9 +327,8 @@ pub fn fish_config_dir(home: &std::path::Path) -> PathBuf {
/// it holds an absolute path, otherwise `$HOME`.
///
/// zsh's rule is `$ZDOTDIR`, or `$HOME` when it is unset. The absolute-only
-/// guard on top is the same one this module already applies to
-/// `$XDG_DATA_HOME` ([`nushell_data_dir_fallback`]) and, through etcetera's
-/// [`Xdg`], to `$XDG_CONFIG_HOME` ([`fish_config_dir`]).
+/// guard on top is the same one etcetera's [`Xdg`] applies to
+/// `$XDG_CONFIG_HOME` ([`fish_config_dir`]).
///
/// A non-absolute value resolves against the current directory, and that
/// directory is `wt`'s: zsh resolves one against *zsh's* own startup
@@ -441,10 +389,10 @@ pub(super) fn config_paths(shell: super::Shell, cmd: &str) -> Result<Vec<PathBuf
}
super::Shell::Nushell => {
// Nushell autoloads `*.nu` from `$nu.vendor-autoload-dirs`; the last
- // entry (under `$nu.data-dir`) is the write target. Earlier entries
- // are fallbacks plus the legacy `<config-dir>/vendor/autoload`
- // locations older worktrunk wrote to (never autoloaded — issue
- // #2878), kept so install/uninstall can clean them up.
+ // entry (under `$nu.data-dir`) is the write target. The rest are the
+ // legacy `<config-dir>/vendor/autoload` locations older worktrunk
+ // wrote to (never autoloaded — issue #2878), kept so
+ // install/uninstall can clean them up.
nushell_autoload_candidates(&home)
.into_iter()
.map(|autoload_dir| autoload_dir.join(format!("{}.nu", cmd)))
@@ -477,50 +425,14 @@ pub(super) fn legacy_fish_conf_d_path(cmd: &str) -> Result<PathBuf, std::io::Err
.join(format!("{}.fish", cmd)))
}
-/// Returns the path to the native completion directory for a shell.
-///
-/// The `cmd` parameter affects the completion filename (e.g., `wt.fish` or `git-wt.fish`).
-///
-/// Note: Bash and Zsh use inline lazy completions in the init script.
-/// Only Fish uses a separate completion file at ~/.config/fish/completions/
-/// (installed by `wt config shell install`) that uses $WORKTRUNK_BIN to bypass
-/// the shell function wrapper.
-pub(super) fn completion_path(shell: super::Shell, cmd: &str) -> Result<PathBuf, std::io::Error> {
- let home = home_dir_required()?;
-
- // Use etcetera for XDG-compliant paths when available
- let strategy = choose_base_strategy().ok();
-
- Ok(match shell {
- super::Shell::Bash => {
- // XDG_DATA_HOME defaults to ~/.local/share
- let data_home = strategy
- .as_ref()
- .map(|s| s.data_dir())
- .unwrap_or_else(|| home.join(".local").join("share"));
- data_home
- .join("bash-completion")
- .join("completions")
- .join(cmd)
- }
- super::Shell::Zsh => home.join(".zfunc").join(format!("_{}", cmd)),
- super::Shell::Fish => fish_config_dir(&home)
- .join("completions")
- .join(format!("{}.fish", cmd)),
- super::Shell::Nushell => {
- // Nushell completions are defined inline in the init script.
- // Return the canonical vendor-autoload path (same as config).
- let dirs = nu_dirs();
- nushell_vendor_autoload_dir(&home, dirs.vendor_autoload.as_deref())
- .join(format!("{}.nu", cmd))
- }
- super::Shell::PowerShell => {
- // PowerShell doesn't use a separate completion file - completions are
- // registered inline in the profile using Register-ArgumentCompleter
- // Return a dummy path that won't be used
- home.join(format!(".{}-powershell-completions", cmd))
- }
- })
+/// The completion file worktrunk installs for fish, the one shell whose
+/// completions live in their own file (`<fish config>/completions/<cmd>.fish`).
+/// Bash, Zsh, Nushell and PowerShell register completions inline in the
+/// integration they install.
+pub fn fish_completion_path(cmd: &str) -> Result<PathBuf, std::io::Error> {
+ Ok(fish_config_dir(&home_dir_required()?)
+ .join("completions")
+ .join(format!("{cmd}.fish")))
}
#[cfg(test)]
@@ -610,29 +522,6 @@ mod tests {
assert_eq!(profile_query_interruption(&ordinary), None);
}
- #[test]
- fn test_nushell_vendor_autoload_dir_prefers_queried() {
- let home = PathBuf::from("/home/user");
- let queried = PathBuf::from("/opt/nu/vendor/autoload");
- assert_eq!(
- nushell_vendor_autoload_dir(&home, Some(&queried)),
- queried,
- "the path nu reports should be used verbatim"
- );
- }
-
- #[test]
- fn test_nushell_vendor_autoload_dir_fallback_under_data_dir() {
- let home = PathBuf::from("/home/user");
- let dir = nushell_vendor_autoload_dir(&home, None);
- // Fallback must land under `<data-dir>/nushell/vendor/autoload`, never
- // under the *config* dir (the bug this fixes).
- assert!(
- dir.ends_with("nushell/vendor/autoload"),
- "fallback should be under <data>/nushell/vendor/autoload: {dir:?}"
- );
- }
-
#[test]
fn test_legacy_nushell_autoload_dirs_are_config_rooted() {
let home = PathBuf::from("/home/user");
@@ -661,13 +550,9 @@ mod tests {
let home = PathBuf::from("/home/user");
let candidates = nushell_autoload_candidates(&home);
- assert!(!candidates.is_empty(), "must return at least one candidate");
- // The write target (first entry) is a vendor/autoload directory.
- assert!(
- candidates[0].ends_with("vendor/autoload"),
- "write target should be a vendor/autoload dir: {:?}",
- candidates[0]
- );
+ // The write target (first entry) is the directory `nu` reports; without
+ // `nu` there is nothing to integrate with, so no candidates at all.
+ assert_eq!(candidates.first(), nu_dirs().vendor_autoload.as_ref());
// No duplicates.
let unique: std::collections::HashSet<_> = candidates.iter().collect();
assert_eq!(
@@ -675,11 +560,13 @@ mod tests {
unique.len(),
"candidates must not contain duplicates: {candidates:?}"
);
- // The legacy ~/.config location is always present for cleanup.
- assert!(
+ // Whenever there is a target, the legacy ~/.config location is there
+ // too, for cleanup.
+ assert_eq!(
candidates
.iter()
.any(|p| p == &home.join(".config/nushell/vendor/autoload")),
+ !candidates.is_empty(),
"legacy ~/.config/nushell location must be a candidate: {candidates:?}"
);
}
diff --git a/src/testing/mod.rs b/src/testing/mod.rs
index 3487fdee4..1680195bb 100644
--- a/src/testing/mod.rs
+++ b/src/testing/mod.rs
@@ -2590,6 +2590,8 @@ impl TestRepo {
.version("gh version 2.0.0 (mock)")
.command("auth", MockResponse::exit(0))
.command("pr", MockResponse::file("pr_data.json"))
+ // A branch with no PR falls back to its commit's check runs: none.
+ .command("api", MockResponse::output("[]"))
.write(&mock_bin);
// Configure glab mock (fails - no GitLab support)
@@ -2740,7 +2742,7 @@ impl TestRepo {
/// Set up mock glab that returns a rate limit error on `ci list`.
///
- /// Used to test the `is_retriable_error` path in `detect_gitlab_pipeline`.
+ /// Used to test the failure path in `detect_gitlab_pipeline`.
/// MR list returns empty (no MRs), so the code falls through to pipeline detection
/// which then hits the rate limit error.
pub fn setup_mock_glab_with_ci_rate_limit(&mut self, project_id: Option<u64>) {
@@ -2817,7 +2819,7 @@ impl TestRepo {
/// Setup mock `az` where `az repos pr list` and/or `az pipelines runs list`
/// fail with the given stderr (exit code 1).
///
- /// Used to exercise the `is_retriable_error` branches in `detect_azure_pr`
+ /// Used to exercise the failure branches in `detect_azure_pr`
/// and `detect_azure_pipeline`. A `None` argument makes that command return
/// an empty JSON array instead of failing.
pub fn setup_mock_az_with_detection_errors(
@@ -2918,6 +2920,13 @@ impl TestRepo {
MockResponse::file("tea_status.json")
.with_stderr(&tea_api_include_stderr(status_status)),
)
+ // Every other branch's commit has no statuses, so only `head_sha`'s
+ // row reflects `status`.
+ .command(
+ "api --include",
+ MockResponse::output(r#"{"state":"","total_count":0}"#)
+ .with_stderr(&tea_api_include_stderr("200 OK")),
+ )
.command("_default", MockResponse::exit(1))
.write(&mock_bin);
@@ -2935,7 +2944,7 @@ impl TestRepo {
/// Setup mock `tea` where every `tea api` call fails with the given stderr
/// (exit code 1).
///
- /// Used to exercise the `is_retriable_error` branch in `detect_gitea_pr`.
+ /// Used to exercise the failure branch in `detect_gitea_pr`.
pub fn setup_mock_tea_with_detection_error(&mut self, stderr: &str) {
let mock_bin = self.temp_dir.path().join("mock-bin");
std::fs::create_dir_all(&mock_bin).unwrap();
@@ -2960,7 +2969,7 @@ impl TestRepo {
/// fails with `stderr` (exit code 1). Assumes the repo's remote points at
/// `owner/test-repo`.
///
- /// Used to exercise the `is_retriable_error` branch in
+ /// Used to exercise the failure branch in
/// `fetch_combined_status`.
pub fn setup_mock_tea_commit_status_error(&mut self, head_sha: &str, stderr: &str) {
let mock_bin = self.temp_dir.path().join("mock-bin");
@@ -2981,6 +2990,12 @@ impl TestRepo {
&format!("api --include repos/owner/test-repo/commits/{head_sha}/status"),
MockResponse::stderr(stderr).with_exit_code(1),
)
+ // Every other branch's commit has no statuses.
+ .command(
+ "api --include",
+ MockResponse::output(r#"{"state":"","total_count":0}"#)
+ .with_stderr(&tea_api_include_stderr("200 OK")),
+ )
.command("_default", MockResponse::exit(1))
.write(&mock_bin);
diff --git a/tests/integration_tests/ci_status.rs b/tests/integration_tests/ci_status.rs
index 8c7b92a3a..4df3aa8ab 100644
--- a/tests/integration_tests/ci_status.rs
+++ b/tests/integration_tests/ci_status.rs
@@ -960,6 +960,90 @@ fn test_list_full_with_branch_fallback_using_fork_pushremote(mut repo: TestRepo)
);
}
+/// A branch whose head is on no remote gets no lookup by commit SHA: the
+/// forge has no such commit and answers with an error, which would otherwise
+/// show the error indicator on ordinary unpushed work. A pushed branch against
+/// the same failing lookup is the control.
+#[rstest]
+fn test_list_full_skips_commit_checks_for_unpushed_head(mut repo: TestRepo) {
+ setup_github_repo_with_feature(&mut repo);
+ // feature-a is one commit ahead of every remote-tracking ref.
+ repo.run_git(&["update-ref", "refs/remotes/origin/feature-a", "feature-a~1"]);
+
+ // No PRs, and every `gh api` check-runs lookup fails.
+ let mock_bin = setup_mock_gh_with_api_data(&repo, "[]", &[]);
+
+ let mut cmd = make_snapshot_cmd(&repo, "list", &["--full"], None);
+ configure_mock_ci_env(&mut cmd, &mock_bin);
+ let output = cmd.output().unwrap();
+ assert!(output.status.success(), "wt list should succeed");
+
+ let stdout = String::from_utf8_lossy(&output.stdout);
+ assert!(!list_line(&stdout, "feature-a").contains('⚠'), "{stdout}");
+ assert!(list_line(&stdout, "feature-b").contains('⚠'), "{stdout}");
+}
+
+/// The `wt list --full` line for `branch`, ANSI-stripped.
+fn list_line(stdout: &str, branch: &str) -> String {
+ stdout
+ .ansi_strip()
+ .lines()
+ .find(|line| line.contains(&format!(" {branch} ")))
+ .unwrap_or_else(|| panic!("expected a {branch} line\nstdout:\n{stdout}"))
+ .to_string()
+}
+
+/// A failed PR/MR list shows the error indicator whatever the CLI printed, here
+/// an authentication failure that no retry would change.
+#[rstest]
+#[case::github("gh", "pr list", "https://github.com/test-owner/test-repo.git")]
+#[case::gitlab("glab", "mr list", "https://gitlab.com/test-group/test-project.git")]
+fn test_list_full_failed_pr_list_shows_error(
+ mut repo: TestRepo,
+ #[case] tool: &str,
+ #[case] list_command: &str,
+ #[case] remote_url: &str,
+) {
+ repo.run_git(&["remote", "set-url", "origin", remote_url]);
+ repo.add_worktree("feature");
+ setup_tracking_for_all_branches(&repo, "origin");
+
+ let mock_bin = repo.root_path().join("mock-bin");
+ std::fs::create_dir_all(&mock_bin).unwrap();
+ MockConfig::new(tool)
+ .version(&format!("{tool} version 2.0.0 (mock)"))
+ .command(
+ list_command,
+ MockResponse::stderr("HTTP 401: Bad credentials").with_exit_code(1),
+ )
+ .command("_default", MockResponse::output("[]"))
+ .write(&mock_bin);
+
+ let mut cmd = make_snapshot_cmd(&repo, "list", &["--full"], None);
+ configure_mock_ci_env(&mut cmd, &mock_bin);
+ let output = cmd.output().unwrap();
+ assert!(output.status.success(), "wt list should succeed");
+ let stdout = String::from_utf8_lossy(&output.stdout);
+ assert!(list_line(&stdout, "feature").contains('⚠'), "{stdout}");
+}
+
+/// The Gitea commit-status lookup is by SHA too, so an unpushed head skips it
+/// (the pushed `test_list_full_with_gitea_commit_status_tea_failure` is the
+/// control: the same failing lookup shows the error indicator).
+#[rstest]
+fn test_list_full_gitea_skips_commit_status_for_unpushed_head(mut repo: TestRepo) {
+ let head_sha = setup_gitea_repo_with_feature(&mut repo);
+ repo.run_git(&["update-ref", "refs/remotes/origin/feature", "feature~1"]);
+ repo.setup_mock_tea_commit_status_error(&head_sha, "Error: connection refused");
+
+ let mut cmd = make_snapshot_cmd(&repo, "list", &["--full"], None);
+ repo.configure_mock_commands(&mut cmd);
+ let output = cmd.output().unwrap();
+ assert!(output.status.success(), "wt list should succeed");
+ let stdout = String::from_utf8_lossy(&output.stdout);
+ assert!(!list_line(&stdout, "feature").contains('⚠'), "{stdout}");
+}
+
// =============================================================================
// GitLab error path tests
// =============================================================================
@@ -994,8 +1078,8 @@ fn test_list_full_with_gitlab_mr_view_failure(mut repo: TestRepo) {
/// Test that rate limit errors in `glab ci list` show error status (not NoCI).
///
-/// This exercises the `is_retriable_error` check in `detect_gitlab_pipeline`,
-/// which is the fallback path when no MR exists for a branch.
+/// This exercises the failure branch in `detect_gitlab_pipeline`, which is
+/// the fallback path when no MR exists for a branch.
#[rstest]
fn test_list_full_with_gitlab_ci_rate_limit(mut repo: TestRepo) {
setup_gitlab_repo_with_feature(&mut repo);
@@ -1249,11 +1333,10 @@ fn test_list_full_with_azure_no_ci(mut repo: TestRepo) {
run_azure_ci_status_test(&mut repo, "azure_no_ci", "[]", "[]");
}
-/// A retriable error from `az repos pr list` (e.g., HTTP 429) surfaces as an
-/// error indicator rather than NoCI (exercises the `is_retriable_error` branch
-/// in `detect_azure_pr`).
+/// A failed `az repos pr list` (e.g., HTTP 429) surfaces as an error indicator
+/// rather than NoCI (exercises the failure branch in `detect_azure_pr`).
#[rstest]
-fn test_list_full_with_azure_pr_list_retriable_error(mut repo: TestRepo) {
+fn test_list_full_with_azure_pr_list_error(mut repo: TestRepo) {
setup_azure_repo_with_feature(&mut repo);
repo.setup_mock_az_with_detection_errors(
Some("ERROR: HTTP error 429: Too Many Requests"),
@@ -1264,15 +1347,15 @@ fn test_list_full_with_azure_pr_list_retriable_error(mut repo: TestRepo) {
settings.bind(|| {
let mut cmd = make_snapshot_cmd(&repo, "list", &["--full"], None);
repo.configure_mock_commands(&mut cmd);
- assert_cmd_snapshot!("azure_pr_list_retriable_error", cmd);
+ assert_cmd_snapshot!("azure_pr_list_error", cmd);
});
}
-/// A retriable error from `az pipelines runs list` surfaces as an error
-/// indicator (exercises the `is_retriable_error` branch in
-/// `detect_azure_pipeline`, reached when no PR exists for the branch).
+/// A failed `az pipelines runs list` surfaces as an error indicator (exercises
+/// the failure branch in `detect_azure_pipeline`, reached when no PR exists
+/// for the branch).
#[rstest]
-fn test_list_full_with_azure_pipeline_retriable_error(mut repo: TestRepo) {
+fn test_list_full_with_azure_pipeline_error(mut repo: TestRepo) {
setup_azure_repo_with_feature(&mut repo);
repo.setup_mock_az_with_detection_errors(
None,
@@ -1283,7 +1366,7 @@ fn test_list_full_with_azure_pipeline_retriable_error(mut repo: TestRepo) {
settings.bind(|| {
let mut cmd = make_snapshot_cmd(&repo, "list", &["--full"], None);
repo.configure_mock_commands(&mut cmd);
- assert_cmd_snapshot!("azure_pipeline_retriable_error", cmd);
+ assert_cmd_snapshot!("azure_pipeline_error", cmd);
});
}
@@ -1334,9 +1417,7 @@ fn run_gitea_ci_status_test(
/// Gitea's `APIError` body, which the API returns in place of the resource
/// whenever a request fails — and which `tea api` copies to stdout with exit 0,
-/// since it never reads the HTTP status. The message is a 500's wrapped
-/// internal error (Gitea passes it through for an admin token), so
-/// `is_retriable_error` recognizes the cause.
+/// since it never reads the HTTP status.
const GITEA_API_ERROR_BODY: &str = r#"{
"message": "pq: dial tcp 10.0.0.5:5432: connect: connection refused",
"url": "https://gitea.example.com/api/swagger"
@@ -1407,8 +1488,7 @@ fn test_list_full_with_gitea_no_ci(mut repo: TestRepo) {
);
}
-/// A Gitea 500 whose `APIError` body names a retriable cause surfaces as an
-/// error indicator rather than NoCI. `tea api` exits 0 here — it copies the
+/// A Gitea 500 surfaces as an error indicator rather than NoCI. `tea api` exits 0 here — it copies the
/// response body through whatever the status — so the status line `--include`
/// puts on stderr is what separates this from a PR list.
#[rstest]
@@ -1439,26 +1519,8 @@ fn test_list_full_with_gitea_commit_status_error_body(mut repo: TestRepo) {
);
}
-/// A 500 the message of which Gitea blanked still reaches the cell as an error.
-/// The status is the whole basis: the body says nothing, so the text sniff that
-/// used to decide had nothing to match and painted the same blank cell as a
-/// healthy branch with no CI.
-#[rstest]
-fn test_list_full_with_gitea_blanked_500(mut repo: TestRepo) {
- let head_sha = setup_gitea_repo_with_feature(&mut repo);
- run_gitea_ci_status_test(
- &mut repo,
- "gitea_blanked_500",
- &head_sha,
- ("500 Internal Server Error", GITEA_BLANK_ERROR_BODY),
- ("200 OK", r#"{"state":"","total_count":0}"#),
- );
-}
-
-/// A 404 is the other half of that: also an error, also carrying no useful
-/// text, but nothing a later `wt list` would answer differently — so the cell
-/// stays blank rather than showing an indicator that never clears. Pairs with
-/// the 500 above; between them the status is doing the deciding, not the body.
+/// A 4xx is a failure like a 5xx: whatever the status, a failed call shows the
+/// error indicator rather than a blank cell.
#[rstest]
fn test_list_full_with_gitea_not_found(mut repo: TestRepo) {
let head_sha = setup_gitea_repo_with_feature(&mut repo);
@@ -1506,7 +1568,7 @@ fn gitea_ci_status_stderr(repo: &mut TestRepo, head_sha: &str, pulls: (&str, &st
/// now read by what accompanied them. A 500 whose message Gitea blanked says
/// nothing about being an error, and a proxy's HTML page isn't Gitea's shape at
/// all; both reach the PR list as errors on the strength of the status line
-/// alone, and the CI cell stays blank because neither carries retriable text.
+/// alone, before any body is parsed.
/// The 200 case is the control: it pins where the warning does belong, and
/// keeps the others from passing merely because nothing logs at all.
///
@@ -1535,11 +1597,10 @@ fn test_list_full_gitea_parse_warning_is_reserved_for_unknown_bodies(
}
/// `tea` itself failing on `tea api .../pulls` surfaces as an error indicator
-/// rather than NoCI (exercises the `is_retriable_error` branch in
-/// `detect_gitea_pr`). A transport failure is the case that does exit non-zero,
+/// rather than NoCI (exercises the failure branch in `detect_gitea_pr`). A transport failure is the case that does exit non-zero,
/// and `tea` names it on stderr.
#[rstest]
-fn test_list_full_with_gitea_retriable_error(mut repo: TestRepo) {
+fn test_list_full_with_gitea_tea_failure(mut repo: TestRepo) {
setup_gitea_repo_with_feature(&mut repo);
repo.setup_mock_tea_with_detection_error(
r#"Error: Get "https://gitea.example.com/api/v1/repos/owner/test-repo/pulls": dial tcp 10.0.0.5:443: connect: connection refused"#,
@@ -1549,15 +1610,15 @@ fn test_list_full_with_gitea_retriable_error(mut repo: TestRepo) {
settings.bind(|| {
let mut cmd = make_snapshot_cmd(&repo, "list", &["--full"], None);
repo.configure_mock_commands(&mut cmd);
- assert_cmd_snapshot!("gitea_retriable_error", cmd);
+ assert_cmd_snapshot!("gitea_tea_failure", cmd);
});
}
-/// A retriable error from the commit-status lookup (when no PR exists for the
-/// branch) surfaces as an error indicator (exercises the `is_retriable_error`
-/// branch in `fetch_combined_status`, reached via `detect_gitea_commit_status`).
+/// A failed commit-status lookup (when no PR exists for the branch) surfaces
+/// as an error indicator (exercises the failure branch in
+/// `fetch_combined_status`, reached via `detect_gitea_commit_status`).
#[rstest]
-fn test_list_full_with_gitea_commit_status_retriable_error(mut repo: TestRepo) {
+fn test_list_full_with_gitea_commit_status_tea_failure(mut repo: TestRepo) {
let head_sha = setup_gitea_repo_with_feature(&mut repo);
repo.setup_mock_tea_commit_status_error(
&head_sha,
@@ -1568,7 +1629,7 @@ fn test_list_full_with_gitea_commit_status_retriable_error(mut repo: TestRepo) {
settings.bind(|| {
let mut cmd = make_snapshot_cmd(&repo, "list", &["--full"], None);
repo.configure_mock_commands(&mut cmd);
- assert_cmd_snapshot!("gitea_commit_status_retriable_error", cmd);
+ assert_cmd_snapshot!("gitea_commit_status_tea_failure", cmd);
});
}
diff --git a/tests/integration_tests/configure_shell.rs b/tests/integration_tests/configure_shell.rs
index 2dd2d5be2..0fbd2169c 100644
--- a/tests/integration_tests/configure_shell.rs
+++ b/tests/integration_tests/configure_shell.rs
@@ -1141,6 +1141,7 @@ fn test_powershell_skipped_when_installed_no_profile(repo: TestRepo, temp_home:
let mut cmd = wt_command();
repo.configure_wt_cmd(&mut cmd);
set_temp_home_env(&mut cmd, temp_home.path());
+ mock_pwsh_reporting_conventional_profile(&mut cmd, &temp_home);
cmd.env("SHELL", "/bin/zsh");
cmd.env("WORKTRUNK_TEST_POWERSHELL_INSTALLED", "1");
cmd.arg("config")
@@ -1787,6 +1788,7 @@ fn test_uninstall_shell_powershell_removes_integration_line(repo: TestRepo, temp
let mut cmd = wt_command();
repo.configure_wt_cmd(&mut cmd);
set_temp_home_env(&mut cmd, temp_home.path());
+ mock_pwsh_reporting_conventional_profile(&mut cmd, &temp_home);
cmd.args(["config", "shell", "uninstall", "powershell", "--yes"])
.current_dir(repo.root_path());
@@ -1827,6 +1829,20 @@ fn mock_pwsh(
mock_bin
}
+/// Put a mock `pwsh` on PATH that reports the conventional
+/// `~/.config/powershell` profile under the temp home, so a test doesn't depend
+/// on a real `pwsh` being installed.
+#[cfg(unix)]
+fn mock_pwsh_reporting_conventional_profile(cmd: &mut std::process::Command, temp_home: &TempDir) {
+ let profile =
+ canonical_temp_home(temp_home).join(".config/powershell/Microsoft.PowerShell_profile.ps1");
+ mock_pwsh(
+ cmd,
+ temp_home,
+ crate::common::mock_commands::MockResponse::output(&format!("{}\n", profile.display())),
+ );
+}
+
/// The profile `pwsh` reports wins over `~/.config/powershell`: PowerShell
/// honors `$XDG_CONFIG_HOME`, so install and uninstall both follow it.
#[cfg(unix)]
@@ -1883,10 +1899,11 @@ fn test_powershell_profile_follows_runtime(repo: TestRepo, temp_home: TempDir) {
assert!(!content.contains("config shell init"), "{content}");
}
-/// A `pwsh` that can't answer leaves install on the conventional profile.
+/// A `pwsh` that can't answer has no profile to integrate with, so install
+/// writes none rather than guessing the conventional one.
#[cfg(unix)]
#[rstest]
-fn test_powershell_profile_falls_back_when_runtime_fails(repo: TestRepo, temp_home: TempDir) {
+fn test_powershell_profile_absent_when_runtime_fails(repo: TestRepo, temp_home: TempDir) {
let home = canonical_temp_home(&temp_home);
let mut cmd = wt_command();
repo.configure_wt_cmd(&mut cmd);
@@ -1900,13 +1917,14 @@ fn test_powershell_profile_falls_back_when_runtime_fails(repo: TestRepo, temp_ho
cmd.args(["config", "shell", "install", "powershell", "--yes"])
.current_dir(repo.root_path());
let output = cmd.output().unwrap();
+ let stderr = String::from_utf8_lossy(&output.stderr);
assert!(
- output.status.success(),
- "{}",
- String::from_utf8_lossy(&output.stderr)
+ !output.status.success() && stderr.contains("No shell config files found"),
+ "{stderr}"
);
assert!(
- home.join(".config/powershell/Microsoft.PowerShell_profile.ps1")
+ !home
+ .join(".config/powershell/Microsoft.PowerShell_profile.ps1")
.exists()
);
}
@@ -3157,68 +3175,6 @@ fn test_uninstall_nushell_cleans_all_candidate_locations(repo: TestRepo, temp_ho
);
}
-/// Uninstall finds a wrapper under `$XDG_DATA_HOME`, the data-dir candidate
-/// `nushell_data_dir_fallback` derives when `nu` can't be queried.
-///
-/// An absolute `XDG_DATA_HOME` wins over `dirs::data_dir()` on every platform,
-/// matching `nu_path::data_dir`. Only macOS and Windows discriminate: `dirs`
-/// reads the variable itself on Linux, so there the assertion holds with or
-/// without `nushell_data_dir_fallback`'s own branch, while on macOS it
-/// separates `$XDG_DATA_HOME` from `~/Library/Application Support`.
-#[rstest]
-fn test_uninstall_nushell_finds_wrapper_under_xdg_data_home(repo: TestRepo, temp_home: TempDir) {
- let home = canonical_temp_home(&temp_home);
- // Distinct from the pinned canonical dir, so the stranded wrapper can only
- // be found by way of the data-dir candidate.
- let xdg_data = home.join("xdg-data");
- let canonical_dir = home.join(".local/share/nushell/vendor/autoload");
- let canonical = canonical_dir.join("wt.nu");
-
- let configure = |cmd: &mut std::process::Command| {
- repo.configure_wt_cmd(cmd);
- set_temp_home_env(cmd, temp_home.path());
- cmd.env("XDG_DATA_HOME", &xdg_data);
- cmd.env("WORKTRUNK_TEST_NU_VENDOR_AUTOLOAD_DIR", &canonical_dir);
- cmd.env("SHELL", "/bin/nu");
- };
-
- // Install to the pinned canonical dir, then strand a copy under
- // `$XDG_DATA_HOME` — the shape an older worktrunk, or a `nu` that was
- // queryable at install time and isn't now, leaves behind.
- let mut install_cmd = wt_command();
- configure(&mut install_cmd);
- install_cmd
- .args(["config", "shell", "install", "nu", "--yes"])
- .current_dir(repo.root_path());
- let install_output = install_cmd.output().expect("Failed to execute install");
- assert!(
- install_output.status.success(),
- "Install should succeed:\nstderr: {}",
- String::from_utf8_lossy(&install_output.stderr)
- );
-
- let stranded_dir = xdg_data.join("nushell/vendor/autoload");
- fs::create_dir_all(&stranded_dir).unwrap();
- let stranded = stranded_dir.join("wt.nu");
- fs::copy(&canonical, &stranded).unwrap();
-
- let mut cmd = wt_command();
- configure(&mut cmd);
- cmd.args(["config", "shell", "uninstall", "nu", "--yes"])
- .current_dir(repo.root_path());
- let output = cmd.output().expect("Failed to execute uninstall");
- assert!(
- output.status.success(),
- "Uninstall should succeed:\nstderr: {}",
- String::from_utf8_lossy(&output.stderr)
- );
-
- assert!(
- !stranded.exists(),
- "Wrapper under $XDG_DATA_HOME should be deleted: {stranded:?}"
- );
-}
-
/// Test that WORKTRUNK_TEST_POWERSHELL_ENV=1 triggers PowerShell auto-detection.
/// This simulates the Windows behavior where we detect PowerShell when SHELL is not set.
#[rstest]
@@ -3236,6 +3192,8 @@ fn test_powershell_env_detection(repo: TestRepo, temp_home: TempDir) {
let mut cmd = wt_command();
repo.configure_wt_cmd(&mut cmd);
set_temp_home_env(&mut cmd, temp_home.path());
+ #[cfg(unix)]
+ mock_pwsh_reporting_conventional_profile(&mut cmd, &temp_home);
// Force PowerShell detection via test env var
cmd.env("WORKTRUNK_TEST_POWERSHELL_ENV", "1");
// Set SHELL to something non-PowerShell to ensure we're testing the override
diff --git a/tests/snapshots/integration__integration_tests__ci_status__azure_pipeline_retriable_error.snap b/tests/snapshots/integration__integration_tests__ci_status__azure_pipeline_error.snap
similarity index 100%
rename from tests/snapshots/integration__integration_tests__ci_status__azure_pipeline_retriable_error.snap
rename to tests/snapshots/integration__integration_tests__ci_status__azure_pipeline_error.snap
diff --git a/tests/snapshots/integration__integration_tests__ci_status__azure_pr_list_retriable_error.snap b/tests/snapshots/integration__integration_tests__ci_status__azure_pr_list_error.snap
similarity index 100%
rename from tests/snapshots/integration__integration_tests__ci_status__azure_pr_list_retriable_error.snap
rename to tests/snapshots/integration__integration_tests__ci_status__azure_pr_list_error.snap
diff --git a/tests/snapshots/integration__integration_tests__ci_status__gitea_commit_status_retriable_error.snap b/tests/snapshots/integration__integration_tests__ci_status__gitea_commit_status_tea_failure.snap
similarity index 100%
rename from tests/snapshots/integration__integration_tests__ci_status__gitea_commit_status_retriable_error.snap
rename to tests/snapshots/integration__integration_tests__ci_status__gitea_commit_status_tea_failure.snap
diff --git a/tests/snapshots/integration__integration_tests__ci_status__gitea_not_found.snap b/tests/snapshots/integration__integration_tests__ci_status__gitea_not_found.snap
index 4ce4a15ef..6b281e073 100644
--- a/tests/snapshots/integration__integration_tests__ci_status__gitea_not_found.snap
+++ b/tests/snapshots/integration__integration_tests__ci_status__gitea_not_found.snap
@@ -58,11 +58,11 @@ success: true
exit_code: 0
----- stdout -----
Branch Status HEAD± main↕ main…± Remote⇅ CI Path Commit Age Message
-@ main ^| | . 05a4a45 16h Initial commit
-+ feature-a ↑| ↑1 +1 | ../repo.feature-a 1b87d47 16h Add feature-a file
-+ feature-b ↑| ↑1 +1 | ../repo.feature-b f62940f 16h Add feature-b file
-+ feature-c ↑| ↑1 +1 | ../repo.feature-c 345c7c9 16h Add feature-c file
-+ feature ↑| ↑1 +1 | ../repo.feature 9c1e078 1d feat: gitea feature
+@ main ^| | ⚠ . 05a4a45 16h Initial commit
++ feature-a ↑| ↑1 +1 | ⚠ ../repo.feature-a 1b87d47 16h Add feature-a file
++ feature-b ↑| ↑1 +1 | ⚠ ../repo.feature-b f62940f 16h Add feature-b file
++ feature-c ↑| ↑1 +1 | ⚠ ../repo.feature-c 345c7c9 16h Add feature-c file
++ feature ↑| ↑1 +1 | ⚠ ../repo.feature 9c1e078 1d feat: gitea feature
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__ci_status__gitea_retriable_error.snap b/tests/snapshots/integration__integration_tests__ci_status__gitea_retriable_error.snap
deleted file mode 100644
index 6b281e073..000000000
--- a/tests/snapshots/integration__integration_tests__ci_status__gitea_retriable_error.snap
+++ /dev/null
@@ -1,69 +0,0 @@
----
-source: tests/integration_tests/ci_status.rs
-info:
- program: wt
- args:
- - list
- - "--full"
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_ALLOW_PROTOCOL: file
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_AUTHOR_EMAIL: [email protected]
- GIT_AUTHOR_NAME: Test User
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_EMAIL: [email protected]
- GIT_COMMITTER_NAME: Test User
- GIT_CONFIG_COUNT: "2"
- GIT_CONFIG_GLOBAL: /nonexistent/wt/gitconfig
- GIT_CONFIG_KEY_0: user.useConfigOnly
- GIT_CONFIG_KEY_1: rerere.enabled
- GIT_CONFIG_SYSTEM: /nonexistent/wt/gitconfig
- GIT_CONFIG_VALUE_0: "true"
- GIT_CONFIG_VALUE_1: "false"
- GIT_TERMINAL_PROMPT: "0"
- HOME: "[TEST_HOME]"
- LANG: C
- LC_ALL: C
- LLVM_PROFILE_FILE: "[LLVM_PROFILE_FILE]"
- OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"
- PATH: "[PATH]"
- TERM: alacritty
- USERPROFILE: "[TEST_HOME]"
- WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
- WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
- WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
- WORKTRUNK_TEST_BASH_INSTALLED: "0"
- WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
- WORKTRUNK_TEST_CODEX_INSTALLED: "0"
- WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
- WORKTRUNK_TEST_EPOCH: "1735776000"
- WORKTRUNK_TEST_FISH_INSTALLED: "0"
- WORKTRUNK_TEST_GEMINI_INSTALLED: "0"
- WORKTRUNK_TEST_MOCK_CONFIG_DIR: "[TEST_MOCK_CONFIG]"
- WORKTRUNK_TEST_NUSHELL_ENV: "0"
- WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
- WORKTRUNK_TEST_PARENT_SHELL: ""
- WORKTRUNK_TEST_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- WORKTRUNK_TEST_PROBE_TIMEOUT_MS: "60000"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- WORKTRUNK_TEST_ZSH_INSTALLED: "0"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: true
-exit_code: 0
------ stdout -----
- Branch Status HEAD± main↕ main…± Remote⇅ CI Path Commit Age Message
-@ main ^| | ⚠ . 05a4a45 16h Initial commit
-+ feature-a ↑| ↑1 +1 | ⚠ ../repo.feature-a 1b87d47 16h Add feature-a file
-+ feature-b ↑| ↑1 +1 | ⚠ ../repo.feature-b f62940f 16h Add feature-b file
-+ feature-c ↑| ↑1 +1 | ⚠ ../repo.feature-c 345c7c9 16h Add feature-c file
-+ feature ↑| ↑1 +1 | ⚠ ../repo.feature 9c1e078 1d feat: gitea feature
-
------ stderr -----
-
-○ Showing 5 worktrees, 4 ahead
diff --git a/tests/snapshots/integration__integration_tests__ci_status__gitea_blanked_500.snap b/tests/snapshots/integration__integration_tests__ci_status__gitea_tea_failure.snap
similarity index 100%
rename from tests/snapshots/integration__integration_tests__ci_status__gitea_blanked_500.snap
rename to tests/snapshots/integration__integration_tests__ci_status__gitea_tea_failure.snap
diff --git a/tests/snapshots/integration__integration_tests__help__help_list_long.snap b/tests/snapshots/integration__integration_tests__help__help_list_long.snap
index 49237640d..560ed00fd 100644
--- a/tests/snapshots/integration__integration_tests__help__help_list_long.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_list_long.snap
@@ -178,17 +178,17 @@ The leftmost column marks each row by physical presence, from most present to le
The CI column shows the branch's open PR/MR — #3035 on GitHub, Gitea, and Azure DevOps, !3035 on GitLab — colored by pipeline status, or a bare # when no number is available (e.g. branch workflows without a PR/MR). Green, blue, red, yellow, and gray show the pipeline state; magenta and cyan show the review state. checks object and review states give the JSON form of each value:
- Indicator Value Meaning
- ───────── ──────────────────── ───────────────────────────────────────────────────────────────
- # green "passed" All checks passed
- # blue "running" Checks in progress
- # red "failed" One or more checks failed
- # yellow "conflicts" Merge conflicts with the target branch
- # gray "no-ci" No PR/MR, or no checks configured
- ⚠ yellow "error" CI status could not be fetched (rate limit, network, etc.)
- # magenta "changes_requested" A reviewer requested changes
- # cyan "pending" A review is required (e.g. branch protection) but not yet given
- (blank) pr and checks absent Branch never pushed, or no PR/MR and no branch workflow
+ Indicator Value Meaning
+ ───────── ──────────────────── ─────────────────────────────────────────────────────────────────────────
+ # green "passed" All checks passed
+ # blue "running" Checks in progress
+ # red "failed" One or more checks failed
+ # yellow "conflicts" Merge conflicts with the target branch
+ # gray "no-ci" No PR/MR, or no checks configured
+ ⚠ yellow "error" CI status could not be fetched (not logged in, rate limit, network, etc.)
+ # magenta "changes_requested" A reviewer requested changes
+ # cyan "pending" A review is required (e.g. branch protection) but not yet given
+ (blank) pr and checks absent Branch never pushed, or no PR/MR and no branch workflow
The two remaining review states have no indicator of their own: "draft" only dims the cell and "approved" leaves the color unchanged.
diff --git a/tests/snapshots/integration__integration_tests__help__help_list_narrow_80.snap b/tests/snapshots/integration__integration_tests__help__help_list_narrow_80.snap
index e5ba6551f..03e470cff 100644
--- a/tests/snapshots/integration__integration_tests__help__help_list_narrow_80.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_list_narrow_80.snap
@@ -209,8 +209,8 @@ checks object and review states give the JSON form of each value:
# red "failed" One or more checks failed
# yellow "conflicts" Merge conflicts with the target branch
# gray "no-ci" No PR/MR, or no checks configured
- ⚠ yellow "error" CI status could not be fetched (rate limit,
- network, etc.)
+ ⚠ yellow "error" CI status could not be fetched (not logged in,
+ rate limit, network, etc.)
# magenta "changes_requested" A reviewer requested changes
# cyan "pending" A review is required (e.g. branch protection)
but not yet given