Skip to content

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

test: converge suite on semantic boundaries (#3663)

Maximilian Roos6d09125b7b18
diff --git a/docs/content/switch.md b/docs/content/switch.md
index 753154099..643b4e3ba 100644
--- a/docs/content/switch.md
+++ b/docs/content/switch.md
@@ -105,7 +105,7 @@ Typing a gutter sigil filters by row kind: `+` narrows to linked worktrees and `
4. **remote⇅** — Ahead/behind diff vs upstream tracking branch
5. **summary** — LLM-generated branch summary; requires `[list] summary = true` and [`commit.generation`](@/config.md#commit)
6. **pr** — The selected row's PR/MR, for any row whose branch has one
-7. **comments** — The PR/MR's comment thread, fetched from the forge on `--prs` rows
+7. **comments** — The PR/MR's comment thread, fetched from the forge for any row whose branch has one
On narrow previews the tab bar compacts to digits — only the active tab keeps its label — so every `Alt-N` accelerator stays visible.
@@ -185,7 +185,8 @@ Usage: <b><span class=c>wt switch</span></b> <span class=c>[OPTIONS]</span> <spa
there.
Supports <u>hook template variables</u> (<b>{{ branch }}</b>, <b>{{ worktree_path }}</b>, etc.) and filters. <b>{{</b>
-<b> base }}</b> and <b>{{ base_worktree_path }}</b> require <b>--create</b>.
+<b> base }}</b> and <b>{{ base_worktree_path }}</b> describe the source: the selected base with <b>--create</b>,
+ or the invoking worktree when switching to an existing worktree.
Especially useful with shell aliases:
diff --git a/plugins/worktrunk/skills/worktrunk/reference/switch.md b/plugins/worktrunk/skills/worktrunk/reference/switch.md
index 8e42ed949..f6c481527 100644
--- a/plugins/worktrunk/skills/worktrunk/reference/switch.md
+++ b/plugins/worktrunk/skills/worktrunk/reference/switch.md
@@ -101,7 +101,7 @@ Typing a gutter sigil filters by row kind: `+` narrows to linked worktrees and `
4. **remote⇅** — Ahead/behind diff vs upstream tracking branch
5. **summary** — LLM-generated branch summary; requires `[list] summary = true` and [`commit.generation`](https://worktrunk.dev/config/#commit)
6. **pr** — The selected row's PR/MR, for any row whose branch has one
-7. **comments** — The PR/MR's comment thread, fetched from the forge on `--prs` rows
+7. **comments** — The PR/MR's comment thread, fetched from the forge for any row whose branch has one
On narrow previews the tab bar compacts to digits — only the active tab keeps its label — so every `Alt-N` accelerator stays visible.
@@ -181,7 +181,8 @@ Options:
there.
Supports hook template variables ({{ branch }}, {{ worktree_path }}, etc.) and filters. {{
- base }} and {{ base_worktree_path }} require --create.
+ base }} and {{ base_worktree_path }} describe the source: the selected base with --create,
+ or the invoking worktree when switching to an existing worktree.
Especially useful with shell aliases:
diff --git a/skills/worktrunk/reference/switch.md b/skills/worktrunk/reference/switch.md
index 8e42ed949..f6c481527 100644
--- a/skills/worktrunk/reference/switch.md
+++ b/skills/worktrunk/reference/switch.md
@@ -101,7 +101,7 @@ Typing a gutter sigil filters by row kind: `+` narrows to linked worktrees and `
4. **remote⇅** — Ahead/behind diff vs upstream tracking branch
5. **summary** — LLM-generated branch summary; requires `[list] summary = true` and [`commit.generation`](https://worktrunk.dev/config/#commit)
6. **pr** — The selected row's PR/MR, for any row whose branch has one
-7. **comments** — The PR/MR's comment thread, fetched from the forge on `--prs` rows
+7. **comments** — The PR/MR's comment thread, fetched from the forge for any row whose branch has one
On narrow previews the tab bar compacts to digits — only the active tab keeps its label — so every `Alt-N` accelerator stays visible.
@@ -181,7 +181,8 @@ Options:
there.
Supports hook template variables ({{ branch }}, {{ worktree_path }}, etc.) and filters. {{
- base }} and {{ base_worktree_path }} require --create.
+ base }} and {{ base_worktree_path }} describe the source: the selected base with --create,
+ or the invoking worktree when switching to an existing worktree.
Especially useful with shell aliases:
diff --git a/src/cli/mod.rs b/src/cli/mod.rs
index 6eb7c9992..4ec1c6e31 100644
--- a/src/cli/mod.rs
+++ b/src/cli/mod.rs
@@ -384,7 +384,9 @@ pub(crate) struct SwitchArgs {
///
/// Supports [hook template variables](@/hook.md#template-variables)
/// (`{{ branch }}`, `{{ worktree_path }}`, etc.) and filters.
- /// `{{ base }}` and `{{ base_worktree_path }}` require `--create`.
+ /// `{{ base }}` and `{{ base_worktree_path }}` describe the source: the
+ /// selected base with `--create`, or the invoking worktree when switching
+ /// to an existing worktree.
///
/// Especially useful with shell aliases:
///
@@ -708,7 +710,7 @@ Typing a gutter sigil filters by row kind: `+` narrows to linked worktrees and `
4. **remote⇅** — Ahead/behind diff vs upstream tracking branch
5. **summary** — LLM-generated branch summary; requires `[list] summary = true` and [`commit.generation`](@/config.md#commit)
6. **pr** — The selected row's PR/MR, for any row whose branch has one
-7. **comments** — The PR/MR's comment thread, fetched from the forge on `--prs` rows
+7. **comments** — The PR/MR's comment thread, fetched from the forge for any row whose branch has one
On narrow previews the tab bar compacts to digits — only the active tab keeps its label — so every `Alt-N` accelerator stays visible.
diff --git a/src/commands/config/show.rs b/src/commands/config/show.rs
index cfa697d8f..79600c0b4 100644
--- a/src/commands/config/show.rs
+++ b/src/commands/config/show.rs
@@ -15,7 +15,7 @@ use worktrunk::config::{
use worktrunk::git::remote_ref::azure::azure_devops_extension_installed;
use worktrunk::git::{CiPlatform, ErrorExt, Repository};
use worktrunk::path::format_path_for_display;
-use worktrunk::shell::{FileDetectionResult, Shell, scan_for_detection_details};
+use worktrunk::shell::{FileDetectionResult, Shell, ZSH_PROBE_FLAGS, scan_for_detection_details};
use worktrunk::shell_exec::Cmd;
use worktrunk::styling::{
FormattedMessage, error_message, format_bash_with_gutter, format_heading, format_toml,
@@ -275,29 +275,14 @@ fn git_version() -> Option<String> {
.map(|s| s.to_string())
}
-/// Args for the interactive zsh compinit probe.
-///
-/// `+m` (disable job control) is load-bearing: without it the interactive
-/// `zsh -ic` grabs wt's controlling terminal and, if the timeout kills it
-/// first, leaves the pager to suspend with SIGTTOU. See `check_zsh_compinit_missing`
-/// and issue #3322.
-const ZSH_COMPINIT_PROBE_ARGS: [&str; 4] =
- ["--no-globalrcs", "+m", "-ic", "(( $+functions[compdef] ))"];
-
/// Check if zsh has compinit enabled by spawning an interactive shell
///
/// Returns true if compinit is NOT enabled (i.e., user needs to add it).
/// Returns false if compinit is enabled or we can't determine (fail-safe: don't warn).
///
-// TODO(zsh-compinit-probe-unify): this duplicates `shell::detect_zsh_compinit`
-// — both spawn an interactive `zsh -ic` to probe for the `compdef` function, and
-// #3322 had to add the `+m` job-control fix to both. They diverge on purpose, so
-// folding them into one parameterized probe isn't a mechanical rename: this one
-// passes `--no-globalrcs` (checks the USER's config so we only nudge when *they*
-// haven't enabled compinit) while `detect_zsh_compinit` intentionally sources
-// global rcs (so shell setup won't re-add what /etc/zshrc already enables); they
-// also differ in result type (bool vs Option<bool>) and runner (`Cmd` vs raw
-// `Command`). Unify behind one `probe_zsh_compdef(no_globalrcs: bool)` helper.
+// This remains separate from `shell::detect_zsh_compinit`: config show skips
+// global rcs, reads the exit status, and uses `Cmd`; shell setup sources global
+// rcs, reads marker output, and manages a raw `Command`.
fn check_zsh_compinit_missing() -> bool {
// Allow tests to bypass this check since zsh subprocess behavior varies across CI envs
if std::env::var("WORKTRUNK_TEST_COMPINIT_CONFIGURED").is_ok() {
@@ -330,7 +315,9 @@ fn check_zsh_compinit_missing() -> bool {
// spawned moments later (config show always pages) raises SIGTTOU,
// suspending the command (`suspended (tty output)`). See issue #3322.
let Ok(output) = Cmd::new("zsh")
- .args(ZSH_COMPINIT_PROBE_ARGS)
+ .arg("--no-globalrcs")
+ .args(ZSH_PROBE_FLAGS)
+ .arg("(( $+functions[compdef] ))")
.env("ZSH_DISABLE_COMPFIX", "true")
.timeout(std::time::Duration::from_secs(2))
.run()
@@ -1674,25 +1661,6 @@ mod tests {
assert!(!is_newer_version("0.23.2", "invalid"));
}
- /// Regression guard for #3322: the interactive zsh compinit probe must
- /// disable job control (`+m`). Without it, the probe grabs wt's controlling
- /// terminal; a timeout-kill then leaves wt in a background process group and
- /// the `wt config show` pager suspends with SIGTTOU (`suspended (tty output)`).
- #[test]
- fn test_compinit_probe_disables_job_control() {
- assert!(
- ZSH_COMPINIT_PROBE_ARGS.contains(&"+m"),
- "compinit probe must pass +m to disable job control (#3322); got {ZSH_COMPINIT_PROBE_ARGS:?}"
- );
- // `+m` must precede `-ic` so it's parsed as an option, not a command arg.
- let m = ZSH_COMPINIT_PROBE_ARGS.iter().position(|a| *a == "+m");
- let ic = ZSH_COMPINIT_PROBE_ARGS.iter().position(|a| *a == "-ic");
- assert!(
- m < ic,
- "+m must come before -ic: {ZSH_COMPINIT_PROBE_ARGS:?}"
- );
- }
-
#[test]
fn test_format_version_status() {
// A version far above the current crate version is "newer".
diff --git a/src/commands/list/ci_status/github.rs b/src/commands/list/ci_status/github.rs
index 0071c707a..a10ce83a7 100644
--- a/src/commands/list/ci_status/github.rs
+++ b/src/commands/list/ci_status/github.rs
@@ -365,11 +365,11 @@ impl From<&GitHubComment> for CommentEntry {
/// - `StatusContext` (external CI like pre-commit.ci): has `state` only
/// ("SUCCESS", "FAILURE", "PENDING", "ERROR")
///
-/// We parse all three fields and check whichever is present. An alternative approach would be
-/// `gh pr checks <number> --json state` which returns a flat array with unified `state` field,
-/// but that requires a separate API call after finding the PR number. Since we also need
-/// `gh run list` for branch-based CI (branches without PRs), keeping the single-call approach
-/// here is simpler overall.
+/// We parse all three fields and check whichever is present. Using
+/// `gh pr checks <number> --json state` would require a second call after PR
+/// discovery, while `statusCheckRollup` returns PR metadata and CI status
+/// together. A branch without a PR has no rollup, so
+/// [`detect_github_commit_checks`] queries the commit's check-runs API separately.
#[derive(Debug, Deserialize)]
pub(crate) struct GitHubCheck {
/// CheckRun only: "COMPLETED", "IN_PROGRESS", "QUEUED", etc.
@@ -538,157 +538,59 @@ mod tests {
#[test]
fn test_github_pr_info_ci_status() {
- // No checks = NoCI
- let pr = GitHubPrInfo {
- number: None,
- head_ref_oid: None,
- merge_state_status: None,
- status_check_rollup: None,
- url: None,
- head_repository_owner: None,
- title: None,
- body: None,
- comments: Vec::new(),
- review_decision: None,
- is_draft: None,
- updated_at: None,
- author: None,
- };
- assert_eq!(pr.ci_status(), CiStatus::NoCI);
-
- // Empty checks = NoCI
- let pr = GitHubPrInfo {
- number: None,
- head_ref_oid: None,
- merge_state_status: None,
- status_check_rollup: Some(vec![]),
- url: None,
- head_repository_owner: None,
- title: None,
- body: None,
- comments: Vec::new(),
- review_decision: None,
- is_draft: None,
- updated_at: None,
- author: None,
- };
- assert_eq!(pr.ci_status(), CiStatus::NoCI);
-
- // CheckRun pending states
- for status in ["IN_PROGRESS", "QUEUED", "PENDING", "EXPECTED"] {
- let pr = GitHubPrInfo {
- number: None,
- head_ref_oid: None,
- merge_state_status: None,
- status_check_rollup: Some(vec![GitHubCheck {
- status: Some(status.into()),
- conclusion: None,
- state: None,
- }]),
- url: None,
- head_repository_owner: None,
- title: None,
- body: None,
- comments: Vec::new(),
- review_decision: None,
- is_draft: None,
- updated_at: None,
- author: None,
- };
- assert_eq!(pr.ci_status(), CiStatus::Running, "status={status}");
- }
-
- // StatusContext pending
- let pr = GitHubPrInfo {
- number: None,
- head_ref_oid: None,
- merge_state_status: None,
- status_check_rollup: Some(vec![GitHubCheck {
- status: None,
- conclusion: None,
- state: Some("PENDING".into()),
- }]),
- url: None,
- head_repository_owner: None,
- title: None,
- body: None,
- comments: Vec::new(),
- review_decision: None,
- is_draft: None,
- updated_at: None,
- author: None,
- };
- assert_eq!(pr.ci_status(), CiStatus::Running);
-
- // CheckRun failures
- for conclusion in ["FAILURE", "ERROR", "CANCELLED"] {
- let pr = GitHubPrInfo {
- number: None,
- head_ref_oid: None,
- merge_state_status: None,
- status_check_rollup: Some(vec![GitHubCheck {
- status: Some("COMPLETED".into()),
- conclusion: Some(conclusion.into()),
- state: None,
- }]),
- url: None,
- head_repository_owner: None,
- title: None,
- body: None,
- comments: Vec::new(),
- review_decision: None,
- is_draft: None,
- updated_at: None,
- author: None,
- };
- assert_eq!(pr.ci_status(), CiStatus::Failed, "conclusion={conclusion}");
- }
+ let cases = [
+ (r#"{}"#, CiStatus::NoCI),
+ (r#"{"statusCheckRollup":[]}"#, CiStatus::NoCI),
+ (
+ r#"{"statusCheckRollup":[{"status":"IN_PROGRESS"}]}"#,
+ CiStatus::Running,
+ ),
+ (
+ r#"{"statusCheckRollup":[{"status":"QUEUED"}]}"#,
+ CiStatus::Running,
+ ),
+ (
+ r#"{"statusCheckRollup":[{"status":"PENDING"}]}"#,
+ CiStatus::Running,
+ ),
+ (
+ r#"{"statusCheckRollup":[{"status":"EXPECTED"}]}"#,
+ CiStatus::Running,
+ ),
+ (
+ r#"{"statusCheckRollup":[{"state":"PENDING"}]}"#,
+ CiStatus::Running,
+ ),
+ (
+ r#"{"statusCheckRollup":[{"status":"COMPLETED","conclusion":"FAILURE"}]}"#,
+ CiStatus::Failed,
+ ),
+ (
+ r#"{"statusCheckRollup":[{"status":"COMPLETED","conclusion":"ERROR"}]}"#,
+ CiStatus::Failed,
+ ),
+ (
+ r#"{"statusCheckRollup":[{"status":"COMPLETED","conclusion":"CANCELLED"}]}"#,
+ CiStatus::Failed,
+ ),
+ (
+ r#"{"statusCheckRollup":[{"state":"FAILURE"}]}"#,
+ CiStatus::Failed,
+ ),
+ (
+ r#"{"statusCheckRollup":[{"state":"ERROR"}]}"#,
+ CiStatus::Failed,
+ ),
+ (
+ r#"{"statusCheckRollup":[{"status":"COMPLETED","conclusion":"SUCCESS"}]}"#,
+ CiStatus::Passed,
+ ),
+ ];
- // StatusContext failures
- for state in ["FAILURE", "ERROR"] {
- let pr = GitHubPrInfo {
- number: None,
- head_ref_oid: None,
- merge_state_status: None,
- status_check_rollup: Some(vec![GitHubCheck {
- status: None,
- conclusion: None,
- state: Some(state.into()),
- }]),
- url: None,
- head_repository_owner: None,
- title: None,
- body: None,
- comments: Vec::new(),
- review_decision: None,
- is_draft: None,
- updated_at: None,
- author: None,
- };
- assert_eq!(pr.ci_status(), CiStatus::Failed, "state={state}");
+ for (json, expected) in cases {
+ let pr: GitHubPrInfo = serde_json::from_str(json).expect("valid GitHub PR JSON");
+ assert_eq!(pr.ci_status(), expected, "json={json}");
}
-
- // Success
- let pr = GitHubPrInfo {
- number: None,
- head_ref_oid: None,
- merge_state_status: None,
- status_check_rollup: Some(vec![GitHubCheck {
- status: Some("COMPLETED".into()),
- conclusion: Some("SUCCESS".into()),
- state: None,
- }]),
- url: None,
- head_repository_owner: None,
- title: None,
- body: None,
- comments: Vec::new(),
- review_decision: None,
- is_draft: None,
- updated_at: None,
- author: None,
- };
- assert_eq!(pr.ci_status(), CiStatus::Passed);
}
#[test]
@@ -935,6 +837,17 @@ mod tests {
];
assert_eq!(aggregate_github_checks(&checks), CiStatus::Running);
+ // A pending StatusContext also takes priority over a successful CheckRun
+ let checks = vec![
+ check("completed", Some("success")),
+ GitHubCheck {
+ status: None,
+ conclusion: None,
+ state: Some("PENDING".into()),
+ },
+ ];
+ assert_eq!(aggregate_github_checks(&checks), CiStatus::Running);
+
// All success = Passed
let checks = vec![
check("completed", Some("success")),
diff --git a/src/commands/list/ci_status/mod.rs b/src/commands/list/ci_status/mod.rs
index 1cc43c006..305c32e30 100644
--- a/src/commands/list/ci_status/mod.rs
+++ b/src/commands/list/ci_status/mod.rs
@@ -857,6 +857,25 @@ mod tests {
};
assert_snapshot!(error.format_cell(usize::MAX, LinkStyle::Unlinked), @"⚠");
+ // A PR or MR without CI still keeps its forge reference
+ let no_ci_pr = PrStatus {
+ ci_status: CiStatus::NoCI,
+ ..pr.clone()
+ };
+ assert_snapshot!(
+ no_ci_pr.format_cell(usize::MAX, LinkStyle::Unlinked),
+ @"#123"
+ );
+ let no_ci_mr = PrStatus {
+ ci_status: CiStatus::NoCI,
+ number: Some(PrRef::mr(7)),
+ ..pr.clone()
+ };
+ assert_snapshot!(
+ no_ci_mr.format_cell(usize::MAX, LinkStyle::Unlinked),
+ @"!7"
+ );
+
// GitLab sigil
let mr = PrStatus {
number: Some(PrRef::mr(7)),
diff --git a/src/commands/picker/mod.rs b/src/commands/picker/mod.rs
index 097b35681..9441200fd 100644
--- a/src/commands/picker/mod.rs
+++ b/src/commands/picker/mod.rs
@@ -119,7 +119,7 @@ use skim::prelude::*;
use skim::reader::CommandCollector;
use skim::tui::event::ActionCallback;
use worktrunk::HookType;
-use worktrunk::config::Approvals;
+use worktrunk::config::{Approvals, CommitGenerationConfig};
use worktrunk::git::{ErrorExt, Repository, current_or_recover};
use worktrunk::path::format_path_for_display;
use worktrunk::styling::{eprintln, error_message, hint_message, info_message, warning_message};
@@ -145,14 +145,9 @@ use preview_orchestrator::PreviewOrchestrator;
/// during the picker would corrupt skim's frame, so collect routes warnings
/// through `PickerProgressHandler::stash_warning` and we emit them here.
///
-/// TODO(picker-feedback): the declined-removal diagnostics (the main-worktree /
-/// dirty / unmerged "can't remove this row" messages from the `alt-x` keep paths)
-/// only surface here, on exit — the user presses `alt-x`, the row visibly stays,
-/// and the reason scrolls past after they quit. Consider a short in-picker message
-/// at `alt-x` time so the *why* lands immediately. skim has no footer slot (see the
-/// dropped Stall-indicator work), so the realistic slot is the header line — swap
-/// it to a transient "main worktree can't be removed" for a beat, then restore. The
-/// stash stays the fallback for background failures that surface after exit.
+/// Declined removals also explain themselves immediately through
+/// [`items::HeaderFlash`]. The stash remains the durable exit-time copy and the
+/// fallback for background failures that surface after the picker frame.
fn drain_stashed_warnings(stash: &Mutex<Vec<String>>) {
for line in stash.lock().unwrap().drain(..) {
eprintln!("{line}");
@@ -1577,6 +1572,63 @@ impl PipelineFactory {
}
}
+/// Select the command or guidance shown by the picker's Summary tab.
+///
+/// The caller supplies the resolved display path so this decision stays pure:
+/// runtime config-path resolution remains at the command boundary, while direct
+/// tests can use an explicit isolated path.
+fn summary_command_and_hint(
+ summaries_enabled: bool,
+ commit_generation: &CommitGenerationConfig,
+ config_path: &str,
+) -> (Option<String>, Option<String>) {
+ let generation_configured = commit_generation.is_configured();
+ if summaries_enabled && generation_configured {
+ return (commit_generation.command.clone(), None);
+ }
+
+ // Keep every prose line short and put the resolved path on its own
+ // line. `render_summary` word-wraps prose to the preview width, and
+ // that width is a column narrower under Windows' PTY — so a sentence
+ // long enough to wrap lands its break on a different word there.
+ // A short lead line, the path alone (one unbreakable token, no wrap
+ // boundary to shift), and the fenced config block (code blocks are
+ // never wrapped) all render identically on every platform. The first
+ // line stays the bold H4 subject, which `render_summary` promotes and
+ // never wraps.
+ let hint = if generation_configured {
+ format!(
+ r#"Summaries off
+
+Enable summaries in:
+{config_path}
+
+```toml
+[list]
+summary = true
+```
+"#
+ )
+ } else {
+ format!(
+ r#"Summaries not configured
+
+Add a [commit.generation] command in:
+{config_path}
+
+```toml
+[commit.generation]
+command = "llm -m haiku"
+
+[list]
+summary = true
+```
+"#
+ )
+ };
+ (None, Some(hint))
+}
+
pub fn handle_picker(
cli_branches: bool,
cli_remotes: bool,
@@ -1766,57 +1818,17 @@ pub fn handle_picker(
.dimensions_for(term_width, term_height, num_items_estimate);
let preview_window_spec = state.initial_layout.spec_for(preview_dims);
- // Summary hint: when summaries are disabled, prime the Summary cache
- // with config guidance instead of showing a perpetual "Generating…"
- // placeholder.
- let (llm_command, summary_hint) =
- if config.list.summary() && config.commit_generation.is_configured() {
- (config.commit_generation.command.clone(), None)
- } else {
- // Point at the config file wt actually loads from, not a hardcoded
- // default (resolution + fallback live in `config_path_for_display`).
- let config_path = worktrunk::config::config_path_for_display();
- // Keep every prose line short and put the resolved path on its own
- // line. `render_summary` word-wraps prose to the preview width, and
- // that width is a column narrower under Windows' PTY — so a sentence
- // long enough to wrap lands its break on a different word there, and
- // the single cross-platform snapshot can't match. A short lead line,
- // the path alone (one unbreakable token, no wrap boundary to shift),
- // and the fenced config block (code blocks are never wrapped) all
- // render identically on every platform. The first line stays the bold
- // H4 subject, which `render_summary` promotes and never wraps.
- let hint = if !config.commit_generation.is_configured() {
- format!(
- r#"Summaries not configured
-
-Add a [commit.generation] command in:
-{config_path}
-
-```toml
-[commit.generation]
-command = "llm -m haiku"
-
-[list]
-summary = true
-```
-"#
- )
- } else {
- format!(
- r#"Summaries off
-
-Enable summaries in:
-{config_path}
-
-```toml
-[list]
-summary = true
-```
-"#
- )
- };
- (None, Some(hint))
- };
+ // When summary generation is unavailable, prime the Summary cache with
+ // config guidance instead of showing a perpetual "Generating…" placeholder.
+ // Point at the config file wt actually loads from, not a hardcoded default
+ // (resolution + fallback live in `config_path_for_display`). Resolve it at
+ // this runtime boundary rather than inside the pure decision helper.
+ let config_path = worktrunk::config::config_path_for_display();
+ let (llm_command, summary_hint) = summary_command_and_hint(
+ config.list.summary(),
+ &config.commit_generation,
+ &config_path,
+ );
// The picker's full row list — header, worktree/branch rows, and (in `--prs`
// mode) PR/MR rows. `on_skeleton` fills it with the header + worktree/branch
@@ -2520,18 +2532,71 @@ pub mod tests {
use super::{
AltXRemover, PickerAction, PickerRemovalTarget, RemovalEffect, drain_stashed_warnings,
install_preview_tab_keybindings, install_shortcut_keybindings, picker_item_identifier,
- resolve_identifier, resolve_shortcut_branch, resolve_shortcut_url, switch_pipeline_repo,
+ resolve_identifier, resolve_shortcut_branch, resolve_shortcut_url,
+ summary_command_and_hint, switch_pipeline_repo,
};
use crate::commands::list::model::{BranchScope, ItemKind, ListItem, WorktreeData};
use crate::commands::worktree::RemovalPlan;
+ use insta::assert_yaml_snapshot;
use skim::prelude::SkimItem;
use std::fs;
use std::path::Path;
use std::sync::{Arc, Mutex, OnceLock};
use std::time::{Duration, Instant};
- use worktrunk::config::Approvals;
+ use worktrunk::config::{Approvals, CommitGenerationConfig};
use worktrunk::git::BranchDeletionMode;
+ #[test]
+ fn summary_command_and_hint_covers_configuration_matrix() {
+ #[derive(serde::Serialize)]
+ struct Decision {
+ case: &'static str,
+ command: Option<String>,
+ hint: Option<String>,
+ }
+
+ let cases = [
+ ("summaries off + no command", false, None),
+ ("summaries on + no command", true, None),
+ ("summaries off + command", false, Some("llm -m haiku")),
+ ("summaries on + command", true, Some("llm -m haiku")),
+ ];
+ let decisions = cases
+ .into_iter()
+ .map(|(case, summaries_enabled, command)| {
+ let commit_generation = CommitGenerationConfig {
+ command: command.map(str::to_string),
+ ..Default::default()
+ };
+ let (command, hint) = summary_command_and_hint(
+ summaries_enabled,
+ &commit_generation,
+ "[TEST_CONFIG]",
+ );
+ Decision {
+ case,
+ command,
+ hint,
+ }
+ })
+ .collect::<Vec<_>>();
+
+ assert_yaml_snapshot!(decisions, @r#"
+ - case: summaries off + no command
+ command: ~
+ hint: "Summaries not configured\n\nAdd a [commit.generation] command in:\n[TEST_CONFIG]\n\n```toml\n[commit.generation]\ncommand = \"llm -m haiku\"\n\n[list]\nsummary = true\n```\n"
+ - case: summaries on + no command
+ command: ~
+ hint: "Summaries not configured\n\nAdd a [commit.generation] command in:\n[TEST_CONFIG]\n\n```toml\n[commit.generation]\ncommand = \"llm -m haiku\"\n\n[list]\nsummary = true\n```\n"
+ - case: summaries off + command
+ command: ~
+ hint: "Summaries off\n\nEnable summaries in:\n[TEST_CONFIG]\n\n```toml\n[list]\nsummary = true\n```\n"
+ - case: summaries on + command
+ command: llm -m haiku
+ hint: ~
+ "#);
+ }
+
/// Empties the stash and emits each line. Verifies post-skim drain
/// semantics without standing up a real picker.
#[test]
@@ -4290,89 +4355,119 @@ pub mod tests {
);
}
- /// `removal_targets_current_worktree` fires only for a `Worktree` whose
- /// `changed_directory` flag is set (the worktree the picker was launched from);
- /// a non-current worktree and any `BranchOnly` row read as `false`.
+ /// End-to-end through `apply`: alt-x on the worktree the picker was launched
+ /// from keeps its exact row in place and stashes the canonical explanation.
+ ///
+ /// The branch is deliberately unmerged. `prepare_removal` therefore proves
+ /// this is both the current worktree (`changed_directory`) and a kept-branch
+ /// worktree removal (`integration_reason == None`): without the current-row
+ /// guard, dispatch would enter the morph path and start background deletion.
+ /// `RemovalEffect::Kept` proves the synchronous guard wins instead, so the
+ /// immediate survival assertions do not race an asynchronous removal.
#[test]
- fn test_removal_targets_current_worktree() {
- let path = std::path::PathBuf::from("/repo.feature");
- let worktree = |changed_directory| RemovalPlan::Worktree {
- main_path: std::path::PathBuf::from("/repo"),
- worktree_path: path.clone(),
- changed_directory,
- branch_name: Some("feature".to_string()),
- deletion_mode: BranchDeletionMode::SafeDelete,
- target_branch: Some("main".to_string()),
- integration_reason: None,
- force_worktree: false,
- removed_commit: None,
- branch_checked_out_at: None,
- };
- assert!(
- super::removal_targets_current_worktree(&worktree(true)),
- "removing the worktree the picker was launched from"
- );
- assert!(
- !super::removal_targets_current_worktree(&worktree(false)),
- "removing some other worktree"
- );
- assert!(
- !super::removal_targets_current_worktree(&RemovalPlan::BranchOnly {
- branch_name: "feature".to_string(),
- deletion_mode: BranchDeletionMode::SafeDelete,
- prune_entry: None,
- target_branch: None,
- integration_reason: None,
- branch_checked_out_at: None,
- }),
- "a branch-only row has no worktree to be standing in"
- );
- }
+ fn test_apply_keeps_current_worktree_row() {
+ let mut test = worktrunk::testing::TestRepo::with_initial_commit();
+ test.add_worktree_with_commit("standing-here", "new.txt", "unmerged work", "unmerged work");
- /// `keep_current_worktree_row` keeps the row in place and stashes the
- /// can't-remove-current-worktree info + switch-away hint — alt-x on the current
- /// worktree never removes it and never spawns a background removal.
- #[test]
- fn test_keep_current_worktree_row() {
- let test = worktrunk::testing::TestRepo::with_initial_commit();
- let repo = worktrunk::git::Repository::at(test.path()).unwrap();
+ let main_repo = worktrunk::git::Repository::at(test.path()).unwrap();
+ let reported_path = main_repo
+ .list_worktrees()
+ .unwrap()
+ .iter()
+ .find(|wt| wt.branch.as_deref() == Some("standing-here"))
+ .map(|wt| wt.path.clone())
+ .expect("standing-here worktree is listed");
+ let repo = worktrunk::git::Repository::at(&reported_path).unwrap();
+ assert_eq!(
+ repo.current_worktree().root().unwrap(),
+ reported_path,
+ "the removal repository is genuinely anchored in the linked worktree"
+ );
- let item = branched_picker_item("current", &test.path().join("current"));
+ let item = branched_picker_item("standing-here", &reported_path);
let token = item.output().to_string();
let items = Arc::new(Mutex::new(vec![Arc::clone(&item)]));
let remover = test_remover(Arc::clone(&items), repo.clone());
- remover.keep_current_worktree_row();
-
+ let target = PickerRemovalTarget::from_signal(&token).expect("worktree token parses");
+ let (planning_repo, plan) = remover.prepare_removal(&target).unwrap();
+ let RemovalPlan::Worktree {
+ worktree_path,
+ changed_directory,
+ branch_name,
+ integration_reason,
+ ..
+ } = &plan
+ else {
+ panic!("a linked-worktree token must prepare a worktree removal");
+ };
+ assert_eq!(worktree_path, &reported_path);
+ assert!(*changed_directory, "the target is the current worktree");
+ assert_eq!(branch_name.as_deref(), Some("standing-here"));
assert_eq!(
- items
- .lock()
- .unwrap()
- .iter()
- .map(|item| item.output().into_owned())
- .collect::<Vec<_>>(),
- vec![token.clone()],
- "the current worktree row is kept, not removed"
+ integration_reason, &None,
+ "the branch is unmerged and would be kept"
);
- let warnings = remover.stashed_warnings.lock().unwrap().clone();
+ assert_eq!(
+ super::worktree_removal_keeps_branch(&planning_repo, &plan).as_deref(),
+ Some("standing-here"),
+ "without the current-worktree guard, dispatch would enter the morph path"
+ );
+
+ let effect = remover.apply(token.clone());
assert!(
- warnings.iter().any(|w| w.contains("current worktree")),
- "stashes the can't-remove-current-worktree info: {warnings:?}"
+ matches!(effect, RemovalEffect::Kept),
+ "the current-worktree guard is synchronous and starts no removal"
);
+
+ {
+ let rows = items.lock().unwrap();
+ assert_eq!(rows.len(), 1);
+ assert!(
+ Arc::ptr_eq(&rows[0], &item),
+ "apply keeps the exact selected row"
+ );
+ assert_eq!(
+ rows[0].output().as_ref(),
+ token,
+ "the row's selection token is unchanged"
+ );
+ }
assert!(
- warnings
- .iter()
- .any(|w| w.contains("Switch to another worktree")),
- "stashes the switch-away hint: {warnings:?}"
+ reported_path.is_dir(),
+ "the synchronous keep guard preserves the worktree directory"
+ );
+ assert!(
+ repo.branch("standing-here").exists_locally().unwrap(),
+ "the synchronous keep guard preserves the branch"
);
- // A second alt-x on the same kept row dedups — the stash doesn't grow.
- remover.keep_current_worktree_row();
+ let warnings = remover.stashed_warnings.lock().unwrap().clone();
+ assert_eq!(
+ warnings,
+ vec![
+ worktrunk::styling::info_message(
+ "Can't remove the current worktree from the picker"
+ )
+ .to_string(),
+ worktrunk::styling::hint_message("Switch to another worktree first").to_string(),
+ ],
+ "apply stashes the canonical current-worktree diagnostic and hint"
+ );
+
+ let second_effect = remover.apply(token.clone());
+ assert!(matches!(second_effect, RemovalEffect::Kept));
assert_eq!(
- remover.stashed_warnings.lock().unwrap().len(),
- warnings.len(),
+ *remover.stashed_warnings.lock().unwrap(),
+ warnings,
"repeated alt-x on the current worktree stashes the hint only once"
);
+ let rows = items.lock().unwrap();
+ assert_eq!(rows.len(), 1);
+ assert!(Arc::ptr_eq(&rows[0], &item));
+ assert_eq!(rows[0].output().as_ref(), token);
+ assert!(reported_path.is_dir());
+ assert!(repo.branch("standing-here").exists_locally().unwrap());
}
/// The header flash a declined alt-x sets self-clears after the beat: the timer
diff --git a/src/commands/picker/progressive_handler.rs b/src/commands/picker/progressive_handler.rs
index d67090f42..93331aeac 100644
--- a/src/commands/picker/progressive_handler.rs
+++ b/src/commands/picker/progressive_handler.rs
@@ -908,9 +908,7 @@ mod tests {
/// differ: an update for a row the cursor isn't on, while a diff tab shows,
/// for an unchanged status, or for an `is_priming`-only flip (which the
/// `pr` / `comments` panes don't draw) repaints the list (`Event::Render`)
- /// but must not re-run the preview — a re-run resets its scroll. Fast
- /// producer-site guard for that wiring; the end-to-end path is also covered
- /// by the PTY test `test_switch_picker_pr_tab_auto_resolves_from_fetching`.
+ /// but must not re-run the preview — a re-run resets its scroll.
#[test]
fn on_update_pokes_run_preview_only_when_the_visible_pane_changes() {
use crate::commands::list::ci_status::{CiSource, CiStatus, PrRef, PrStatus};
@@ -1599,11 +1597,14 @@ mod tests {
// Static Summary hint primed for every item at skeleton time.
for branch in ["alpha", "beta", "gamma"] {
- assert!(
- handler
- .preview_cache
- .contains_key(&(branch.into(), PreviewMode::Summary)),
- "Summary hint should be filled for {branch} at skeleton time"
+ let key = (branch.to_string(), PreviewMode::Summary);
+ let hint = handler.preview_cache.get(&key).unwrap_or_else(|| {
+ panic!("Summary hint should be filled for {branch} at skeleton time")
+ });
+ assert_eq!(
+ hint.value(),
+ "disabled",
+ "Summary cache should contain the selected hint for {branch}"
);
}
diff --git a/src/commands/worktree/resolve.rs b/src/commands/worktree/resolve.rs
index 2374bd4ce..2b5de02ea 100644
--- a/src/commands/worktree/resolve.rs
+++ b/src/commands/worktree/resolve.rs
@@ -269,53 +269,45 @@ mod tests {
use super::*;
#[test]
- fn test_template_references_repo_name_default() {
- // Default template uses {{ repo }}
- assert!(template_references_repo_name(
- "{{ repo_path }}/../{{ repo }}.{{ branch | sanitize }}"
- ));
- }
-
- #[test]
- fn test_template_references_repo_name_with_filter() {
- assert!(template_references_repo_name("{{ repo | sanitize }}"));
- }
-
- #[test]
- fn test_template_references_repo_name_deprecated_alias() {
- assert!(template_references_repo_name(
- "{{ main_worktree }}.{{ branch }}"
- ));
- }
-
- #[test]
- fn test_template_references_repo_name_not_repo_path() {
- // {{ repo_path }} should NOT match
- assert!(!template_references_repo_name(
- "{{ repo_path }}/../{{ branch | sanitize }}"
- ));
- }
-
- #[test]
- fn test_template_references_repo_name_no_repo() {
- assert!(!template_references_repo_name("../{{ branch | sanitize }}"));
- }
-
- #[test]
- fn test_template_references_repo_name_no_spaces() {
- assert!(template_references_repo_name("{{repo}}.{{branch}}"));
- }
-
- #[test]
- fn test_template_references_repo_name_no_braces() {
- // "repo" outside template expressions should not match
- assert!(!template_references_repo_name("my-repo-path/{{ branch }}"));
- }
-
- #[test]
- fn test_template_references_repo_name_substring_prefix() {
- // "myrepo" should NOT match — "repo" is a suffix of a longer identifier
- assert!(!template_references_repo_name("{{ myrepo }}"));
- assert!(!template_references_repo_name("{{ norepo }}"));
+ fn test_template_references_repo_name() {
+ let cases = [
+ (
+ "default template",
+ "{{ repo_path }}/../{{ repo }}.{{ branch | sanitize }}",
+ true,
+ ),
+ ("repo with filter", "{{ repo | sanitize }}", true),
+ (
+ "deprecated main_worktree alias",
+ "{{ main_worktree }}.{{ branch }}",
+ true,
+ ),
+ (
+ "repo_path is a distinct variable",
+ "{{ repo_path }}/../{{ branch | sanitize }}",
+ false,
+ ),
+ (
+ "no repository variable",
+ "../{{ branch | sanitize }}",
+ false,
+ ),
+ ("expression without spaces", "{{repo}}.{{branch}}", true),
+ (
+ "repo outside an expression",
+ "my-repo-path/{{ branch }}",
+ false,
+ ),
+ ("repo suffix in myrepo", "{{ myrepo }}", false),
+ ("repo suffix in norepo", "{{ norepo }}", false),
+ ];
+
+ for (name, template, expected) in cases {
+ assert_eq!(
+ template_references_repo_name(template),
+ expected,
+ "{name}: {template}"
+ );
+ }
}
}
diff --git a/src/commands/worktree/types.rs b/src/commands/worktree/types.rs
index 5e569b829..f912b8a00 100644
--- a/src/commands/worktree/types.rs
+++ b/src/commands/worktree/types.rs
@@ -392,13 +392,6 @@ impl RemovalPlan {
mod tests {
use super::*;
- #[test]
- fn test_switch_result_path_already_at() {
- let path = PathBuf::from("/test/path");
- let result = SwitchResult::AlreadyAt(path.clone());
- assert_eq!(result.path(), &path);
- }
-
#[cfg(unix)]
#[test]
fn remove_result_branch_name_reads_both_variants() {
@@ -483,40 +476,51 @@ mod tests {
}
#[test]
- fn test_switch_result_path_existing() {
- let path = PathBuf::from("/test/existing");
- let result = SwitchResult::Existing { path: path.clone() };
- assert_eq!(result.path(), &path);
- }
-
- #[test]
- fn test_switch_result_path_created() {
- let path = PathBuf::from("/test/created");
- let result = SwitchResult::Created {
- path: path.clone(),
- created_branch: true,
- base_branch: Some("main".to_string()),
- base_worktree_path: Some("/test/main".to_string()),
- from_remote: None,
- pr_number: None,
- pr_url: None,
- };
- assert_eq!(result.path(), &path);
- }
+ fn test_switch_result_path() {
+ let cases = [
+ (
+ "already at worktree",
+ SwitchResult::AlreadyAt(PathBuf::from("/test/path")),
+ PathBuf::from("/test/path"),
+ ),
+ (
+ "existing worktree",
+ SwitchResult::Existing {
+ path: PathBuf::from("/test/existing"),
+ },
+ PathBuf::from("/test/existing"),
+ ),
+ (
+ "created branch",
+ SwitchResult::Created {
+ path: PathBuf::from("/test/created"),
+ created_branch: true,
+ base_branch: Some("main".to_string()),
+ base_worktree_path: Some("/test/main".to_string()),
+ from_remote: None,
+ pr_number: None,
+ pr_url: None,
+ },
+ PathBuf::from("/test/created"),
+ ),
+ (
+ "created from remote",
+ SwitchResult::Created {
+ path: PathBuf::from("/test/remote"),
+ created_branch: false,
+ base_branch: None,
+ base_worktree_path: None,
+ from_remote: Some("origin/feature".to_string()),
+ pr_number: None,
+ pr_url: None,
+ },
+ PathBuf::from("/test/remote"),
+ ),
+ ];
- #[test]
- fn test_switch_result_created_with_remote() {
- let path = PathBuf::from("/test/remote");
- let result = SwitchResult::Created {
- path: path.clone(),
- created_branch: false,
- base_branch: None,
- base_worktree_path: None,
- from_remote: Some("origin/feature".to_string()),
- pr_number: None,
- pr_url: None,
- };
- assert_eq!(result.path(), &path);
+ for (name, result, expected) in cases {
+ assert_eq!(result.path(), &expected, "{name}");
+ }
}
#[test]
diff --git a/src/config/deprecation.rs b/src/config/deprecation.rs
index 99da93300..c8c2af145 100644
--- a/src/config/deprecation.rs
+++ b/src/config/deprecation.rs
@@ -1978,6 +1978,8 @@ pub fn with_scope_note(message: String, other_description: &str, key: &str) -> S
#[cfg(test)]
mod tests {
use super::*;
+ use ansi_str::AnsiStr;
+ use insta::assert_snapshot;
/// `USER_ONLY_COMMIT_GENERATION_PATHS` must stay in sync with
/// `CommitGenerationConfig`: every key except the project-valid
@@ -4325,25 +4327,6 @@ pager = "delta"
assert_eq!(result, content);
}
- #[test]
- fn test_format_deprecation_warnings_switch_picker_timeout() {
- let info = DeprecationInfo {
- config_path: std::path::PathBuf::from("/tmp/test-config.toml"),
- deprecations: vec![DeprecationKind::SwitchPickerTimeout],
- kind: ConfigFileKind::User,
- main_worktree_path: None,
- };
- let output = format_deprecation_warnings(&info);
- assert!(
- output.contains("switch.picker.timeout-ms"),
- "Should mention the field: {output}"
- );
- assert!(
- output.contains("no longer used"),
- "Should explain deprecation reason: {output}"
- );
- }
-
#[test]
fn test_detect_list_task_timeout_top_level() {
let content = r#"
@@ -4423,38 +4406,49 @@ timeout-ms = 500
assert_eq!(result, content);
}
- #[test]
- fn test_format_deprecation_warnings_list_task_timeout() {
- let info = DeprecationInfo {
- config_path: std::path::PathBuf::from("/tmp/test-config.toml"),
- deprecations: vec![DeprecationKind::ListTaskTimeout],
- kind: ConfigFileKind::User,
- main_worktree_path: None,
- };
- let output = format_deprecation_warnings(&info);
- assert!(
- output.contains("list.task-timeout-ms"),
- "Should mention the field: {output}"
- );
- assert!(
- output.contains("list.timeout-ms"),
- "Should point at the surviving budget: {output}"
- );
- }
-
// ==================== negated bool format + migration tests ====================
#[test]
- fn test_format_deprecation_warnings_no_ff_and_no_cd() {
+ fn test_format_deprecation_warnings_all_kinds() {
let info = DeprecationInfo {
config_path: std::path::PathBuf::from("/tmp/test-config.toml"),
- deprecations: vec![DeprecationKind::NoFf, DeprecationKind::NoCd],
+ // Keep one representative of each warning kind in
+ // DEPRECATION_RULES emission order. Commit-generation includes
+ // both scopes because its formatter has distinct branches.
+ deprecations: vec![
+ DeprecationKind::TemplateVar {
+ old: "repo_root",
+ new: "repo_path",
+ },
+ DeprecationKind::CommitGeneration(CommitGenerationDeprecations {
+ has_top_level: true,
+ project_keys: vec!["github.com/user/repo".to_string()],
+ }),
+ DeprecationKind::ApprovedCommands,
+ DeprecationKind::Select,
+ DeprecationKind::CiSection,
+ DeprecationKind::NoFf,
+ DeprecationKind::NoCd,
+ DeprecationKind::SwitchPickerTimeout,
+ DeprecationKind::ListTaskTimeout,
+ DeprecationKind::JsonSchemaUnset,
+ ],
kind: ConfigFileKind::User,
main_worktree_path: None,
};
- let output = format_deprecation_warnings(&info);
- assert!(output.contains("no-ff"), "Should mention no-ff: {output}");
- assert!(output.contains("no-cd"), "Should mention no-cd: {output}");
+ assert_snapshot!(format_deprecation_warnings(&info).ansi_strip(), @r#"
+ ▲ User config: template variable repo_root is deprecated in favor of repo_path
+ ▲ User config: [commit-generation] is deprecated in favor of [commit.generation]
+ ▲ User config: [projects."github.com/user/repo".commit-generation] is deprecated in favor of [projects."github.com/user/repo".commit.generation]
+ ▲ User config: approved-commands under [projects] is deprecated in favor of approvals.toml
+ ▲ User config: [select] is deprecated in favor of [switch.picker]
+ ▲ User config: [ci] is deprecated in favor of [forge]
+ ▲ User config: merge.no-ff is deprecated in favor of merge.ff (inverted)
+ ▲ User config: switch.no-cd is deprecated in favor of switch.cd (inverted)
+ ▲ User config: switch.picker.timeout-ms is no longer used — the picker now renders progressively
+ ▲ User config: list.task-timeout-ms is no longer used — list.timeout-ms bounds the collect phase
+ ▲ User config: [list] json-schema is unset; a future release switches the JSON default to schema 2
+ "#);
}
#[test]
diff --git a/src/config/expansion.rs b/src/config/expansion.rs
index dba7c919e..79dcbe62c 100644
--- a/src/config/expansion.rs
+++ b/src/config/expansion.rs
@@ -2440,67 +2440,52 @@ mod tests {
}
#[test]
- fn test_redact_credentials_https_token() {
- // GitHub-style personal access token
- assert_eq!(
- redact_credentials("https://[email protected]/owner/repo"),
- "https://[REDACTED]@github.com/owner/repo"
- );
- // GitLab-style token
- assert_eq!(
- redact_credentials("https://[email protected]/owner/repo.git"),
- "https://[REDACTED]@gitlab.com/owner/repo.git"
- );
- }
-
- #[test]
- fn test_redact_credentials_https_user_pass() {
- // Username:password format
- assert_eq!(
- redact_credentials("https://user:[email protected]/owner/repo"),
- "https://[REDACTED]@github.com/owner/repo"
- );
- }
-
- #[test]
- fn test_redact_credentials_no_credentials() {
- // Normal HTTPS URL without credentials - unchanged
- assert_eq!(
- redact_credentials("https://github.com/owner/repo"),
- "https://github.com/owner/repo"
- );
- // SSH URL - unchanged (no credentials in URL format)
- assert_eq!(
- redact_credentials("[email protected]:owner/repo.git"),
- "[email protected]:owner/repo.git"
- );
- }
-
- #[test]
- fn test_redact_credentials_non_url() {
- // Non-URL values pass through unchanged
- assert_eq!(redact_credentials("main"), "main");
- assert_eq!(redact_credentials("feature/auth"), "feature/auth");
- assert_eq!(redact_credentials("/path/to/worktree"), "/path/to/worktree");
- assert_eq!(redact_credentials(""), "");
- }
-
- #[test]
- fn test_redact_credentials_git_protocol() {
- // git:// protocol with credentials
- assert_eq!(
- redact_credentials("git://[email protected]/owner/repo.git"),
- "git://[REDACTED]@github.com/owner/repo.git"
- );
- }
+ fn test_redact_credentials() {
+ let cases = [
+ (
+ "GitHub personal access token",
+ "https://[email protected]/owner/repo",
+ "https://[REDACTED]@github.com/owner/repo",
+ ),
+ (
+ "GitLab personal access token",
+ "https://[email protected]/owner/repo.git",
+ "https://[REDACTED]@gitlab.com/owner/repo.git",
+ ),
+ (
+ "HTTPS username and password",
+ "https://user:[email protected]/owner/repo",
+ "https://[REDACTED]@github.com/owner/repo",
+ ),
+ (
+ "HTTPS without credentials",
+ "https://github.com/owner/repo",
+ "https://github.com/owner/repo",
+ ),
+ (
+ "SSH URL",
+ "[email protected]:owner/repo.git",
+ "[email protected]:owner/repo.git",
+ ),
+ ("branch name", "main", "main"),
+ ("branch name with slash", "feature/auth", "feature/auth"),
+ ("filesystem path", "/path/to/worktree", "/path/to/worktree"),
+ ("empty value", "", ""),
+ (
+ "git protocol token",
+ "git://[email protected]/owner/repo.git",
+ "git://[REDACTED]@github.com/owner/repo.git",
+ ),
+ (
+ "path and query after credentials",
+ "https://[email protected]/owner/repo.git?ref=main",
+ "https://[REDACTED]@github.com/owner/repo.git?ref=main",
+ ),
+ ];
- #[test]
- fn test_redact_credentials_preserves_path() {
- // Full URL with path and query should preserve everything after host
- assert_eq!(
- redact_credentials("https://[email protected]/owner/repo.git?ref=main"),
- "https://[REDACTED]@github.com/owner/repo.git?ref=main"
- );
+ for (name, input, expected) in cases {
+ assert_eq!(redact_credentials(input), expected, "{name}: {input}");
+ }
}
#[test]
diff --git a/src/shell/mod.rs b/src/shell/mod.rs
index 330639263..e58989593 100644
--- a/src/shell/mod.rs
+++ b/src/shell/mod.rs
@@ -23,8 +23,8 @@ pub use paths::{
line_based_config_paths, nushell_autoload_candidates,
};
pub use utils::{
- AncestorShell, ancestor_shell, current_shell, current_shell_name, detect_zsh_compinit,
- extract_filename_from_path,
+ AncestorShell, ZSH_PROBE_FLAGS, ancestor_shell, current_shell, current_shell_name,
+ detect_zsh_compinit, extract_filename_from_path,
};
/// Validate a command name before embedding it in shell syntax or shell-owned paths.
diff --git a/src/shell/utils.rs b/src/shell/utils.rs
index a62b93931..8794b6856 100644
--- a/src/shell/utils.rs
+++ b/src/shell/utils.rs
@@ -308,7 +308,7 @@ fn process_name_and_ppid(_pid: u32) -> Option<(String, u32)> {
/// `+m` (disable job control) is load-bearing — see the call site and issue
/// #3322. It must precede `-ic` so zsh parses it as an option, not a command
/// argument.
-const ZSH_PROBE_FLAGS: [&str; 2] = ["+m", "-ic"];
+pub const ZSH_PROBE_FLAGS: [&str; 2] = ["+m", "-ic"];
/// Detect if user's zsh has compinit enabled by probing for the compdef function.
///
@@ -325,10 +325,9 @@ const ZSH_PROBE_FLAGS: [&str; 2] = ["+m", "-ic"];
/// - `Some(false)` if compinit is NOT enabled
/// - `None` if detection failed (zsh not installed, timeout, error)
///
-// TODO(zsh-compinit-probe-unify): see `config::show::check_zsh_compinit_missing`
-// for the matching probe and why the two haven't been merged (intentional
-// `--no-globalrcs` divergence, different result types and runners). #3322 had to
-// apply the `+m` job-control fix in both places.
+// Config show skips global rcs, reads the exit status, and uses `Cmd`; this
+// probe sources global rcs, reads marker output, and manages a raw `Command`.
+// Only the load-bearing zsh flags are shared.
pub fn detect_zsh_compinit() -> Option<bool> {
// Allow tests to bypass this check since zsh subprocess behavior varies across CI envs
if std::env::var("WORKTRUNK_TEST_COMPINIT_CONFIGURED").is_ok() {
@@ -589,9 +588,10 @@ mod tests {
#[cfg(any(target_os = "linux", target_os = "macos"))]
#[test]
fn test_probe_reports_invoked_name_for_sh() {
- // Compound command so sh doesn't exec-replace itself with `sleep`.
+ // Block in a shell builtin so sh stays alive without spawning a child.
let mut child = Command::new("/bin/sh")
- .args(["-c", "sleep 30; true"])
+ .args(["-c", "read _"])
+ .stdin(Stdio::piped())
.stdout(Stdio::null())
.spawn()
.expect("spawn sh");
diff --git a/src/testing/mock_commands.rs b/src/testing/mock_commands.rs
index 02d9112bd..0d5dcb70e 100644
--- a/src/testing/mock_commands.rs
+++ b/src/testing/mock_commands.rs
@@ -78,8 +78,7 @@ pub struct MockResponse {
output: Option<String>,
stderr: Option<String>,
exit_code: i32,
- delay_ms: u64,
- hold_until_parent_exit: bool,
+ wait_for_file: Option<String>,
}
impl MockResponse {
@@ -90,8 +89,7 @@ impl MockResponse {
output: None,
stderr: None,
exit_code: 0,
- delay_ms: 0,
- hold_until_parent_exit: false,
+ wait_for_file: None,
}
}
@@ -102,8 +100,7 @@ impl MockResponse {
output: Some(text.to_string()),
stderr: None,
exit_code: 0,
- delay_ms: 0,
- hold_until_parent_exit: false,
+ wait_for_file: None,
}
}
@@ -114,8 +111,7 @@ impl MockResponse {
output: None,
stderr: Some(text.to_string()),
exit_code: 0,
- delay_ms: 0,
- hold_until_parent_exit: false,
+ wait_for_file: None,
}
}
@@ -126,8 +122,7 @@ impl MockResponse {
output: None,
stderr: None,
exit_code: code,
- delay_ms: 0,
- hold_until_parent_exit: false,
+ wait_for_file: None,
}
}
@@ -143,20 +138,12 @@ impl MockResponse {
self
}
- /// Sleep this long before responding, to simulate a slow command (e.g. a
- /// forge call) so a test can observe the caller's in-flight UI.
- pub fn with_delay_ms(mut self, ms: u64) -> Self {
- self.delay_ms = ms;
- self
- }
-
- /// Hold the response until the parent `wt` process exits, then exit without
- /// output. Pins a transient in-flight frame (e.g. the picker's
- /// `Loading open PRs…` marker) on screen for exactly the picker's lifetime,
- /// so a presence assertion never races boot latency. Overrides any delay or
- /// response body. See the `hold_until_parent_exit` docs in `mock-stub`.
- pub fn hold_until_parent_exit(mut self) -> Self {
- self.hold_until_parent_exit = true;
+ /// Wait until `path` exists under the mock config directory before
+ /// responding. This gives a test a causal release gate for an in-flight
+ /// command: first assert the caller's loading state, then create the file
+ /// and observe the response without sending another input.
+ pub fn wait_for_file(mut self, path: &str) -> Self {
+ self.wait_for_file = Some(path.to_string());
self
}
@@ -176,11 +163,8 @@ impl MockResponse {
{
obj.insert("exit_code".to_string(), json!(self.exit_code));
}
- if self.delay_ms != 0 {
- obj.insert("delay_ms".to_string(), json!(self.delay_ms));
- }
- if self.hold_until_parent_exit {
- obj.insert("hold_until_parent_exit".to_string(), json!(true));
+ if let Some(path) = &self.wait_for_file {
+ obj.insert("wait_for_file".to_string(), json!(path));
}
serde_json::Value::Object(obj)
}
@@ -431,6 +415,10 @@ mod tests {
.version("test-cmd version 1.0")
.command("foo", MockResponse::output("hello"))
.command("bar", MockResponse::exit(42))
+ .command(
+ "gated",
+ MockResponse::output("released").wait_for_file("release"),
+ )
.write(bin_dir);
// Check config file exists and is valid JSON
@@ -439,6 +427,7 @@ mod tests {
let content = fs::read_to_string(&config_path).unwrap();
let parsed: serde_json::Value = serde_json::from_str(&content).unwrap();
assert_eq!(parsed["version"], "test-cmd version 1.0");
+ assert_eq!(parsed["commands"]["gated"]["wait_for_file"], "release");
// Check binary exists
#[cfg(unix)]
diff --git a/src/testing/mod.rs b/src/testing/mod.rs
index 084a2773f..fd48e60f6 100644
--- a/src/testing/mod.rs
+++ b/src/testing/mod.rs
@@ -21,6 +21,8 @@
//! caller-specified path (e.g. the `project/.git` clone layout).
//! - [`TestRepo::standard()`] — copies pre-built fixture with remote + worktrees.
//! For integration tests (used by the `repo()` rstest fixture).
+//! - [`TestRepo::standard_main_only()`] — copies the same pinned main history and
+//! remote without linked worktrees. For tests that shape their own topology.
//! - [`TestRepo::empty()`] — `git init` with no commits, no branches.
//!
//! ## Environment Isolation
@@ -104,6 +106,12 @@ use tempfile::TempDir;
/// `target/` are abandoned rather than reused.
const STANDARD_FIXTURE_VERSION: u32 = 1;
+/// Bump when the main-only transformation in
+/// [`build_standard_main_only_fixture`] changes. Its cache key also includes
+/// [`STANDARD_FIXTURE_VERSION`] because the derived template copies that
+/// fixture as its source.
+const STANDARD_MAIN_ONLY_FIXTURE_VERSION: u32 = 1;
+
/// Timestamp for the template's commits, author and committer alike.
///
/// The `-08:00` offset looks arbitrary but is load-bearing: commit SHAs
@@ -136,6 +144,25 @@ fn standard_fixture_template() -> PathBuf {
dir
}
+/// Get-or-create the standard fixture's main-only topology.
+///
+/// Picker tests build every linked-worktree topology themselves. Copying this
+/// template avoids immediately tearing down the standard fixture's three
+/// linked worktrees with six serial Git subprocesses in every test.
+fn standard_main_only_fixture_template() -> PathBuf {
+ let mut base = std::env::current_exe().expect("failed to get test executable path");
+ base.pop(); // test binary name
+ base.pop(); // deps/
+ let fixtures = base.join("wt-test-fixtures");
+ let dir = fixtures.join(format!(
+ "standard-v{STANDARD_FIXTURE_VERSION}-main-only-v{STANDARD_MAIN_ONLY_FIXTURE_VERSION}"
+ ));
+ if !dir.exists() {
+ claim_template(&fixtures, &dir, build_standard_main_only_fixture);
+ }
+ dir
+}
+
/// Build into a private scratch directory under `parent`, then rename it to
/// `dir` — the atomic claim that makes concurrent cold-cache builders race
/// benignly. `TempDir::new_in` names the scratch uniquely per call, so
@@ -224,6 +251,53 @@ fn build_standard_fixture(root: &Path) {
}
}
+/// Build the main-only template from the standard fixture once per target
+/// directory. Deriving it with real Git preserves the pinned commit, remote,
+/// tracking refs, attributes, and config while removing linked-worktree
+/// administration through Git's supported path.
+fn build_standard_main_only_fixture(root: &Path) {
+ let fixture = copy_standard_fixture(root);
+ let git = |dir: &Path| configure_git_env(Cmd::new("git")).current_dir(dir);
+ let run = |cmd: Cmd, what: &str| {
+ let output = cmd.run().unwrap();
+ check_git_status(&output, what);
+ };
+ let repo = root.join("repo");
+
+ for branch in ["feature-a", "feature-b", "feature-c"] {
+ let worktree = fixture
+ .worktrees
+ .get(branch)
+ .expect("standard fixture worktree");
+ let worktree = worktree.to_string_lossy();
+ run(
+ git(&repo).args(["worktree", "remove", "--force", worktree.as_ref()]),
+ "worktree remove",
+ );
+ run(
+ git(&repo).args(["branch", "-D", branch]),
+ "delete fixture branch",
+ );
+ }
+}
+
+/// Copy a directory tree without spawning a platform-specific copy command.
+fn copy_dir_recursive(src: &Path, dest: &Path) {
+ std::fs::create_dir_all(dest).unwrap();
+ for entry in std::fs::read_dir(src).unwrap() {
+ let entry = entry.unwrap();
+ let file_type = entry.file_type().unwrap();
+ let src_path = entry.path();
+ let dest_path = dest.join(entry.file_name());
+ if file_type.is_dir() {
+ copy_dir_recursive(&src_path, &dest_path);
+ } else if file_type.is_file() {
+ std::fs::copy(&src_path, &dest_path).unwrap();
+ }
+ // Skip symlinks, sockets, etc (shouldn't be in fixtures).
+ }
+}
+
/// Copy the standard fixture template to create a new test repo with
/// worktrees and remote.
///
@@ -231,23 +305,6 @@ fn build_standard_fixture(root: &Path) {
/// Benchmarked at 21ms vs 53ms per fixture copy on macOS.
fn copy_standard_fixture(dest: &Path) -> FixtureWorktrees {
shell_exec::enable_hermetic_test_env();
-
- fn copy_dir_recursive(src: &Path, dest: &Path) {
- std::fs::create_dir_all(dest).unwrap();
- for entry in std::fs::read_dir(src).unwrap() {
- let entry = entry.unwrap();
- let file_type = entry.file_type().unwrap();
- let src_path = entry.path();
- let dest_path = dest.join(entry.file_name());
- if file_type.is_dir() {
- copy_dir_recursive(&src_path, &dest_path);
- } else if file_type.is_file() {
- std::fs::copy(&src_path, &dest_path).unwrap();
- }
- // Skip symlinks, sockets, etc (shouldn't be in fixture)
- }
- }
-
copy_dir_recursive(&standard_fixture_template(), dest);
// Canonicalize dest for worktrees map (on macOS /var -> /private/var)
@@ -291,6 +348,13 @@ fn copy_standard_fixture(dest: &Path) -> FixtureWorktrees {
FixtureWorktrees { worktrees, remote }
}
+/// Copy the pinned standard history with only its primary worktree and remote.
+fn copy_standard_main_only_fixture(dest: &Path) -> PathBuf {
+ shell_exec::enable_hermetic_test_env();
+ copy_dir_recursive(&standard_main_only_fixture_template(), dest);
+ canonicalize(dest).unwrap().join("origin.git")
+}
+
/// The identity every test commit is authored and committed under.
///
/// Reaches a harness-built `git` through [`git_test_env`] and an in-process one
@@ -1237,6 +1301,24 @@ impl TestRepo {
repo
}
+ /// Create a test repository with the standard fixture's pinned main
+ /// history and remote, but no linked worktrees.
+ ///
+ /// Use when a test constructs its own worktree topology. Unlike
+ /// [`standard()`](Self::standard), this does not install forge mocks:
+ /// callers that exercise forge commands should install strict mocks for
+ /// the route they expect.
+ pub fn standard_main_only() -> Self {
+ let temp_dir = TempDir::new().unwrap();
+ let remote = copy_standard_main_only_fixture(temp_dir.path());
+
+ let paths = TestConfigPaths::in_dir(temp_dir.path());
+ let root = temp_dir.path().join("repo");
+ let mut repo = Self::assemble(temp_dir, &root, paths);
+ repo.remote = Some(remote);
+ repo
+ }
+
/// Create a repo at a caller-specified path with identity configured.
///
/// Unlike [`new()`](Self::new), this does not own the repo's parent
@@ -2010,12 +2092,10 @@ impl TestRepo {
/// The mock gh returns:
/// - `gh auth status`: exits successfully (0)
/// - `gh pr list`: returns empty JSON array (no PRs found)
- /// - `gh run list`: returns empty JSON array (no runs found)
///
/// This prevents CI detection from blocking tests with network calls.
pub fn setup_mock_gh(&mut self) {
- // Delegate to setup_mock_gh_with_ci_data with empty arrays
- self.setup_mock_gh_with_ci_data("[]", "[]");
+ self.setup_mock_gh_with_ci_data("[]");
}
/// Setup mock `gh` and `glab` commands that show "installed but not authenticated"
@@ -2290,25 +2370,20 @@ impl TestRepo {
/// Setup mock `gh` that returns configurable PR/CI data
///
/// Use this for testing CI status parsing code. The mock returns JSON data
- /// for `gh pr list` and `gh run list` commands.
+ /// for `gh pr list`.
///
/// # Arguments
/// * `pr_json` - JSON string to return for `gh pr list --json ...`
- /// * `run_json` - JSON string to return for `gh run list --json ...`
- pub fn setup_mock_gh_with_ci_data(&mut self, pr_json: &str, run_json: &str) {
+ pub fn setup_mock_gh_with_ci_data(&mut self, pr_json: &str) {
let mock_bin = self.temp_dir.path().join("mock-bin");
std::fs::create_dir_all(&mock_bin).unwrap();
- // Write JSON data files
std::fs::write(mock_bin.join("pr_data.json"), pr_json).unwrap();
- std::fs::write(mock_bin.join("run_data.json"), run_json).unwrap();
- // Configure gh mock
MockConfig::new("gh")
.version("gh version 2.0.0 (mock)")
.command("auth", MockResponse::exit(0))
.command("pr", MockResponse::file("pr_data.json"))
- .command("run", MockResponse::file("run_data.json"))
.write(&mock_bin);
// Configure glab mock (fails - no GitLab support)
@@ -3444,30 +3519,46 @@ mod tests {
#[test]
fn test_standard_fixture_template_reproduces_pinned_shas() {
let repo = standard_fixture_template().join("repo");
- let rev_parse = |rev: &str| {
+ let rev_parse = |repo: &Path, rev: &str| {
let output = configure_git_env(Cmd::new("git"))
.args(["rev-parse", rev])
- .current_dir(&repo)
+ .current_dir(repo)
.run()
.unwrap();
String::from_utf8(output.stdout).unwrap().trim().to_string()
};
assert_eq!(
- rev_parse("main"),
+ rev_parse(&repo, "main"),
"05a4a45d0b981dad5c27db59dca482836d59f89e"
);
assert_eq!(
- rev_parse("feature-a"),
+ rev_parse(&repo, "feature-a"),
"1b87d4731ea707905d15a726e193531c20affa14"
);
assert_eq!(
- rev_parse("feature-b"),
+ rev_parse(&repo, "feature-b"),
"f62940fcec424585adf98625e722fdf990810614"
);
assert_eq!(
- rev_parse("feature-c"),
+ rev_parse(&repo, "feature-c"),
"345c7c93ad7c3d8f5b08380898d78e024019599c"
);
+
+ let main_only = standard_main_only_fixture_template().join("repo");
+ assert_eq!(
+ rev_parse(&main_only, "main"),
+ "05a4a45d0b981dad5c27db59dca482836d59f89e"
+ );
+ let branches = configure_git_env(Cmd::new("git"))
+ .args(["branch", "--format=%(refname:short)"])
+ .current_dir(&main_only)
+ .run()
+ .unwrap();
+ assert_eq!(
+ String::from_utf8(branches.stdout).unwrap().trim(),
+ "main",
+ "main-only fixture must not retain the standard linked-worktree branches"
+ );
}
#[test]
diff --git a/tests/CLAUDE.md b/tests/CLAUDE.md
index 62520fa7f..73622fa0f 100644
--- a/tests/CLAUDE.md
+++ b/tests/CLAUDE.md
@@ -538,6 +538,16 @@ Equivalent coverage or identical snapshots are useful duplication signals, not
automatic deletion rules. Before removing a test, identify the belief it owns
and make sure another test proves that belief at an equal or better boundary.
+A test's setup is part of its proof. For topology, absence, and error paths,
+assert the precondition named by the test; fixture names and comments are not
+evidence. If an earlier guard can produce the observed result, the test proves
+that guard rather than the intended condition.
+
+Configuring a subprocess mock is likewise not evidence that production used
+that route. When route selection is the belief, assert the recorded call with
+`mock_calls` and make unexpected calls fail (for example, through `_default`);
+otherwise a fallback or blank response can satisfy the oracle.
+
Assert semantics through state, structured values, and exit status; snapshot
the pragmatic user experience when the complete rendering is the contract. A
custom verifier must fail for every violation it claims to check—diagnostic
diff --git a/tests/helpers/mock-stub/src/main.rs b/tests/helpers/mock-stub/src/main.rs
index a02e37f97..e7159c3f3 100644
--- a/tests/helpers/mock-stub/src/main.rs
+++ b/tests/helpers/mock-stub/src/main.rs
@@ -31,14 +31,9 @@
//! - `output`: output literal string to stdout
//! - `stderr`: output literal string to stderr
//! - `exit_code`: exit with specified code (default 0)
-//! - `delay_ms`: sleep this long before responding (default 0), to simulate a
-//! slow command (e.g. a forge call the picker streams in behind its frame)
-//! - `hold_until_parent_exit`: hold the response until the parent process (the
-//! `wt` under test) exits, then exit without producing output. Lets a test
-//! pin a *transient* frame — e.g. the picker's `Loading open PRs…` marker,
-//! on screen only while a forge call is in flight — on screen for exactly as
-//! long as the picker lives, with no fixed `delay_ms` to outguess boot
-//! latency. Overrides `delay_ms` and any `file`/`output` response.
+//! - `wait_for_file`: wait for this path under the config directory to exist
+//! before responding. Lets a test observe a loading state, then causally
+//! release the response without another user input.
use serde::Deserialize;
use std::collections::HashMap;
@@ -64,47 +59,7 @@ struct CommandResponse {
stderr: Option<String>,
#[serde(default)]
exit_code: i32,
- #[serde(default)]
- delay_ms: u64,
- #[serde(default)]
- hold_until_parent_exit: bool,
-}
-
-/// Block until the parent process (the `wt` under test) exits, then return.
-///
-/// A test that asserts a *transient* frame — the picker's `Loading open PRs…`
-/// marker, on screen only while a forge call is in flight — needs that frame to
-/// stay up for exactly as long as the picker lives, with no fixed sleep to
-/// outguess boot latency. This mock *is* the in-flight forge call: the picker's
-/// fetch thread runs it with a piped stdout and blocks reading that pipe to EOF,
-/// so as long as this process neither writes a full response nor exits, the
-/// marker stays. When the test aborts the picker, `wt` detaches the fetch thread
-/// and exits, which closes the read end of our stdout pipe; the next write here
-/// then fails with `BrokenPipe`.
-///
-/// Polling for that write error is a *causal* parent-death signal — release is
-/// tied to the parent exiting, not to a timer — and it needs no platform
-/// primitive (`getppid` / `OpenProcess`), so it behaves identically on Unix and
-/// Windows. Rust's runtime ignores `SIGPIPE`, so the broken write surfaces as an
-/// `Err` rather than killing this process.
-///
-/// The one-byte probes written into stdout are harmless: this mode's contract is
-/// that the parent aborts without ever parsing the response, and the fetch
-/// thread drains the pipe until process exit, so the bytes are never observed. A
-/// generous cap bounds a stuck orphan if the pipe somehow never breaks.
-fn wait_for_parent_exit() {
- // 20ms per poll × 3000 = a 60s ceiling, far beyond any picker lifetime; it
- // exists only so a detached mock can't linger forever if detection fails.
- const MAX_POLLS: u32 = 3000;
- let mut stdout = io::stdout();
- for _ in 0..MAX_POLLS {
- match stdout.write_all(&[0]).and_then(|()| stdout.flush()) {
- // Write succeeded → the parent's read end is still open → still alive.
- Ok(()) => sleep(Duration::from_millis(20)),
- // BrokenPipe (or any other write failure) → the parent has exited.
- Err(_) => return,
- }
- }
+ wait_for_file: Option<String>,
}
/// Get command name from argv\[0\].
@@ -187,8 +142,7 @@ fn main() {
output: None,
stderr: None,
exit_code: 1,
- delay_ms: 0,
- hold_until_parent_exit: false,
+ wait_for_file: None,
};
// Try triple match first (e.g., "mr view 1", "mr view 2")
@@ -220,17 +174,26 @@ fn main() {
.or_else(|| config.commands.get("_default"))
.unwrap_or(&default_response);
- // Hold the response for the parent's whole lifetime, then exit without
- // output — the marker-clearing edge is the parent's death, not a timer.
- if response.hold_until_parent_exit {
- wait_for_parent_exit();
- exit(0);
- }
-
- // Simulate a slow command (e.g. a forge call) so tests can observe the
- // caller's in-flight UI before the response lands.
- if response.delay_ms > 0 {
- sleep(Duration::from_millis(response.delay_ms));
+ // Causal release gate for tests that must first observe the caller's
+ // in-flight state. Bound the wait so a failed test cannot orphan the mock.
+ if let Some(path) = &response.wait_for_file {
+ const MAX_POLLS: u32 = 6000; // 10ms × 6000 = 60s
+ let release = config_dir.join(path);
+ let mut released = false;
+ for _ in 0..MAX_POLLS {
+ if release.exists() {
+ released = true;
+ break;
+ }
+ sleep(Duration::from_millis(10));
+ }
+ if !released {
+ eprintln!(
+ "mock: timed out waiting for release file {}",
+ release.display()
+ );
+ exit(1);
+ }
}
if let Some(file) = &response.file {
diff --git a/tests/integration_tests/ci_status.rs b/tests/integration_tests/ci_status.rs
index 829d1c5e2..6a15d786a 100644
--- a/tests/integration_tests/ci_status.rs
+++ b/tests/integration_tests/ci_status.rs
@@ -47,8 +47,8 @@ fn setup_tracking_for_all_branches(repo: &TestRepo, remote: &str) {
}
/// Helper to run a CI status test with the given mock data
-fn run_ci_status_test(repo: &mut TestRepo, snapshot_name: &str, pr_json: &str, run_json: &str) {
- repo.setup_mock_gh_with_ci_data(pr_json, run_json);
+fn run_ci_status_test(repo: &mut TestRepo, snapshot_name: &str, pr_json: &str) {
+ repo.setup_mock_gh_with_ci_data(pr_json);
let settings = setup_snapshot_settings(repo);
settings.bind(|| {
@@ -119,45 +119,28 @@ fn setup_github_repo_with_feature(repo: &mut TestRepo) -> String {
}
// =============================================================================
-// PR status tests (CheckRun format)
+// PR conflict status
// =============================================================================
#[rstest]
-#[case::passed("CLEAN", "COMPLETED", "SUCCESS", "github_pr_passed")]
-#[case::failed("BLOCKED", "COMPLETED", "FAILURE", "github_pr_failed")]
-#[case::running("UNKNOWN", "IN_PROGRESS", "null", "github_pr_running")]
-#[case::conflicts("DIRTY", "COMPLETED", "SUCCESS", "github_pr_conflicts")]
-fn test_list_full_with_github_pr_status(
- mut repo: TestRepo,
- #[case] merge_state: &str,
- #[case] status: &str,
- #[case] conclusion: &str,
- #[case] snapshot_name: &str,
-) {
+fn test_list_full_with_github_pr_conflicts(mut repo: TestRepo) {
let head_sha = setup_github_repo_with_feature(&mut repo);
- // Format conclusion - use raw value for null, quoted for strings
- let conclusion_json = if conclusion == "null" {
- "null".to_string()
- } else {
- format!("\"{}\"", conclusion)
- };
-
let pr_json = format!(
r#"[{{
"number": 1,
"headRefOid": "{}",
- "mergeStateStatus": "{}",
+ "mergeStateStatus": "DIRTY",
"statusCheckRollup": [
- {{"status": "{}", "conclusion": {}}}
+ {{"status": "COMPLETED", "conclusion": "SUCCESS"}}
],
"url": "https://github.com/test-owner/test-repo/pull/1",
"headRepositoryOwner": {{"login": "test-owner"}}
}}]"#,
- head_sha, merge_state, status, conclusion_json
+ head_sha
);
- run_ci_status_test(&mut repo, snapshot_name, &pr_json, "[]");
+ run_ci_status_test(&mut repo, "github_pr_conflicts", &pr_json);
}
#[rstest]
@@ -176,7 +159,7 @@ fn test_list_full_json_ci_repo_from_pr_url(mut repo: TestRepo) {
}}]"#,
head_sha
);
- repo.setup_mock_gh_with_ci_data(&pr_json, "[]");
+ repo.setup_mock_gh_with_ci_data(&pr_json);
let mut cmd = repo.wt_command();
cmd.args(["list", "--full", "--format=json"]);
@@ -237,7 +220,7 @@ fn test_list_full_json_ci_repo_uses_configured_provider_for_opaque_host(mut repo
}}]"#,
head_sha
);
- repo.setup_mock_gh_with_ci_data(&pr_json, "[]");
+ repo.setup_mock_gh_with_ci_data(&pr_json);
let mut cmd = repo.wt_command();
cmd.args(["list", "--full", "--format=json"]);
@@ -273,20 +256,11 @@ fn test_list_full_json_ci_repo_uses_configured_provider_for_opaque_host(mut repo
}
// =============================================================================
-// Review state tests (reviewDecision / isDraft from gh pr list)
+// Review state
// =============================================================================
#[rstest]
-#[case::changes_requested("\"CHANGES_REQUESTED\"", "false", "github_pr_changes_requested")]
-#[case::review_required("\"REVIEW_REQUIRED\"", "false", "github_pr_review_required")]
-#[case::approved("\"APPROVED\"", "false", "github_pr_approved")]
-#[case::draft("\"APPROVED\"", "true", "github_pr_draft")]
-fn test_list_full_with_github_review_state(
- mut repo: TestRepo,
- #[case] review_decision: &str,
- #[case] is_draft: &str,
- #[case] snapshot_name: &str,
-) {
+fn test_list_full_with_github_changes_requested(mut repo: TestRepo) {
let head_sha = setup_github_repo_with_feature(&mut repo);
let pr_json = format!(
@@ -299,78 +273,13 @@ fn test_list_full_with_github_review_state(
],
"url": "https://github.com/test-owner/test-repo/pull/1",
"headRepositoryOwner": {{"login": "test-owner"}},
- "reviewDecision": {},
- "isDraft": {}
- }}]"#,
- head_sha, review_decision, is_draft
- );
-
- run_ci_status_test(&mut repo, snapshot_name, &pr_json, "[]");
-}
-
-// =============================================================================
-// StatusContext tests (external CI systems like Jenkins)
-// =============================================================================
-
-#[rstest]
-#[case::pending("UNKNOWN", "PENDING", "status_context_pending")]
-#[case::failure("BLOCKED", "FAILURE", "status_context_failure")]
-fn test_list_full_with_status_context(
- mut repo: TestRepo,
- #[case] merge_state: &str,
- #[case] state: &str,
- #[case] snapshot_name: &str,
-) {
- let head_sha = setup_github_repo_with_feature(&mut repo);
-
- let pr_json = format!(
- r#"[{{
- "number": 1,
- "headRefOid": "{}",
- "mergeStateStatus": "{}",
- "statusCheckRollup": [
- {{"state": "{}"}}
- ],
- "url": "https://github.com/test-owner/test-repo/pull/1",
- "headRepositoryOwner": {{"login": "test-owner"}}
+ "reviewDecision": "CHANGES_REQUESTED",
+ "isDraft": false
}}]"#,
- head_sha, merge_state, state
- );
-
- run_ci_status_test(&mut repo, snapshot_name, &pr_json, "[]");
-}
-
-// =============================================================================
-// Workflow run tests (no PR, just workflow runs)
-// =============================================================================
-
-#[rstest]
-#[case::completed("completed", "success", "github_workflow_run")]
-#[case::running("in_progress", "null", "github_workflow_running")]
-fn test_list_full_with_github_workflow(
- mut repo: TestRepo,
- #[case] status: &str,
- #[case] conclusion: &str,
- #[case] snapshot_name: &str,
-) {
- let head_sha = setup_github_repo_with_feature(&mut repo);
-
- let conclusion_json = if conclusion == "null" {
- "null".to_string()
- } else {
- format!("\"{}\"", conclusion)
- };
-
- let run_json = format!(
- r#"[{{
- "status": "{}",
- "conclusion": {},
- "headSha": "{}"
- }}]"#,
- status, conclusion_json, head_sha
+ head_sha
);
- run_ci_status_test(&mut repo, snapshot_name, "[]", &run_json);
+ run_ci_status_test(&mut repo, "github_pr_changes_requested", &pr_json);
}
// =============================================================================
@@ -399,49 +308,7 @@ fn test_list_full_with_stale_pr(mut repo: TestRepo) {
"headRepositoryOwner": {"login": "test-owner"}
}]"#;
- run_ci_status_test(&mut repo, "stale_pr", pr_json, "[]");
-}
-
-#[rstest]
-fn test_list_full_with_mixed_check_types(mut repo: TestRepo) {
- let head_sha = setup_github_repo_with_feature(&mut repo);
-
- // Mixed: CheckRun (passed) + StatusContext (pending)
- let pr_json = format!(
- r#"[{{
- "number": 1,
- "headRefOid": "{}",
- "mergeStateStatus": "UNKNOWN",
- "statusCheckRollup": [
- {{"status": "COMPLETED", "conclusion": "SUCCESS"}},
- {{"state": "PENDING"}}
- ],
- "url": "https://github.com/test-owner/test-repo/pull/1",
- "headRepositoryOwner": {{"login": "test-owner"}}
- }}]"#,
- head_sha
- );
-
- run_ci_status_test(&mut repo, "mixed_check_types", &pr_json, "[]");
-}
-
-#[rstest]
-fn test_list_full_with_no_ci_checks(mut repo: TestRepo) {
- let head_sha = setup_github_repo_with_feature(&mut repo);
-
- let pr_json = format!(
- r#"[{{
- "number": 1,
- "headRefOid": "{}",
- "mergeStateStatus": "CLEAN",
- "statusCheckRollup": [],
- "url": "https://github.com/test-owner/test-repo/pull/1",
- "headRepositoryOwner": {{"login": "test-owner"}}
- }}]"#,
- head_sha
- );
-
- run_ci_status_test(&mut repo, "no_ci_checks", &pr_json, "[]");
+ run_ci_status_test(&mut repo, "stale_pr", pr_json);
}
#[rstest]
@@ -480,7 +347,7 @@ fn test_list_full_filters_by_repo_owner(mut repo: TestRepo) {
head_sha
);
- run_ci_status_test(&mut repo, "filters_by_repo_owner", &pr_json, "[]");
+ run_ci_status_test(&mut repo, "filters_by_repo_owner", &pr_json);
}
#[rstest]
@@ -531,8 +398,7 @@ platform = "github"
}}]"#,
head_sha
);
- let run_json = "[]";
- repo.setup_mock_gh_with_ci_data(&pr_json, run_json);
+ repo.setup_mock_gh_with_ci_data(&pr_json);
let settings = setup_snapshot_settings(&repo);
settings.bind(|| {
@@ -628,7 +494,7 @@ platform = "invalid_platform"
}}]"#,
head_sha
);
- repo.setup_mock_gh_with_ci_data(&pr_json, "[]");
+ repo.setup_mock_gh_with_ci_data(&pr_json);
let mut settings = setup_snapshot_settings(&repo);
// Normalize worker thread ID prefix in log output (e.g., [n], [z], [A] -> [W]).
@@ -687,33 +553,23 @@ fn setup_gitlab_repo_with_feature(repo: &mut TestRepo) -> String {
}
#[rstest]
-#[case::passed("success", false, "gitlab_mr_passed")]
-#[case::failed("failed", false, "gitlab_mr_failed")]
-#[case::running("running", false, "gitlab_mr_running")]
-#[case::pending("pending", false, "gitlab_mr_pending")]
-#[case::conflicts("success", true, "gitlab_mr_conflicts")]
-fn test_list_full_with_gitlab_mr_status(
- mut repo: TestRepo,
- #[case] pipeline_status: &str,
- #[case] has_conflicts: bool,
- #[case] snapshot_name: &str,
-) {
+fn test_list_full_with_gitlab_mr_conflicts(mut repo: TestRepo) {
let head_sha = setup_gitlab_repo_with_feature(&mut repo);
let mr_json = format!(
r#"[{{
"iid": 1,
"sha": "{}",
- "has_conflicts": {},
+ "has_conflicts": true,
"detailed_merge_status": null,
- "head_pipeline": {{"status": "{}"}},
+ "head_pipeline": {{"status": "success"}},
"source_project_id": 12345,
"web_url": "https://gitlab.com/test-group/test-project/-/merge_requests/1"
}}]"#,
- head_sha, has_conflicts, pipeline_status
+ head_sha
);
- run_gitlab_ci_status_test(&mut repo, snapshot_name, &mr_json, Some(12345));
+ run_gitlab_ci_status_test(&mut repo, "gitlab_mr_conflicts", &mr_json, Some(12345));
}
#[rstest]
@@ -740,27 +596,6 @@ fn test_list_full_with_gitlab_stale_mr(mut repo: TestRepo) {
run_gitlab_ci_status_test(&mut repo, "gitlab_stale_mr", mr_json, Some(12345));
}
-#[rstest]
-fn test_list_full_with_gitlab_no_ci(mut repo: TestRepo) {
- let head_sha = setup_gitlab_repo_with_feature(&mut repo);
-
- // MR with no pipeline
- let mr_json = format!(
- r#"[{{
- "iid": 1,
- "sha": "{}",
- "has_conflicts": false,
- "detailed_merge_status": null,
- "head_pipeline": null,
- "source_project_id": 12345,
- "web_url": "https://gitlab.com/test-group/test-project/-/merge_requests/1"
- }}]"#,
- head_sha
- );
-
- run_gitlab_ci_status_test(&mut repo, "gitlab_no_ci", &mr_json, Some(12345));
-}
-
#[rstest]
fn test_list_full_with_gitlab_filters_by_project_id(mut repo: TestRepo) {
// Use a specific project for our repo
@@ -952,7 +787,7 @@ fn test_list_full_with_url_based_pushremote(mut repo: TestRepo) {
head_sha
);
- run_ci_status_test(&mut repo, "url_based_pushremote", &pr_json, "[]");
+ run_ci_status_test(&mut repo, "url_based_pushremote", &pr_json);
}
/// When a branch has no PR yet, fallback check-runs detection should query the
@@ -1098,7 +933,7 @@ fn test_ci_cache_expired_entry_refetches(mut repo: TestRepo) {
"headRepositoryOwner": {{"login": "test-owner"}}
}}]"#
);
- repo.setup_mock_gh_with_ci_data(&pr_json, "[]");
+ repo.setup_mock_gh_with_ci_data(&pr_json);
// Expired cache entry claiming the CI failed
let git_dir = repo.git_output(&["rev-parse", "--git-common-dir"]);
@@ -1213,34 +1048,20 @@ fn test_list_full_with_azure_pr_queued(mut repo: TestRepo) {
/// No PR for the branch falls back to the latest pipeline run
/// (exercises `detect_azure_pipeline` via `parse_azure_pipeline_status`).
#[rstest]
-#[case::passed("completed", "succeeded", "azure_pipeline_passed")]
-#[case::failed("completed", "failed", "azure_pipeline_failed")]
-#[case::running("inProgress", "null", "azure_pipeline_running")]
-fn test_list_full_with_azure_pipeline_status(
- mut repo: TestRepo,
- #[case] status: &str,
- #[case] result: &str,
- #[case] snapshot_name: &str,
-) {
+fn test_list_full_with_azure_passed_pipeline(mut repo: TestRepo) {
let head_sha = setup_azure_repo_with_feature(&mut repo);
let runs_json = format!(
r#"[{{
"id": 4242,
- "status": "{}",
- "result": {},
+ "status": "completed",
+ "result": "succeeded",
"sourceVersion": "{}"
}}]"#,
- status,
- if result == "null" {
- "null".to_string()
- } else {
- format!(r#""{}""#, result)
- },
head_sha
);
- run_azure_ci_status_test(&mut repo, snapshot_name, "[]", &runs_json);
+ run_azure_ci_status_test(&mut repo, "azure_pipeline_passed", "[]", &runs_json);
}
/// A pipeline run from a different SHA than local HEAD is marked stale (dimmed).
@@ -1387,28 +1208,6 @@ fn test_list_full_with_gitea_pr_conflicts(mut repo: TestRepo) {
);
}
-/// An open PR's CI state comes from the PR head commit's combined status, and
-/// the indicator links to the PR.
-#[rstest]
-#[case::passed("success", "gitea_pr_passed")]
-#[case::failed("failure", "gitea_pr_failed")]
-#[case::running("pending", "gitea_pr_running")]
-fn test_list_full_with_gitea_pr_status(
- mut repo: TestRepo,
- #[case] state: &str,
- #[case] snapshot_name: &str,
-) {
- let head_sha = setup_gitea_repo_with_feature(&mut repo);
- let status_json = format!(r#"{{"state":"{state}","total_count":2}}"#);
- run_gitea_ci_status_test(
- &mut repo,
- snapshot_name,
- &head_sha,
- &gitea_feature_pr_json(&head_sha, true),
- &status_json,
- );
-}
-
/// No PR for the branch falls back to the HEAD commit's combined status
/// (exercises `detect_gitea_commit_status` and the `failure` state mapping).
#[rstest]
diff --git a/tests/integration_tests/config_show.rs b/tests/integration_tests/config_show.rs
index 3b6c4e3b3..adaa6aea5 100644
--- a/tests/integration_tests/config_show.rs
+++ b/tests/integration_tests/config_show.rs
@@ -45,9 +45,7 @@ server = "npm run dev"
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -73,9 +71,7 @@ fn test_config_show_no_project_config(mut repo: TestRepo, temp_home: TempDir) {
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -117,9 +113,7 @@ command = "company-llm-tool"
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.env("WORKTRUNK_SYSTEM_CONFIG_PATH", &system_config_path);
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
@@ -540,9 +534,7 @@ fn test_config_show_empty_system_config(mut repo: TestRepo, temp_home: TempDir)
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.env("WORKTRUNK_SYSTEM_CONFIG_PATH", &system_config_path);
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
@@ -569,9 +561,7 @@ fn test_config_show_invalid_system_config(mut repo: TestRepo, temp_home: TempDir
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.env("WORKTRUNK_SYSTEM_CONFIG_PATH", &system_config_path);
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
@@ -611,40 +601,6 @@ fn test_system_config_unknown_keys_warning_during_load(repo: TestRepo) {
);
}
-/// System config should use the same deprecation warning gate as user config.
-#[rstest]
-fn test_system_config_deprecation_warning_during_load(repo: TestRepo) {
- let system_config_dir = tempfile::tempdir().unwrap();
- let system_config_path = system_config_dir.path().join("config.toml");
- fs::write(
- &system_config_path,
- r#"[select]
-pager = "delta --paging=never"
-"#,
- )
- .unwrap();
-
- let mut cmd = repo.wt_command();
- cmd.env("WORKTRUNK_SYSTEM_CONFIG_PATH", &system_config_path);
- cmd.arg("list").current_dir(repo.root_path());
-
- let output = cmd.output().unwrap();
- assert!(
- output.status.success(),
- "Command should succeed: {}",
- String::from_utf8_lossy(&output.stderr)
- );
- let stderr = String::from_utf8_lossy(&output.stderr);
- assert!(
- stderr.contains("System config") && stderr.contains("[select]"),
- "Expected deprecation warning from system config load, got: {stderr}"
- );
- assert!(
- stderr.contains("[switch.picker]"),
- "Expected replacement section in warning, got: {stderr}"
- );
-}
-
/// System config is routed through the same deprecation gate as user config:
/// a non-fatal deprecation surfaces a warning, and a deprecated hook key is
/// migrated to its canonical name and stays active.
@@ -736,9 +692,7 @@ if command -v wt >/dev/null 2>&1; then eval "$(command wt config shell init zsh)
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
// Force compinit warning for deterministic tests across environments
cmd.env("WORKTRUNK_TEST_COMPINIT_MISSING", "1");
cmd.arg("config").arg("show").current_dir(repo.root_path());
@@ -765,9 +719,7 @@ fn test_config_show_skipped_with_installed_binary(mut repo: TestRepo, temp_home:
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -808,9 +760,7 @@ if command -v wt >/dev/null 2>&1; then eval "$(command wt config shell init zsh)
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -851,9 +801,7 @@ fn test_config_show_fish_with_completions(mut repo: TestRepo, temp_home: TempDir
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -887,9 +835,7 @@ fn test_config_show_fish_without_completions(mut repo: TestRepo, temp_home: Temp
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -924,9 +870,7 @@ fn test_config_show_fish_outdated_wrapper(mut repo: TestRepo, temp_home: TempDir
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -962,9 +906,7 @@ fn test_config_show_nushell_outdated_wrapper(mut repo: TestRepo, temp_home: Temp
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -1001,9 +943,7 @@ eval "$(wt.exe config shell init bash)"
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -1052,9 +992,7 @@ if command -v wt >/dev/null 2>&1; then eval "$(command wt config shell init zsh)
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -1190,9 +1128,7 @@ fn test_config_show_warns_unknown_project_keys(mut repo: TestRepo, temp_home: Te
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -1217,9 +1153,7 @@ fn test_config_show_warns_unknown_user_keys(mut repo: TestRepo, temp_home: TempD
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -1289,9 +1223,7 @@ fn test_config_show_suggests_user_config_for_commit_generation(
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -1317,9 +1249,7 @@ fn test_config_show_suggests_project_config_for_ci(mut repo: TestRepo, temp_home
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -1343,9 +1273,7 @@ fn test_config_show_invalid_user_toml(mut repo: TestRepo, temp_home: TempDir) {
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -1374,9 +1302,7 @@ fn test_config_show_invalid_project_toml(mut repo: TestRepo, temp_home: TempDir)
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -1402,9 +1328,7 @@ fn test_config_show_full_not_configured(mut repo: TestRepo, temp_home: TempDir)
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
// Inject current version for deterministic version check output
cmd.env("WORKTRUNK_TEST_LATEST_VERSION", env!("CARGO_PKG_VERSION"));
cmd.arg("config")
@@ -1439,9 +1363,7 @@ command = "nonexistent-llm-command-12345 -m test-model"
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
// Inject current version for deterministic version check output
cmd.env("WORKTRUNK_TEST_LATEST_VERSION", env!("CARGO_PKG_VERSION"));
cmd.arg("config")
@@ -1472,9 +1394,7 @@ fn test_config_show_full_update_available(mut repo: TestRepo, temp_home: TempDir
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
// Inject a higher version to trigger update-available message
cmd.env("WORKTRUNK_TEST_LATEST_VERSION", "99.0.0");
cmd.arg("config")
@@ -1503,9 +1423,7 @@ fn test_config_show_full_version_check_unavailable(mut repo: TestRepo, temp_home
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
// Simulate a fetch failure
cmd.env("WORKTRUNK_TEST_LATEST_VERSION", "error");
cmd.arg("config")
@@ -1545,9 +1463,7 @@ fn test_config_show_full_gitea_remote(mut repo: TestRepo, temp_home: TempDir) {
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.env("WORKTRUNK_TEST_LATEST_VERSION", env!("CARGO_PKG_VERSION"));
cmd.arg("config")
.arg("show")
@@ -1597,9 +1513,7 @@ fn test_config_show_full_azure_remote(
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.env("WORKTRUNK_TEST_LATEST_VERSION", env!("CARGO_PKG_VERSION"));
cmd.arg("config")
.arg("show")
@@ -1637,9 +1551,7 @@ fn test_config_show_github_remote(mut repo: TestRepo, temp_home: TempDir) {
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -1673,9 +1585,7 @@ fn test_config_show_gitlab_remote(mut repo: TestRepo, temp_home: TempDir) {
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -1706,42 +1616,7 @@ fn test_config_show_empty_project_config(mut repo: TestRepo, temp_home: TempDir)
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
- cmd.arg("config").arg("show").current_dir(repo.root_path());
- set_temp_home_env(&mut cmd, temp_home.path());
- set_xdg_config_path(&mut cmd, temp_home.path());
-
- assert_cmd_snapshot!(cmd);
- });
-}
-
-#[rstest]
-fn test_config_show_whitespace_only_project_config(mut repo: TestRepo, temp_home: TempDir) {
- // Setup mock gh/glab for deterministic BINARIES output
- repo.setup_mock_ci_tools_unauthenticated();
-
- // Create fake global config
- let global_config_dir = temp_home.path().join(".config").join("worktrunk");
- fs::create_dir_all(&global_config_dir).unwrap();
- fs::write(
- global_config_dir.join("config.toml"),
- r#"worktree-path = "../{{ repo }}.{{ branch }}"
-"#,
- )
- .unwrap();
-
- // Create project config file with only whitespace
- let config_dir = repo.root_path().join(".config");
- fs::create_dir_all(&config_dir).unwrap();
- fs::write(config_dir.join("wt.toml"), " \n\t\n ").unwrap();
-
- let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
- settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -1761,9 +1636,7 @@ fn test_config_show_no_user_config(mut repo: TestRepo, temp_home: TempDir) {
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -1798,9 +1671,7 @@ alias wt="git worktree"
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -1840,9 +1711,7 @@ export WT_BIN="/c/Program Files/wt.exe"
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -1894,9 +1763,7 @@ alias wt="git worktree"
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -1982,35 +1849,27 @@ pre-start = "ln -sf {{ repo_root }}/node_modules {{ worktree }}/node_modules"
});
}
-/// When a migration file has already been written, subsequent `wt list` runs should:
-/// 1. Still show a brief deprecation warning
-/// 2. NOT write or overwrite the migration file (skip write since hint is set)
-///
-/// The file remains available for the user. If they want a fresh one, `wt config show` regenerates.
+/// Loading deprecated project config warns but leaves the config untouched.
+/// Materializing migrations is `wt config update`'s job.
#[rstest]
fn test_wt_list_never_writes_migration_file(repo: TestRepo, temp_home: TempDir) {
- // Write project config with deprecated variables
- let project_config_dir = repo.root_path().join(".config");
- fs::create_dir_all(&project_config_dir).unwrap();
- let project_config_path = project_config_dir.join("wt.toml");
- let original = r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"
+ let project_config_path = repo.root_path().join(".config").join("wt.toml");
+ let original = r#"pre-start = "echo {{ main_worktree }}"
"#;
- fs::write(&project_config_path, original).unwrap();
-
- // `wt list` should emit a deprecation warning but never write a .new file
- // or modify the config. Materializing migrations is `wt config update`'s job.
- for _ in 0..2 {
- let mut cmd = repo.wt_command();
- cmd.arg("list").current_dir(repo.root_path());
- set_temp_home_env(&mut cmd, temp_home.path());
- let output = cmd.output().unwrap();
- assert!(
- output.status.success(),
- "wt list should succeed: {:?}",
- String::from_utf8_lossy(&output.stderr)
- );
- }
+ repo.write_project_config(original);
+ let mut cmd = repo.wt_command();
+ cmd.arg("list").current_dir(repo.root_path());
+ set_temp_home_env(&mut cmd, temp_home.path());
+ let output = cmd.output().unwrap();
+ let stderr = String::from_utf8_lossy(&output.stderr);
+ assert!(output.status.success(), "wt list should succeed: {stderr}");
+ assert!(
+ stderr.contains("Project config")
+ && stderr.contains("main_worktree")
+ && stderr.contains("is deprecated"),
+ "Expected the project-config template deprecation warning, got: {stderr}"
+ );
assert!(
!project_config_path.with_extension("toml.new").exists(),
"wt list must not write a .new migration file"
@@ -2022,133 +1881,63 @@ fn test_wt_list_never_writes_migration_file(repo: TestRepo, temp_home: TempDir)
);
}
-/// Fixing a deprecated config and later introducing a new one still shows a
-/// warning on the new deprecation — no stale state persists across process
-/// runs now that `.new` files are gone, so this just exercises the plain
-/// per-process warning path.
+/// A linked worktree loads its own project hooks, but suppresses project-config
+/// deprecation warnings because the migration is only actionable from the main
+/// worktree.
#[rstest]
-fn test_fixing_deprecated_config_then_reintroducing_still_warns(
- repo: TestRepo,
+fn test_deprecated_project_config_silent_in_linked_worktree(
+ mut repo: TestRepo,
temp_home: TempDir,
) {
- let project_config_dir = repo.root_path().join(".config");
- fs::create_dir_all(&project_config_dir).unwrap();
- let project_config_path = project_config_dir.join("wt.toml");
-
- fs::write(
- &project_config_path,
- r#"pre-start = "ln -sf {{ main_worktree }}/node_modules"
-"#,
- )
- .unwrap();
- {
- let mut cmd = repo.wt_command();
- cmd.arg("list").current_dir(repo.root_path());
- set_temp_home_env(&mut cmd, temp_home.path());
- assert!(cmd.output().unwrap().status.success());
- }
-
- fs::write(
- &project_config_path,
- r#"pre-start = "ln -sf {{ repo }}/node_modules"
-"#,
- )
- .unwrap();
- {
- let mut cmd = repo.wt_command();
- cmd.arg("list").current_dir(repo.root_path());
- set_temp_home_env(&mut cmd, temp_home.path());
- let output = cmd.output().unwrap();
- assert!(output.status.success());
- let stderr = String::from_utf8_lossy(&output.stderr);
- assert!(
- !stderr.contains("deprecated"),
- "No deprecation warning for clean config"
- );
- }
-
- fs::write(
- &project_config_path,
- r#"pre-start = "cd {{ worktree }} && npm install"
-"#,
- )
- .unwrap();
- {
- let mut cmd = repo.wt_command();
- cmd.arg("list").current_dir(repo.root_path());
- set_temp_home_env(&mut cmd, temp_home.path());
- let output = cmd.output().unwrap();
- assert!(output.status.success());
- let stderr = String::from_utf8_lossy(&output.stderr);
- assert!(
- stderr.contains("is deprecated"),
- "New deprecation should show warning, got: {stderr}"
- );
- }
+ let linked_path = repo.add_worktree("feature");
+ let config_path = linked_path.join(".config").join("wt.toml");
+ let original = r#"pre-start = "echo linked-project-hook {{ main_worktree }}"
+"#;
+ fs::create_dir_all(config_path.parent().unwrap()).unwrap();
+ fs::write(&config_path, original).unwrap();
+ // `hook show` loads and renders project config without globally
+ // suppressing warnings; only ProjectConfig's linked-worktree gate makes
+ // the deprecation silent.
+ let mut cmd = repo.wt_command();
+ cmd.args(["hook", "show", "pre-start", "--format=json"])
+ .current_dir(&linked_path)
+ .env("NO_COLOR", "1");
+ set_temp_home_env(&mut cmd, temp_home.path());
+ let output = cmd.output().unwrap();
+ let stderr = String::from_utf8_lossy(&output.stderr);
assert!(
- !project_config_path.with_extension("toml.new").exists(),
- "wt list must never write a .new file"
+ output.status.success(),
+ "wt hook show from linked worktree should succeed: {stderr}"
);
-}
-
-/// Deprecation warnings should only appear in the main worktree where the migration
-/// file can be applied. Running from a feature worktree should skip the warning entirely.
-#[rstest]
-fn test_deprecated_project_config_silent_in_feature_worktree(repo: TestRepo, temp_home: TempDir) {
- // Create a feature worktree first (before adding project config)
- {
- let mut cmd = repo.wt_command();
- cmd.args(["switch", "--create", "feature"])
- .current_dir(repo.root_path());
- set_temp_home_env(&mut cmd, temp_home.path());
- let output = cmd.output().unwrap();
- assert!(
- output.status.success(),
- "Creating feature worktree should succeed: {:?}",
- String::from_utf8_lossy(&output.stderr)
- );
- }
-
- // Get the feature worktree path
- let feature_path = repo.root_path().parent().unwrap().join(format!(
- "{}.feature",
- repo.root_path().file_name().unwrap().to_string_lossy()
- ));
- // Write project config with deprecated variables IN THE FEATURE WORKTREE
- // (project config is loaded from the current worktree root, not the main worktree)
- let feature_config_dir = feature_path.join(".config");
- fs::create_dir_all(&feature_config_dir).unwrap();
- fs::write(
- feature_config_dir.join("wt.toml"),
- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"
-"#,
- )
- .unwrap();
-
- // Run wt list from the feature worktree - should NOT show deprecation warning
- // because warn_and_migrate is false for non-main worktrees
- {
- let mut cmd = repo.wt_command();
- cmd.arg("list").current_dir(&feature_path);
- set_temp_home_env(&mut cmd, temp_home.path());
- let output = cmd.output().unwrap();
- assert!(
- output.status.success(),
- "wt list from feature worktree should succeed: {:?}",
- String::from_utf8_lossy(&output.stderr)
- );
- let stderr = String::from_utf8_lossy(&output.stderr);
- assert!(
- !stderr.contains("deprecated template variables"),
- "Deprecation warning should NOT appear in feature worktree, got: {stderr}"
- );
- assert!(
- !stderr.contains("Wrote migrated"),
- "Migration file should NOT be written from feature worktree, got: {stderr}"
- );
- }
+ let hooks: serde_json::Value =
+ serde_json::from_slice(&output.stdout).expect("hook show should emit valid JSON");
+ let project_hook = hooks
+ .as_array()
+ .expect("hook show should emit an array")
+ .iter()
+ .find(|hook| hook["source"] == "project" && hook["type"] == "pre-start")
+ .expect("linked-worktree project hook should be listed");
+ assert_eq!(
+ project_hook["template"],
+ "echo linked-project-hook {{ main_worktree }}"
+ );
+ assert!(
+ !(stderr.contains("Project config")
+ && stderr.contains("main_worktree")
+ && stderr.contains("deprecated")),
+ "Project-config deprecation warning should be silent in a linked worktree, got: {stderr}"
+ );
+ assert_eq!(
+ fs::read_to_string(&config_path).unwrap(),
+ original,
+ "loading linked-worktree project config must not modify it"
+ );
+ assert!(
+ !config_path.with_extension("toml.new").exists(),
+ "loading linked-worktree project config must not write a .new migration file"
+ );
}
/// `wt list` emits a user-config deprecation warning but never writes a
@@ -2207,9 +1996,7 @@ fn test_config_show_shell_integration_active(mut repo: TestRepo, temp_home: Temp
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -2244,9 +2031,7 @@ fn test_config_show_shell_active_but_not_in_config_file(mut repo: TestRepo, temp
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -2278,9 +2063,7 @@ fn test_config_show_plugin_installed(mut repo: TestRepo, temp_home: TempDir) {
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -2308,9 +2091,7 @@ fn test_config_show_claude_available_plugin_not_installed(mut repo: TestRepo, te
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -2340,9 +2121,7 @@ fn test_config_show_statusline_configured(mut repo: TestRepo, temp_home: TempDir
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -2370,9 +2149,7 @@ fn test_config_show_codex_available(mut repo: TestRepo, temp_home: TempDir) {
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -2403,9 +2180,7 @@ fn test_config_show_opencode_available_plugin_not_installed(
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -2434,9 +2209,7 @@ fn test_config_show_opencode_plugin_installed(mut repo: TestRepo, temp_home: Tem
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -2473,9 +2246,7 @@ fn test_config_show_opencode_plugin_outdated(mut repo: TestRepo, temp_home: Temp
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -2506,9 +2277,7 @@ fn test_config_show_gemini_available_extension_not_installed(
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -2539,9 +2308,7 @@ fn test_config_show_gemini_extension_invalid_manifest(mut repo: TestRepo, temp_h
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -2568,11 +2335,9 @@ fn test_config_show_gemini_extension_installed(mut repo: TestRepo, temp_home: Te
)
.unwrap();
- let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
- settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
+ settings.bind(|| {
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -2602,9 +2367,7 @@ fn test_config_show_clis_detected_via_path(mut repo: TestRepo, temp_home: TempDi
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -2880,9 +2643,7 @@ fn test_config_show_powershell_detected_via_psmodulepath(mut repo: TestRepo, tem
// Collapse triple newlines that may result from stripping adjacent lines
settings.add_filter(r"\n\n\n", "\n\n");
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -2918,9 +2679,7 @@ fn test_config_show_detected_shell_via_process_tree(mut repo: TestRepo, temp_hom
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -2942,9 +2701,7 @@ fn test_config_show_detected_shell_via_process_tree(mut repo: TestRepo, temp_hom
fn test_config_show_runs_real_ancestry_walk(mut repo: TestRepo, temp_home: TempDir) {
repo.setup_mock_ci_tools_unauthenticated();
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -3076,9 +2833,7 @@ pre-start = "ln -sf {{ repo_root }}/node_modules"
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -3129,9 +2884,7 @@ fn test_config_show_from_linked_worktree_shows_main_worktree_hint(
// Run wt config show from the linked worktree
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(&feature_path);
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -3164,9 +2917,7 @@ command = "llm -m gpt-4"
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.arg("config").arg("show").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
@@ -3278,30 +3029,6 @@ fn test_config_update_applies_project_config_migration(repo: TestRepo) {
assert!(!updated.contains("main_worktree"));
}
-/// `wt config update` with a clean project config (no deprecations) treats
-/// the repo as nothing-to-do — covers the project-config path through
-/// `check_and_migrate` when it returns `info == None`.
-#[rstest]
-fn test_config_update_clean_project_config_is_noop(repo: TestRepo) {
- repo.write_project_config(
- r#"pre-start = "echo ready"
-"#,
- );
- repo.commit("Add clean project config");
-
- let output = repo
- .wt_command()
- .args(["config", "update"])
- .output()
- .unwrap();
- assert!(output.status.success());
- let stderr = String::from_utf8_lossy(&output.stderr);
- assert!(
- stderr.contains("No deprecated settings found"),
- "Expected no-op message, got: {stderr}"
- );
-}
-
/// `wt config update` from a linked worktree declines to mutate project
/// config and instead points at the main worktree. Covers the `is_linked`
/// branch in `check_project_config`.
@@ -3524,48 +3251,6 @@ fn test_config_update_json_schema_adopt_defers_to_system_config(repo: TestRepo)
);
}
-/// `wt config update --yes` applies template variable migration
-#[rstest]
-fn test_config_update_applies_template_var_migration(repo: TestRepo) {
- let config_path = repo.test_config_path();
- fs::write(
- config_path,
- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"
-pre-start = "ln -sf {{ repo_root }}/node_modules {{ worktree }}/node_modules"
-"#,
- )
- .unwrap();
-
- let settings = setup_snapshot_settings(&repo);
- settings.bind(|| {
- let mut cmd = repo.wt_command();
- cmd.args(["config", "update", "--yes"]);
-
- assert_cmd_snapshot!(cmd);
- });
-
- // Config file should now contain the updated variables
- let updated = fs::read_to_string(config_path).unwrap();
- assert!(
- updated.contains("{{ repo }}"),
- "Should replace main_worktree with repo"
- );
- assert!(
- updated.contains("{{ repo_path }}"),
- "Should replace repo_root with repo_path"
- );
- assert!(
- updated.contains("{{ worktree_path }}"),
- "Should replace worktree with worktree_path"
- );
-
- // Migration .new file should be gone (renamed over original)
- assert!(
- !config_path.with_extension("toml.new").exists(),
- ".new file should be consumed by the update"
- );
-}
-
/// `wt config update` migrates the deprecated `commits` squash-template
/// variable to `commit_details` (see #2984). The rewrite is a plain identifier
/// rename — the loop variable stays bare — because each `commit_details`
@@ -3613,171 +3298,6 @@ Combine {{ commits | length }} commits:
);
}
-/// `wt config show` displays deprecation details for `[select]` → `[switch.picker]`.
-/// Uses user config so the warning label reads "User config".
-#[rstest]
-fn test_config_show_displays_select_section_deprecation(mut repo: TestRepo, temp_home: TempDir) {
- repo.setup_mock_ci_tools_unauthenticated();
-
- let global_config_dir = temp_home.path().join(".config").join("worktrunk");
- fs::create_dir_all(&global_config_dir).unwrap();
- let config_path = global_config_dir.join("config.toml");
- fs::write(
- &config_path,
- r#"[select]
-pager = "delta --paging=never"
-"#,
- )
- .unwrap();
-
- let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
- settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
- cmd.arg("config").arg("show").current_dir(repo.root_path());
- set_temp_home_env(&mut cmd, temp_home.path());
- set_xdg_config_path(&mut cmd, temp_home.path());
-
- assert_cmd_snapshot!(cmd);
- });
-}
-
-/// `wt config show` displays deprecation details for `[merge] no-ff` → `ff` (inverted).
-#[rstest]
-fn test_config_show_displays_no_ff_deprecation(mut repo: TestRepo, temp_home: TempDir) {
- repo.setup_mock_ci_tools_unauthenticated();
-
- let global_config_dir = temp_home.path().join(".config").join("worktrunk");
- fs::create_dir_all(&global_config_dir).unwrap();
- let config_path = global_config_dir.join("config.toml");
- fs::write(
- &config_path,
- r#"[merge]
-no-ff = true
-"#,
- )
- .unwrap();
-
- let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
- settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
- cmd.arg("config").arg("show").current_dir(repo.root_path());
- set_temp_home_env(&mut cmd, temp_home.path());
- set_xdg_config_path(&mut cmd, temp_home.path());
-
- assert_cmd_snapshot!(cmd);
- });
-}
-
-/// `wt config show` displays deprecation details for `[switch] no-cd` → `cd` (inverted).
-#[rstest]
-fn test_config_show_displays_no_cd_deprecation(mut repo: TestRepo, temp_home: TempDir) {
- repo.setup_mock_ci_tools_unauthenticated();
-
- let global_config_dir = temp_home.path().join(".config").join("worktrunk");
- fs::create_dir_all(&global_config_dir).unwrap();
- let config_path = global_config_dir.join("config.toml");
- fs::write(
- &config_path,
- r#"[switch]
-no-cd = true
-"#,
- )
- .unwrap();
-
- let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
- settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
- cmd.arg("config").arg("show").current_dir(repo.root_path());
- set_temp_home_env(&mut cmd, temp_home.path());
- set_xdg_config_path(&mut cmd, temp_home.path());
-
- assert_cmd_snapshot!(cmd);
- });
-}
-
-/// `wt config update --yes` applies commit-generation section rename
-#[rstest]
-fn test_config_update_applies_commit_generation_migration(repo: TestRepo) {
- let config_path = repo.test_config_path();
- fs::write(
- config_path,
- r#"worktree-path = "../{{ repo }}.{{ branch }}"
-
-[commit-generation]
-command = "llm"
-args = ["-m", "haiku"]
-"#,
- )
- .unwrap();
-
- let settings = setup_snapshot_settings(&repo);
- settings.bind(|| {
- let mut cmd = repo.wt_command();
- cmd.args(["config", "update", "--yes"]);
-
- assert_cmd_snapshot!(cmd);
- });
-
- // Config file should have the renamed section and merged args
- let updated = fs::read_to_string(config_path).unwrap();
- assert!(
- updated.contains("[commit.generation]"),
- "Should rename section"
- );
- assert!(
- updated.contains("command = \"llm -m haiku\""),
- "Should merge args into command"
- );
- assert!(
- !updated.contains("[commit-generation]"),
- "Old section name should be gone"
- );
- assert!(!updated.contains("args ="), "Args field should be removed");
-}
-
-/// `wt config update --yes` handles approved-commands migration
-#[rstest]
-fn test_config_update_applies_approved_commands_migration(repo: TestRepo) {
- let config_path = repo.test_config_path();
- fs::write(
- config_path,
- r#"worktree-path = "../{{ repo }}.{{ branch }}"
-
-[projects."github.com/user/repo"]
-approved-commands = ["npm install", "npm test"]
-"#,
- )
- .unwrap();
-
- let settings = setup_snapshot_settings(&repo);
- settings.bind(|| {
- let mut cmd = repo.wt_command();
- cmd.args(["config", "update", "--yes"]);
-
- assert_cmd_snapshot!(cmd);
- });
-
- // Config should no longer have approved-commands
- let updated = fs::read_to_string(config_path).unwrap();
- assert!(
- !updated.contains("approved-commands"),
- "approved-commands should be removed from config"
- );
-
- // Approvals should be in approvals.toml
- let approvals_file = config_path.with_file_name("approvals.toml");
- assert!(approvals_file.exists(), "approvals.toml should exist");
- let approvals = fs::read_to_string(&approvals_file).unwrap();
- assert!(approvals.contains("npm install"));
- assert!(approvals.contains("npm test"));
-}
-
/// A relative `--config` resolves against `-C`, the way git resolves the path
/// options in its own command line.
///
@@ -3839,9 +3359,7 @@ fn test_plugins_claude_install(mut repo: TestRepo, temp_home: TempDir) {
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.args(["config", "plugins", "claude", "install", "--yes"])
.current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
@@ -3863,9 +3381,7 @@ fn test_plugins_claude_install_invalid_plugins_json(mut repo: TestRepo, temp_hom
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.args(["config", "plugins", "claude", "install", "--yes"])
.current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
@@ -3882,9 +3398,7 @@ fn test_plugins_claude_install_already_installed(mut repo: TestRepo, temp_home:
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.args(["config", "plugins", "claude", "install", "--yes"])
.current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
@@ -3915,9 +3429,7 @@ fn test_plugins_claude_uninstall(mut repo: TestRepo, temp_home: TempDir) {
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.args(["config", "plugins", "claude", "uninstall", "--yes"])
.current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
@@ -3934,9 +3446,7 @@ fn test_plugins_claude_uninstall_not_installed(mut repo: TestRepo, temp_home: Te
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.args(["config", "plugins", "claude", "uninstall", "--yes"])
.current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
@@ -3954,9 +3464,7 @@ fn test_plugins_codex_install(mut repo: TestRepo, temp_home: TempDir) {
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.args(["config", "plugins", "codex", "install", "--yes"])
.current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
@@ -3986,9 +3494,7 @@ fn test_plugins_codex_uninstall(mut repo: TestRepo, temp_home: TempDir) {
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.args(["config", "plugins", "codex", "uninstall", "--yes"])
.current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
@@ -4004,9 +3510,7 @@ fn test_plugins_codex_install_command_fails(mut repo: TestRepo, temp_home: TempD
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.args(["config", "plugins", "codex", "install", "--yes"])
.current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
@@ -4746,9 +4250,7 @@ fn test_plugins_claude_install_command_fails(mut repo: TestRepo, temp_home: Temp
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.args(["config", "plugins", "claude", "install", "--yes"])
.current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
@@ -4778,9 +4280,7 @@ fn test_plugins_claude_install_second_step_fails(mut repo: TestRepo, temp_home:
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.args(["config", "plugins", "claude", "install", "--yes"])
.current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
@@ -4797,9 +4297,7 @@ fn test_plugins_claude_uninstall_command_fails(mut repo: TestRepo, temp_home: Te
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
+ let mut cmd = repo.wt_command();
cmd.args(["config", "plugins", "claude", "uninstall", "--yes"])
.current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
diff --git a/tests/integration_tests/directives.rs b/tests/integration_tests/directives.rs
index d93281a89..0084093ad 100644
--- a/tests/integration_tests/directives.rs
+++ b/tests/integration_tests/directives.rs
@@ -698,19 +698,6 @@ fn test_switch_without_directive_file(repo: TestRepo) {
});
}
-#[rstest]
-fn test_remove_without_directive_file(repo: TestRepo) {
- let settings = setup_snapshot_settings(&repo);
-
- settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- cmd.arg("remove").current_dir(repo.root_path());
-
- assert_cmd_snapshot!(cmd);
- });
-}
-
#[rstest]
fn test_merge_directive_no_remove(mut repo_with_feature_worktree: TestRepo) {
let repo = &mut repo_with_feature_worktree;
diff --git a/tests/integration_tests/list.rs b/tests/integration_tests/list.rs
index 161b76aa4..870d6313f 100644
--- a/tests/integration_tests/list.rs
+++ b/tests/integration_tests/list.rs
@@ -90,15 +90,7 @@ fn setup_timestamped_worktrees(repo: &mut TestRepo) -> std::path::PathBuf {
}
#[rstest]
-fn test_list_single_worktree(repo: TestRepo) {
- assert_cmd_snapshot!(list_snapshots::command(&repo, repo.root_path()));
-}
-
-#[rstest]
-fn test_list_multiple_worktrees(mut repo: TestRepo) {
- repo.add_worktree("feature-a");
- repo.add_worktree("feature-b");
-
+fn test_list_multiple_worktrees(repo: TestRepo) {
assert_cmd_snapshot!(list_snapshots::command(&repo, repo.root_path()));
}
@@ -1020,34 +1012,9 @@ fn test_list_primary_on_different_branch(mut repo: TestRepo) {
assert_cmd_snapshot!(list_snapshots::command(&repo, repo.root_path()));
}
-/// NOTE: This test is used for doc generation (claude-code.md). It removes fixture
-/// worktrees to produce clean output.
-/// TODO: Consider extracting fixture cleanup into a helper function shared with
-/// setup_readme_example_repo.
-#[rstest]
-fn test_list_with_user_marker(mut repo: TestRepo) {
- // Remove fixture worktrees for clean doc output (used by claude-code.md)
- for branch in &["feature-a", "feature-b", "feature-c"] {
- let worktree_path = repo
- .root_path()
- .parent()
- .unwrap()
- .join(format!("repo.{}", branch));
- if worktree_path.exists() {
- let _ = repo
- .git_command()
- .args([
- "worktree",
- "remove",
- "--force",
- worktree_path.to_str().unwrap(),
- ])
- .run();
- }
- // Delete the branch after removing the worktree
- let _ = repo.git_command().args(["branch", "-D", branch]).run();
- }
-
+/// Set up the clean worktree state shared by the user-marker documentation snapshots.
+fn setup_user_marker_example(repo: &mut TestRepo) {
+ repo.remove_fixture_worktrees();
repo.commit_with_age("Initial commit", DAY);
// Branch ahead of main with commits and user marker 🤖
@@ -1075,7 +1042,11 @@ fn test_list_with_user_marker(mut repo: TestRepo) {
// Branch with uncommitted changes only (no user marker)
let wip_wt = repo.add_worktree("wip-docs");
std::fs::write(wip_wt.join("README.md"), "# Documentation").unwrap();
+}
+#[rstest]
+fn test_list_with_user_marker(mut repo: TestRepo) {
+ setup_user_marker_example(&mut repo);
assert_cmd_snapshot!(list_snapshots::command(&repo, repo.root_path()));
}
@@ -1212,32 +1183,6 @@ fn test_list_user_marker_with_special_characters(mut repo: TestRepo) {
// These functions create minimal repos for Quick Start documentation.
// The examples show the simplest workflow: create → list → merge.
-/// Remove fixture worktrees to start with a clean main-only repo.
-///
-/// The standard TestRepo fixture includes feature-a, feature-b, feature-c.
-/// Doc examples need clean output without these.
-fn remove_fixture_worktrees(repo: &mut TestRepo) {
- for branch in &["feature-a", "feature-b", "feature-c"] {
- let worktree_path = repo
- .root_path()
- .parent()
- .unwrap()
- .join(format!("repo.{}", branch));
- if worktree_path.exists() {
- let _ = repo
- .git_command()
- .args([
- "worktree",
- "remove",
- "--force",
- worktree_path.to_str().unwrap(),
- ])
- .run();
- }
- let _ = repo.git_command().args(["branch", "-D", branch]).run();
- }
-}
-
/// Set up a minimal repo with just main branch.
///
/// Creates a simple codebase:
@@ -1247,7 +1192,7 @@ fn remove_fixture_worktrees(repo: &mut TestRepo) {
///
/// Used as base for both Quick Start and full README examples.
fn setup_quickstart_base(repo: &mut TestRepo) {
- remove_fixture_worktrees(repo);
+ repo.remove_fixture_worktrees();
// Suppress the "customize worktree locations" hint for clean snapshots
repo.run_git(&["config", "worktrunk.hints.worktree-path", "true"]);
@@ -1481,7 +1426,7 @@ pub fn init() -> bool {
/// use a different setup function.
fn setup_readme_example_repo(repo: &mut TestRepo) -> std::path::PathBuf {
// Start with clean base (removes fixture worktrees)
- remove_fixture_worktrees(repo);
+ repo.remove_fixture_worktrees();
// === Set up main branch with initial codebase ===
// Main has a working API with security issues that fix-auth will harden
@@ -2640,32 +2585,7 @@ fn test_readme_example_list_branches(mut repo: TestRepo) {
/// Output: tests/snapshots/integration__integration_tests__list__readme_example_list_marker.snap
#[rstest]
fn test_readme_example_list_marker(mut repo: TestRepo) {
- remove_fixture_worktrees(&mut repo);
-
- repo.commit_with_age("Initial commit", DAY);
-
- // Branch ahead of main with commits and user marker 🤖
- let _feature_wt = repo.add_worktree_with_commit(
- "feature-api",
- "api.rs",
- "// API implementation",
- "Add REST API endpoints",
- );
- repo.set_marker("feature-api", "🤖");
-
- // Branch with uncommitted changes and user marker 💬
- let review_wt = repo.add_worktree_with_commit(
- "review-ui",
- "component.tsx",
- "// UI component",
- "Add dashboard component",
- );
- std::fs::write(review_wt.join("styles.css"), "/* pending styles */").unwrap();
- repo.set_marker("review-ui", "💬");
-
- // Branch with uncommitted changes only (no user marker)
- let wip_wt = repo.add_worktree("wip-docs");
- std::fs::write(wip_wt.join("README.md"), "# Documentation").unwrap();
+ setup_user_marker_example(&mut repo);
assert_cmd_snapshot!(
"readme_example_list_marker",
@@ -2699,20 +2619,6 @@ url = "http://localhost:{{ branch | hash_port }}"
);
}
-#[rstest]
-fn test_list_progressive_flag(mut repo: TestRepo) {
- repo.add_worktree("feature-a");
- repo.add_worktree("feature-b");
-
- // Force progressive mode even in non-TTY test environment
- // Output should be identical to buffered mode (only process differs)
- assert_cmd_snapshot!({
- let mut cmd = list_snapshots::command(&repo, repo.root_path());
- cmd.arg("--progressive");
- cmd
- });
-}
-
#[rstest]
fn test_list_no_progressive_flag(mut repo: TestRepo) {
repo.add_worktree("feature");
@@ -2772,28 +2678,6 @@ fn test_list_first_output_writes_buffered_stdout(mut repo: TestRepo) {
// Task DAG Mode Tests
// ============================================================================
-#[rstest]
-fn test_list_task_dag_single_worktree(repo: TestRepo) {
- assert_cmd_snapshot!({
- let mut cmd = list_snapshots::command(&repo, repo.root_path());
- cmd.arg("--progressive");
- cmd
- });
-}
-
-#[rstest]
-fn test_list_task_dag_multiple_worktrees(mut repo: TestRepo) {
- repo.add_worktree("feature-a");
- repo.add_worktree("feature-b");
- repo.add_worktree("feature-c");
-
- assert_cmd_snapshot!({
- let mut cmd = list_snapshots::command(&repo, repo.root_path());
- cmd.arg("--progressive");
- cmd
- });
-}
-
#[rstest]
fn test_list_task_dag_full_with_diffs(mut repo: TestRepo) {
// Create worktree with changes
diff --git a/tests/integration_tests/list_config.rs b/tests/integration_tests/list_config.rs
index cd190ad39..325e05abf 100644
--- a/tests/integration_tests/list_config.rs
+++ b/tests/integration_tests/list_config.rs
@@ -194,28 +194,9 @@ fn test_list_json_no_url_without_template(repo: TestRepo) {
///
/// Only worktrees should have URLs - branches without worktrees can't have running dev servers.
#[rstest]
-fn test_list_url_with_branches_flag(repo: TestRepo) {
+fn test_list_url_with_branches_flag(mut repo: TestRepo) {
// Remove fixture worktrees and their branches to isolate test (keep only main worktree)
- for branch in &["feature-a", "feature-b", "feature-c"] {
- let worktree_path = repo
- .root_path()
- .parent()
- .unwrap()
- .join(format!("repo.{}", branch));
- if worktree_path.exists() {
- let _ = repo
- .git_command()
- .args([
- "worktree",
- "remove",
- "--force",
- worktree_path.to_str().unwrap(),
- ])
- .run();
- }
- // Delete the branch after removing the worktree
- let _ = repo.git_command().args(["branch", "-D", branch]).run();
- }
+ repo.remove_fixture_worktrees();
// Create a branch without a worktree
repo.run_git(&["branch", "feature"]);
diff --git a/tests/integration_tests/merge.rs b/tests/integration_tests/merge.rs
index 5f3b4c888..02586bd0e 100644
--- a/tests/integration_tests/merge.rs
+++ b/tests/integration_tests/merge.rs
@@ -1,9 +1,9 @@
use crate::common::{
SLEEP_FOR_ABSENCE_CHECK, TestRepo, make_snapshot_cmd, merge_scenario,
mock_commands::{create_mock_cargo, create_mock_llm_auth},
- repo, repo_with_alternate_primary, repo_with_feature_worktree, repo_with_main_worktree,
- repo_with_multi_commit_feature, repo_with_remote, setup_snapshot_settings, wait_for_file,
- wait_for_file_content, wait_for_worktree_removed,
+ repo, repo_with_alternate_primary, repo_with_main_worktree, repo_with_multi_commit_feature,
+ repo_with_remote, setup_snapshot_settings, wait_for_file, wait_for_file_content,
+ wait_for_worktree_removed,
};
use insta::assert_snapshot;
use insta_cmd::assert_cmd_snapshot;
@@ -154,27 +154,6 @@ fn test_merge_dirty_working_tree(mut repo: TestRepo) {
));
}
-#[rstest]
-fn test_merge_not_fast_forward(mut repo: TestRepo) {
- // Create commits in both branches
- // Add commit to main (repo root)
- std::fs::write(repo.root_path().join("main.txt"), "main content").unwrap();
-
- repo.run_git(&["add", "main.txt"]);
- repo.run_git(&["commit", "-m", "Add main file"]);
-
- // Create a feature worktree branching from before the main commit
- let feature_wt = repo.add_feature();
-
- // Try to merge (should fail or require actual merge)
- assert_cmd_snapshot!(make_snapshot_cmd(
- &repo,
- "merge",
- &["main"],
- Some(&feature_wt)
- ));
-}
-
/// The --no-commit flag skips the rebase step, so the push fails with not-fast-forward error.
/// The hint should say "Run 'wt merge' again" (not "Use 'wt merge'").
#[rstest]
@@ -1040,15 +1019,6 @@ fn test_merge_pre_commit_collected_for_squash_clean_worktree(
));
}
-#[rstest]
-fn test_merge_no_remote(#[from(repo_with_feature_worktree)] repo: TestRepo) {
- // Deliberately NOT calling setup_remote to test the error case
- let feature_wt = repo.worktree_path("feature");
-
- // Try to merge without specifying target (should fail - no remote to get default branch)
- assert_cmd_snapshot!(make_snapshot_cmd(&repo, "merge", &[], Some(feature_wt)));
-}
-
// README EXAMPLE GENERATION TESTS
// These tests are specifically designed to generate realistic output examples for the README.
// The snapshots from these tests are manually copied into README.md to show users what
@@ -1507,20 +1477,6 @@ fn accepts_non_empty_strings() {
});
}
-#[rstest]
-fn test_merge_no_commit_with_clean_tree(mut repo_with_feature_worktree: TestRepo) {
- let repo = &mut repo_with_feature_worktree;
- let feature_wt = &repo.worktrees["feature"];
-
- // Merge with --no-commit (should succeed - clean tree)
- assert_cmd_snapshot!(make_snapshot_cmd(
- repo,
- "merge",
- &["main", "--no-commit", "--no-remove"],
- Some(feature_wt),
- ));
-}
-
#[rstest]
fn test_merge_no_commit_with_dirty_tree(mut repo: TestRepo) {
// Create a feature worktree with a commit
@@ -1557,20 +1513,6 @@ fn test_merge_no_commit_with_dirty_tree(mut repo: TestRepo) {
);
}
-#[rstest]
-fn test_merge_no_commit_no_squash_no_remove_redundant(mut repo_with_feature_worktree: TestRepo) {
- let repo = &mut repo_with_feature_worktree;
- let feature_wt = &repo.worktrees["feature"];
-
- // Merge with --no-commit --no-squash --no-remove (redundant but valid - should succeed)
- assert_cmd_snapshot!(make_snapshot_cmd(
- repo,
- "merge",
- &["main", "--no-commit", "--no-squash", "--no-remove"],
- Some(feature_wt),
- ));
-}
-
#[rstest]
fn test_merge_no_commits(mut repo_with_main_worktree: TestRepo) {
let repo = &mut repo_with_main_worktree;
@@ -2269,68 +2211,6 @@ fn test_merge_pre_remove_new_commit_keeps_branch(mut repo: TestRepo) {
);
}
-#[rstest]
-fn test_merge_race_condition_commit_after_push(mut repo_with_feature_worktree: TestRepo) {
- let repo = &mut repo_with_feature_worktree;
- let feature_wt = repo.worktrees["feature"].clone();
-
- // Merge to main (this pushes the branch to main)
- assert_cmd_snapshot!(make_snapshot_cmd(
- repo,
- "merge",
- &["main", "--no-remove"],
- Some(&feature_wt)
- ));
-
- // RACE CONDITION: Simulate another developer adding a commit to the feature branch
- // after the merge/push but before worktree removal and branch deletion.
- // Since feature is already checked out in feature_wt, we'll add the commit directly there.
- fs::write(feature_wt.join("extra.txt"), "race condition commit").unwrap();
- repo.run_git_in(&feature_wt, &["add", "extra.txt"]);
- repo.run_git_in(
- &feature_wt,
- &["commit", "-m", "Add extra file (race condition)"],
- );
-
- // Now simulate what wt merge would do: remove the worktree
- repo.run_git(&["worktree", "remove", feature_wt.to_str().unwrap()]);
-
- // Try to delete the branch with -d (safe delete)
- // This should FAIL because the branch has the race condition commit not in main
- let output = repo
- .git_command()
- .args(["branch", "-d", "feature"])
- .run()
- .unwrap();
-
- // Verify the deletion failed (non-zero exit code)
- assert!(
- !output.status.success(),
- "git branch -d should fail when branch has unmerged commits"
- );
-
- // Verify the error message mentions the branch is not fully merged
- let stderr = String::from_utf8_lossy(&output.stderr);
- assert!(
- stderr.contains("not fully merged") || stderr.contains("not merged"),
- "Error should mention branch is not fully merged, got: {}",
- stderr
- );
-
- // Verify the branch still exists (wasn't deleted)
- let output = repo
- .git_command()
- .args(["branch", "--list", "feature"])
- .run()
- .unwrap();
-
- let stdout = String::from_utf8_lossy(&output.stdout);
- assert!(
- stdout.contains("feature"),
- "Branch should still exist after failed deletion"
- );
-}
-
#[rstest]
fn test_merge_to_non_default_target(repo: TestRepo) {
// Switch back to main and add a commit there
diff --git a/tests/integration_tests/push.rs b/tests/integration_tests/push.rs
index 812941d9c..ad9eefddb 100644
--- a/tests/integration_tests/push.rs
+++ b/tests/integration_tests/push.rs
@@ -57,25 +57,6 @@ fn test_push_diffstat_without_detectable_width(mut repo: TestRepo) {
);
}
-#[rstest]
-fn test_push_not_fast_forward(mut repo: TestRepo) {
- // Create commits in both worktrees
- // Note: We use commit_in_worktree on root to match the original file layout
- // (file named main.txt instead of file.txt that repo.commit() creates)
- repo.commit_in_worktree(
- repo.root_path(),
- "main.txt",
- "main content",
- "Add main file",
- );
-
- // Create a feature worktree branching from before the main commit
- let feature_wt = repo.add_feature();
-
- // Try to push from feature to main (should fail - not fast-forward)
- snapshot_push("push_not_fast_forward", &repo, &["main"], Some(&feature_wt));
-}
-
#[rstest]
fn test_push_to_default_branch(#[from(repo_with_feature_worktree)] repo: TestRepo) {
let feature_wt = repo.worktree_path("feature");
@@ -368,15 +349,6 @@ fn main_sha(repo: &TestRepo) -> String {
String::from_utf8_lossy(&output.stdout).trim().to_string()
}
-#[rstest]
-fn test_push_no_remote(#[from(repo_with_feature_worktree)] repo: TestRepo) {
- // Note: repo_with_feature_worktree doesn't call setup_remote(), so this tests the "no remote" error case
- let feature_wt = repo.worktree_path("feature");
-
- // Try to push without specifying target (should fail - no remote to get default branch)
- snapshot_push("push_no_remote", &repo, &[], Some(feature_wt));
-}
-
/// A push target can be named by the worktree it is checked out in, the same as
/// a rebase or diff target — `require_target_branch`'s path fallback, where
/// `require_target_ref`'s is covered by `wt step diff`.
diff --git a/tests/integration_tests/remove.rs b/tests/integration_tests/remove.rs
index 34e24c2e6..ab1f6f407 100644
--- a/tests/integration_tests/remove.rs
+++ b/tests/integration_tests/remove.rs
@@ -9,20 +9,6 @@ use insta_cmd::assert_cmd_snapshot;
use path_slash::PathExt as _;
use rstest::rstest;
-#[rstest]
-fn test_remove_already_on_default(repo: TestRepo) {
- // Already on main branch
- assert_cmd_snapshot!(make_snapshot_cmd(&repo, "remove", &[], None));
-}
-
-#[rstest]
-fn test_remove_switch_to_default(repo: TestRepo) {
- // Create and switch to a feature branch in the main repo
- repo.run_git(&["switch", "-c", "feature"]);
-
- assert_cmd_snapshot!(make_snapshot_cmd(&repo, "remove", &[], None));
-}
-
#[rstest]
fn test_remove_from_worktree(mut repo: TestRepo) {
let worktree_path = repo.add_worktree("feature-wt");
@@ -168,14 +154,6 @@ fn test_remove_as_git_subcommand(mut repo: TestRepo) {
});
}
-#[rstest]
-fn test_remove_dirty_working_tree(repo: TestRepo) {
- // Create a dirty file
- std::fs::write(repo.root_path().join("dirty.txt"), "uncommitted changes").unwrap();
-
- assert_cmd_snapshot!(make_snapshot_cmd(&repo, "remove", &[], None));
-}
-
#[rstest]
fn test_remove_locked_worktree(mut repo: TestRepo) {
// Create a worktree and lock it
@@ -347,12 +325,6 @@ fn test_remove_current_by_name(mut repo: TestRepo) {
));
}
-#[rstest]
-fn test_remove_nonexistent_worktree(repo: TestRepo) {
- // Try to remove a worktree that doesn't exist
- assert_cmd_snapshot!(make_snapshot_cmd(&repo, "remove", &["nonexistent"], None));
-}
-
///
/// Regression test for bug where `wt remove npm` would show "Cannot create worktree for npm"
/// when the expected path was occupied. Resolution skips the path occupation check entirely,
@@ -3788,27 +3760,6 @@ fn test_remove_json(mut repo: TestRepo) {
});
}
-#[cfg(not(target_os = "windows"))] // foreground removal with cwd inside the worktree hits directory locking
-#[rstest]
-fn test_remove_json_current(mut repo: TestRepo) {
- repo.commit("initial");
- let feature_wt = repo.add_worktree("feature");
-
- let output = repo
- .wt_command()
- .args(["remove", "--format=json", "--yes", "--foreground"])
- .current_dir(&feature_wt)
- .output()
- .unwrap();
- assert!(output.status.success());
-
- let mut settings = insta::Settings::clone_current();
- settings.add_filter(r#""path": "[^"]*""#, r#""path": "<PATH>""#);
- settings.bind(|| {
- assert_snapshot!(String::from_utf8_lossy(&output.stdout));
- });
-}
-
#[rstest]
fn test_remove_json_branch_only(repo: TestRepo) {
repo.commit("initial");
diff --git a/tests/integration_tests/security.rs b/tests/integration_tests/security.rs
index 17f39feb1..ccd04de0d 100644
--- a/tests/integration_tests/security.rs
+++ b/tests/integration_tests/security.rs
@@ -243,34 +243,6 @@ fn test_commit_message_with_directive_not_executed(mut repo: TestRepo) {
);
}
-///
-/// This tests if file paths shown in output could inject directives
-#[cfg(unix)]
-#[rstest]
-fn test_path_with_directive_not_executed(repo: TestRepo) {
- // Create a directory with a malicious name
- let malicious_dir = repo
- .root_path()
- .join("__WORKTRUNK_EXEC__echo PWNED > /tmp/hacked5");
- std::fs::create_dir_all(&malicious_dir).unwrap();
-
- let settings = setup_snapshot_settings(&repo);
-
- // Run a command that might display this path
- settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- cmd.arg("list").current_dir(repo.root_path());
-
- assert_cmd_snapshot!(cmd);
- });
-
- assert!(
- !std::path::Path::new("/tmp/hacked5").exists(),
- "Malicious code was executed from path display!"
- );
-}
-
///
/// Similar to EXEC injection, but for CD directives
#[rstest]
@@ -421,47 +393,6 @@ fn test_git_rejects_ansi_escape_in_branch_names(repo: TestRepo) {
);
}
-/// Test that manually created refs with ANSI escapes are ignored by git.
-///
-/// Even if an attacker bypasses git's normal validation and creates a ref file
-/// directly in .git/refs/heads/ with ANSI codes in the filename, git ignores it.
-#[rstest]
-#[cfg(unix)]
-fn test_git_ignores_malformed_refs_with_ansi(repo: TestRepo) {
- let shell_cmd = r#"
- commit_sha=$(git rev-parse HEAD)
- printf "$commit_sha" > '.git/refs/heads/feature-'$'\x1b''[31mRED'$'\x1b''[0m-test'
- "#;
-
- let create_result = Command::new("bash")
- .args(["-c", shell_cmd])
- .current_dir(repo.root_path())
- .output()
- .unwrap();
-
- assert!(
- create_result.status.success(),
- "Failed to create malformed ref file: {}",
- String::from_utf8_lossy(&create_result.stderr)
- );
-
- // Git should ignore the malformed ref
- let branch_output = repo.git_output(&["branch", "-a"]);
- assert!(
- !branch_output.contains("RED"),
- "Malformed ref with ANSI escape should not appear in branch list"
- );
-
- // wt list should also not show it
- let settings = setup_snapshot_settings(&repo);
- settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- cmd.arg("list").current_dir(repo.root_path());
- assert_cmd_snapshot!(cmd);
- });
-}
-
/// Test that literal escape-like text in branch names displays safely.
///
/// Branch names like "fix-backslash-x1b-test" contain literal characters
diff --git a/tests/integration_tests/switch.rs b/tests/integration_tests/switch.rs
index 5b01e1172..0dfe4b3af 100644
--- a/tests/integration_tests/switch.rs
+++ b/tests/integration_tests/switch.rs
@@ -942,15 +942,6 @@ fn test_switch_error_path_occupied(repo: TestRepo) {
std::fs::remove_dir_all(&expected_path).ok();
}
// Execute flag tests
-#[rstest]
-fn test_switch_execute_success(repo: TestRepo) {
- snapshot_switch(
- "switch_execute_success",
- &repo,
- &["--create", "exec-test", "--execute", "echo 'test output'"],
- );
-}
-
#[rstest]
fn test_switch_execute_creates_file(repo: TestRepo) {
let create_file_cmd = "echo 'test content' > test.txt";
@@ -960,38 +951,41 @@ fn test_switch_execute_creates_file(repo: TestRepo) {
&repo,
&["--create", "file-test", "--execute", create_file_cmd],
);
-}
-#[rstest]
-fn test_switch_execute_failure(repo: TestRepo) {
- snapshot_switch(
- "switch_execute_failure",
- &repo,
- &["--create", "fail-test", "--execute", "exit 1"],
- );
-}
-
-#[rstest]
-fn test_switch_execute_with_existing_worktree(mut repo: TestRepo) {
- repo.add_worktree("existing-exec");
-
- let create_file_cmd = "echo 'existing worktree' > existing.txt";
+ // Query Git rather than reconstructing the configured path template: this
+ // keeps the state oracle correct if the fixture's worktree-path changes.
+ let worktrees = repo.git_output(&["worktree", "list", "--porcelain"]);
+ let file_worktree = worktrees
+ .split("\n\n")
+ .find(|entry| {
+ entry
+ .lines()
+ .any(|line| line == "branch refs/heads/file-test")
+ })
+ .unwrap_or_else(|| panic!("file-test worktree not registered:\n{worktrees}"));
+ let worktree_path = file_worktree
+ .lines()
+ .find_map(|line| line.strip_prefix("worktree "))
+ .map(Path::new)
+ .unwrap_or_else(|| panic!("file-test worktree has no path:\n{file_worktree}"));
- snapshot_switch(
- "switch_execute_existing",
- &repo,
- &["existing-exec", "--execute", create_file_cmd],
+ assert_eq!(
+ fs::read_to_string(worktree_path.join("test.txt")).unwrap(),
+ "test content\n",
+ "--execute should run in the created worktree"
+ );
+ assert!(
+ !repo.root_path().join("test.txt").exists(),
+ "--execute must not run in the source worktree"
);
}
#[rstest]
-fn test_switch_execute_multiline(repo: TestRepo) {
- let multiline_cmd = "echo 'line1'\necho 'line2'\necho 'line3'";
-
+fn test_switch_execute_failure(repo: TestRepo) {
snapshot_switch(
- "switch_execute_multiline",
+ "switch_execute_failure",
&repo,
- &["--create", "multiline-test", "--execute", multiline_cmd],
+ &["--create", "fail-test", "--execute", "exit 1"],
);
}
@@ -1013,15 +1007,17 @@ fn test_switch_execute_template_branch(repo: TestRepo) {
#[rstest]
fn test_switch_execute_template_base(repo: TestRepo) {
- // Test that {{ base }} is available when creating with --create
+ repo.create_branch("release-base");
+
+ // A create uses the explicitly selected base, not the default branch.
snapshot_switch(
"switch_execute_template_base",
&repo,
&[
"--create",
- "from-main",
+ "from-release-base",
"--base",
- "main",
+ "release-base",
"--execute",
"echo 'base={{ base }}'",
],
@@ -1029,9 +1025,9 @@ fn test_switch_execute_template_base(repo: TestRepo) {
}
#[rstest]
-fn test_switch_execute_template_base_without_create(mut repo: TestRepo) {
- // Test that {{ base }} errors when switching to existing worktree (no --create)
- // The `base` variable is only available during branch creation
+fn test_switch_execute_template_base_for_existing_worktree_uses_source(mut repo: TestRepo) {
+ // For an existing-worktree switch, `base` is the source worktree rather
+ // than a branch selected by `--base`. This command starts from main.
repo.add_worktree("existing");
snapshot_switch(
"switch_execute_template_base_without_create",
@@ -1040,21 +1036,6 @@ fn test_switch_execute_template_base_without_create(mut repo: TestRepo) {
);
}
-#[rstest]
-fn test_switch_execute_template_with_filter(repo: TestRepo) {
- // Test that filters work ({{ branch | sanitize }})
- snapshot_switch(
- "switch_execute_template_with_filter",
- &repo,
- &[
- "--create",
- "feature/with-slash",
- "--execute",
- "echo 'sanitized={{ branch | sanitize }}'",
- ],
- );
-}
-
#[rstest]
fn test_switch_execute_template_shell_escape(repo: TestRepo) {
// Test that shell metacharacters in branch names are escaped
@@ -1066,21 +1047,6 @@ fn test_switch_execute_template_shell_escape(repo: TestRepo) {
);
}
-#[rstest]
-fn test_switch_execute_template_worktree_path(repo: TestRepo) {
- // Test that {{ worktree_path }} is expanded
- snapshot_switch(
- "switch_execute_template_worktree_path",
- &repo,
- &[
- "--create",
- "path-test",
- "--execute",
- "echo 'path={{ worktree_path }}'",
- ],
- );
-}
-
#[rstest]
fn test_switch_execute_template_in_args(repo: TestRepo) {
// Test that templates are expanded in trailing args (after --)
@@ -1128,27 +1094,6 @@ fn test_switch_execute_arg_template_error(repo: TestRepo) {
}
// Verbose mode tests
-#[rstest]
-fn test_switch_execute_verbose_template_expansion(repo: TestRepo) {
- // Test that -v shows template expansion details
- let settings = setup_snapshot_settings(&repo);
- settings.bind(|| {
- let mut cmd = make_snapshot_cmd_with_global_flags(
- &repo,
- "switch",
- &[
- "--create",
- "verbose-test",
- "--execute",
- "echo 'branch={{ branch }}'",
- ],
- None,
- &["-v"],
- );
- assert_cmd_snapshot!("switch_execute_verbose_template", cmd);
- });
-}
-
#[rstest]
fn test_switch_execute_verbose_multiline_template(repo: TestRepo) {
// Test that -v shows multiline template expansion with proper formatting
@@ -1736,29 +1681,6 @@ fn test_switch_detached_worktree_by_path(mut repo: TestRepo) {
);
}
-/// Switch via a symlink that resolves to an existing worktree (#2460).
-#[cfg(unix)]
-#[rstest]
-fn test_switch_worktree_by_symlinked_path(mut repo: TestRepo) {
- let worktree_path = repo.add_worktree("feature-symlinked");
-
- let symlink_path = worktree_path.parent().unwrap().join("worktree-link");
- std::os::unix::fs::symlink(&worktree_path, &symlink_path).unwrap();
-
- let symlink_str = symlink_path.to_string_lossy().to_string();
- let output = repo
- .wt_command()
- .args(["switch", &symlink_str])
- .output()
- .unwrap();
-
- assert!(
- output.status.success(),
- "wt switch via symlink should succeed: {}",
- String::from_utf8_lossy(&output.stderr)
- );
-}
-
/// Switch to a detached worktree by relative path (#1661).
/// Relative paths with directory separators (e.g., "../repo.feature") resolve
/// against the directory wt was pointed at, which here is the process cwd.
diff --git a/tests/integration_tests/switch_picker.rs b/tests/integration_tests/switch_picker.rs
index c84a3c698..7b61fad5c 100644
--- a/tests/integration_tests/switch_picker.rs
+++ b/tests/integration_tests/switch_picker.rs
@@ -26,13 +26,13 @@
//! - **Stabilization detection** waits for screen to stop changing
//! - **Content expectations** wait for async preview content to load (e.g., "diff --git")
-use crate::common::mock_commands::{MockConfig, MockResponse};
-use crate::common::{TEST_EPOCH, TestRepo, repo, wt_bin};
+use crate::common::mock_commands::{MockConfig, MockResponse, mock_calls};
+use crate::common::{TEST_EPOCH, TestRepo, wt_bin};
use insta::assert_snapshot;
use portable_pty::CommandBuilder;
use rstest::rstest;
use std::io::Write;
-use std::path::Path;
+use std::path::{Path, PathBuf};
use std::sync::mpsc;
use std::sync::{Arc, Mutex};
use std::time::{Duration, Instant};
@@ -86,6 +86,14 @@ const POLL_INTERVAL: Duration = Duration::from_millis(10);
/// an async item-list refresh resets the cursor to the top.
const CURSOR_REISSUE_INTERVAL: Duration = Duration::from_secs(1);
+/// Picker tests shape their own linked-worktree topology. Starting from the
+/// cached main-only variant avoids constructing and immediately removing the
+/// standard fixture's three unrelated linked worktrees in every PTY test.
+#[rstest::fixture]
+fn repo() -> TestRepo {
+ TestRepo::standard_main_only()
+}
+
/// Columns that split the list and preview panels in the 120-col test terminal.
/// skim 4.x draws the │ separator at col 59, with the list to its left (cols
/// 0..59) and the preview interior to its right (cols 60..120). Slicing around
@@ -380,19 +388,6 @@ fn wait_for_exit(
child.wait().unwrap().exit_code() as i32
}
-/// Execute a command in a PTY and return the parsed terminal state.
-///
-/// Uses polling with stabilization detection instead of fixed delays.
-fn exec_in_pty_with_input(
- command: &str,
- args: &[&str],
- working_dir: &Path,
- env_vars: &[(String, String)],
- input: &str,
-) -> PtyResult {
- exec_in_pty_with_input_expectations(command, args, working_dir, env_vars, &[(input, None)])
-}
-
/// Execute a command in a PTY with a sequence of inputs and optional content expectations.
///
/// Each input is `(input_bytes, expected_content)`:
@@ -472,60 +467,6 @@ fn exec_in_pty_capture_before_abort(
working_dir: &Path,
env_vars: &[(String, String)],
pre_abort_inputs: &[(&str, Option<&str>)],
-) -> PtyResult {
- exec_in_pty_capture_before_abort_inner(
- command,
- args,
- working_dir,
- env_vars,
- pre_abort_inputs,
- false,
- )
-}
-
-/// Like `exec_in_pty_capture_before_abort`, but additionally waits for every
-/// asynchronously-decorated list-pane column (git ahead/behind, CI status) to
-/// resolve — its `·` loading placeholder cleared — before capturing.
-///
-/// Committed snapshots of the settled list frame must use this.
-/// `wait_for_stable` alone gates on "no screen change for STABLE_DURATION plus
-/// the awaited row text present", which a column's async output can satisfy
-/// *inside a lull*: a slow git ahead/behind or CI-status compute (e.g. under
-/// coverage instrumentation on a loaded Windows runner) emits nothing during
-/// the window, so the screen looks stable while a cell still shows `·` where
-/// the snapshot has the resolved value. That freezes a different async-render
-/// frame than the committed snapshot — the exact race documented on
-/// `exec_in_pty_capture_noop_probe`. No committed `switch_picker` snapshot
-/// contains `·`, so the settled frame is always reachable.
-///
-/// Tests that *intentionally* capture a transient frame keep the non-settling
-/// `exec_in_pty_capture_before_abort` — e.g.
-/// `test_switch_picker_prs_shows_loading_marker`, which asserts the "loading
-/// open PRs…" header is on screen before the rows stream in.
-fn exec_in_pty_capture_settled_before_abort(
- command: &str,
- args: &[&str],
- working_dir: &Path,
- env_vars: &[(String, String)],
- pre_abort_inputs: &[(&str, Option<&str>)],
-) -> PtyResult {
- exec_in_pty_capture_before_abort_inner(
- command,
- args,
- working_dir,
- env_vars,
- pre_abort_inputs,
- true,
- )
-}
-
-fn exec_in_pty_capture_before_abort_inner(
- command: &str,
- args: &[&str],
- working_dir: &Path,
- env_vars: &[(String, String)],
- pre_abort_inputs: &[(&str, Option<&str>)],
- settle_columns: bool,
) -> PtyResult {
let PickerSession {
child,
@@ -540,13 +481,6 @@ fn exec_in_pty_capture_before_abort_inner(
send_input_awaiting_content(&writer, &rx, &mut parser, input, *expected_content);
}
- // The rows are on screen, but their async-decorated columns may still show
- // the `·` loading placeholder. A committed-snapshot caller waits for those
- // to resolve so it freezes the settled frame, not a loading one.
- if settle_columns {
- wait_for_list_columns_settled(&rx, &mut parser);
- }
-
// === CAPTURE: screen state is now stable — snapshot BEFORE aborting ===
// The parser retains this state because we stop feeding output to it.
let exit_code = abort_and_exit_code(child, writer, rx);
@@ -554,28 +488,6 @@ fn exec_in_pty_capture_before_abort_inner(
PtyResult { parser, exit_code }
}
-/// Wait until every asynchronously-decorated list-pane column has resolved — no
-/// `·` loading placeholder remains anywhere on screen.
-///
-/// `·` loading placeholders live in the list pane's column gutter, and no
-/// committed `switch_picker` snapshot contains one, so a full-screen check
-/// settles correctly for callers whose preview pane never renders a literal
-/// `·` — e.g. `--branches` (commit-log preview). The `--prs` comments preview
-/// renders `@author · {when}`, so a `--prs` caller can't use this full-screen
-/// gate as-is (it would never clear, panicking at the stabilize timeout).
-/// Routed through `wait_for_stable_until`'s
-/// readiness predicate, so a timeout that never saw the placeholders clear
-/// panics with diagnostics rather than silently capturing a loading frame.
-fn wait_for_list_columns_settled(rx: &mpsc::Receiver<Vec<u8>>, parser: &mut vt100::Parser) {
- wait_for_stable_until(
- rx,
- parser,
- |screen| !screen.contains('·'),
- Some("all list-pane loading placeholders (·) to clear"),
- None,
- );
-}
-
/// Drive the picker to a settled baseline, capture the list pane, send a
/// sequence of keys, capture the list pane again, then abort. Returns
/// `(baseline, after, exit_code)` so the caller can assert the keys left the
@@ -824,9 +736,8 @@ fn is_cursor_arrow(input: &str) -> bool {
/// that decorate asynchronously (CI status / PR markers): when the background
/// resolution lands it refreshes skim's item list, which resets the cursor to the
/// top, stranding the pointer on the primary worktree. That is a Windows-CI flake
-/// — observed as `test_switch_picker_worktree_row_comments_tab_shows_thread`
-/// timing out with the cursor stuck on `main`, so the HEAD± tab showed the
-/// primary's (empty) diff and the awaited `diff --git` never appeared. Re-issuing
+/// observed with the cursor stuck on `main`, where the HEAD± tab showed the
+/// primary's empty diff and the awaited `diff --git` never appeared. Re-issuing
/// the idempotent arrow drives the cursor back down after any reset; the wait
/// returns only once the pointer holds on the target through [`STABLE_DURATION`],
/// by which point the list has stopped refreshing.
@@ -913,8 +824,7 @@ fn switch_picker_settings(repo: &TestRepo) -> insta::Settings {
}
#[rstest]
-fn test_switch_picker_abort_with_escape(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
+fn test_switch_picker_abort_with_escape(repo: TestRepo) {
// Remove origin so snapshots don't show origin/main
repo.run_git(&["remote", "remove", "origin"]);
let env_vars = repo.test_env_vars();
@@ -936,34 +846,6 @@ fn test_switch_picker_abort_with_escape(mut repo: TestRepo) {
});
}
-#[rstest]
-fn test_switch_picker_with_multiple_worktrees(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
- // Remove origin so snapshots don't show origin/main
- repo.run_git(&["remote", "remove", "origin"]);
- repo.add_worktree("feature-one");
- repo.add_worktree("feature-two");
-
- let env_vars = repo.test_env_vars();
- let result = exec_in_pty_capture_before_abort(
- wt_bin().to_str().unwrap(),
- &["switch"],
- repo.root_path(),
- &env_vars,
- // Wait for items to render before capturing (prevents flakiness on slow CI)
- &[("", Some("feature-two"))],
- );
-
- assert_valid_abort_exit_code(result.exit_code);
-
- let (list, preview) = result.panels();
- let settings = switch_picker_settings(&repo);
- settings.bind(|| {
- assert_snapshot!("switch_picker_multiple_worktrees_list", list);
- assert_snapshot!("switch_picker_multiple_worktrees_preview", preview);
- });
-}
-
/// A branch name containing `/` (`feature/auth`) must keep its place in collect
/// order on the empty-query view — it must not sink below plainer names. skim's
/// empty-query engine scores every row `(score=0, begin=0)`, so a `PathName`
@@ -977,7 +859,6 @@ fn test_switch_picker_with_multiple_worktrees(mut repo: TestRepo) {
/// timing can't drift it.
#[rstest]
fn test_switch_picker_slashed_branch_keeps_collect_order(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
// Remove origin so the list doesn't show origin/main
repo.run_git(&["remote", "remove", "origin"]);
repo.add_worktree("feature/auth");
@@ -1021,7 +902,6 @@ fn test_switch_picker_slashed_branch_keeps_collect_order(mut repo: TestRepo) {
/// render timing the way a frozen snapshot can.
#[rstest]
fn test_switch_picker_alt_l_does_not_hscroll(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
// Remove origin so the list doesn't show origin/main
repo.run_git(&["remote", "remove", "origin"]);
repo.add_worktree("feature-one");
@@ -1048,47 +928,6 @@ fn test_switch_picker_alt_l_does_not_hscroll(mut repo: TestRepo) {
);
}
-#[rstest]
-fn test_switch_picker_with_branches(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
- // Remove origin so snapshots don't show origin/main
- repo.run_git(&["remote", "remove", "origin"]);
- repo.add_worktree("active-worktree");
- // Create a branch without a worktree
- let output = repo
- .git_command()
- .args(["branch", "orphan-branch"])
- .run()
- .unwrap();
- assert!(output.status.success(), "Failed to create branch");
-
- let env_vars = repo.test_env_vars();
- // Snapshot captures the settled column values (git ahead/behind), so wait
- // for the `·` loading placeholders to clear, not just for the row text:
- // under coverage instrumentation on a loaded Windows runner the stat
- // compute can lag past wait_for_stable's window, freezing a `···` loading
- // frame instead of the committed settled one (run 28213021257).
- let result = exec_in_pty_capture_settled_before_abort(
- wt_bin().to_str().unwrap(),
- &["switch", "--branches"],
- repo.root_path(),
- &env_vars,
- // Wait for branch items to render before capturing. On macOS CI under
- // heavy load, skim may show the prompt and header before item rows,
- // causing wait_for_stable to capture too early (just the header).
- &[("", Some("orphan-branch"))],
- );
-
- assert_valid_abort_exit_code(result.exit_code);
-
- let (list, preview) = result.panels();
- let settings = switch_picker_settings(&repo);
- settings.bind(|| {
- assert_snapshot!("switch_picker_with_branches_list", list);
- assert_snapshot!("switch_picker_with_branches_preview", preview);
- });
-}
-
/// A list taller than the viewport renders skim's scrollbar thumb (`▐`) down
/// the right edge of the item pane. The thumb only appears because the picker
/// sets `.scrollbar("▐")` explicitly: skim's `▐` default lives in its clap
@@ -1098,8 +937,7 @@ fn test_switch_picker_with_branches(mut repo: TestRepo) {
/// `--branches` overflows the 30-row test terminal cheaply (one `git branch`
/// per row, no `git worktree add`).
#[rstest]
-fn test_switch_picker_scrollbar_on_overflow(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
+fn test_switch_picker_scrollbar_on_overflow(repo: TestRepo) {
repo.run_git(&["remote", "remove", "origin"]);
// Far more branches than the ~24 item rows the 30-row terminal can show, so
@@ -1132,177 +970,68 @@ fn test_switch_picker_scrollbar_on_overflow(mut repo: TestRepo) {
);
}
-/// Typing a gutter glyph filters the picker by row kind. `+` is the linked-
-/// worktree glyph, so it narrows to linked worktrees — excluding the current
-/// worktree (`@`) and branch rows (`/`). This is the end-to-end answer to "why
-/// doesn't `+` select *all* the worktrees?": the current worktree is a
-/// different gutter kind. The `active-worktree` row has no literal `+` in its
-/// name or path, so the match succeeds *only* via the glyph folded into the
-/// search text (`progressive_handler::on_skeleton`) — if the fold regressed,
-/// the list would empty out and the `active-worktree` wait below would time out.
-#[rstest]
-fn test_switch_picker_gutter_glyph_filters_by_kind(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
- // Remove origin so a remote-tracking row doesn't join the list.
- repo.run_git(&["remote", "remove", "origin"]);
- repo.add_worktree("active-worktree");
- // Create a branch without a worktree (a `/` gutter row).
- let output = repo
- .git_command()
- .args(["branch", "orphan-branch"])
- .run()
- .unwrap();
- assert!(output.status.success(), "Failed to create branch");
-
- let env_vars = repo.test_env_vars();
- let result = exec_in_pty_capture_before_abort(
- wt_bin().to_str().unwrap(),
- &["switch", "--branches"],
- repo.root_path(),
- &env_vars,
- // Type the linked-worktree glyph, then wait for the filtered list to
- // settle on the one linked worktree before capturing.
- &[("+", Some("active-worktree"))],
- );
-
- assert_valid_abort_exit_code(result.exit_code);
-
- let (list, _preview) = result.panels();
- assert!(
- list.contains("active-worktree"),
- "`+` keeps the linked worktree:\n{list}"
- );
- assert!(
- !list.contains("@ main"),
- "`+` filters out the current worktree (`@`):\n{list}"
- );
- assert!(
- !list.contains("orphan-branch"),
- "`+` filters out branch rows (`/`):\n{list}"
- );
-}
-
#[rstest]
-fn test_switch_picker_preview_panel_uncommitted(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
- // Remove origin so snapshots don't show origin/main
+fn test_switch_picker_preview_navigation_and_log_panel(mut repo: TestRepo) {
repo.run_git(&["remote", "remove", "origin"]);
let feature_path = repo.add_worktree("feature");
- // First, create and commit a file so we have something to modify
- std::fs::write(feature_path.join("tracked.txt"), "Original content\n").unwrap();
- let output = repo
- .git_command()
- .args(["-C", feature_path.to_str().unwrap(), "add", "tracked.txt"])
- .run()
- .unwrap();
- assert!(output.status.success(), "Failed to add file");
- let output = repo
- .git_command()
- .args([
- "-C",
- feature_path.to_str().unwrap(),
- "commit",
- "-m",
- "Add tracked file",
- ])
- .run()
- .unwrap();
- assert!(output.status.success(), "Failed to commit");
-
- // Now make uncommitted modifications to the tracked file
- std::fs::write(
- feature_path.join("tracked.txt"),
- "Modified content\nNew line added\nAnother line\n",
- )
- .unwrap();
+ // One clean commit is enough to distinguish the log pane from HEAD±.
+ std::fs::write(feature_path.join("file.txt"), "content\n").unwrap();
+ repo.run_git_in(&feature_path, &["add", "file.txt"]);
+ repo.run_git_in(
+ &feature_path,
+ &["commit", "-m", "Commit for preview navigation"],
+ );
+ // Make the wrapped comments tab deterministic and local.
+ seed_ci_status(&repo, "feature", "null");
let env_vars = repo.test_env_vars();
- // Select `feature`, then Alt-1 for the HEAD± panel (bare digits filter; the
- // preview tabs moved to Alt). Wait for "diff --git" — the async preview can
- // be slow under congestion.
- let result = exec_in_pty_capture_before_abort(
+ let PickerSession {
+ child,
+ _master,
+ writer,
+ rx,
+ mut parser,
+ } = boot_picker_pty(
wt_bin().to_str().unwrap(),
&["switch"],
repo.root_path(),
&env_vars,
- &[
- // Select `feature` by cursor navigation, not a filter query. skim's
- // matcher runs on a separate thread; under heavy parallel macOS load
- // its row redraw can lag the keystroke-driven prompt by more than the
- // 30s gate timeout (#2334/#2729/#2767). Arrow navigation never invokes
- // the matcher, so the selection is deterministic regardless of load.
- // The list now shows both worktrees with the cursor on `feature`; the
- // panel-content gate below still fails loudly if the wrong row is
- // selected (the snapshot would not match `feature`'s preview).
- ("\x1b[B", None), // Down: move cursor to `feature`
- ("\x1b1", Some("diff --git")), // Alt-1: HEAD± panel; wait for diff
- ],
);
- assert_valid_abort_exit_code(result.exit_code);
+ // One real session covers both cyclic directions and direct Alt-N
+ // selection. The paired Shift-Tab then Tab transition distinguishes
+ // comments (7) from PR (6): both empty panes say "has no PR", but only
+ // comments advances to HEAD± (1).
+ send_input_awaiting_content(&writer, &rx, &mut parser, "\x1b[B", Some("feature"));
- let (list, preview) = result.panels();
- let settings = switch_picker_settings(&repo);
- settings.bind(|| {
- assert_snapshot!("switch_picker_preview_uncommitted_list", list);
- assert_snapshot!("switch_picker_preview_uncommitted_preview", preview);
- });
-}
+ send_input_awaiting_content(&writer, &rx, &mut parser, "\x1b[Z", Some("has no PR"));
-#[rstest]
-fn test_switch_picker_preview_panel_log(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
- // Remove origin so snapshots don't show origin/main
- repo.run_git(&["remote", "remove", "origin"]);
- let feature_path = repo.add_worktree("feature");
+ send_input_awaiting_content(
+ &writer,
+ &rx,
+ &mut parser,
+ "\t",
+ Some("has no uncommitted changes"),
+ );
- // Make several commits in the feature worktree
- for i in 1..=5 {
- std::fs::write(
- feature_path.join(format!("file{i}.txt")),
- format!("Content for file {i}\n"),
- )
- .unwrap();
- let output = repo
- .git_command()
- .args(["-C", feature_path.to_str().unwrap(), "add", "."])
- .run()
- .unwrap();
- assert!(output.status.success(), "Failed to add files");
- let output = repo
- .git_command()
- .args([
- "-C",
- feature_path.to_str().unwrap(),
- "commit",
- "-m",
- &format!("Add file {i} with content"),
- ])
- .run()
- .unwrap();
- assert!(output.status.success(), "Failed to commit");
- }
+ send_input_awaiting_content(&writer, &rx, &mut parser, "\t", Some("* "));
- let env_vars = repo.test_env_vars();
- // Select `feature`, then Alt-2 for the log panel. Wait for commit log
- // format "* [hash]" — the async preview can be slow under congestion.
- let result = exec_in_pty_capture_before_abort(
- wt_bin().to_str().unwrap(),
- &["switch"],
- repo.root_path(),
- &env_vars,
- &[
- // Cursor-navigation select: see test_switch_picker_preview_panel_uncommitted
- // for the matcher-lag rationale.
- ("\x1b[B", None), // Down: move cursor to `feature`
- ("\x1b2", Some("* ")), // Alt-2: log panel; wait for git log output
- ],
+ send_input_awaiting_content(
+ &writer,
+ &rx,
+ &mut parser,
+ "\x1b1",
+ Some("has no uncommitted changes"),
);
- assert_valid_abort_exit_code(result.exit_code);
+ send_input_awaiting_content(&writer, &rx, &mut parser, "\x1b2", Some("* "));
+
+ let list = list_pane_text(parser.screen());
+ let preview = preview_pane_text(parser.screen());
+ let exit_code = abort_and_exit_code(child, writer, rx);
+ assert_valid_abort_exit_code(exit_code);
- let (list, preview) = result.panels();
let settings = switch_picker_settings(&repo);
settings.bind(|| {
assert_snapshot!("switch_picker_preview_log_list", list);
@@ -1310,367 +1039,64 @@ fn test_switch_picker_preview_panel_log(mut repo: TestRepo) {
});
}
-#[rstest]
-fn test_switch_picker_preview_panel_main_diff(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
- // Remove origin so snapshots don't show origin/main
- repo.run_git(&["remote", "remove", "origin"]);
- let feature_path = repo.add_worktree("feature");
-
- // Make commits in the feature worktree that differ from main
- std::fs::write(
- feature_path.join("feature_code.rs"),
- r#"fn new_feature() {
- println!("This is a new feature!");
- let x = 42;
- let y = x * 2;
- println!("Result: {}", y);
+/// Seed a fresh CI-status cache entry for `branch` so the picker primes the
+/// row's `pr_status` at skeleton time (`populate_from_cache`) — making the `pr`
+/// and `comments` tabs resolve deterministically with no dependence on the live
+/// forge fetch's timing. `status_json` is the cached `status` value: `"null"`
+/// for "CI checked, no PR", or a PR object (e.g.
+/// `{"ci_status":"passed","source":"pr","is_stale":false,"number":{"number":42,"sigil":"#"}}`).
+/// `branch` must be a checked-out worktree — its current HEAD is the cache key.
+fn seed_ci_status(repo: &TestRepo, branch: &str, status_json: &str) {
+ let head = repo.git_output(&["rev-parse", branch]);
+ let cache_dir = repo.path().join(".git/wt/cache/ci-status");
+ std::fs::create_dir_all(&cache_dir).unwrap();
+ let entry = format!(
+ r#"{{"status":{status_json},"checked_at":{TEST_EPOCH},"head":"{head}","branch":"{branch}"}}"#,
+ head = head.trim(),
+ );
+ std::fs::write(cache_dir.join(format!("{branch}.json")), entry).unwrap();
}
-"#,
- )
- .unwrap();
- let output = repo
- .git_command()
- .args(["-C", feature_path.to_str().unwrap(), "add", "."])
- .run()
- .unwrap();
- assert!(output.status.success(), "Failed to add files");
- let output = repo
- .git_command()
- .args([
- "-C",
- feature_path.to_str().unwrap(),
- "commit",
- "-m",
- "Add new feature implementation",
- ])
- .run()
- .unwrap();
- assert!(output.status.success(), "Failed to commit");
-
- // Add another commit
- std::fs::write(
- feature_path.join("tests.rs"),
- r#"#[test]
-fn test_new_feature() {
- assert_eq!(42 * 2, 84);
+
+/// Env vars (mock-bin on PATH + `WORKTRUNK_TEST_MOCK_CONFIG_DIR`) for a PTY
+/// `wt` run that should resolve `gh`/`glab` to a mock written into `mock_bin`.
+/// Shared by tests that build their own strict list, CI, and preview responses.
+fn forge_mock_env_vars(repo: &TestRepo, mock_bin: &Path) -> Vec<(String, String)> {
+ let mut env_vars = repo.test_env_vars();
+ env_vars.push((
+ "WORKTRUNK_TEST_MOCK_CONFIG_DIR".to_string(),
+ mock_bin.display().to_string(),
+ ));
+ // Prepend mock-bin to PATH using the OS separator (`;` on Windows, `:` on
+ // Unix) — a hardcoded `:` corrupts the PATH on Windows, so the mock
+ // `gh.exe`/`glab.exe` is never found and the `--prs` fetch silently no-ops.
+ // `configure_pty_command` sets `PATH` (uppercase), which this entry overrides.
+ let base_path = std::env::var_os("PATH").unwrap_or_default();
+ let mut paths = vec![mock_bin.to_path_buf()];
+ paths.extend(std::env::split_paths(&base_path));
+ let joined = std::env::join_paths(paths).expect("mock-bin joins into PATH");
+ env_vars.push(("PATH".to_string(), joined.to_string_lossy().into_owned()));
+ env_vars
}
-"#,
- )
- .unwrap();
- let output = repo
- .git_command()
- .args(["-C", feature_path.to_str().unwrap(), "add", "."])
- .run()
- .unwrap();
- assert!(output.status.success(), "Failed to add files");
- let output = repo
- .git_command()
- .args([
- "-C",
- feature_path.to_str().unwrap(),
- "commit",
- "-m",
- "Add tests for new feature",
- ])
- .run()
- .unwrap();
- assert!(output.status.success(), "Failed to commit");
- let env_vars = repo.test_env_vars();
- // Select `feature`, then Alt-3 for the main…± panel. Wait for "diff --git"
- // — the async preview can be slow under congestion.
- let result = exec_in_pty_capture_before_abort(
- wt_bin().to_str().unwrap(),
- &["switch"],
- repo.root_path(),
- &env_vars,
- &[
- // Cursor-navigation select: see test_switch_picker_preview_panel_uncommitted
- // for the matcher-lag rationale.
- ("\x1b[B", None), // Down: move cursor to `feature`
- ("\x1b3", Some("diff --git")), // Alt-3: main…± panel; wait for diff
- ],
- );
+/// A file-backed mock response gate that also releases on panic, so a failed
+/// PTY assertion cannot leave the mock subprocess blocked until its timeout.
+struct MockReleaseGate(PathBuf);
- assert_valid_abort_exit_code(result.exit_code);
+impl MockReleaseGate {
+ fn new(path: PathBuf) -> Self {
+ Self(path)
+ }
- let (list, preview) = result.panels();
- let settings = switch_picker_settings(&repo);
- settings.bind(|| {
- assert_snapshot!("switch_picker_preview_main_diff_list", list);
- assert_snapshot!("switch_picker_preview_main_diff_preview", preview);
- });
+ fn release(&self) {
+ std::fs::write(&self.0, "").expect("release gated mock response");
+ }
}
-#[rstest]
-fn test_switch_picker_preview_panel_summary(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
- // Remove origin so snapshots don't show origin/main
- repo.run_git(&["remote", "remove", "origin"]);
- let feature_path = repo.add_worktree("feature");
-
- // Make a commit so there's content to potentially summarize
- std::fs::write(feature_path.join("new.txt"), "content\n").unwrap();
- let output = repo
- .git_command()
- .args(["-C", feature_path.to_str().unwrap(), "add", "."])
- .run()
- .unwrap();
- assert!(output.status.success(), "Failed to add file");
- let output = repo
- .git_command()
- .args([
- "-C",
- feature_path.to_str().unwrap(),
- "commit",
- "-m",
- "Add new file",
- ])
- .run()
- .unwrap();
- assert!(output.status.success(), "Failed to commit");
-
- let env_vars = repo.test_env_vars();
- // Select `feature`, then Alt-5 for the summary panel. Wait for the
- // "commit.generation" config hint since no LLM is configured.
- let result = exec_in_pty_capture_before_abort(
- wt_bin().to_str().unwrap(),
- &["switch"],
- repo.root_path(),
- &env_vars,
- &[
- // Cursor-navigation select: see test_switch_picker_preview_panel_uncommitted
- // for the matcher-lag rationale.
- ("\x1b[B", None), // Down: move cursor to `feature`
- ("\x1b5", Some("commit.generation")), // Alt-5: summary panel; wait for hint
- ],
- );
-
- assert_valid_abort_exit_code(result.exit_code);
-
- let (list, preview) = result.panels();
- let settings = switch_picker_settings(&repo);
- settings.bind(|| {
- assert_snapshot!("switch_picker_preview_summary_list", list);
- assert_snapshot!("switch_picker_preview_summary_preview", preview);
- });
-}
-
-/// The summary panel's "enable summaries" hint — shown when commit.generation
-/// IS configured but `[list] summary = false`. Covers the second hint arm (the
-/// first is exercised by `test_switch_picker_preview_panel_summary`), and pins
-/// that both hints point at the resolved config path: under the test's
-/// `WORKTRUNK_CONFIG_PATH` isolation that path redacts to `[TEST_CONFIG]`, not
-/// a hardcoded `~/.config/worktrunk/config.toml`.
-#[rstest]
-fn test_switch_picker_preview_panel_summary_disabled(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
- // Remove origin so snapshots don't show origin/main
- repo.run_git(&["remote", "remove", "origin"]);
- repo.add_worktree("feature");
-
- // commit.generation configured, but summaries off — the picker seeds the
- // Summary tab with the "enable summaries" hint rather than generating one.
- repo.write_test_config(
- "[commit.generation]\ncommand = \"llm -m haiku\"\n\n[list]\nsummary = false\n",
- );
-
- let env_vars = repo.test_env_vars();
- // Select `feature`, then Alt-5 for the summary panel. Wait for the hint.
- let result = exec_in_pty_capture_before_abort(
- wt_bin().to_str().unwrap(),
- &["switch"],
- repo.root_path(),
- &env_vars,
- &[
- // Cursor-navigation select: see test_switch_picker_preview_panel_uncommitted
- // for the matcher-lag rationale.
- ("\x1b[B", None), // Down: move cursor to `feature`
- ("\x1b5", Some("Enable")), // Alt-5: summary panel; wait for hint
- ],
- );
-
- assert_valid_abort_exit_code(result.exit_code);
-
- let (_, preview) = result.panels();
- let settings = switch_picker_settings(&repo);
- settings.bind(|| {
- assert_snapshot!("switch_picker_preview_summary_disabled_preview", preview);
- });
-}
-
-/// Seed a fresh CI-status cache entry for `branch` so the picker primes the
-/// row's `pr_status` at skeleton time (`populate_from_cache`) — making the `pr`
-/// and `comments` tabs resolve deterministically with no dependence on the live
-/// forge fetch's timing. `status_json` is the cached `status` value: `"null"`
-/// for "CI checked, no PR", or a PR object (e.g.
-/// `{"ci_status":"passed","source":"pr","is_stale":false,"number":{"number":42,"sigil":"#"}}`).
-/// `branch` must be a checked-out worktree — its current HEAD is the cache key.
-fn seed_ci_status(repo: &TestRepo, branch: &str, status_json: &str) {
- let head = repo.git_output(&["rev-parse", branch]);
- let cache_dir = repo.path().join(".git/wt/cache/ci-status");
- std::fs::create_dir_all(&cache_dir).unwrap();
- let entry = format!(
- r#"{{"status":{status_json},"checked_at":{TEST_EPOCH},"head":"{head}","branch":"{branch}"}}"#,
- head = head.trim(),
- );
- std::fs::write(cache_dir.join(format!("{branch}.json")), entry).unwrap();
-}
-
-/// Install a mock forge CLI (`gh`/`glab`) that answers the `--prs` list call
-/// from a canned JSON file with a caller-supplied response shape, and return
-/// env vars (mock on PATH + WORKTRUNK_TEST_MOCK_CONFIG_DIR) for a
-/// `wt switch --prs` PTY run. No network is touched. The `list.json` file the
-/// response reads from is written here, so `list_response` should be built with
-/// `MockResponse::file("list.json")`.
-fn mock_forge_env_with(
- repo: &TestRepo,
- cli: &str,
- list_cmd: &str,
- list_json: &str,
- list_response: MockResponse,
-) -> Vec<(String, String)> {
- let mock_bin = repo.root_path().join("mock-bin");
- std::fs::create_dir_all(&mock_bin).unwrap();
- std::fs::write(mock_bin.join("list.json"), list_json).unwrap();
- MockConfig::new(cli)
- .version(&format!("{cli} version 1.0.0 (mock)"))
- .command(list_cmd, list_response)
- .command("_default", MockResponse::exit(1))
- .write(&mock_bin);
-
- forge_mock_env_vars(repo, &mock_bin)
-}
-
-/// [`mock_forge_env_with`] with a fixed-delay list response. `list_delay_ms`
-/// sleeps the list call (0 = instant) so a test can observe the picker's
-/// in-flight loading marker before the rows land.
-fn mock_forge_env(
- repo: &TestRepo,
- cli: &str,
- list_cmd: &str,
- list_json: &str,
- list_delay_ms: u64,
-) -> Vec<(String, String)> {
- mock_forge_env_with(
- repo,
- cli,
- list_cmd,
- list_json,
- MockResponse::file("list.json").with_delay_ms(list_delay_ms),
- )
-}
-
-/// Env vars (mock-bin on PATH + `WORKTRUNK_TEST_MOCK_CONFIG_DIR`) for a PTY
-/// `wt` run that should resolve `gh`/`glab` to a mock written into `mock_bin`.
-/// Shared by
-/// [`mock_forge_env`] and tests that build a richer mock (extra `pr view`
-/// responses) directly.
-fn forge_mock_env_vars(repo: &TestRepo, mock_bin: &Path) -> Vec<(String, String)> {
- let mut env_vars = repo.test_env_vars();
- env_vars.push((
- "WORKTRUNK_TEST_MOCK_CONFIG_DIR".to_string(),
- mock_bin.display().to_string(),
- ));
- // Prepend mock-bin to PATH using the OS separator (`;` on Windows, `:` on
- // Unix) — a hardcoded `:` corrupts the PATH on Windows, so the mock
- // `gh.exe`/`glab.exe` is never found and the `--prs` fetch silently no-ops.
- // `configure_pty_command` sets `PATH` (uppercase), which this entry overrides.
- let base_path = std::env::var_os("PATH").unwrap_or_default();
- let mut paths = vec![mock_bin.to_path_buf()];
- paths.extend(std::env::split_paths(&base_path));
- let joined = std::env::join_paths(paths).expect("mock-bin joins into PATH");
- env_vars.push(("PATH".to_string(), joined.to_string_lossy().into_owned()));
- env_vars
-}
-
-/// `wt switch --prs` on a GitHub repo: the open-PR list streams into the picker
-/// via a mocked `gh pr list`. Asserts the PR row reaches the list (the `#42`
-/// reference in the CI column), which deterministically exercises the whole
-/// fetch → stream → render path (`fetch_open_prs`, `fetch_github`,
-/// `parse_github_prs`, `stream_open_prs`, `PrEntry::display_status`, `render_grid_row`,
-/// `render_pr_description`). The title isn't on the row — it lives in the `pr`
-/// preview tab so the columns align — so the row's stable substring is `#42`.
-/// The full list isn't snapshotted because the worktree rows' CI cells fill
-/// asynchronously.
-#[rstest]
-fn test_switch_picker_prs_github_list(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
- repo.run_git(&[
- "remote",
- "set-url",
- "origin",
- "https://github.com/owner/test-repo.git",
- ]);
- let pr_json = r#"[{"number":42,"title":"Retry the flaky network test","headRefName":"fix/flaky","author":{"login":"octocat"},"isDraft":false,"url":"https://github.com/owner/test-repo/pull/42","body":"Wraps the request in a retry so the suite stops flaking."}]"#;
- let env_vars = mock_forge_env(&repo, "gh", "pr list", pr_json, 0);
-
- let result = exec_in_pty_capture_before_abort(
- wt_bin().to_str().unwrap(),
- &["switch", "--prs"],
- repo.root_path(),
- &env_vars,
- // `main…±` now occupies the preview-shown list pane, clipping the CI
- // column (`#42`) past skim's split. Toggle the preview off (alt-p) so
- // the list spans full width and renders the number, then gate on it —
- // deterministic, no dependency on selecting an async-arrived row.
- &[("\x1bp", Some("#42"))],
- );
-
- assert_valid_abort_exit_code(result.exit_code);
- // Preview off → full-width list renders the CI column; assert on the whole
- // screen since `#42` sits past the panel split column.
- let screen = result.screen();
- assert!(screen.contains("#42"), "PR number on screen:\n{screen}");
- // The title lives in the preview (now hidden), never on the row itself.
- assert!(
- !screen.contains("Retry the flaky network test"),
- "PR title should stay off the row:\n{screen}"
- );
- // The header's loading marker is gone once the rows have streamed in.
- assert!(
- !screen.contains("Loading open PRs"),
- "loading marker cleared once rows arrived:\n{screen}"
- );
-}
-
-/// `wt switch --prs` on a GitLab repo: the open-MR list streams in via a mocked
-/// `glab mr list`. Covers the GitLab fetch path (`fetch_gitlab`,
-/// `parse_gitlab_mrs`, `gitlab_mr_status`).
-#[rstest]
-fn test_switch_picker_prs_gitlab_list(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
- repo.run_git(&[
- "remote",
- "set-url",
- "origin",
- "https://gitlab.com/owner/test-repo.git",
- ]);
- let mr_json = r#"[{"iid":7,"title":"Cache the dependency graph","source_branch":"feat/cache","author":{"username":"alice"},"draft":false,"web_url":"https://gitlab.com/owner/test-repo/-/merge_requests/7","detailed_merge_status":"ci_still_running","description":"Speeds up CI by caching deps between jobs."}]"#;
- let env_vars = mock_forge_env(&repo, "glab", "mr list", mr_json, 0);
-
- let result = exec_in_pty_capture_before_abort(
- wt_bin().to_str().unwrap(),
- &["switch", "--prs"],
- repo.root_path(),
- &env_vars,
- // `main…±` clips the CI column (`!7`) past skim's split in the
- // preview-shown pane. Toggle the preview off (alt-p) so the full-width
- // list renders the ref, then gate on it.
- &[("\x1bp", Some("!7"))],
- );
-
- assert_valid_abort_exit_code(result.exit_code);
- // Preview off → full-width list renders the CI column; assert on the whole
- // screen since `!7` sits past the panel split column.
- let screen = result.screen();
- assert!(screen.contains("!7"), "MR number on screen:\n{screen}");
- assert!(
- !screen.contains("Cache the dependency graph"),
- "MR title should stay off the row:\n{screen}"
- );
-}
+impl Drop for MockReleaseGate {
+ fn drop(&mut self) {
+ let _ = std::fs::write(&self.0, "");
+ }
+}
/// Removing a worktree row with alt-x in `--prs` mode must keep the streamed
/// PR/MR rows on screen — only the removed worktree row leaves the list, no
@@ -1679,11 +1105,11 @@ fn test_switch_picker_prs_gitlab_list(mut repo: TestRepo) {
/// alt-x's drop path rebuilds skim's item pool from the picker's shared row list
/// (`resync_pool`). The `--prs` thread streams its PR rows straight to skim's
/// item channel, so unless they're also recorded in that shared list the rebuild
-/// drops them. This drives the drop path (a clean, integrated worktree, removed
-/// row leaves the list) and asserts the `#42` PR row survives it.
+/// drops them. This first proves the complete mocked GitHub
+/// fetch lifecycle from its in-flight marker through the loaded state, then
+/// drives the drop path and asserts the `#42` PR row survives it.
#[rstest]
fn test_switch_picker_prs_rows_survive_alt_x_removal(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
repo.run_git(&[
"remote",
"set-url",
@@ -1698,735 +1124,290 @@ fn test_switch_picker_prs_rows_survive_alt_x_removal(mut repo: TestRepo) {
// PR #42's head branch isn't a shown worktree/branch, so it survives the
// `--prs` dedup and streams in as its own `#42` row. The mock answers only
// the `--prs` list call (`gh pr list --state`); the per-worktree CI fetch
- // (`gh pr list --head <branch>`) gets an empty list, so `#42` appears solely
- // as the streamed `--prs` row — never folded into a worktree row's CI cell.
- let pr_json = r#"[{"number":42,"title":"Retry the flaky network test","headRefName":"fix/flaky","author":{"login":"octocat"},"isDraft":false,"url":"https://github.com/owner/test-repo/pull/42","body":"Wraps the request in a retry so the suite stops flaking."}]"#;
- let mock_bin = repo.root_path().join("mock-bin");
- std::fs::create_dir_all(&mock_bin).unwrap();
- std::fs::write(mock_bin.join("list.json"), pr_json).unwrap();
- MockConfig::new("gh")
- .version("gh version 1.0.0 (mock)")
- .command("pr list --state", MockResponse::file("list.json"))
- .command("pr list --head", MockResponse::output("[]"))
- .command("_default", MockResponse::exit(1))
- .write(&mock_bin);
- let env_vars = forge_mock_env_vars(&repo, &mock_bin);
-
- let PickerSession {
- child,
- _master,
- writer,
- rx,
- mut parser,
- } = boot_picker_pty(
- wt_bin().to_str().unwrap(),
- &["switch", "--prs"],
- repo.root_path(),
- &env_vars,
- );
-
- // Preview off (alt-p) so the full-width list renders the CI column (`#42`),
- // which the preview-shown pane otherwise clips past skim's split. The wait
- // also blocks until the `--prs` row has streamed in.
- send_input_awaiting_content(&writer, &rx, &mut parser, "\x1bp", Some("#42"));
- // The worktree row is on screen too (one skeleton batch).
- wait_for_stable_with_content(&rx, &mut parser, Some("wt-drop"));
-
- // Cursor onto the removable worktree row (the row below the pinned current
- // worktree), then alt-x removes it.
- send_input_awaiting_content(&writer, &rx, &mut parser, "\x1b[B", Some("wt-drop"));
- {
- let mut w = writer.lock().unwrap();
- w.write_all(b"\x1bx").unwrap();
- w.flush().unwrap();
- }
- // The worktree row drops; gating on its disappearance proves the resync ran.
- wait_for_stable_until(
- &rx,
- &mut parser,
- |screen| !screen.contains("wt-drop"),
- Some("the wt-drop row to leave the list"),
- None,
- );
-
- let screen = parser.screen().contents();
- let exit_code = abort_and_exit_code(child, writer, rx);
- assert_valid_abort_exit_code(exit_code);
- assert!(
- screen.contains("#42"),
- "PR row must survive the alt-x worktree removal (no alt-r needed).\nScreen:\n{screen}"
- );
-}
-
-/// alt-x on a row that can't be removed flashes the reason in the header at
-/// alt-x time, not only when the stash drains on exit. The current worktree is
-/// the picker's pinned top row, so launching from the main worktree and pressing
-/// alt-x (no cursor move) targets it — and the main worktree can't be removed, so
-/// the header swaps the column labels for `✗ The main worktree cannot be removed`
-/// for a beat. The flash *clearing* after the beat is covered by the `HeaderFlash`
-/// unit tests; this asserts it paints. A presence-wait catches it before the beat
-/// elapses (`HEADER_FLASH_DURATION`), so the test never depends on the timer.
-#[rstest]
-fn test_switch_picker_alt_x_flashes_unremovable_reason(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
- repo.run_git(&["remote", "remove", "origin"]);
- // A second worktree so the skeleton paints a distinctive row to gate on; the
- // cursor still starts on the pinned current (main) worktree above it.
- repo.add_worktree("wt-extra");
-
- let env_vars = repo.test_env_vars();
- let PickerSession {
- child,
- _master,
- writer,
- rx,
- mut parser,
- } = boot_picker_pty(
- wt_bin().to_str().unwrap(),
- &["switch"],
- repo.root_path(),
- &env_vars,
- );
-
- // The worktree rows have painted (one skeleton batch); the cursor is on the
- // pinned current worktree — the main worktree, which can't be removed.
- wait_for_stable_with_content(&rx, &mut parser, Some("wt-extra"));
-
- // alt-x is declined, and the reason flashes in the header. The presence-wait
- // returns as soon as the flash paints — before it self-clears.
- send_input_awaiting_content(
- &writer,
- &rx,
- &mut parser,
- "\x1bx",
- Some("main worktree cannot be removed"),
- );
-
- let screen = parser.screen().contents();
- let exit_code = abort_and_exit_code(child, writer, rx);
- assert_valid_abort_exit_code(exit_code);
- assert!(
- screen.contains("main worktree cannot be removed"),
- "the unremovable reason flashes in the header at alt-x time:\n{screen}"
- );
-}
-
-/// A preview pane fills in on its own once its background compute lands — no
-/// keystroke needed. The deterministic vehicle is a `--prs` row's `comments`
-/// tab: the comment fetch (`gh pr view <n> --json comments`) is mocked behind a
-/// delay, so when the row is selected and the comments tab is opened the pane is
-/// still on its "Loading comments…" placeholder. The comment then surfaces with
-/// no further input once the delayed fetch resolves and the orchestrator pokes a
-/// repaint (`PreviewNotifier`). Before that product-side poke the placeholder
-/// would strand until the next keystroke — the gap the picker's test harness
-/// used to paper over by re-issuing the tab key.
-///
-/// The PR row is selected by driving the cursor with a re-issued Down, not by an
-/// `!main` filter: a filter applied before the async `--prs` row streams in
-/// empties the result set, and skim doesn't reselect the lone row when it arrives
-/// — so the gate timed out under contention (#3269). Down is idempotent and
-/// clamps on the bottom row, where the streamed PR row sits (below the worktree
-/// row), so the cursor-arrow wait re-issues it until the `>` pointer holds on
-/// `flaky`, outlasting both the stream-in and the cursor reset that the
-/// item-list refresh triggers.
-#[rstest]
-fn test_switch_picker_preview_auto_refreshes_when_compute_lands(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
- repo.run_git(&[
- "remote",
- "set-url",
- "origin",
- "https://github.com/owner/test-repo.git",
- ]);
-
- // The mock holds `gh pr view` (the comments / log fetch) long enough that the
- // tab is reliably opened before the fetch resolves — so the pane is observed
- // mid-load and the appearance of the comment proves the auto-refresh, not a
- // cache hit. `pr list` is instant so the row lands promptly.
- let mock_bin = repo.root_path().join("mock-bin");
- std::fs::create_dir_all(&mock_bin).unwrap();
- // A short head branch so the PR row isn't truncated in the narrow
- // (preview-shown) list pane.
- let pr_json = r#"[{"number":42,"title":"Retry the flaky network test","headRefName":"flaky","author":{"login":"octocat"},"isDraft":false,"url":"https://github.com/owner/test-repo/pull/42","body":"body"}]"#;
- std::fs::write(mock_bin.join("pr_list.json"), pr_json).unwrap();
- let comments_json = r#"{"comments":[{"author":{"login":"octocat"},"body":"AUTOREFRESHMARK","createdAt":"2025-01-01T00:00:00Z"}]}"#;
- MockConfig::new("gh")
- .version("gh version 1.0.0 (mock)")
- .command("pr list", MockResponse::file("pr_list.json"))
- .command(
- "pr view",
- MockResponse::output(comments_json).with_delay_ms(3000),
- )
- .command("_default", MockResponse::exit(1))
- .write(&mock_bin);
- let env_vars = forge_mock_env_vars(&repo, &mock_bin);
-
- let result = exec_in_pty_capture_before_abort(
- wt_bin().to_str().unwrap(),
- &["switch", "--prs"],
- repo.root_path(),
- &env_vars,
- &[
- // Drive the cursor onto the PR row. Its narrow (preview-shown) list
- // line shows the short head branch `flaky`; the worktree row shows
- // `main`. A re-issued Down lands the `>` pointer on `flaky` (the
- // bottom row) and re-drives it there if a streamed-row refresh resets
- // the cursor — see the docstring for why this replaces the `!main`
- // filter.
- ("\x1b[B", Some("flaky")),
- // alt-7: comments tab. The fetch is still in flight, so the pane shows
- // "Loading comments…"; the comment appears with NO further input once
- // the delayed fetch lands and the picker repaints on its own.
- ("\x1b7", Some("AUTOREFRESHMARK")),
- ],
- );
-
- assert_valid_abort_exit_code(result.exit_code);
- let (_list, preview) = result.panels();
- assert!(
- preview.contains("AUTOREFRESHMARK"),
- "comment surfaced on its own once the delayed fetch landed:\n{preview}"
- );
-}
-
-/// `wt switch --prs` shows a dim "↳ Loading open PRs…" marker on the header row
-/// while the forge call is in flight. The mock holds the PR list until `wt`
-/// exits (`hold_until_parent_exit`), so the marker is on the real screen for
-/// exactly the picker's lifetime and the presence assertion never races boot
-/// latency. The picker captures and aborts at stabilize time, and the `--prs`
-/// thread is detached on exit (not joined), so the test finishes in about a
-/// second. The marker's *clearing* once rows arrive is covered by the
-/// `header_loading_marker_shows_until_cleared` unit test and the negative
-/// assertion in `test_switch_picker_prs_github_list`.
-#[rstest]
-fn test_switch_picker_prs_shows_loading_marker(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
- repo.run_git(&[
- "remote",
- "set-url",
- "origin",
- "https://github.com/owner/test-repo.git",
- ]);
- let pr_json = r#"[{"number":42,"title":"Retry the flaky network test","headRefName":"fix/flaky","author":{"login":"octocat"},"isDraft":false,"url":"https://github.com/owner/test-repo/pull/42","body":""}]"#;
- // Hold the loading marker on screen for exactly the picker's lifetime — no
- // fixed delay to outguess boot latency. `hold_until_parent_exit` makes the
- // mocked `gh pr list` block until `wt` exits (it polls for its stdout pipe's
- // read end to close), so the transient "Loading open PRs" frame is present
- // for the entire window the helper could observe it, on any hardware. A
- // fixed `delay_ms` can't guarantee this: a 3s hold flaked on a loaded
- // Windows runner because `boot_picker_pty`'s skim-ready wait plus its initial
- // `wait_for_stable`, and the async worktree-column churn, ate the whole 3s
- // window, so by the time `send_input_awaiting_content` first polled for the
- // marker the mock had already returned and the rows had streamed in — the
- // marker was gone and the wait timed out at STABILIZE_TIMEOUT (30s). Bumping
- // the delay only widens the margin; tying release to parent death removes the
- // race outright.
- //
- // The picker still exits in well under a second: `exec_in_pty_capture_before_abort`
- // snapshots and sends Escape the instant the marker settles, and abort does
- // *not* join the background `--prs` fetch thread — the interactive teardown
- // ends it with `drop(prs_handle)` (see `run_picker` in
- // `src/commands/picker/mod.rs`: "don't join — the forge call may still be in
- // flight, and process exit terminates the thread"). When `wt` exits it closes
- // the mock's stdout pipe, the mock's next write fails with `BrokenPipe`, and
- // the mock exits — no orphaned sleeper left behind.
- let env_vars = mock_forge_env_with(
- &repo,
- "gh",
- "pr list",
- pr_json,
- MockResponse::file("list.json").hold_until_parent_exit(),
- );
-
- let result = exec_in_pty_capture_before_abort(
- wt_bin().to_str().unwrap(),
- &["switch", "--prs"],
- repo.root_path(),
- &env_vars,
- // The loading line paints at skeleton, before the (slow) forge call
- // returns its rows.
- &[("", Some("Loading open PRs"))],
- );
-
- assert_valid_abort_exit_code(result.exit_code);
- let (list, _preview) = result.panels();
- assert!(
- list.contains("Loading open PRs"),
- "loading line on the header while --prs fetches:\n{list}"
- );
- // The PR row hasn't streamed in yet — still inside the delayed forge call.
- assert!(!list.contains("#42"), "rows not yet streamed in:\n{list}");
-}
-
-/// A plain `wt switch` (no `--prs`) worktree row whose branch has an open PR
-/// shows the real comment thread in its `comments` tab — the same background
-/// `gh pr view <n> --json comments` fetch and render a `--prs` row makes. This
-/// is the crux of the unification: the comments tab no longer points a worktree
-/// row at `--prs`; it loads the thread directly. The PR is primed from a fresh
-/// CI cache so the row resolves to "has PR" at skeleton with no `gh pr list`,
-/// and the conversation comes from a mocked `gh pr view`.
-#[rstest]
-fn test_switch_picker_worktree_row_comments_tab_shows_thread(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
- repo.run_git(&[
- "remote",
- "set-url",
- "origin",
- "https://github.com/owner/test-repo.git",
- ]);
- let feature_path = repo.add_worktree("feature");
- // Commit a file, then leave an uncommitted edit so `feature`'s HEAD± tab
- // shows a `diff --git` — a preview-only sync anchor (it never appears in the
- // list) that confirms the cursor landed on `feature` before reading comments.
- std::fs::write(feature_path.join("file.txt"), "content\n").unwrap();
- let add = repo
- .git_command()
- .args(["-C", feature_path.to_str().unwrap(), "add", "."])
- .run()
- .unwrap();
- assert!(add.status.success(), "Failed to add file");
- let commit = repo
- .git_command()
- .args([
- "-C",
- feature_path.to_str().unwrap(),
- "commit",
- "-m",
- "Commit for comments tab",
- ])
- .run()
- .unwrap();
- assert!(commit.status.success(), "Failed to commit");
- std::fs::write(feature_path.join("file.txt"), "content\nmore\n").unwrap();
-
- // Prime a fresh CI status carrying an open PR (#42) so the row resolves to
- // "has PR" at skeleton — detect reads this same fresh entry, so no `gh pr
- // list`. The comments thread still needs a live `gh pr view`, mocked below.
- seed_ci_status(
- &repo,
- "feature",
- r##"{"ci_status":"passed","source":"pr","is_stale":false,"number":{"number":42,"sigil":"#"}}"##,
- );
-
- // Mock the only forge call a worktree row makes — `gh pr view 42 --json
- // comments` (the `log` tab is local; the `pr` tab rides the cached CI). Any
- // other gh invocation falls through to `_default` exit 1.
- let mock_bin = repo.root_path().join("mock-bin");
- std::fs::create_dir_all(&mock_bin).unwrap();
- let comments_json = r#"{"comments":[{"author":{"login":"octocat"},"body":"Looks solid, shipping it.","createdAt":"2024-12-01T00:00:00Z"}]}"#;
- std::fs::write(mock_bin.join("comments.json"), comments_json).unwrap();
- MockConfig::new("gh")
- .version("gh version 1.0.0 (mock)")
- .command("pr view", MockResponse::file("comments.json"))
- .command("_default", MockResponse::exit(1))
- .write(&mock_bin);
- let mut env_vars = repo.test_env_vars();
- env_vars.push((
- "WORKTRUNK_TEST_MOCK_CONFIG_DIR".to_string(),
- mock_bin.display().to_string(),
- ));
- // Prepend mock-bin to PATH using the OS separator (`;` on Windows, `:` on
- // Unix) — a hardcoded `:` corrupts the PATH on Windows, so the mock `gh.exe`
- // is never found and the comments fetch fails ("Couldn't load comments").
- let base_path = std::env::var_os("PATH").unwrap_or_default();
- let mut paths = vec![mock_bin.clone()];
- paths.extend(std::env::split_paths(&base_path));
- let joined = std::env::join_paths(paths).expect("mock-bin joins into PATH");
- env_vars.push(("PATH".to_string(), joined.to_string_lossy().into_owned()));
-
- let result = exec_in_pty_capture_before_abort(
- wt_bin().to_str().unwrap(),
- &["switch"],
- repo.root_path(),
- &env_vars,
- &[
- // Cursor-navigation select: see test_switch_picker_preview_panel_uncommitted
- // for the matcher-lag rationale. Gate on the row name so the Down is
- // re-issued until the `>` pointer lands on `feature` — this row
- // decorates asynchronously (primed CI status → "has PR"), and that
- // background refresh resets skim's cursor to the top, which stranded
- // the pointer on `main` and timed this test out on Windows CI.
- ("\x1b[B", Some("feature")), // Down: move cursor to `feature`
- // Alt-1: HEAD± panel. `feature`'s uncommitted diff (`diff --git`) is a
- // preview-only anchor that gives the skeleton-spawned comments fetch
- // time to land before we read its tab.
- ("\x1b1", Some("diff --git")),
- // Alt-7: jump to comments (7). The thread was fetched in the
- // background at skeleton time (the PR was primed), so it's cached by
- // now — wait for the comment body to confirm the real thread renders.
- ("\x1b7", Some("Looks solid")),
- ],
- );
-
- assert_valid_abort_exit_code(result.exit_code);
- let (_list, preview) = result.panels();
- assert!(
- preview.contains("octocat"),
- "comment author renders on a worktree row's comments tab:\n{preview}"
- );
- assert!(
- preview.contains("Looks solid"),
- "comment body renders on a worktree row's comments tab:\n{preview}"
- );
- // No `--prs` pointer — the worktree row loads the thread itself.
- assert!(
- !preview.contains("--prs"),
- "comments tab must not point at --prs:\n{preview}"
- );
-}
-
-/// The `pr` tab auto-resolves from "Fetching PR status…" to the live PR with no
-/// keystroke. A worktree row's CI status is fetched live (`gh pr list --head`),
-/// mocked behind a delay and left UNSEEDED so the tab is observed mid-fetch; when
-/// the status lands, `on_update` pokes a `RunPreview` (`PreviewNotifier`) and the
-/// pane re-renders. Distinct producer from
-/// `test_switch_picker_preview_auto_refreshes_when_compute_lands` (an orchestrator
-/// cache fill): here it's the CI fetch surfaced through `on_update`.
-#[rstest]
-fn test_switch_picker_pr_tab_auto_resolves_from_fetching(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
- repo.run_git(&[
- "remote",
- "set-url",
- "origin",
- "https://github.com/owner/test-repo.git",
- ]);
-
- let mock_bin = repo.root_path().join("mock-bin");
- std::fs::create_dir_all(&mock_bin).unwrap();
- // The per-row CI fetch (`gh pr list --head <branch>`), delayed so the `pr`
- // tab is opened while still "Fetching PR status…"; unseeded, so it starts
- // there rather than resolving at skeleton from the cache.
- let pr_list_json = r#"[{"number":654,"title":"PRTABMARK auto-resolve","body":"","comments":[],"statusCheckRollup":[],"url":"https://github.com/owner/test-repo/pull/654","isDraft":false}]"#;
- std::fs::write(mock_bin.join("pr_list.json"), pr_list_json).unwrap();
- MockConfig::new("gh")
- .version("gh version 1.0.0 (mock)")
- .command(
- "pr list",
- MockResponse::file("pr_list.json").with_delay_ms(3000),
- )
- .command("_default", MockResponse::exit(1))
- .write(&mock_bin);
- let env_vars = forge_mock_env_vars(&repo, &mock_bin);
-
- let result = exec_in_pty_capture_before_abort(
- wt_bin().to_str().unwrap(),
- &["switch"],
- repo.root_path(),
- &env_vars,
- &[
- // alt-6: the `pr` tab. The CI fetch is still in flight (delayed), so
- // the pane shows the fetching hint.
- ("\x1b6", Some("Fetching PR status")),
- // No further input: the resolved PR title appears on its own once the
- // delayed CI fetch lands and the picker repaints.
- ("", Some("PRTABMARK")),
- ],
- );
-
- assert_valid_abort_exit_code(result.exit_code);
- let (_list, preview) = result.panels();
- assert!(
- preview.contains("PRTABMARK"),
- "pr tab resolved from 'Fetching' on its own:\n{preview}"
- );
-}
-
-#[rstest]
-fn test_switch_picker_preview_cycle_tab_forward(mut repo: TestRepo) {
- // Tab cycles the preview tab forward. From the default HEAD± tab (1), one
- // Tab lands on the log tab (2), exercising the native `PreviewMode::next`
- // rotation behind the tab key's `Action::Custom` binding. (alt-1..alt-7 jump
- // directly; the panel tests above cover those — this covers the cycle path.)
- repo.remove_fixture_worktrees();
- repo.run_git(&["remote", "remove", "origin"]);
- let feature_path = repo.add_worktree("feature");
-
- // Commit a file so the log tab has content; the worktree stays clean, so the
- // HEAD± tab shows no diff and the "* " log-graph marker is unambiguous.
- std::fs::write(feature_path.join("file.txt"), "content\n").unwrap();
- let add = repo
- .git_command()
- .args(["-C", feature_path.to_str().unwrap(), "add", "."])
- .run()
- .unwrap();
- assert!(add.status.success(), "Failed to add file");
- let commit = repo
- .git_command()
- .args([
- "-C",
- feature_path.to_str().unwrap(),
- "commit",
- "-m",
- "Commit for tab cycle",
- ])
- .run()
- .unwrap();
- assert!(commit.status.success(), "Failed to commit");
-
- let env_vars = repo.test_env_vars();
- let result = exec_in_pty_capture_before_abort(
- wt_bin().to_str().unwrap(),
- &["switch"],
- repo.root_path(),
- &env_vars,
- &[
- // Cursor-navigation select: see test_switch_picker_preview_panel_uncommitted
- // for the matcher-lag rationale.
- ("\x1b[B", None), // Down: move cursor to `feature`
- ("\t", Some("* ")), // Tab: HEAD± → log; wait for git log output
- ],
- );
-
- assert_valid_abort_exit_code(result.exit_code);
-
- let (_list, preview) = result.panels();
- assert!(
- preview.contains("* "),
- "Tab should advance the preview to the log tab; preview was:\n{preview}"
- );
-}
-
-#[rstest]
-fn test_switch_picker_preview_cycle_tab_forward_wraps(mut repo: TestRepo) {
- // Forward cycling wraps 7 → 1: from the comments tab (reached via Alt-7), one
- // Tab returns to the HEAD± tab. This covers the `7 → 1` wraparound in
- // `PreviewMode::next`, the half most easily typo'd away.
- repo.remove_fixture_worktrees();
- repo.run_git(&["remote", "remove", "origin"]);
- let feature_path = repo.add_worktree("feature");
-
- // Commit so the worktree is clean: the HEAD± tab then reads "no uncommitted
- // changes", a message unique to tab 1 — so seeing it proves the wrap landed
- // there and not on some other tab.
- std::fs::write(feature_path.join("file.txt"), "content\n").unwrap();
- let add = repo
- .git_command()
- .args(["-C", feature_path.to_str().unwrap(), "add", "."])
- .run()
- .unwrap();
- assert!(add.status.success(), "Failed to add file");
- let commit = repo
- .git_command()
- .args([
- "-C",
- feature_path.to_str().unwrap(),
- "commit",
- "-m",
- "Commit for forward-wrap cycle",
- ])
- .run()
- .unwrap();
- assert!(commit.status.success(), "Failed to commit");
-
- seed_ci_status(&repo, "feature", "null");
+ // (`gh pr list --head <branch>`) gets an empty list, so `#42` appears solely
+ // as the streamed `--prs` row — never folded into a worktree row's CI cell.
+ let pr_json = r#"[{"number":42,"title":"Retry the flaky network test","headRefName":"fix/flaky","author":{"login":"octocat"},"isDraft":false,"url":"https://github.com/owner/test-repo/pull/42","body":"Wraps the request in a retry so the suite stops flaking."}]"#;
+ let mock_bin = repo.root_path().join("mock-bin");
+ std::fs::create_dir_all(&mock_bin).unwrap();
+ std::fs::write(mock_bin.join("list.json"), pr_json).unwrap();
+ MockConfig::new("gh")
+ .version("gh version 1.0.0 (mock)")
+ .command(
+ "pr list --state",
+ MockResponse::file("list.json").wait_for_file("prs.release"),
+ )
+ .command("pr list --head", MockResponse::output("[]"))
+ .command("_default", MockResponse::exit(1))
+ .write(&mock_bin);
+ let release = MockReleaseGate::new(mock_bin.join("prs.release"));
+ let env_vars = forge_mock_env_vars(&repo, &mock_bin);
- let env_vars = repo.test_env_vars();
- let result = exec_in_pty_capture_before_abort(
+ let PickerSession {
+ child,
+ _master,
+ writer,
+ rx,
+ mut parser,
+ } = boot_picker_pty(
wt_bin().to_str().unwrap(),
- &["switch"],
+ &["switch", "--prs"],
repo.root_path(),
&env_vars,
- &[
- // Cursor-navigation select: see test_switch_picker_preview_panel_uncommitted
- // for the matcher-lag rationale.
- ("\x1b[B", None), // Down: move cursor to `feature`
- // Alt-7: jump to comments (7). The comments tab behaves the same on a
- // worktree row as on a `--prs` row — with no PR (seeded above) it shows
- // "has no PR", matching the `pr` tab.
- ("\x1b7", Some("has no PR")),
- ("\t", Some("no uncommitted changes")), // Tab: wrap 7 → HEAD± (1)
- ],
);
- assert_valid_abort_exit_code(result.exit_code);
-
- let (_list, preview) = result.panels();
+ // The list fetch is causally held, so this is the real in-flight frame and
+ // no PR row can have streamed in yet.
+ wait_for_stable_with_content(&rx, &mut parser, Some("Loading open PRs"));
+ let loading_screen = parser.screen().contents();
assert!(
- preview.contains("no uncommitted changes"),
- "Tab from the comments tab should wrap to the HEAD± tab; preview was:\n{preview}"
+ loading_screen.contains("Loading open PRs"),
+ "loading line on the header while --prs fetches:\n{loading_screen}"
);
-}
-
-#[rstest]
-fn test_switch_picker_preview_cycle_shift_tab_wraps(mut repo: TestRepo) {
- // Shift-Tab cycles backward and wraps: from the default HEAD± tab (1), one
- // Shift-Tab lands on the comments tab (7), exercising the reverse rotation
- // `PreviewMode::prev` including the 1 → 7 wraparound.
- repo.remove_fixture_worktrees();
- repo.run_git(&["remote", "remove", "origin"]);
- let feature_path = repo.add_worktree("feature");
-
- std::fs::write(feature_path.join("new.txt"), "content\n").unwrap();
- let add = repo
- .git_command()
- .args(["-C", feature_path.to_str().unwrap(), "add", "."])
- .run()
- .unwrap();
- assert!(add.status.success(), "Failed to add file");
- let commit = repo
- .git_command()
- .args([
- "-C",
- feature_path.to_str().unwrap(),
- "commit",
- "-m",
- "Add new file",
- ])
- .run()
- .unwrap();
- assert!(commit.status.success(), "Failed to commit");
-
- seed_ci_status(&repo, "feature", "null");
-
- let env_vars = repo.test_env_vars();
- let result = exec_in_pty_capture_before_abort(
- wt_bin().to_str().unwrap(),
- &["switch"],
- repo.root_path(),
- &env_vars,
- &[
- // Cursor-navigation select: see test_switch_picker_preview_panel_uncommitted
- // for the matcher-lag rationale.
- ("\x1b[B", None), // Down: move cursor to `feature`
- // Shift-Tab: HEAD± (1) → comments (7), the 1 → 7 wraparound. With no PR
- // (seeded above) the comments tab shows "has no PR", like the `pr` tab.
- ("\x1b[Z", Some("has no PR")),
- ],
+ assert!(
+ !loading_screen.contains("#42"),
+ "PR row must not render before the list response is released:\n{loading_screen}"
);
- assert_valid_abort_exit_code(result.exit_code);
+ release.release();
- let (_list, preview) = result.panels();
+ // Preview off (alt-p) so the full-width list renders the CI column (`#42`),
+ // which the preview-shown pane otherwise clips past skim's split. The wait
+ // also blocks until the `--prs` row has streamed in.
+ send_input_awaiting_content(&writer, &rx, &mut parser, "\x1bp", Some("#42"));
+ // The worktree row is on screen too (one skeleton batch).
+ wait_for_stable_with_content(&rx, &mut parser, Some("wt-drop"));
+ let loaded_screen = parser.screen().contents();
assert!(
- preview.contains("has no PR"),
- "Shift-Tab should wrap to the comments tab; preview was:\n{preview}"
+ loaded_screen.contains("#42"),
+ "mocked GitHub PR row reached the picker:\n{loaded_screen}"
);
-}
-
-#[rstest]
-fn test_switch_picker_respects_list_config(mut repo: TestRepo) {
- // Use the same reliable setup as test_switch_picker_with_branches:
- // remove fixture worktrees (which use relative gitdir paths that can fail
- // to resolve under concurrent operations) and origin (to avoid remote branch noise)
- repo.remove_fixture_worktrees();
- repo.run_git(&["remote", "remove", "origin"]);
-
- repo.add_worktree("active-worktree");
- // Create a branch without a worktree
- let output = repo
- .git_command()
- .args(["branch", "orphan-branch"])
- .run()
- .unwrap();
- assert!(output.status.success(), "Failed to create branch");
-
- // Write user config with [list] branches = true
- // This should enable branches in the picker without the --branches flag
- repo.write_test_config(
- r#"
-[list]
-branches = true
-"#,
+ assert!(
+ !loaded_screen.contains("Retry the flaky network test"),
+ "PR title belongs in the hidden preview, not the list row:\n{loaded_screen}"
);
-
- let env_vars = repo.test_env_vars();
- // Capture screen BEFORE sending Escape. Screen must stabilize with orphan-branch visible.
- let result = exec_in_pty_capture_before_abort(
- wt_bin().to_str().unwrap(),
- &["switch"], // No --branches flag - config should enable it
- repo.root_path(),
- &env_vars,
- &[("", Some("orphan-branch"))], // Wait for orphan-branch to appear in list before abort
+ assert!(
+ !loaded_screen.contains("Loading open PRs"),
+ "loading marker clears when the PR row lands:\n{loaded_screen}"
);
- assert_valid_abort_exit_code(result.exit_code);
+ // Cursor onto the removable worktree row (the row below the pinned current
+ // worktree), then alt-x removes it.
+ send_input_awaiting_content(&writer, &rx, &mut parser, "\x1b[B", Some("wt-drop"));
+ {
+ let mut w = writer.lock().unwrap();
+ w.write_all(b"\x1bx").unwrap();
+ w.flush().unwrap();
+ }
+ // The worktree row drops; gating on its disappearance proves the resync ran.
+ wait_for_stable_until(
+ &rx,
+ &mut parser,
+ |screen| !screen.contains("wt-drop"),
+ Some("the wt-drop row to leave the list"),
+ None,
+ );
- let screen = result.screen();
- // Verify that orphan-branch appears (enabled by config, not CLI flag)
+ let screen = parser.screen().contents();
+ let exit_code = abort_and_exit_code(child, writer, rx);
+ assert_valid_abort_exit_code(exit_code);
assert!(
- screen.contains("orphan-branch"),
- "orphan-branch should appear when [list] branches = true in config.\nScreen:\n{}",
- screen
+ screen.contains("#42"),
+ "PR row must survive the alt-x worktree removal (no alt-r needed).\nScreen:\n{screen}"
);
}
+/// alt-x on a row that can't be removed explains the rejection immediately and
+/// keeps the cursor on that row. Launching from `wt-a` puts the unremovable main
+/// worktree between two real rows; that setup makes a one-row cursor drift
+/// observable rather than letting bottom-of-list clamping hide it. One transient
+/// frame must contain both the header reason and the pointer on `^ main`.
+///
+/// The flash clearing after the beat is covered by
+/// `test_header_flash_set_then_self_clears`; this asserts the flash paints.
#[rstest]
-fn test_switch_picker_create_worktree_with_alt_c(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
- // Remove origin so there's no interference from remote branches
+fn test_switch_picker_alt_x_flashes_unremovable_reason(mut repo: TestRepo) {
repo.run_git(&["remote", "remove", "origin"]);
+ let wt_a = repo.add_worktree("wt-a");
+ repo.add_worktree("wt-b");
let env_vars = repo.test_env_vars();
+ let PickerSession {
+ child,
+ _master,
+ writer,
+ rx,
+ mut parser,
+ } = boot_picker_pty(wt_bin().to_str().unwrap(), &["switch"], &wt_a, &env_vars);
- // Type branch name "new-feature", then press Alt-C (escape + c) to create
- let result = exec_in_pty_with_input_expectations(
- wt_bin().to_str().unwrap(),
- &["switch"],
- repo.root_path(),
- &env_vars,
- &[
- ("new-feature", None), // Type the branch name
- ("\x1bc", None), // Alt-C (escape + c) to create worktree
- ],
+ wait_for_stable_with_content(&rx, &mut parser, Some("wt-b"));
+
+ // Prove main is genuinely mid-list before relying on cursor preservation:
+ // row-specific gutter/name pairs keep the `main↕` column header from
+ // satisfying the main lookup.
+ let list = list_pane_text(parser.screen());
+ let row = |needle: &str| {
+ list.lines()
+ .position(|line| line.contains(needle))
+ .unwrap_or_else(|| panic!("missing picker row {needle:?}:\n{list}"))
+ };
+ let wt_a_row = row("@ wt-a");
+ let main_row = row("^ main");
+ let wt_b_row = row("+ wt-b");
+ assert!(
+ wt_a_row < main_row && main_row < wt_b_row,
+ "expected rendered row order wt-a < main < wt-b, got \
+ {wt_a_row} < {main_row} < {wt_b_row}:\n{list}"
);
- // Alt-C triggers accept which should exit normally. The create's success is
- // proven deterministically by the branch existing below; the exit code
- // tolerates the Windows self-exit-1 quirk (see assert_valid_create_exit_code).
- assert_valid_create_exit_code(result.exit_code);
+ // Down from the pinned current row onto the mid-list main worktree.
+ send_input_awaiting_content(&writer, &rx, &mut parser, "\x1b[B", Some("^ main"));
- let screen = result.screen();
+ {
+ let mut w = writer.lock().unwrap();
+ w.write_all(b"\x1bx").unwrap();
+ w.flush().unwrap();
+ }
- // Verify the success message shows the new branch
+ // Observe one frame that proves both effects of the rejected alt-x. Process
+ // queued output byte-by-byte and check after each parser state: even if this
+ // test thread is descheduled for the flash's full 2.5-second lifetime, a
+ // later clear repaint queued behind it cannot erase the transient frame
+ // before the predicate sees it.
+ let start = Instant::now();
+ let mut saw_rejected_frame = false;
+ 'wait: while start.elapsed() < STABILIZE_TIMEOUT {
+ match rx.recv_timeout(POLL_INTERVAL) {
+ Ok(chunk) => {
+ for byte in chunk {
+ parser.process(&[byte]);
+ let screen = parser.screen().contents();
+ if screen.contains("main worktree cannot be removed")
+ && cursor_points_at(&screen, "^ main")
+ {
+ saw_rejected_frame = true;
+ break 'wait;
+ }
+ }
+ }
+ Err(mpsc::RecvTimeoutError::Timeout) => {}
+ Err(mpsc::RecvTimeoutError::Disconnected) => break,
+ }
+ }
assert!(
- screen.contains("new-feature") || screen.contains("Switched"),
- "Expected success message showing new-feature branch.\nScreen:\n{}",
- screen
+ saw_rejected_frame,
+ "never observed one frame with both the unremovable reason and the cursor \
+ on the main row:\n{}",
+ parser.screen().contents()
);
- // Verify the worktree was actually created by checking the branch exists
- let branch_output = repo
- .git_command()
- .args(["branch", "--list", "new-feature"])
- .run()
- .unwrap();
- assert!(
- String::from_utf8_lossy(&branch_output.stdout).contains("new-feature"),
- "Branch new-feature should have been created"
- );
+ let exit_code = abort_and_exit_code(child, writer, rx);
+ assert_valid_abort_exit_code(exit_code);
}
+/// A preview pane fills in on its own once its background compute lands — no
+/// keystroke needed. The deterministic vehicle is a `--prs` row's `comments`
+/// tab: the comment fetch (`gh pr view <n> --json comments`) is held behind a
+/// causal file gate. The test first observes the "Loading comments…"
+/// placeholder, then releases the fetch; the comment must surface with no
+/// further input once the orchestrator pokes a repaint (`PreviewNotifier`).
+/// Before that product-side poke the placeholder would strand until the next
+/// keystroke — the gap the picker's test harness used to paper over by
+/// re-issuing the tab key.
+///
+/// The PR row is selected by driving the cursor with a re-issued Down, not by an
+/// `!main` filter: a filter applied before the async `--prs` row streams in
+/// empties the result set, and skim doesn't reselect the lone row when it arrives
+/// — so the gate timed out under contention (#3269). Down is idempotent and
+/// clamps on the bottom row, where the streamed PR row sits (below the worktree
+/// row), so the cursor-arrow wait re-issues it until the `>` pointer holds on
+/// `flaky`, outlasting both the stream-in and the cursor reset that the
+/// item-list refresh triggers.
#[rstest]
-fn test_switch_picker_create_with_empty_query_fails(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
- // Remove origin so there's no interference from remote branches
- repo.run_git(&["remote", "remove", "origin"]);
+fn test_switch_picker_preview_auto_refreshes_when_compute_lands(repo: TestRepo) {
+ repo.run_git(&[
+ "remote",
+ "set-url",
+ "origin",
+ "https://github.com/owner/test-repo.git",
+ ]);
- let env_vars = repo.test_env_vars();
+ // `pr list` is instant so the row lands promptly. `pr view` cannot answer
+ // until the test creates `comments.release`, so boot speed cannot erase the
+ // loading-state precondition.
+ let mock_bin = repo.root_path().join("mock-bin");
+ std::fs::create_dir_all(&mock_bin).unwrap();
+ // A short head branch so the PR row isn't truncated in the narrow
+ // (preview-shown) list pane. A locally resolvable head OID keeps the log
+ // preview on its local fast path, so the gated `pr view` is exclusively the
+ // comments fetch whose repaint this test measures.
+ let head = repo.git_output(&["rev-parse", "HEAD"]);
+ let pr_json = format!(
+ r#"[{{"number":42,"title":"Retry the flaky network test","headRefName":"flaky","headRefOid":"{}","author":{{"login":"octocat"}},"isDraft":false,"url":"https://github.com/owner/test-repo/pull/42","body":"body"}}]"#,
+ head.trim()
+ );
+ std::fs::write(mock_bin.join("pr_list.json"), pr_json).unwrap();
+ let comments_json = r#"{"comments":[{"author":{"login":"octocat"},"body":"AUTOREFRESHMARK","createdAt":"2025-01-01T00:00:00Z"}]}"#;
+ MockConfig::new("gh")
+ .version("gh version 1.0.0 (mock)")
+ .command("pr list --state", MockResponse::file("pr_list.json"))
+ .command("pr list --head", MockResponse::output("[]"))
+ .command(
+ "pr view 42",
+ MockResponse::output(comments_json).wait_for_file("comments.release"),
+ )
+ .command("_default", MockResponse::exit(1))
+ .write(&mock_bin);
+ let release = MockReleaseGate::new(mock_bin.join("comments.release"));
+ let call_log = tempfile::tempdir().unwrap();
+ let mut env_vars = forge_mock_env_vars(&repo, &mock_bin);
+ env_vars.push((
+ "WORKTRUNK_TEST_MOCK_CALL_LOG_DIR".to_string(),
+ call_log.path().display().to_string(),
+ ));
- // Press Alt-C without typing a query - should error
- let result = exec_in_pty_with_input(
+ let PickerSession {
+ child,
+ _master,
+ writer,
+ rx,
+ mut parser,
+ } = boot_picker_pty(
wt_bin().to_str().unwrap(),
- &["switch"],
+ &["switch", "--prs"],
repo.root_path(),
&env_vars,
- "\x1bc", // Alt-C (escape + c) without typing a branch name
);
- // Should exit with error (non-zero)
- assert_ne!(
- result.exit_code, 0,
- "Expected non-zero exit for empty query"
+ // Drive the cursor onto the PR row. Its narrow (preview-shown) list line
+ // shows the short head branch `flaky`; the worktree row shows `main`. A
+ // re-issued Down re-drives the pointer after a streamed-row refresh.
+ send_input_awaiting_content(&writer, &rx, &mut parser, "\x1b[B", Some("flaky"));
+ send_input_awaiting_content(&writer, &rx, &mut parser, "\x1b7", Some("Loading comments"));
+ let loading = preview_pane_text(parser.screen());
+ assert!(
+ loading.contains("Loading comments"),
+ "comments fetch must be visibly in flight before release:\n{loading}"
);
- let screen = result.screen();
-
- // Verify the error message
+ // Release the already-open fetch, then wait without sending another
+ // keystroke. Only the product's notifier can repaint the marker.
+ release.release();
+ wait_for_stable_with_content(&rx, &mut parser, Some("AUTOREFRESHMARK"));
+ let preview = preview_pane_text(parser.screen());
assert!(
- screen.contains("no branch name entered") || screen.contains("Cannot create"),
- "Expected error message about missing branch name.\nScreen:\n{}",
- screen
+ preview.contains("AUTOREFRESHMARK"),
+ "comment surfaced on its own once the gated fetch landed:\n{preview}"
+ );
+ let exit_code = abort_and_exit_code(child, writer, rx);
+ assert_valid_abort_exit_code(exit_code);
+ let preview_calls: Vec<_> = mock_calls(call_log.path(), "gh")
+ .into_iter()
+ .filter(|call| call.starts_with("pr view"))
+ .collect();
+ assert_eq!(
+ preview_calls,
+ ["pr view 42 --json comments"],
+ "only the intended comments fetch may drive this repaint"
);
}
@@ -2441,8 +1422,7 @@ fn test_switch_picker_create_with_empty_query_fails(mut repo: TestRepo) {
/// succeeds — proving the pre-flight aborts cleanly rather than leaving a
/// half-created worktree behind.
#[rstest]
-fn test_switch_picker_create_validates_templates_before_worktree(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
+fn test_switch_picker_create_validates_templates_before_worktree(repo: TestRepo) {
repo.run_git(&["remote", "remove", "origin"]);
// Broken `pre-start` in user config: unbalanced `{{` is a minijinja parse
@@ -2530,11 +1510,10 @@ fn test_switch_picker_create_validates_templates_before_worktree(mut repo: TestR
#[rstest]
fn test_switch_picker_emits_cd_directive_by_default(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
repo.run_git(&["remote", "remove", "origin"]);
// Create a worktree to switch to
- repo.add_worktree("target-branch");
+ let target_path = repo.add_worktree("target-branch");
let (cd_path, exec_path, _guard) = worktrunk::testing::directive_files();
@@ -2576,18 +1555,18 @@ fn test_switch_picker_emits_cd_directive_by_default(mut repo: TestRepo) {
result.screen()
);
- // Verify CD file DOES contain a path (default behavior)
+ // The directive must name the row the picker actually selected, not merely
+ // contain some path (which could hide a stale/default-worktree write).
let cd_content = std::fs::read_to_string(&cd_path).unwrap_or_default();
- assert!(
- !cd_content.trim().is_empty(),
- "CD file should contain a path without --no-cd, got: {}",
- cd_content
+ assert_eq!(
+ crate::common::canonicalize(Path::new(cd_content.trim())).unwrap(),
+ crate::common::canonicalize(&target_path).unwrap(),
+ "CD directive must point at the selected target-branch worktree; got {cd_content:?}"
);
}
#[rstest]
fn test_switch_picker_no_cd_switches_without_cd_directive(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
repo.run_git(&["remote", "remove", "origin"]);
// Create a worktree to switch to
@@ -2636,67 +1615,12 @@ fn test_switch_picker_no_cd_switches_without_cd_directive(mut repo: TestRepo) {
screen
);
- // --no-cd suppresses only the cd directive; the switch still ran.
- let cd_content = std::fs::read_to_string(&cd_path).unwrap_or_default();
- assert!(
- cd_content.trim().is_empty(),
- "CD file should be empty with --no-cd, got: {}",
- cd_content
- );
-}
-
-/// `wt switch -x <cmd>` with no branch argument opens the picker and runs the
-/// command against the selected worktree — the composition requested in #3370.
-/// Before the fix, `--execute`'s `requires = "branch"` rejected this at parse
-/// time. The EXEC directive file is the observable proof: `--execute` writes
-/// the expanded command there for the shell wrapper to source, so its presence
-/// confirms the picker threaded `execute` into the shared `SwitchPipeline`.
-#[rstest]
-fn test_switch_picker_runs_execute_command(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
- repo.run_git(&["remote", "remove", "origin"]);
- repo.add_worktree("target-branch");
-
- let (cd_path, exec_path, _guard) = worktrunk::testing::directive_files();
-
- let mut env_vars = repo.test_env_vars();
- env_vars.push((
- "WORKTRUNK_DIRECTIVE_CD_FILE".to_string(),
- cd_path.display().to_string(),
- ));
- env_vars.push((
- "WORKTRUNK_DIRECTIVE_EXEC_FILE".to_string(),
- exec_path.display().to_string(),
- ));
-
- // No branch argument — `-x` alone opens the picker. Select target-branch and
- // press Enter; the switch pipeline then writes the execute command to the
- // EXEC file instead of a cd directive.
- let result = exec_in_pty_with_input_expectations(
- wt_bin().to_str().unwrap(),
- &["switch", "--execute", "echo picker-exec-ran"],
- repo.root_path(),
- &env_vars,
- &[
- // Cursor-navigation select: see test_switch_picker_emits_cd_directive_by_default.
- ("\x1b[B", Some("target-branch")),
- ("\r", None), // Enter to switch
- ],
- );
-
- let exec_contents = std::fs::read_to_string(&exec_path).unwrap_or_default();
- assert_eq!(
- result.exit_code,
- 0,
- "Expected exit code 0 for picker switch with --execute.\n\
- EXEC file: {exec_contents:?}\nScreen:\n{}",
- result.screen()
- );
-
+ // --no-cd suppresses only the cd directive; the switch still ran.
+ let cd_content = std::fs::read_to_string(&cd_path).unwrap_or_default();
assert!(
- exec_contents.contains("picker-exec-ran"),
- "EXEC file should contain the --execute command after a picker switch, got: {}",
- exec_contents
+ cd_content.trim().is_empty(),
+ "CD file should be empty with --no-cd, got: {}",
+ cd_content
);
}
@@ -2709,7 +1633,6 @@ fn test_switch_picker_runs_execute_command(mut repo: TestRepo) {
/// Selecting from the `main` worktree, `{{ base }}` expands to `main`.
#[rstest]
fn test_switch_picker_execute_base_resolves_to_source(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
repo.run_git(&["remote", "remove", "origin"]);
repo.add_worktree("target-branch");
@@ -2765,7 +1688,6 @@ fn test_switch_picker_execute_base_resolves_to_source(mut repo: TestRepo) {
/// declined at the prompt; it must not run, and the switch must still succeed.
#[rstest]
fn test_switch_picker_pre_switch_hook_requires_approval(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
repo.run_git(&["remote", "remove", "origin"]);
repo.add_worktree("target-branch");
@@ -2812,169 +1734,16 @@ fn test_switch_picker_pre_switch_hook_requires_approval(mut repo: TestRepo) {
assert!(!marker.exists(), "a declined pre-switch hook must not run");
}
-/// Drive the picker to remove the first non-current worktree with alt-x, then
-/// switch — capturing the screen between steps so the assertion doesn't depend on
-/// the picker's commit-recency row order. Returns `(landing_branch, final_screen,
-/// exit_code)`, where `landing_branch` is the worktree that slid into the removed
-/// row's slot (the row the sticky cursor must land on).
-fn drive_alt_x_then_switch(
- args: &[&str],
- working_dir: &Path,
- env_vars: &[(String, String)],
- candidates: [&str; 2],
-) -> (String, String, i32) {
- let pair = crate::common::open_pty_with_size(TERM_ROWS, TERM_COLS);
-
- let mut cmd = CommandBuilder::new(wt_bin().to_str().unwrap());
- for arg in args {
- cmd.arg(arg);
- }
- cmd.cwd(working_dir);
- crate::common::configure_pty_command(&mut cmd);
- cmd.env("TERM", "xterm-256color");
- for (key, value) in env_vars {
- cmd.env(key, value);
- }
-
- let mut child = pair.slave.spawn_command(cmd).unwrap();
- drop(pair.slave);
-
- let reader = pair.master.try_clone_reader().unwrap();
- let writer: crate::common::pty::SharedPtyWriter =
- Arc::new(Mutex::new(pair.master.take_writer().unwrap()));
- let rx = crate::common::pty::spawn_pty_reader_answering_queries(reader, Arc::clone(&writer));
-
- let mut parser = vt100::Parser::new(TERM_ROWS, TERM_COLS, 0);
- let drain = |rx: &mpsc::Receiver<Vec<u8>>, parser: &mut vt100::Parser| {
- while let Ok(chunk) = rx.try_recv() {
- parser.process(&chunk);
- }
- };
- let send = |writer: &crate::common::pty::SharedPtyWriter, bytes: &[u8]| {
- let mut w = writer.lock().unwrap();
- w.write_all(bytes).unwrap();
- w.flush().unwrap();
- };
-
- // Wait for skim to be ready.
- let start = Instant::now();
- loop {
- drain(&rx, &mut parser);
- if is_skim_ready(&parser.screen().contents()) || start.elapsed() > READY_TIMEOUT {
- break;
- }
- std::thread::sleep(POLL_INTERVAL);
- }
-
- // Both worktree rows land in one skeleton batch, so waiting for the first
- // candidate implies the second is present too.
- wait_for_stable_with_content(&rx, &mut parser, Some(candidates[0]));
-
- // Learn the row order: the candidate on the earlier list line is row 1 — the
- // one Down lands on and alt-x removes; the other is the sticky landing row.
- let (row1, row2) = {
- let screen = parser.screen();
- let list = screen
- .rows(0, LIST_WIDTH)
- .map(|row| row.trim_end().to_string())
- .collect::<Vec<_>>()
- .join("\n");
- let line_of = |name: &str| list.lines().position(|l| l.contains(name));
- let a = line_of(candidates[0]).expect("candidate 0 in list");
- let b = line_of(candidates[1]).expect("candidate 1 in list");
- if a < b {
- (candidates[0], candidates[1])
- } else {
- (candidates[1], candidates[0])
- }
- };
-
- // Down onto row 1, confirmed via the list-pane cursor pointer (cursor
- // navigation never invokes the matcher, and the pointer refreshes on every
- // render, so this is deterministic regardless of load).
- send(&writer, b"\x1b[B");
- wait_for_cursor_on_row(&rx, &mut parser, row1);
-
- // alt-x removes row 1; the cursor must stick to its slot — now holding row 2.
- // The pointer landing on row 2 *is* the sticky assertion: a cursor reset to
- // the top would leave the pointer on the current worktree and time this out.
- // We gate on the pointer, not row 2's preview pane, because the reposition is
- // a `Custom` action and skim doesn't repaint the preview after one — see
- // `wait_for_cursor_on_row`.
- send(&writer, b"\x1bx");
- wait_for_cursor_on_row(&rx, &mut parser, row2);
-
- // Enter switches to the cursor row (row 2).
- send(&writer, b"\r");
- drop(writer);
-
- // Let the switch finish and the process exit on its own — a hang panics
- // rather than being killed into an exit code (see `wait_for_exit`).
- let exit_code = wait_for_exit(&mut child, &rx, &mut parser, "Enter");
-
- (row2.to_string(), parser.screen().contents(), exit_code)
-}
-
-/// alt-x keeps the cursor on the removed row's slot. After removing the first
-/// non-current worktree, the cursor stays on the row that slides up (the next
-/// worktree), so Enter switches there — not back to the current worktree at the
-/// top, which is where skim's reload would otherwise reset the cursor.
-#[rstest]
-fn test_switch_picker_alt_x_keeps_cursor_sticky(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
- repo.run_git(&["remote", "remove", "origin"]);
- repo.add_worktree("wt-keep");
- repo.add_worktree("wt-drop");
-
- let env_vars = repo.test_env_vars();
- let (landing, screen, exit_code) = drive_alt_x_then_switch(
- &["switch", "--no-cd", "--format=json"],
- repo.root_path(),
- &env_vars,
- ["wt-keep", "wt-drop"],
- );
-
- // The cursor-stickiness belief is proven by the emitted result on screen,
- // not by the process exit code: the `--format=json` payload reaches stdout
- // only after the switch pipeline ran, and it names the sticky landing row
- // (not the current worktree at the top, which is where a cursor reset would
- // have switched instead).
- assert!(
- screen.contains("\"action\""),
- "switch emitted its --format=json result.\nScreen:\n{screen}"
- );
- assert!(
- screen.contains(&landing),
- "switch targeted the sticky row `{landing}`.\nScreen:\n{screen}"
- );
- // The interactive skim session's *process* exit code is a separate, weaker
- // signal than the emitted result above. It has been observed as 1 on Windows
- // even when the switch verifiably succeeded (the result lines are present) —
- // a non-zero exit from somewhere after the success output, distinct from the
- // cursor stickiness this test covers. Accept skim's selection/abort codes
- // (0 or 1) rather than pinning to 0 and flaking on that race; the same
- // tolerance `assert_valid_abort_exit_code` already applies across this
- // file's PTY tests. A gross failure (panic, crash) still fails the screen
- // assertions above, which require the success output to be present.
- assert!(
- exit_code == 0 || exit_code == 1,
- "switch after alt-x exited with an unexpected code {exit_code} (expected 0 or 1).\nScreen:\n{screen}"
- );
-}
-
/// alt-x lands the cursor on the row that slides up — the *immediate* next row —
/// not one past it, even when the removed row has several rows below it.
///
-/// [`test_switch_picker_alt_x_keeps_cursor_sticky`] removes the row directly below
-/// the pinned current worktree, leaving a single row beneath it. That can't tell a
-/// correct landing from a one-row overshoot: `scroll_by` clamps the cursor to the
-/// list's last row, so an off-by-one lands on the same (only) remaining row and the
-/// test passes anyway. This removes a *middle* row with two rows below it, where an
-/// overshoot lands one row too far instead of being clamped — the exact "jumps two
-/// down" a user sees with a long worktree list.
+/// A two-row setup can't distinguish a correct landing from a one-row overshoot:
+/// `scroll_by` clamps the cursor to the list's last row, so both land on the same
+/// remaining row. This removes a *middle* row with two rows below it, where an
+/// overshoot lands one row too far instead of being clamped — the exact "jumps
+/// two down" a user sees with a long worktree list.
#[rstest]
fn test_switch_picker_alt_x_lands_on_immediate_next_row(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
repo.run_git(&["remote", "remove", "origin"]);
// Four worktrees beneath the pinned current (main) row. All sit at main's
// commit, so each alt-x integrates-and-drops (no morph) — the drop path.
@@ -3067,7 +1836,6 @@ fn test_switch_picker_alt_x_lands_on_immediate_next_row(mut repo: TestRepo) {
/// removed row's preview until the next keystroke.
#[rstest]
fn test_switch_picker_alt_x_last_row_refreshes_preview(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
repo.run_git(&["remote", "remove", "origin"]);
// Two clean worktrees at main's commit, so alt-x integrates-and-drops them.
for branch in ["wt-a", "wt-b"] {
@@ -3156,8 +1924,7 @@ fn test_switch_picker_alt_x_last_row_refreshes_preview(mut repo: TestRepo) {
/// worktree (the top row), so the cursor sits on it before and after the reload
/// regardless of skim's reload cursor behavior — no navigation needed.
#[rstest]
-fn test_switch_picker_alt_r_refreshes_preview(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
+fn test_switch_picker_alt_r_refreshes_preview(repo: TestRepo) {
repo.run_git(&["remote", "remove", "origin"]);
// A committed, tracked file in the current worktree so `git diff HEAD` has
@@ -3217,51 +1984,8 @@ fn test_switch_picker_alt_r_refreshes_preview(mut repo: TestRepo) {
/// stays responsive — its screen stabilizes, then aborts cleanly.
#[rstest]
fn test_switch_picker_alt_x_no_match_stays_responsive(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
- repo.run_git(&["remote", "remove", "origin"]);
- repo.add_worktree("solo-wt");
-
- let env_vars = repo.test_env_vars();
- let result = exec_in_pty_capture_before_abort(
- wt_bin().to_str().unwrap(),
- &["switch"],
- repo.root_path(),
- &env_vars,
- &[
- ("solo-wt", Some("solo-wt")), // filter to the sole matching worktree
- ("\x1bx", None), // alt-x removes it; query now matches nothing
- ("\x1bx", None), // alt-x again with nothing selected: a no-op
- ],
- );
-
- assert_valid_abort_exit_code(result.exit_code);
-}
-
-/// alt-x on an unmerged branch-only row leaves the row present end-to-end through
-/// real skim — `SafeDelete` refuses to delete an unmerged branch, so the row must
-/// not vanish. The inverse of `…_no_match_stays_responsive`, which removes a row
-/// and expects emptiness.
-///
-/// This guards the integration outcome (the real reload re-renders the row, the
-/// list doesn't empty), not the no-flicker mechanism specifically: a regression in
-/// the up-front keep would be masked here by the background restore backstop, which
-/// re-inserts the row. The keep-path-specific "never dropped, no flicker" property
-/// is unit-tested in `test_invoke_keeps_unmerged_branch_only_row`, which checks the
-/// synchronous `items` state before any backstop can run.
-#[rstest]
-fn test_switch_picker_alt_x_keeps_unmerged_branch_row(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
repo.run_git(&["remote", "remove", "origin"]);
-
- // An unmerged branch — a commit off the default branch — with no worktree.
- // Use the branch wt itself resolves as the default, so the picker's
- // integration check and this checkout key off the same ref.
- let default_branch = repo.git_output(&["symbolic-ref", "--short", "HEAD"]);
- repo.run_git(&["checkout", "-b", "unmerged-orphan"]);
- std::fs::write(repo.root_path().join("orphan.txt"), "unmerged work").unwrap();
- repo.run_git(&["add", "."]);
- repo.run_git(&["commit", "-m", "unmerged work"]);
- repo.run_git(&["checkout", &default_branch]);
+ let wt_path = repo.add_worktree("solo-wt");
let env_vars = repo.test_env_vars();
let PickerSession {
@@ -3272,30 +1996,46 @@ fn test_switch_picker_alt_x_keeps_unmerged_branch_row(mut repo: TestRepo) {
mut parser,
} = boot_picker_pty(
wt_bin().to_str().unwrap(),
- &["switch", "--branches"],
+ &["switch"],
repo.root_path(),
&env_vars,
);
- // Filter to the branch-only row, then wait for the cursor (`>`) to land on it.
- // A local branch with no worktree carries the `/` gutter, so `/ unmerged-orphan`
- // names the data row specifically — skim's query-echo prompt line is
- // `> unmerged-orphan` (no gutter), which this gate ignores. Keying off the
- // gutter rather than the bare name is what makes the wait robust: under Windows
- // CI load the prompt echo trails its keystrokes (the final character can still
- // be unrendered once the row is already on screen), and an assertion that
- // counted the name across both the prompt and the row flaked when the prompt
- // came up a character short.
- send_input_awaiting_content(&writer, &rx, &mut parser, "unmerged-orphan", None);
- wait_for_cursor_on_row(&rx, &mut parser, "/ unmerged-orphan");
-
- // alt-x: `SafeDelete` refuses to drop an unmerged branch, so the row stays and
- // the cursor holds on `/ unmerged-orphan`. A regression that dropped the row
- // would empty the filtered list, the `/` data row would never reappear, and
- // this wait would time out with a screen dump.
- send_input_awaiting_content(&writer, &rx, &mut parser, "\x1bx", None);
- wait_for_cursor_on_row(&rx, &mut parser, "/ unmerged-orphan");
+ send_input_awaiting_content(&writer, &rx, &mut parser, "solo-wt", Some("solo-wt"));
+ wait_for_cursor_on_row(&rx, &mut parser, "+ solo-wt");
+ // First alt-x must actually remove the selected worktree row. The query
+ // line still contains `solo-wt`, so look only for the linked-worktree row.
+ {
+ let mut w = writer.lock().unwrap();
+ w.write_all(b"\x1bx").unwrap();
+ w.flush().unwrap();
+ }
+ wait_for_stable_until(
+ &rx,
+ &mut parser,
+ |screen| {
+ !screen.lines().any(|line| {
+ let list: String = line.chars().take(LIST_WIDTH as usize).collect();
+ list.contains("+ solo-wt")
+ })
+ },
+ Some("the + solo-wt row to leave the filtered list"),
+ None,
+ );
+ worktrunk::testing::wait_for_worktree_removed(&wt_path);
+ worktrunk::testing::wait_for("integrated solo-wt branch deletion", || {
+ repo.git_output(&["branch", "--list", "solo-wt"]).is_empty()
+ });
+ worktrunk::testing::assert_worktree_removed(&wt_path);
+ assert!(
+ repo.git_output(&["branch", "--list", "solo-wt"]).is_empty(),
+ "integrated solo-wt branch should be deleted with its worktree"
+ );
+
+ // The filtered list is now empty. A second alt-x has no selection and must
+ // be a no-op; normal Escape teardown proves the event loop stayed live.
+ send_input_awaiting_content(&writer, &rx, &mut parser, "\x1bx", None);
let exit_code = abort_and_exit_code(child, writer, rx);
assert_valid_abort_exit_code(exit_code);
}
@@ -3310,7 +2050,6 @@ fn test_switch_picker_alt_x_keeps_unmerged_branch_row(mut repo: TestRepo) {
/// gutter flip and the sticky cursor in one assertion.
#[rstest]
fn test_switch_picker_alt_x_morphs_removed_worktree_in_place(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
repo.run_git(&["remote", "remove", "origin"]);
// A worktree on a branch with a commit the default branch lacks, so
@@ -3333,77 +2072,45 @@ fn test_switch_picker_alt_x_morphs_removed_worktree_in_place(mut repo: TestRepo)
.unwrap();
let env_vars = repo.test_env_vars();
- let pair = crate::common::open_pty_with_size(TERM_ROWS, TERM_COLS);
- let mut cmd = CommandBuilder::new(wt_bin().to_str().unwrap());
- cmd.arg("switch");
- cmd.cwd(repo.root_path());
- crate::common::configure_pty_command(&mut cmd);
- cmd.env("TERM", "xterm-256color");
- for (key, value) in &env_vars {
- cmd.env(key, value);
- }
- let mut child = pair.slave.spawn_command(cmd).unwrap();
- drop(pair.slave);
-
- let reader = pair.master.try_clone_reader().unwrap();
- let writer: crate::common::pty::SharedPtyWriter =
- Arc::new(Mutex::new(pair.master.take_writer().unwrap()));
- let rx = crate::common::pty::spawn_pty_reader_answering_queries(reader, Arc::clone(&writer));
- let mut parser = vt100::Parser::new(TERM_ROWS, TERM_COLS, 0);
- let drain = |rx: &mpsc::Receiver<Vec<u8>>, parser: &mut vt100::Parser| {
- while let Ok(chunk) = rx.try_recv() {
- parser.process(&chunk);
- }
- };
- let send = |writer: &crate::common::pty::SharedPtyWriter, bytes: &[u8]| {
+ let PickerSession {
+ child,
+ _master,
+ writer,
+ rx,
+ mut parser,
+ } = boot_picker_pty(
+ wt_bin().to_str().unwrap(),
+ &["switch"],
+ repo.root_path(),
+ &env_vars,
+ );
+ let send = |bytes: &[u8]| {
let mut w = writer.lock().unwrap();
w.write_all(bytes).unwrap();
w.flush().unwrap();
};
- // Wait for skim to be ready, then for the worktree row to land.
- let start = Instant::now();
- loop {
- drain(&rx, &mut parser);
- if is_skim_ready(&parser.screen().contents()) || start.elapsed() > READY_TIMEOUT {
- break;
- }
- std::thread::sleep(POLL_INTERVAL);
- }
wait_for_stable_with_content(&rx, &mut parser, Some("transform-me"));
// Filter to the single worktree row so the selection is deterministic
// regardless of commit-recency order, then confirm the cursor is on it. The
// row still reads `> + transform-me` — a linked worktree.
- send(&writer, b"transform-me");
+ send(b"transform-me");
wait_for_cursor_on_row(&rx, &mut parser, "+ transform-me");
// alt-x morphs the row in place. The cursor must land back on the morphed
// row — `> / transform-me`, gutter flipped to the branch sigil. The morph
// leaves `search_text` untouched, so the row still matches the active filter;
// a drop would empty the list, and the old re-collect would reset the cursor.
- send(&writer, b"\x1bx");
+ send(b"\x1bx");
wait_for_cursor_on_row(&rx, &mut parser, "/ transform-me");
- send(&writer, b"\x1b"); // Esc to exit the picker.
- drop(writer);
- let start = Instant::now();
- while start.elapsed() < CHILD_EXIT_TIMEOUT {
- if child.try_wait().unwrap().is_some() {
- break;
- }
- std::thread::sleep(Duration::from_millis(10));
- }
- let _ = child.kill();
- drain(&rx, &mut parser);
- let _ = child.wait();
+ worktrunk::testing::wait_for_worktree_removed(&wt_path);
+ let exit_code = abort_and_exit_code(child, writer, rx);
+ assert_valid_abort_exit_code(exit_code);
// The worktree is gone but its branch survives — the morph's premise.
- assert!(
- !wt_path.exists(),
- "alt-x removed the worktree directory.\nScreen:\n{}",
- parser.screen().contents()
- );
+ worktrunk::testing::assert_worktree_removed(&wt_path);
let branches = repo.git_output(&["branch", "--list", "transform-me"]);
assert!(
branches.contains("transform-me"),
@@ -3411,163 +2118,6 @@ fn test_switch_picker_alt_x_morphs_removed_worktree_in_place(mut repo: TestRepo)
);
}
-/// alt-x on the *current* worktree — the one the picker was launched from — keeps
-/// the row in place rather than removing it. Removing the worktree the shell is
-/// sitting in would have to cd elsewhere first, which drags `post-switch` hooks
-/// into the picker and swaps an empty placeholder under the cursor mid-render, so
-/// the picker declines (`removal_targets_current_worktree`). End-to-end through
-/// real skim launched from inside the worktree: after alt-x the cursor stays on
-/// the unchanged `@ standing-here` row (gutter still `@` — not dropped, not
-/// morphed to `/`) and the worktree survives on disk. The branch is unmerged, so
-/// were the guard absent the row would morph; a surviving `@` proves the
-/// current-worktree check fires before the morph path.
-#[rstest]
-fn test_switch_picker_alt_x_keeps_current_worktree(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
- repo.run_git(&["remote", "remove", "origin"]);
-
- let wt_path = repo.add_worktree("standing-here");
- std::fs::write(wt_path.join("new.txt"), "unmerged work").unwrap();
- repo.git_command()
- .args(["-C", wt_path.to_str().unwrap(), "add", "new.txt"])
- .run()
- .unwrap();
- repo.git_command()
- .args([
- "-C",
- wt_path.to_str().unwrap(),
- "commit",
- "-m",
- "unmerged work",
- ])
- .run()
- .unwrap();
-
- let env_vars = repo.test_env_vars();
- let pair = crate::common::open_pty_with_size(TERM_ROWS, TERM_COLS);
- let mut cmd = CommandBuilder::new(wt_bin().to_str().unwrap());
- cmd.arg("switch");
- cmd.cwd(&wt_path); // launched from inside the worktree → it's the current one
- crate::common::configure_pty_command(&mut cmd);
- cmd.env("TERM", "xterm-256color");
- for (key, value) in &env_vars {
- cmd.env(key, value);
- }
- let mut child = pair.slave.spawn_command(cmd).unwrap();
- drop(pair.slave);
-
- let reader = pair.master.try_clone_reader().unwrap();
- let writer: crate::common::pty::SharedPtyWriter =
- Arc::new(Mutex::new(pair.master.take_writer().unwrap()));
- let rx = crate::common::pty::spawn_pty_reader_answering_queries(reader, Arc::clone(&writer));
- let mut parser = vt100::Parser::new(TERM_ROWS, TERM_COLS, 0);
- let drain = |rx: &mpsc::Receiver<Vec<u8>>, parser: &mut vt100::Parser| {
- while let Ok(chunk) = rx.try_recv() {
- parser.process(&chunk);
- }
- };
- let send = |writer: &crate::common::pty::SharedPtyWriter, bytes: &[u8]| {
- let mut w = writer.lock().unwrap();
- w.write_all(bytes).unwrap();
- w.flush().unwrap();
- };
-
- let start = Instant::now();
- loop {
- drain(&rx, &mut parser);
- if is_skim_ready(&parser.screen().contents()) || start.elapsed() > READY_TIMEOUT {
- break;
- }
- std::thread::sleep(POLL_INTERVAL);
- }
- wait_for_stable_with_content(&rx, &mut parser, Some("standing-here"));
-
- // Filter to the current-worktree row so the selection is deterministic, then
- // confirm the cursor is on it — `> @ standing-here`, the `@` current gutter.
- send(&writer, b"standing-here");
- wait_for_cursor_on_row(&rx, &mut parser, "@ standing-here");
-
- // alt-x is declined for the current worktree: the row neither drops (the
- // filtered list would empty) nor morphs (the gutter would flip to `/`). After
- // the reload settles the cursor is back on the unchanged `@ standing-here` row.
- send(&writer, b"\x1bx");
- wait_for_cursor_on_row(&rx, &mut parser, "@ standing-here");
-
- send(&writer, b"\x1b"); // Esc to exit the picker.
- drop(writer);
- let start = Instant::now();
- while start.elapsed() < CHILD_EXIT_TIMEOUT {
- if child.try_wait().unwrap().is_some() {
- break;
- }
- std::thread::sleep(Duration::from_millis(10));
- }
- let _ = child.kill();
- drain(&rx, &mut parser);
- let _ = child.wait();
-
- // The worktree survives — alt-x declined to remove the one we're standing in.
- assert!(
- wt_path.exists(),
- "alt-x removed the current worktree.\nScreen:\n{}",
- parser.screen().contents()
- );
-}
-
-/// alt-x on an unremovable row (here the main worktree) keeps the cursor exactly on
-/// that row — it must not drift down — even with several rows below it.
-///
-/// This mirrors the keep paths a user hits most: alt-x on the main worktree or a
-/// dirty worktree surfaces a diagnostic and keeps the row. The single-row filtered
-/// case in [`test_switch_picker_alt_x_keeps_current_worktree`] can't catch a
-/// one-row drift (only one row matches the filter), so this drives a full,
-/// unfiltered list and removes nothing: the cursor has to come back to the *same*
-/// row, not the one below it.
-#[rstest]
-fn test_switch_picker_alt_x_unremovable_row_keeps_cursor(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
- repo.run_git(&["remote", "remove", "origin"]);
- // Launch from `wt-a` so it's the pinned current row; `main` then sorts second,
- // with `wt-b`/`wt-c`/`wt-d` below it — main is a mid-list unremovable row.
- let wt_a = repo.add_worktree("wt-a");
- for branch in ["wt-b", "wt-c", "wt-d"] {
- repo.add_worktree(branch);
- }
-
- let env_vars = repo.test_env_vars();
- let PickerSession {
- child,
- _master,
- writer,
- rx,
- mut parser,
- } = boot_picker_pty(
- wt_bin().to_str().unwrap(),
- &["switch", "--no-cd", "--format=json"],
- &wt_a,
- &env_vars,
- );
- let send = |bytes: &[u8]| {
- let mut w = writer.lock().unwrap();
- w.write_all(bytes).unwrap();
- w.flush().unwrap();
- };
-
- wait_for_stable_with_content(&rx, &mut parser, Some("wt-d"));
-
- // Down from the pinned current `wt-a` onto the `main` row (sorted second).
- send(b"\x1b[B");
- wait_for_cursor_on_row(&rx, &mut parser, "main");
-
- // alt-x is declined for the main worktree (it can't be removed). The row stays
- // and the cursor must land back on it — a one-row drift lands on the worktree
- // below `main` and times this out.
- send(b"\x1bx");
- wait_for_cursor_on_row(&rx, &mut parser, "main");
-
- let _ = abort_and_exit_code(child, writer, rx);
-}
-
/// alt-x under an active fuzzy query lands the cursor on the row displayed just
/// below the removed one — the *filtered display* order, not the removed row's
/// index in the full (unfiltered) `shared_items` list.
@@ -3583,7 +2133,6 @@ fn test_switch_picker_alt_x_unremovable_row_keeps_cursor(mut repo: TestRepo) {
/// clamps it to the last filtered row), an identity-based one lands on the neighbor.
#[rstest]
fn test_switch_picker_alt_x_lands_on_neighbor_under_filter(mut repo: TestRepo) {
- repo.remove_fixture_worktrees();
repo.run_git(&["remote", "remove", "origin"]);
// Keepers (match the query `keep`) interleaved with decoys (don't), so each
// keeper carries decoys ahead of it in `shared_items` order. All sit at main's
diff --git a/tests/integration_tests/switch_picker_dry_run.rs b/tests/integration_tests/switch_picker_dry_run.rs
index d0e1f5abe..eff6e1803 100644
--- a/tests/integration_tests/switch_picker_dry_run.rs
+++ b/tests/integration_tests/switch_picker_dry_run.rs
@@ -9,21 +9,65 @@
//! Runs on every platform: the dry-run bypass is consulted before the
//! interactive TTY path, so these exercise the picker pipeline on Windows too.
+use crate::common::mock_commands::{MockConfig, MockResponse, mock_calls};
use crate::common::{TEST_EPOCH, TestRepo, repo};
use rstest::rstest;
-/// Runs the dry-run picker with summaries disabled (default). Covers the
-/// base cache-dump path and the `else` branch that inserts a config hint
-/// in place of real summaries.
+#[rstest::fixture]
+fn main_only_repo() -> TestRepo {
+ TestRepo::standard_main_only()
+}
+
+/// Install a strict fake summary command through TestRepo's cross-platform
+/// mock-PATH wiring. Tests observe its external call log to distinguish the
+/// generated-summary route from the static mode-5 config hint.
+fn install_summary_probe(repo: &mut TestRepo) {
+ repo.setup_mock_gh();
+ let mock_bin = repo
+ .mock_bin_path()
+ .expect("setup_mock_gh installs a mock bin");
+ MockConfig::new("summary-probe")
+ .command("_default", MockResponse::output("generated-summary-marker"))
+ .write(mock_bin);
+}
+
+/// Runs the dry-run picker with summaries disabled (default). Covers configured
+/// branch-only row collection, the base cache-dump path, and the `else` branch
+/// that inserts a config hint in place of real summaries.
#[rstest]
-fn test_picker_dry_run_dumps_cache_json(mut repo: TestRepo) {
- repo.add_worktree("feature-a");
- repo.add_worktree("feature-b");
+fn test_picker_dry_run_emits_configured_rows_and_cache_json(
+ #[from(main_only_repo)] mut repo: TestRepo,
+) {
+ repo.run_git(&["remote", "remove", "origin"]);
+ repo.add_worktree("active-worktree");
+ repo.run_git(&["branch", "orphan-branch"]);
+
+ let orphan_head = repo.git_output(&["rev-parse", "--verify", "refs/heads/orphan-branch"]);
+ assert_eq!(
+ orphan_head,
+ repo.git_output(&["rev-parse", "HEAD"]),
+ "orphan-branch must exist as a local branch ref"
+ );
+ let worktrees = repo.git_output(&["worktree", "list", "--porcelain"]);
+ assert!(
+ !worktrees
+ .lines()
+ .any(|line| line == "branch refs/heads/orphan-branch"),
+ "orphan-branch must not belong to a worktree:\n{worktrees}"
+ );
+
+ repo.write_test_config("[list]\nbranches = true\n");
+ install_summary_probe(&mut repo);
+ let call_log = tempfile::tempdir().unwrap();
let output = repo
.wt_command()
+ // No `--branches`: the config setting must drive branch collection.
.args(["switch"])
.env("WORKTRUNK_PICKER_DRY_RUN", "1")
+ // A configured generator must still stay off while list.summary=false.
+ .env("WORKTRUNK_COMMIT__GENERATION__COMMAND", "summary-probe")
+ .env("WORKTRUNK_TEST_MOCK_CALL_LOG_DIR", call_log.path())
.output()
.unwrap();
@@ -35,6 +79,17 @@ fn test_picker_dry_run_dumps_cache_json(mut repo: TestRepo) {
let stdout = String::from_utf8(output.stdout).expect("stdout is utf-8");
let parsed: serde_json::Value = serde_json::from_str(&stdout).expect("stdout is valid JSON");
+ let rows: Vec<&str> = parsed["rows"]
+ .as_array()
+ .expect("top-level `rows` array")
+ .iter()
+ .map(|row| row.as_str().expect("row is a string"))
+ .collect();
+ assert!(
+ rows.iter().any(|row| row.contains("/ orphan-branch")),
+ "configured branch-only row missing from structured rows: {rows:#?}"
+ );
+
let entries = parsed["entries"]
.as_array()
.expect("top-level `entries` array");
@@ -48,10 +103,110 @@ fn test_picker_dry_run_dumps_cache_json(mut repo: TestRepo) {
// schema (not specific branches/modes) keeps the test robust to fixture
// changes while still covering the dump format.
for e in entries {
- assert!(e["branch"].is_string(), "entry missing branch: {e}");
- assert!(e["mode"].is_number(), "entry missing mode: {e}");
- assert!(e["bytes"].is_number(), "entry missing bytes: {e}");
+ assert!(
+ e["branch"]
+ .as_str()
+ .is_some_and(|branch| !branch.is_empty()),
+ "entry missing nonempty branch: {e}"
+ );
+ assert!(
+ e["mode"]
+ .as_u64()
+ .is_some_and(|mode| u8::try_from(mode).is_ok()),
+ "entry mode is not a u8: {e}"
+ );
+ assert!(
+ e["bytes"]
+ .as_u64()
+ .is_some_and(|bytes| usize::try_from(bytes).is_ok()),
+ "entry bytes is not a usize: {e}"
+ );
}
+
+ assert!(
+ entries
+ .iter()
+ .any(|e| e["mode"] == 5 && e["bytes"].as_u64().is_some_and(|bytes| bytes > 0)),
+ "summaries are disabled, so the picker must seed a nonempty static config hint: {stdout}"
+ );
+ assert!(
+ mock_calls(call_log.path(), "summary-probe").is_empty(),
+ "a configured summary command must not run while list.summary=false"
+ );
+}
+
+/// `switch --prs` must select the GitLab subprocess route from the remote URL,
+/// not merely parse GitLab-shaped JSON after some caller has already selected
+/// the provider. A fresh null CI cache entry keeps the worktree-row CI task
+/// local, leaving only the `--prs` availability probe and list call observable.
+#[rstest]
+fn test_picker_dry_run_prs_routes_to_gitlab(#[from(main_only_repo)] mut repo: TestRepo) {
+ repo.run_git(&[
+ "remote",
+ "set-url",
+ "origin",
+ "https://gitlab.com/owner/test-repo.git",
+ ]);
+
+ let branch = repo.current_branch();
+ let head = repo.git_output(&["rev-parse", "HEAD"]);
+ let cache_dir = repo.path().join(".git/wt/cache/ci-status");
+ std::fs::create_dir_all(&cache_dir).unwrap();
+ let entry = serde_json::json!({
+ "status": null,
+ "checked_at": TEST_EPOCH,
+ "head": head.trim(),
+ "branch": branch,
+ });
+ std::fs::write(cache_dir.join(format!("{branch}.json")), entry.to_string()).unwrap();
+
+ // Reuse TestRepo's cross-platform mock-PATH wiring, then replace both forge
+ // configs with strict route-specific mocks.
+ repo.setup_mock_gh();
+ let mock_bin = repo
+ .mock_bin_path()
+ .expect("setup_mock_gh installs a mock bin")
+ .to_path_buf();
+ MockConfig::new("glab")
+ .version("glab version 1.0.0 (mock)")
+ .command(
+ "mr list --per-page 50 --output json",
+ MockResponse::output("[]"),
+ )
+ .command("_default", MockResponse::exit(1))
+ .write(&mock_bin);
+ MockConfig::new("gh")
+ .command("_default", MockResponse::exit(1))
+ .write(&mock_bin);
+
+ // Keep observability outside the repository: writing the call log into the
+ // worktree would perturb the status being collected by the picker.
+ let call_log = tempfile::tempdir().unwrap();
+ let output = repo
+ .wt_command()
+ .args(["switch", "--prs"])
+ .env("WORKTRUNK_PICKER_DRY_RUN", "1")
+ .env("WORKTRUNK_TEST_MOCK_CALL_LOG_DIR", call_log.path())
+ .output()
+ .unwrap();
+
+ assert!(
+ output.status.success(),
+ "GitLab dry-run should exit 0; stderr:\n{}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+ assert_eq!(
+ mock_calls(call_log.path(), "glab"),
+ [
+ "--version".to_string(),
+ "mr list --per-page 50 --output json".to_string(),
+ ],
+ "GitLab routing must issue exactly the availability probe and MR list call"
+ );
+ assert!(
+ mock_calls(call_log.path(), "gh").is_empty(),
+ "a GitLab remote must not invoke the GitHub CLI"
+ );
}
/// A fresh cached CI status surfaces a PR number in picker rows without any
@@ -181,22 +336,21 @@ fn test_picker_dry_run_drains_stashed_warnings(mut repo: TestRepo) {
);
}
-/// Same as above but with `list.summary=true` and a fake LLM command
-/// configured, to exercise the `spawn_summary` branch in `handle_picker`.
-/// Uses `cat` as the LLM: it reads stdin and writes it back, so the
-/// summary pipeline runs end-to-end without a real model. The command runs
-/// via the platform shell (`sh` on Unix, Git Bash on Windows), so the bare
-/// name resolves on PATH on both.
+/// Same as above but with `list.summary=true` and a strict fake LLM command,
+/// proving the configured generator runs before its result reaches mode 5.
#[rstest]
fn test_picker_dry_run_with_summary(mut repo: TestRepo) {
repo.add_worktree("feature-a");
+ install_summary_probe(&mut repo);
+ let call_log = tempfile::tempdir().unwrap();
let output = repo
.wt_command()
.args(["switch"])
.env("WORKTRUNK_PICKER_DRY_RUN", "1")
.env("WORKTRUNK_LIST__SUMMARY", "true")
- .env("WORKTRUNK_COMMIT__GENERATION__COMMAND", "cat")
+ .env("WORKTRUNK_COMMIT__GENERATION__COMMAND", "summary-probe")
+ .env("WORKTRUNK_TEST_MOCK_CALL_LOG_DIR", call_log.path())
.output()
.unwrap();
@@ -222,6 +376,10 @@ fn test_picker_dry_run_with_summary(mut repo: TestRepo) {
entries.iter().any(|e| e["mode"] == 5),
"expected at least one Summary entry, got: {stdout}"
);
+ assert!(
+ !mock_calls(call_log.path(), "summary-probe").is_empty(),
+ "list.summary=true must invoke the configured summary command"
+ );
}
/// `WORKTRUNK_PREVIEW_BENCH=1` shares the dry-run early-exit path but
diff --git a/tests/snapshots/integration__integration_tests__ci_status__azure_pipeline_failed.snap b/tests/snapshots/integration__integration_tests__ci_status__azure_pipeline_failed.snap
deleted file mode 100644
index 9fac433c1..000000000
--- a/tests/snapshots/integration__integration_tests__ci_status__azure_pipeline_failed.snap
+++ /dev/null
@@ -1,57 +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_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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 ^| | # . 05a4a45d 16h Initial commit
-+ feature _| | # ../repo.feature 05a4a45d 16h Initial commit
-+ feature-a ↑| ↑1 +1 | # ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑| ↑1 +1 | # ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑| ↑1 +1 | # ../repo.feature-c 345c7c93 16h Add feature-c file
-
------ stderr -----
-
-○ Showing 5 worktrees, 3 ahead
diff --git a/tests/snapshots/integration__integration_tests__ci_status__azure_pipeline_running.snap b/tests/snapshots/integration__integration_tests__ci_status__azure_pipeline_running.snap
deleted file mode 100644
index c66c721cf..000000000
--- a/tests/snapshots/integration__integration_tests__ci_status__azure_pipeline_running.snap
+++ /dev/null
@@ -1,57 +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_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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 ^| | # . 05a4a45d 16h Initial commit
-+ feature _| | # ../repo.feature 05a4a45d 16h Initial commit
-+ feature-a ↑| ↑1 +1 | # ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑| ↑1 +1 | # ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑| ↑1 +1 | # ../repo.feature-c 345c7c93 16h Add feature-c file
-
------ stderr -----
-
-○ Showing 5 worktrees, 3 ahead
diff --git a/tests/snapshots/integration__integration_tests__ci_status__gitea_pr_failed.snap b/tests/snapshots/integration__integration_tests__ci_status__gitea_pr_failed.snap
deleted file mode 100644
index 59c4144b6..000000000
--- a/tests/snapshots/integration__integration_tests__ci_status__gitea_pr_failed.snap
+++ /dev/null
@@ -1,57 +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_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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 ^| | . 05a4a45d 16h Initial commit
-+ feature-a ↑| ↑1 +1 | ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑| ↑1 +1 | ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑| ↑1 +1 | ../repo.feature-c 345c7c93 16h Add feature-c file
-+ feature ↑| ↑1 +1 | #7 ../repo.feature 9c1e078b 1d feat: gitea feature
-
------ stderr -----
-
-○ Showing 5 worktrees, 4 ahead
diff --git a/tests/snapshots/integration__integration_tests__ci_status__gitea_pr_passed.snap b/tests/snapshots/integration__integration_tests__ci_status__gitea_pr_passed.snap
deleted file mode 100644
index 5519f4e9a..000000000
--- a/tests/snapshots/integration__integration_tests__ci_status__gitea_pr_passed.snap
+++ /dev/null
@@ -1,57 +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_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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 ^| | . 05a4a45d 16h Initial commit
-+ feature-a ↑| ↑1 +1 | ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑| ↑1 +1 | ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑| ↑1 +1 | ../repo.feature-c 345c7c93 16h Add feature-c file
-+ feature ↑| ↑1 +1 | #7 ../repo.feature 9c1e078b 1d feat: gitea feature
-
------ stderr -----
-
-○ Showing 5 worktrees, 4 ahead
diff --git a/tests/snapshots/integration__integration_tests__ci_status__gitea_pr_running.snap b/tests/snapshots/integration__integration_tests__ci_status__gitea_pr_running.snap
deleted file mode 100644
index cba83e196..000000000
--- a/tests/snapshots/integration__integration_tests__ci_status__gitea_pr_running.snap
+++ /dev/null
@@ -1,57 +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_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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 ^| | . 05a4a45d 16h Initial commit
-+ feature-a ↑| ↑1 +1 | ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑| ↑1 +1 | ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑| ↑1 +1 | ../repo.feature-c 345c7c93 16h Add feature-c file
-+ feature ↑| ↑1 +1 | #7 ../repo.feature 9c1e078b 1d feat: gitea feature
-
------ stderr -----
-
-○ Showing 5 worktrees, 4 ahead
diff --git a/tests/snapshots/integration__integration_tests__ci_status__github_pr_approved.snap b/tests/snapshots/integration__integration_tests__ci_status__github_pr_approved.snap
deleted file mode 100644
index feabaf5bc..000000000
--- a/tests/snapshots/integration__integration_tests__ci_status__github_pr_approved.snap
+++ /dev/null
@@ -1,57 +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_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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 ^| | #1 . 05a4a45d 16h Initial commit
-+ feature _| | #1 ../repo.feature 05a4a45d 16h Initial commit
-+ feature-a ↑| ↑1 +1 | #1 ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑| ↑1 +1 | #1 ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑| ↑1 +1 | #1 ../repo.feature-c 345c7c93 16h Add feature-c file
-
------ stderr -----
-
-○ Showing 5 worktrees, 3 ahead
diff --git a/tests/snapshots/integration__integration_tests__ci_status__github_pr_draft.snap b/tests/snapshots/integration__integration_tests__ci_status__github_pr_draft.snap
deleted file mode 100644
index 209fe563f..000000000
--- a/tests/snapshots/integration__integration_tests__ci_status__github_pr_draft.snap
+++ /dev/null
@@ -1,57 +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_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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 ^| | #1 . 05a4a45d 16h Initial commit
-+ feature _| | #1 ../repo.feature 05a4a45d 16h Initial commit
-+ feature-a ↑| ↑1 +1 | #1 ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑| ↑1 +1 | #1 ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑| ↑1 +1 | #1 ../repo.feature-c 345c7c93 16h Add feature-c file
-
------ stderr -----
-
-○ Showing 5 worktrees, 3 ahead
diff --git a/tests/snapshots/integration__integration_tests__ci_status__github_pr_failed.snap b/tests/snapshots/integration__integration_tests__ci_status__github_pr_failed.snap
deleted file mode 100644
index f3c5cc63f..000000000
--- a/tests/snapshots/integration__integration_tests__ci_status__github_pr_failed.snap
+++ /dev/null
@@ -1,57 +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_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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 ^| | #1 . 05a4a45d 16h Initial commit
-+ feature _| | #1 ../repo.feature 05a4a45d 16h Initial commit
-+ feature-a ↑| ↑1 +1 | #1 ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑| ↑1 +1 | #1 ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑| ↑1 +1 | #1 ../repo.feature-c 345c7c93 16h Add feature-c file
-
------ stderr -----
-
-○ Showing 5 worktrees, 3 ahead
diff --git a/tests/snapshots/integration__integration_tests__ci_status__github_pr_passed.snap b/tests/snapshots/integration__integration_tests__ci_status__github_pr_passed.snap
deleted file mode 100644
index feabaf5bc..000000000
--- a/tests/snapshots/integration__integration_tests__ci_status__github_pr_passed.snap
+++ /dev/null
@@ -1,57 +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_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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 ^| | #1 . 05a4a45d 16h Initial commit
-+ feature _| | #1 ../repo.feature 05a4a45d 16h Initial commit
-+ feature-a ↑| ↑1 +1 | #1 ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑| ↑1 +1 | #1 ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑| ↑1 +1 | #1 ../repo.feature-c 345c7c93 16h Add feature-c file
-
------ stderr -----
-
-○ Showing 5 worktrees, 3 ahead
diff --git a/tests/snapshots/integration__integration_tests__ci_status__github_pr_review_required.snap b/tests/snapshots/integration__integration_tests__ci_status__github_pr_review_required.snap
deleted file mode 100644
index b4fcfedff..000000000
--- a/tests/snapshots/integration__integration_tests__ci_status__github_pr_review_required.snap
+++ /dev/null
@@ -1,57 +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_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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 ^| | #1 . 05a4a45d 16h Initial commit
-+ feature _| | #1 ../repo.feature 05a4a45d 16h Initial commit
-+ feature-a ↑| ↑1 +1 | #1 ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑| ↑1 +1 | #1 ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑| ↑1 +1 | #1 ../repo.feature-c 345c7c93 16h Add feature-c file
-
------ stderr -----
-
-○ Showing 5 worktrees, 3 ahead
diff --git a/tests/snapshots/integration__integration_tests__ci_status__github_pr_running.snap b/tests/snapshots/integration__integration_tests__ci_status__github_pr_running.snap
deleted file mode 100644
index 9aa4d2e46..000000000
--- a/tests/snapshots/integration__integration_tests__ci_status__github_pr_running.snap
+++ /dev/null
@@ -1,57 +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_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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 ^| | #1 . 05a4a45d 16h Initial commit
-+ feature _| | #1 ../repo.feature 05a4a45d 16h Initial commit
-+ feature-a ↑| ↑1 +1 | #1 ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑| ↑1 +1 | #1 ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑| ↑1 +1 | #1 ../repo.feature-c 345c7c93 16h Add feature-c file
-
------ stderr -----
-
-○ Showing 5 worktrees, 3 ahead
diff --git a/tests/snapshots/integration__integration_tests__ci_status__github_workflow_run.snap b/tests/snapshots/integration__integration_tests__ci_status__github_workflow_run.snap
deleted file mode 100644
index a7814dc35..000000000
--- a/tests/snapshots/integration__integration_tests__ci_status__github_workflow_run.snap
+++ /dev/null
@@ -1,57 +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_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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 ^| | . 05a4a45d 16h Initial commit
-+ feature _| | ../repo.feature 05a4a45d 16h Initial commit
-+ feature-a ↑| ↑1 +1 | ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑| ↑1 +1 | ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑| ↑1 +1 | ../repo.feature-c 345c7c93 16h Add feature-c file
-
------ stderr -----
-
-○ Showing 5 worktrees, 3 ahead
diff --git a/tests/snapshots/integration__integration_tests__ci_status__github_workflow_running.snap b/tests/snapshots/integration__integration_tests__ci_status__github_workflow_running.snap
deleted file mode 100644
index a7814dc35..000000000
--- a/tests/snapshots/integration__integration_tests__ci_status__github_workflow_running.snap
+++ /dev/null
@@ -1,57 +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_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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 ^| | . 05a4a45d 16h Initial commit
-+ feature _| | ../repo.feature 05a4a45d 16h Initial commit
-+ feature-a ↑| ↑1 +1 | ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑| ↑1 +1 | ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑| ↑1 +1 | ../repo.feature-c 345c7c93 16h Add feature-c file
-
------ stderr -----
-
-○ Showing 5 worktrees, 3 ahead
diff --git a/tests/snapshots/integration__integration_tests__ci_status__gitlab_mr_failed.snap b/tests/snapshots/integration__integration_tests__ci_status__gitlab_mr_failed.snap
deleted file mode 100644
index 7c6945ce5..000000000
--- a/tests/snapshots/integration__integration_tests__ci_status__gitlab_mr_failed.snap
+++ /dev/null
@@ -1,57 +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_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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 ^| | !1 . 05a4a45d 16h Initial commit
-+ feature _| | !1 ../repo.feature 05a4a45d 16h Initial commit
-+ feature-a ↑| ↑1 +1 | !1 ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑| ↑1 +1 | !1 ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑| ↑1 +1 | !1 ../repo.feature-c 345c7c93 16h Add feature-c file
-
------ stderr -----
-
-○ Showing 5 worktrees, 3 ahead
diff --git a/tests/snapshots/integration__integration_tests__ci_status__gitlab_mr_passed.snap b/tests/snapshots/integration__integration_tests__ci_status__gitlab_mr_passed.snap
deleted file mode 100644
index 43370b923..000000000
--- a/tests/snapshots/integration__integration_tests__ci_status__gitlab_mr_passed.snap
+++ /dev/null
@@ -1,57 +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_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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 ^| | !1 . 05a4a45d 16h Initial commit
-+ feature _| | !1 ../repo.feature 05a4a45d 16h Initial commit
-+ feature-a ↑| ↑1 +1 | !1 ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑| ↑1 +1 | !1 ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑| ↑1 +1 | !1 ../repo.feature-c 345c7c93 16h Add feature-c file
-
------ stderr -----
-
-○ Showing 5 worktrees, 3 ahead
diff --git a/tests/snapshots/integration__integration_tests__ci_status__gitlab_mr_pending.snap b/tests/snapshots/integration__integration_tests__ci_status__gitlab_mr_pending.snap
deleted file mode 100644
index a240afe57..000000000
--- a/tests/snapshots/integration__integration_tests__ci_status__gitlab_mr_pending.snap
+++ /dev/null
@@ -1,57 +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_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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 ^| | !1 . 05a4a45d 16h Initial commit
-+ feature _| | !1 ../repo.feature 05a4a45d 16h Initial commit
-+ feature-a ↑| ↑1 +1 | !1 ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑| ↑1 +1 | !1 ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑| ↑1 +1 | !1 ../repo.feature-c 345c7c93 16h Add feature-c file
-
------ stderr -----
-
-○ Showing 5 worktrees, 3 ahead
diff --git a/tests/snapshots/integration__integration_tests__ci_status__gitlab_mr_running.snap b/tests/snapshots/integration__integration_tests__ci_status__gitlab_mr_running.snap
deleted file mode 100644
index a240afe57..000000000
--- a/tests/snapshots/integration__integration_tests__ci_status__gitlab_mr_running.snap
+++ /dev/null
@@ -1,57 +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_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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 ^| | !1 . 05a4a45d 16h Initial commit
-+ feature _| | !1 ../repo.feature 05a4a45d 16h Initial commit
-+ feature-a ↑| ↑1 +1 | !1 ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑| ↑1 +1 | !1 ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑| ↑1 +1 | !1 ../repo.feature-c 345c7c93 16h Add feature-c file
-
------ stderr -----
-
-○ Showing 5 worktrees, 3 ahead
diff --git a/tests/snapshots/integration__integration_tests__ci_status__gitlab_no_ci.snap b/tests/snapshots/integration__integration_tests__ci_status__gitlab_no_ci.snap
deleted file mode 100644
index 18e3bc73a..000000000
--- a/tests/snapshots/integration__integration_tests__ci_status__gitlab_no_ci.snap
+++ /dev/null
@@ -1,57 +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_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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 ^| | !1 . 05a4a45d 16h Initial commit
-+ feature _| | !1 ../repo.feature 05a4a45d 16h Initial commit
-+ feature-a ↑| ↑1 +1 | !1 ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑| ↑1 +1 | !1 ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑| ↑1 +1 | !1 ../repo.feature-c 345c7c93 16h Add feature-c file
-
------ stderr -----
-
-○ Showing 5 worktrees, 3 ahead
diff --git a/tests/snapshots/integration__integration_tests__ci_status__mixed_check_types.snap b/tests/snapshots/integration__integration_tests__ci_status__mixed_check_types.snap
deleted file mode 100644
index 9aa4d2e46..000000000
--- a/tests/snapshots/integration__integration_tests__ci_status__mixed_check_types.snap
+++ /dev/null
@@ -1,57 +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_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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 ^| | #1 . 05a4a45d 16h Initial commit
-+ feature _| | #1 ../repo.feature 05a4a45d 16h Initial commit
-+ feature-a ↑| ↑1 +1 | #1 ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑| ↑1 +1 | #1 ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑| ↑1 +1 | #1 ../repo.feature-c 345c7c93 16h Add feature-c file
-
------ stderr -----
-
-○ Showing 5 worktrees, 3 ahead
diff --git a/tests/snapshots/integration__integration_tests__ci_status__no_ci_checks.snap b/tests/snapshots/integration__integration_tests__ci_status__no_ci_checks.snap
deleted file mode 100644
index 1ebeb4b5d..000000000
--- a/tests/snapshots/integration__integration_tests__ci_status__no_ci_checks.snap
+++ /dev/null
@@ -1,57 +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_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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 ^| | #1 . 05a4a45d 16h Initial commit
-+ feature _| | #1 ../repo.feature 05a4a45d 16h Initial commit
-+ feature-a ↑| ↑1 +1 | #1 ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑| ↑1 +1 | #1 ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑| ↑1 +1 | #1 ../repo.feature-c 345c7c93 16h Add feature-c file
-
------ stderr -----
-
-○ Showing 5 worktrees, 3 ahead
diff --git a/tests/snapshots/integration__integration_tests__ci_status__status_context_failure.snap b/tests/snapshots/integration__integration_tests__ci_status__status_context_failure.snap
deleted file mode 100644
index f3c5cc63f..000000000
--- a/tests/snapshots/integration__integration_tests__ci_status__status_context_failure.snap
+++ /dev/null
@@ -1,57 +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_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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 ^| | #1 . 05a4a45d 16h Initial commit
-+ feature _| | #1 ../repo.feature 05a4a45d 16h Initial commit
-+ feature-a ↑| ↑1 +1 | #1 ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑| ↑1 +1 | #1 ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑| ↑1 +1 | #1 ../repo.feature-c 345c7c93 16h Add feature-c file
-
------ stderr -----
-
-○ Showing 5 worktrees, 3 ahead
diff --git a/tests/snapshots/integration__integration_tests__ci_status__status_context_pending.snap b/tests/snapshots/integration__integration_tests__ci_status__status_context_pending.snap
deleted file mode 100644
index 9aa4d2e46..000000000
--- a/tests/snapshots/integration__integration_tests__ci_status__status_context_pending.snap
+++ /dev/null
@@ -1,57 +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_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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 ^| | #1 . 05a4a45d 16h Initial commit
-+ feature _| | #1 ../repo.feature 05a4a45d 16h Initial commit
-+ feature-a ↑| ↑1 +1 | #1 ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑| ↑1 +1 | #1 ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑| ↑1 +1 | #1 ../repo.feature-c 345c7c93 16h Add feature-c file
-
------ stderr -----
-
-○ Showing 5 worktrees, 3 ahead
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_no_cd_deprecation.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_displays_no_cd_deprecation.snap
deleted file mode 100644
index 82fb03d84..000000000
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_no_cd_deprecation.snap
+++ /dev/null
@@ -1,82 +0,0 @@
----
-source: tests/integration_tests/config_show.rs
-info:
- program: wt
- args:
- - config
- - show
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- WORKTRUNK_TEST_ZSH_INSTALLED: "0"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: true
-exit_code: 0
------ stdout -----
-USER CONFIG @ ~/.config/worktrunk/config.toml
-▲ User config: switch.no-cd is deprecated in favor of switch.cd (inverted)
-▲ User config: [list] json-schema is unset; a future release switches the JSON default to schema 2
-↳ To apply: wt config update
-○ Proposed diff:
-  diff --git a/config.toml/current b/config.toml/migrated
-  index ec5c19e..3d9f6a7 100644
-  --- a/config.toml/current
-  +++ b/config.toml/migrated
-  @@ -1,2 +1,5 @@
-  [switch]
-  -no-cd = true
-  +cd = false
-  +
-  +[list]
-  +json-schema = 2
-↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
-
-PROJECT CONFIG @ _REPO_/.config/wt.toml
-○ Identifier: ../origin
-↳ Not found
-
-SHELL INTEGRATION
-▲ Shell integration not configured
-↳ To configure, run wt config shell install
-  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt
-
-OTHER
-○ wt: [VERSION]
-○ git: [VERSION]
-○ Hyperlinks: inactive
-
------ stderr -----
-▲ User config: switch.no-cd is deprecated in favor of switch.cd (inverted)
-↳ To see details, run wt config show; to apply updates, run wt config update
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_no_ff_deprecation.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_displays_no_ff_deprecation.snap
deleted file mode 100644
index dd9e03328..000000000
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_no_ff_deprecation.snap
+++ /dev/null
@@ -1,82 +0,0 @@
----
-source: tests/integration_tests/config_show.rs
-info:
- program: wt
- args:
- - config
- - show
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- WORKTRUNK_TEST_ZSH_INSTALLED: "0"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: true
-exit_code: 0
------ stdout -----
-USER CONFIG @ ~/.config/worktrunk/config.toml
-▲ User config: merge.no-ff is deprecated in favor of merge.ff (inverted)
-▲ User config: [list] json-schema is unset; a future release switches the JSON default to schema 2
-↳ To apply: wt config update
-○ Proposed diff:
-  diff --git a/config.toml/current b/config.toml/migrated
-  index f4de629..abacac3 100644
-  --- a/config.toml/current
-  +++ b/config.toml/migrated
-  @@ -1,2 +1,5 @@
-  [merge]
-  -no-ff = true
-  +ff = false
-  +
-  +[list]
-  +json-schema = 2
-↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
-
-PROJECT CONFIG @ _REPO_/.config/wt.toml
-○ Identifier: ../origin
-↳ Not found
-
-SHELL INTEGRATION
-▲ Shell integration not configured
-↳ To configure, run wt config shell install
-  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt
-
-OTHER
-○ wt: [VERSION]
-○ git: [VERSION]
-○ Hyperlinks: inactive
-
------ stderr -----
-▲ User config: merge.no-ff is deprecated in favor of merge.ff (inverted)
-↳ To see details, run wt config show; to apply updates, run wt config update
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_select_section_deprecation.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_displays_select_section_deprecation.snap
deleted file mode 100644
index 6cccf7f5b..000000000
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_select_section_deprecation.snap
+++ /dev/null
@@ -1,82 +0,0 @@
----
-source: tests/integration_tests/config_show.rs
-info:
- program: wt
- args:
- - config
- - show
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- WORKTRUNK_TEST_ZSH_INSTALLED: "0"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: true
-exit_code: 0
------ stdout -----
-USER CONFIG @ ~/.config/worktrunk/config.toml
-▲ User config: [select] is deprecated in favor of [switch.picker]
-▲ User config: [list] json-schema is unset; a future release switches the JSON default to schema 2
-↳ To apply: wt config update
-○ Proposed diff:
-  diff --git a/config.toml/current b/config.toml/migrated
-  index 0d6352a..d8b30e0 100644
-  --- a/config.toml/current
-  +++ b/config.toml/migrated
-  @@ -1,2 +1,5 @@
-  -[select]
-  +[switch.picker]
-  pager = "delta --paging=never"
-  +
-  +[list]
-  +json-schema = 2
-↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
-
-PROJECT CONFIG @ _REPO_/.config/wt.toml
-○ Identifier: ../origin
-↳ Not found
-
-SHELL INTEGRATION
-▲ Shell integration not configured
-↳ To configure, run wt config shell install
-  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt
-
-OTHER
-○ wt: [VERSION]
-○ git: [VERSION]
-○ Hyperlinks: inactive
-
------ stderr -----
-▲ User config: [select] is deprecated in favor of [switch.picker]
-↳ To see details, run wt config show; to apply updates, run wt config update
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_whitespace_only_project_config.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_whitespace_only_project_config.snap
deleted file mode 100644
index c54dac8ee..000000000
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_whitespace_only_project_config.snap
+++ /dev/null
@@ -1,79 +0,0 @@
----
-source: tests/integration_tests/config_show.rs
-info:
- program: wt
- args:
- - config
- - show
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- WORKTRUNK_TEST_ZSH_INSTALLED: "0"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: true
-exit_code: 0
------ stdout -----
-USER CONFIG @ ~/.config/worktrunk/config.toml
-▲ User config: [list] json-schema is unset; a future release switches the JSON default to schema 2
-↳ To apply: wt config update
-○ Proposed diff:
-  diff --git a/config.toml/current b/config.toml/migrated
-  index a30ca31..894e11f 100644
-  --- a/config.toml/current
-  +++ b/config.toml/migrated
-  @@ -1 +1,4 @@
-  worktree-path = "../{{ repo }}.{{ branch }}"
-  +
-  +[list]
-  +json-schema = 2
-
-  worktree-path = "../{{ repo }}.{{ branch }}"
-↳ Optional system config not found @ /etc/xdg/worktrunk/config.toml
-
-PROJECT CONFIG @ _REPO_/.config/wt.toml
-○ Identifier: ../origin
-↳ Empty file
-
-SHELL INTEGRATION
-▲ Shell integration not configured
-↳ To configure, run wt config shell install
-  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt
-
-OTHER
-○ wt: [VERSION]
-○ git: [VERSION]
-○ Hyperlinks: inactive
-
------ stderr -----
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_update_applies_approved_commands_migration.snap b/tests/snapshots/integration__integration_tests__config_show__config_update_applies_approved_commands_migration.snap
deleted file mode 100644
index 78740331c..000000000
--- a/tests/snapshots/integration__integration_tests__config_show__config_update_applies_approved_commands_migration.snap
+++ /dev/null
@@ -1,66 +0,0 @@
----
-source: tests/integration_tests/config_show.rs
-info:
- program: wt
- args:
- - config
- - update
- - "--yes"
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- WORKTRUNK_TEST_ZSH_INSTALLED: "0"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: true
-exit_code: 0
------ stdout -----
-
------ stderr -----
-▲ User config: approved-commands under [projects] is deprecated in favor of approvals.toml
-▲ User config: [list] json-schema is unset; a future release switches the JSON default to schema 2
-○ Proposed diff:
-  diff --git a/test-config.toml/current b/test-config.toml/migrated
-  index 51f8ab1..894e11f 100644
-  --- a/test-config.toml/current
-  +++ b/test-config.toml/migrated
-  @@ -1,4 +1,4 @@
-  worktree-path = "../{{ repo }}.{{ branch }}"
-  
-  -[projects."github.com/user/repo"]
-  -approved-commands = ["npm install", "npm test"]
-  +[list]
-  +json-schema = 2
-○ Copied approved commands to approvals.toml
-✓ Updated user config
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_update_applies_commit_generation_migration.snap b/tests/snapshots/integration__integration_tests__config_show__config_update_applies_commit_generation_migration.snap
deleted file mode 100644
index 5769f5d6e..000000000
--- a/tests/snapshots/integration__integration_tests__config_show__config_update_applies_commit_generation_migration.snap
+++ /dev/null
@@ -1,69 +0,0 @@
----
-source: tests/integration_tests/config_show.rs
-info:
- program: wt
- args:
- - config
- - update
- - "--yes"
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- WORKTRUNK_TEST_ZSH_INSTALLED: "0"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: true
-exit_code: 0
------ stdout -----
-
------ stderr -----
-▲ User config: [commit-generation] is deprecated in favor of [commit.generation]
-▲ User config: [list] json-schema is unset; a future release switches the JSON default to schema 2
-○ Proposed diff:
-  diff --git a/test-config.toml/current b/test-config.toml/migrated
-  index 40d0385..c495877 100644
-  --- a/test-config.toml/current
-  +++ b/test-config.toml/migrated
-  @@ -1,5 +1,7 @@
-  worktree-path = "../{{ repo }}.{{ branch }}"
-  
-  -[commit-generation]
-  -command = "llm"
-  -args = ["-m", "haiku"]
-  +[commit.generation]
-  +command = "llm -m haiku"
-  +
-  +[list]
-  +json-schema = 2
-✓ Updated user config
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_update_applies_template_var_migration.snap b/tests/snapshots/integration__integration_tests__config_show__config_update_applies_template_var_migration.snap
deleted file mode 100644
index fca1e0b22..000000000
--- a/tests/snapshots/integration__integration_tests__config_show__config_update_applies_template_var_migration.snap
+++ /dev/null
@@ -1,68 +0,0 @@
----
-source: tests/integration_tests/config_show.rs
-info:
- program: wt
- args:
- - config
- - update
- - "--yes"
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- WORKTRUNK_TEST_ZSH_INSTALLED: "0"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: true
-exit_code: 0
------ stdout -----
-
------ stderr -----
-▲ User config: template variable repo_root is deprecated in favor of repo_path
-▲ User config: template variable worktree is deprecated in favor of worktree_path
-▲ User config: template variable main_worktree is deprecated in favor of repo
-▲ User config: [list] json-schema is unset; a future release switches the JSON default to schema 2
-○ Proposed diff:
-  diff --git a/test-config.toml/current b/test-config.toml/migrated
-  index 7cc556b..fa857a1 100644
-  --- a/test-config.toml/current
-  +++ b/test-config.toml/migrated
-  @@ -1,2 +1,5 @@
-  -worktree-path = "../{{ main_worktree }}.{{ branch }}"
-  -pre-start = "ln -sf {{ repo_root }}/node_modules {{ worktree }}/node_modules"
-  +worktree-path = "../{{ repo }}.{{ branch }}"
-  +pre-start = "ln -sf {{ repo_path }}/node_modules {{ worktree_path }}/node_modules"
-  +
-  +[list]
-  +json-schema = 2
-✓ Updated user config
diff --git a/tests/snapshots/integration__integration_tests__directives__remove_without_directive_file.snap b/tests/snapshots/integration__integration_tests__directives__remove_without_directive_file.snap
deleted file mode 100644
index a4e95d172..000000000
--- a/tests/snapshots/integration__integration_tests__directives__remove_without_directive_file.snap
+++ /dev/null
@@ -1,48 +0,0 @@
----
-source: tests/integration_tests/directives.rs
-info:
- program: wt
- args:
- - remove
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- WORKTRUNK_TEST_ZSH_INSTALLED: "0"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: false
-exit_code: 1
------ stdout -----
-
------ stderr -----
-✗ The main worktree cannot be removed
diff --git a/tests/snapshots/integration__integration_tests__help__help_switch_long.snap b/tests/snapshots/integration__integration_tests__help__help_switch_long.snap
index 67bd36d32..8314010b4 100644
--- a/tests/snapshots/integration__integration_tests__help__help_switch_long.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_switch_long.snap
@@ -65,7 +65,7 @@ Usage: wt switch [OPTIONS] [BRANCH] [--
Without a branch argument, the interactive picker opens and the command runs against the selected worktree — so wt switch -x claude picks a worktree, then launches Claude Code there.
- Supports ]8;;@/hook.md#template-variables\hook template variables]8;;\ ({{ branch }}, {{ worktree_path }}, etc.) and filters. {{ base }} and {{ base_worktree_path }} require --create.
+ Supports ]8;;@/hook.md#template-variables\hook template variables]8;;\ ({{ branch }}, {{ worktree_path }}, etc.) and filters. {{ base }} and {{ base_worktree_path }} describe the source: the selected base with --create, or the invoking worktree when switching to an existing worktree.
Especially useful with shell aliases:
@@ -218,7 +218,7 @@ Typing a gutter sigil filters by row kind: + narrows to linked worktree
4. remote⇅ — Ahead/behind diff vs upstream tracking branch
5. summary — LLM-generated branch summary; requires [list] summary = true and commit.generation
6. pr — The selected row's PR/MR, for any row whose branch has one
-7. comments — The PR/MR's comment thread, fetched from the forge on --prs rows
+7. comments — The PR/MR's comment thread, fetched from the forge for any row whose branch has one
On narrow previews the tab bar compacts to digits — only the active tab keeps its label — so every Alt-N accelerator stays visible.
diff --git a/tests/snapshots/integration__integration_tests__list__list_progressive_flag.snap b/tests/snapshots/integration__integration_tests__list__list_progressive_flag.snap
deleted file mode 100644
index 26fa075da..000000000
--- a/tests/snapshots/integration__integration_tests__list__list_progressive_flag.snap
+++ /dev/null
@@ -1,56 +0,0 @@
----
-source: tests/integration_tests/list.rs
-info:
- program: wt
- args:
- - list
- - "--progressive"
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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⇅ Path Commit Age Message
-@ main ^| | . 05a4a45d 16h Initial commit
-+ feature-a ↑ ↑1 +1 ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑ ↑1 +1 ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑ ↑1 +1 ../repo.feature-c 345c7c93 16h Add feature-c file
-
------ stderr -----
-
-○ Showing 4 worktrees, 3 ahead
diff --git a/tests/snapshots/integration__integration_tests__list__list_single_worktree.snap b/tests/snapshots/integration__integration_tests__list__list_single_worktree.snap
deleted file mode 100644
index 2070b62ec..000000000
--- a/tests/snapshots/integration__integration_tests__list__list_single_worktree.snap
+++ /dev/null
@@ -1,55 +0,0 @@
----
-source: tests/integration_tests/list.rs
-info:
- program: wt
- args:
- - list
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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⇅ Path Commit Age Message
-@ main ^| | . 05a4a45d 16h Initial commit
-+ feature-a ↑ ↑1 +1 ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑ ↑1 +1 ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑ ↑1 +1 ../repo.feature-c 345c7c93 16h Add feature-c file
-
------ stderr -----
-
-○ Showing 4 worktrees, 3 ahead
diff --git a/tests/snapshots/integration__integration_tests__list__list_task_dag_multiple_worktrees.snap b/tests/snapshots/integration__integration_tests__list__list_task_dag_multiple_worktrees.snap
deleted file mode 100644
index 26fa075da..000000000
--- a/tests/snapshots/integration__integration_tests__list__list_task_dag_multiple_worktrees.snap
+++ /dev/null
@@ -1,56 +0,0 @@
----
-source: tests/integration_tests/list.rs
-info:
- program: wt
- args:
- - list
- - "--progressive"
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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⇅ Path Commit Age Message
-@ main ^| | . 05a4a45d 16h Initial commit
-+ feature-a ↑ ↑1 +1 ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑ ↑1 +1 ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑ ↑1 +1 ../repo.feature-c 345c7c93 16h Add feature-c file
-
------ stderr -----
-
-○ Showing 4 worktrees, 3 ahead
diff --git a/tests/snapshots/integration__integration_tests__list__list_task_dag_single_worktree.snap b/tests/snapshots/integration__integration_tests__list__list_task_dag_single_worktree.snap
deleted file mode 100644
index 26fa075da..000000000
--- a/tests/snapshots/integration__integration_tests__list__list_task_dag_single_worktree.snap
+++ /dev/null
@@ -1,56 +0,0 @@
----
-source: tests/integration_tests/list.rs
-info:
- program: wt
- args:
- - list
- - "--progressive"
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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⇅ Path Commit Age Message
-@ main ^| | . 05a4a45d 16h Initial commit
-+ feature-a ↑ ↑1 +1 ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑ ↑1 +1 ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑ ↑1 +1 ../repo.feature-c 345c7c93 16h Add feature-c file
-
------ stderr -----
-
-○ Showing 4 worktrees, 3 ahead
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_no_commit_no_squash_no_remove_redundant.snap b/tests/snapshots/integration__integration_tests__merge__merge_no_commit_no_squash_no_remove_redundant.snap
deleted file mode 100644
index 031170c18..000000000
--- a/tests/snapshots/integration__integration_tests__merge__merge_no_commit_no_squash_no_remove_redundant.snap
+++ /dev/null
@@ -1,57 +0,0 @@
----
-source: tests/integration_tests/merge.rs
-info:
- program: wt
- args:
- - merge
- - main
- - "--no-commit"
- - "--no-squash"
- - "--no-remove"
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- WORKTRUNK_TEST_ZSH_INSTALLED: "0"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: true
-exit_code: 0
------ stdout -----
-
------ stderr -----
-◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
-  * [HASH] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
-✓ Merged to main (1 commit, 1 file, +1)
-○ Worktree preserved (--no-remove)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_no_commit_with_clean_tree.snap b/tests/snapshots/integration__integration_tests__merge__merge_no_commit_with_clean_tree.snap
deleted file mode 100644
index a1f1b048e..000000000
--- a/tests/snapshots/integration__integration_tests__merge__merge_no_commit_with_clean_tree.snap
+++ /dev/null
@@ -1,56 +0,0 @@
----
-source: tests/integration_tests/merge.rs
-info:
- program: wt
- args:
- - merge
- - main
- - "--no-commit"
- - "--no-remove"
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- WORKTRUNK_TEST_ZSH_INSTALLED: "0"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: true
-exit_code: 0
------ stdout -----
-
------ stderr -----
-◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
-  * [HASH] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
-✓ Merged to main (1 commit, 1 file, +1)
-○ Worktree preserved (--no-remove)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_no_remote.snap b/tests/snapshots/integration__integration_tests__merge__merge_no_remote.snap
deleted file mode 100644
index ba6780dfe..000000000
--- a/tests/snapshots/integration__integration_tests__merge__merge_no_remote.snap
+++ /dev/null
@@ -1,55 +0,0 @@
----
-source: tests/integration_tests/merge.rs
-info:
- program: wt
- args:
- - merge
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- WORKTRUNK_TEST_ZSH_INSTALLED: "0"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: true
-exit_code: 0
------ stdout -----
-
------ stderr -----
-◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
-  * [HASH] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
-✓ Merged to main (1 commit, 1 file, +1)
-◎ Removing feature worktree & branch in background (same commit as main, _)
-▲ Cannot change directory — shell integration not installed
-↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_not_fast_forward.snap b/tests/snapshots/integration__integration_tests__merge__merge_not_fast_forward.snap
deleted file mode 100644
index 1d92dd96a..000000000
--- a/tests/snapshots/integration__integration_tests__merge__merge_not_fast_forward.snap
+++ /dev/null
@@ -1,56 +0,0 @@
----
-source: tests/integration_tests/merge.rs
-info:
- program: wt
- args:
- - merge
- - main
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- WORKTRUNK_TEST_ZSH_INSTALLED: "0"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: true
-exit_code: 0
------ stdout -----
-
------ stderr -----
-◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
-  * [HASH] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
-✓ Merged to main (1 commit, 1 file, +1)
-◎ Removing feature worktree & branch in background (same commit as main, _)
-▲ Cannot change directory — shell integration not installed
-↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_race_condition_commit_after_push.snap b/tests/snapshots/integration__integration_tests__merge__merge_race_condition_commit_after_push.snap
deleted file mode 100644
index bebbc6d28..000000000
--- a/tests/snapshots/integration__integration_tests__merge__merge_race_condition_commit_after_push.snap
+++ /dev/null
@@ -1,55 +0,0 @@
----
-source: tests/integration_tests/merge.rs
-info:
- program: wt
- args:
- - merge
- - main
- - "--no-remove"
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- WORKTRUNK_TEST_ZSH_INSTALLED: "0"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: true
-exit_code: 0
------ stdout -----
-
------ stderr -----
-◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
-  * [HASH] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
-✓ Merged to main (1 commit, 1 file, +1)
-○ Worktree preserved (--no-remove)
diff --git a/tests/snapshots/integration__integration_tests__push__push_no_remote.snap b/tests/snapshots/integration__integration_tests__push__push_no_remote.snap
deleted file mode 100644
index 11f795a66..000000000
--- a/tests/snapshots/integration__integration_tests__push__push_no_remote.snap
+++ /dev/null
@@ -1,53 +0,0 @@
----
-source: tests/integration_tests/push.rs
-info:
- program: wt
- args:
- - step
- - push
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- WORKTRUNK_TEST_ZSH_INSTALLED: "0"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: true
-exit_code: 0
------ stdout -----
-
------ stderr -----
-◎ Pushing 1 commit to main @ [HASH]
-  * [HASH] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
-✓ Pushed to main (1 commit, 1 file, +1)
diff --git a/tests/snapshots/integration__integration_tests__push__push_not_fast_forward.snap b/tests/snapshots/integration__integration_tests__push__push_not_fast_forward.snap
deleted file mode 100644
index 2556770f2..000000000
--- a/tests/snapshots/integration__integration_tests__push__push_not_fast_forward.snap
+++ /dev/null
@@ -1,54 +0,0 @@
----
-source: tests/integration_tests/push.rs
-info:
- program: wt
- args:
- - step
- - push
- - main
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- WORKTRUNK_TEST_ZSH_INSTALLED: "0"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: true
-exit_code: 0
------ stdout -----
-
------ stderr -----
-◎ Pushing 1 commit to main @ [HASH]
-  * [HASH] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
-✓ Pushed to main (1 commit, 1 file, +1)
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_already_on_default.snap b/tests/snapshots/integration__integration_tests__remove__remove_already_on_default.snap
deleted file mode 100644
index 81451fd76..000000000
--- a/tests/snapshots/integration__integration_tests__remove__remove_already_on_default.snap
+++ /dev/null
@@ -1,48 +0,0 @@
----
-source: tests/integration_tests/remove.rs
-info:
- program: wt
- args:
- - remove
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- WORKTRUNK_TEST_ZSH_INSTALLED: "0"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: false
-exit_code: 1
------ stdout -----
-
------ stderr -----
-✗ The main worktree cannot be removed
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_dirty_working_tree.snap b/tests/snapshots/integration__integration_tests__remove__remove_dirty_working_tree.snap
deleted file mode 100644
index 81451fd76..000000000
--- a/tests/snapshots/integration__integration_tests__remove__remove_dirty_working_tree.snap
+++ /dev/null
@@ -1,48 +0,0 @@
----
-source: tests/integration_tests/remove.rs
-info:
- program: wt
- args:
- - remove
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- WORKTRUNK_TEST_ZSH_INSTALLED: "0"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: false
-exit_code: 1
------ stdout -----
-
------ stderr -----
-✗ The main worktree cannot be removed
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_json_current.snap b/tests/snapshots/integration__integration_tests__remove__remove_json_current.snap
deleted file mode 100644
index ebbc67627..000000000
--- a/tests/snapshots/integration__integration_tests__remove__remove_json_current.snap
+++ /dev/null
@@ -1,13 +0,0 @@
----
-source: tests/integration_tests/remove.rs
-expression: "String::from_utf8_lossy(&output.stdout)"
----
-[
- {
- "branch": "feature",
- "branch_checked_out_at": null,
- "branch_deleted": true,
- "kind": "worktree",
- "path": "<PATH>"
- }
-]
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_nonexistent_worktree.snap b/tests/snapshots/integration__integration_tests__remove__remove_nonexistent_worktree.snap
deleted file mode 100644
index b69967e3c..000000000
--- a/tests/snapshots/integration__integration_tests__remove__remove_nonexistent_worktree.snap
+++ /dev/null
@@ -1,50 +0,0 @@
----
-source: tests/integration_tests/remove.rs
-info:
- program: wt
- args:
- - remove
- - nonexistent
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- WORKTRUNK_TEST_ZSH_INSTALLED: "0"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: false
-exit_code: 1
------ stdout -----
-
------ stderr -----
-✗ No branch named nonexistent
-↳ To list branches, run wt list --branches --remotes
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_switch_to_default.snap b/tests/snapshots/integration__integration_tests__remove__remove_switch_to_default.snap
deleted file mode 100644
index 81451fd76..000000000
--- a/tests/snapshots/integration__integration_tests__remove__remove_switch_to_default.snap
+++ /dev/null
@@ -1,48 +0,0 @@
----
-source: tests/integration_tests/remove.rs
-info:
- program: wt
- args:
- - remove
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- WORKTRUNK_TEST_ZSH_INSTALLED: "0"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: false
-exit_code: 1
------ stdout -----
-
------ stderr -----
-✗ The main worktree cannot be removed
diff --git a/tests/snapshots/integration__integration_tests__security__git_ignores_malformed_refs_with_ansi.snap b/tests/snapshots/integration__integration_tests__security__git_ignores_malformed_refs_with_ansi.snap
deleted file mode 100644
index 4172fc2d4..000000000
--- a/tests/snapshots/integration__integration_tests__security__git_ignores_malformed_refs_with_ansi.snap
+++ /dev/null
@@ -1,55 +0,0 @@
----
-source: tests/integration_tests/security.rs
-info:
- program: wt
- args:
- - list
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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⇅ Path Commit Age Message
-@ main ^| | . 05a4a45d 16h Initial commit
-+ feature-a ↑ ↑1 +1 ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑ ↑1 +1 ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑ ↑1 +1 ../repo.feature-c 345c7c93 16h Add feature-c file
-
------ stderr -----
-
-○ Showing 4 worktrees, 3 ahead
diff --git a/tests/snapshots/integration__integration_tests__security__path_with_directive_not_executed.snap b/tests/snapshots/integration__integration_tests__security__path_with_directive_not_executed.snap
deleted file mode 100644
index 4172fc2d4..000000000
--- a/tests/snapshots/integration__integration_tests__security__path_with_directive_not_executed.snap
+++ /dev/null
@@ -1,55 +0,0 @@
----
-source: tests/integration_tests/security.rs
-info:
- program: wt
- args:
- - list
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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⇅ Path Commit Age Message
-@ main ^| | . 05a4a45d 16h Initial commit
-+ feature-a ↑ ↑1 +1 ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑ ↑1 +1 ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑ ↑1 +1 ../repo.feature-c 345c7c93 16h Add feature-c file
-
------ stderr -----
-
-○ Showing 4 worktrees, 3 ahead
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_existing.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_existing.snap
deleted file mode 100644
index 3c87c5a64..000000000
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_existing.snap
+++ /dev/null
@@ -1,56 +0,0 @@
----
-source: tests/integration_tests/switch.rs
-info:
- program: wt
- args:
- - switch
- - existing-exec
- - "--execute"
- - "echo 'existing worktree' > existing.txt"
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- WORKTRUNK_TEST_ZSH_INSTALLED: "0"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: true
-exit_code: 0
------ stdout -----
-
------ stderr -----
-▲ --execute will change in a future release: it will run a single program, with arguments after --, not a shell command line
-↳ Comment at https://github.com/max-sixty/worktrunk/issues/2860 if the new single-program form would make a workflow worse; to run this command line unchanged, pass it to a shell: --execute sh -- -c 'echo '\''existing worktree'\'' > existing.txt'
-▲ Worktree for existing-exec @ _REPO_.existing-exec, but cannot change directory — shell integration not installed
-↳ To enable automatic cd, run wt config shell install
-◎ Executing (--execute) @ _REPO_.existing-exec:
-  echo 'existing worktree' > existing.txt
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_multiline.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_multiline.snap
deleted file mode 100644
index 507da46be..000000000
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_multiline.snap
+++ /dev/null
@@ -1,66 +0,0 @@
----
-source: tests/integration_tests/switch.rs
-info:
- program: wt
- args:
- - switch
- - "--create"
- - multiline-test
- - "--execute"
- - "echo 'line1'\necho 'line2'\necho 'line3'"
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- WORKTRUNK_TEST_ZSH_INSTALLED: "0"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: true
-exit_code: 0
------ stdout -----
-line1
-line2
-line3
-
------ stderr -----
-▲ --execute will change in a future release: it will run a single program, with arguments after --, not a shell command line
-↳ Comment at https://github.com/max-sixty/worktrunk/issues/2860 if the new single-program form would make a workflow worse; to run this command line unchanged, pass it to a shell: --execute sh -- -c 'echo '\''line1'\''
-echo '\''line2'\''
-echo '\''line3'\'''
-✓ Created branch multiline-test from main and worktree @ _REPO_.multiline-test
-↳ To customize worktree locations, run wt config create
-▲ Cannot change directory — shell integration not installed
-↳ To enable automatic cd, run wt config shell install
-◎ Executing (--execute) @ _REPO_.multiline-test:
-  echo 'line1'
-  echo 'line2'
-  echo 'line3'
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_success.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_success.snap
deleted file mode 100644
index f7e874f37..000000000
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_success.snap
+++ /dev/null
@@ -1,60 +0,0 @@
----
-source: tests/integration_tests/switch.rs
-info:
- program: wt
- args:
- - switch
- - "--create"
- - exec-test
- - "--execute"
- - "echo 'test output'"
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- WORKTRUNK_TEST_ZSH_INSTALLED: "0"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: true
-exit_code: 0
------ stdout -----
-test output
-
------ stderr -----
-▲ --execute will change in a future release: it will run a single program, with arguments after --, not a shell command line
-↳ Comment at https://github.com/max-sixty/worktrunk/issues/2860 if the new single-program form would make a workflow worse; to run this command line unchanged, pass it to a shell: --execute sh -- -c 'echo '\''test output'\'''
-✓ Created branch exec-test from main and worktree @ _REPO_.exec-test
-↳ To customize worktree locations, run wt config create
-▲ Cannot change directory — shell integration not installed
-↳ To enable automatic cd, run wt config shell install
-◎ Executing (--execute) @ _REPO_.exec-test:
-  echo 'test output'
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_template_base.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_template_base.snap
index b697e4de9..73faef7ac 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_template_base.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_template_base.snap
@@ -5,15 +5,17 @@ info:
args:
- switch
- "--create"
- - from-main
+ - from-release-base
- "--base"
- - main
+ - release-base
- "--execute"
- "echo 'base={{ base }}'"
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_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -40,6 +42,7 @@ info:
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_SKIP_URL_HEALTH_CHECK: "1"
@@ -49,14 +52,14 @@ info:
success: true
exit_code: 0
----- stdout -----
-base=main
+base=release-base
----- stderr -----
▲ --execute will change in a future release: it will run a single program, with arguments after --, not a shell command line
↳ Comment at https://github.com/max-sixty/worktrunk/issues/2860 if the new single-program form would make a workflow worse; to run this command line unchanged, pass it to a shell: --execute sh -- -c 'echo '\''base={{ base }}'\'''
-✓ Created branch from-main from main and worktree @ _REPO_.from-main
+✓ Created branch from-release-base from release-base and worktree @ _REPO_.from-release-base
↳ To customize worktree locations, run wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
-◎ Executing (--execute) @ _REPO_.from-main:
-  echo 'base=main'
+◎ Executing (--execute) @ _REPO_.from-release-base:
+  echo 'base=release-base'
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_template_with_filter.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_template_with_filter.snap
deleted file mode 100644
index f57a157f9..000000000
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_template_with_filter.snap
+++ /dev/null
@@ -1,60 +0,0 @@
----
-source: tests/integration_tests/switch.rs
-info:
- program: wt
- args:
- - switch
- - "--create"
- - feature/with-slash
- - "--execute"
- - "echo 'sanitized={{ branch | sanitize }}'"
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- WORKTRUNK_TEST_ZSH_INSTALLED: "0"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: true
-exit_code: 0
------ stdout -----
-sanitized=feature-with-slash
-
------ stderr -----
-▲ --execute will change in a future release: it will run a single program, with arguments after --, not a shell command line
-↳ Comment at https://github.com/max-sixty/worktrunk/issues/2860 if the new single-program form would make a workflow worse; to run this command line unchanged, pass it to a shell: --execute sh -- -c 'echo '\''sanitized={{ branch | sanitize }}'\'''
-✓ Created branch feature/with-slash from main and worktree @ _REPO_.feature-with-slash
-↳ To customize worktree locations, run wt config create
-▲ Cannot change directory — shell integration not installed
-↳ To enable automatic cd, run wt config shell install
-◎ Executing (--execute) @ _REPO_.feature-with-slash:
-  echo 'sanitized=feature-with-slash'
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_template_worktree_path.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_template_worktree_path.snap
deleted file mode 100644
index 853f0688e..000000000
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_template_worktree_path.snap
+++ /dev/null
@@ -1,60 +0,0 @@
----
-source: tests/integration_tests/switch.rs
-info:
- program: wt
- args:
- - switch
- - "--create"
- - path-test
- - "--execute"
- - "echo 'path={{ worktree_path }}'"
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- WORKTRUNK_TEST_ZSH_INSTALLED: "0"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: true
-exit_code: 0
------ stdout -----
-path=_REPO_.path-test
-
------ stderr -----
-▲ --execute will change in a future release: it will run a single program, with arguments after --, not a shell command line
-↳ Comment at https://github.com/max-sixty/worktrunk/issues/2860 if the new single-program form would make a workflow worse; to run this command line unchanged, pass it to a shell: --execute sh -- -c 'echo '\''path={{ worktree_path }}'\'''
-✓ Created branch path-test from main and worktree @ _REPO_.path-test
-↳ To customize worktree locations, run wt config create
-▲ Cannot change directory — shell integration not installed
-↳ To enable automatic cd, run wt config shell install
-◎ Executing (--execute) @ _REPO_.path-test:
-  echo 'path=_REPO_.path-test'
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_verbose_template.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_verbose_template.snap
deleted file mode 100644
index 8991c5209..000000000
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_verbose_template.snap
+++ /dev/null
@@ -1,69 +0,0 @@
----
-source: tests/integration_tests/switch.rs
-info:
- program: wt
- args:
- - "-v"
- - switch
- - "--create"
- - verbose-test
- - "--execute"
- - "echo 'branch={{ branch }}'"
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- 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_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
- 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=verbose-test
-
------ stderr -----
-○ worktree-path source
-  {{ repo_path }}/../{{ repo }}.{{ branch | sanitize }}
-○ worktree-path result
-  _REPO_/../repo.verbose-test
-▲ --execute will change in a future release: it will run a single program, with arguments after --, not a shell command line
-↳ Comment at https://github.com/max-sixty/worktrunk/issues/2860 if the new single-program form would make a workflow worse; to run this command line unchanged, pass it to a shell: --execute sh -- -c 'echo '\''branch={{ branch }}'\'''
-✓ Created branch verbose-test from main and worktree @ _REPO_.verbose-test
-↳ To customize worktree locations, run wt config create
-▲ Cannot change directory — shell integration not installed
-↳ To enable automatic cd, run wt config shell install
-○ --execute command source
-  echo 'branch={{ branch }}'
-○ --execute command result
-  echo 'branch=verbose-test'
-◎ Executing (--execute) @ _REPO_.verbose-test:
-  echo 'branch=verbose-test'
diff --git a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_multiple_worktrees_list.snap b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_multiple_worktrees_list.snap
deleted file mode 100644
index d9c73a430..000000000
--- a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_multiple_worktrees_list.snap
+++ /dev/null
@@ -1,9 +0,0 @@
----
-source: tests/integration_tests/switch_picker.rs
-expression: list
----
->
- Branch Status HEAD± main↕ main…± R
-> @ main ^
- + feature-one _
- + feature-two _
diff --git a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_multiple_worktrees_preview.snap b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_multiple_worktrees_preview.snap
deleted file mode 100644
index d3cfb2703..000000000
--- a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_multiple_worktrees_preview.snap
+++ /dev/null
@@ -1,8 +0,0 @@
----
-source: tests/integration_tests/switch_picker.rs
-expression: preview
----
-1: HEAD± 2 3 4 5 6 7
-Enter: switch | ctrl-u/d: scroll | Tab/alt-1…7: preview | a
-
-○ main has no uncommitted changes
diff --git a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_log_list.snap b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_log_list.snap
index dd1b9e70e..5c2be7224 100644
--- a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_log_list.snap
+++ b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_log_list.snap
@@ -5,4 +5,4 @@ expression: list
>
Branch Status HEAD± main↕ main…± Remot
@ main ^
-> + feature ↑ ↑5 +5
+> + feature ↑ ↑1 +1 -1
diff --git a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_log_preview.snap b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_log_preview.snap
index be7ff3524..d29db1c39 100644
--- a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_log_preview.snap
+++ b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_log_preview.snap
@@ -5,9 +5,5 @@ expression: preview
1 2: log 3 4 5 6 7
Enter: switch | ctrl-u/d: scroll | Tab/alt-1…7: preview | a
-* [HASH] +1 [TIME] (feature) Add file 5 with content
-* [HASH] +1 [TIME] Add file 4 with content
-* [HASH] +1 [TIME] Add file 3 with content
-* [HASH] +1 [TIME] Add file 2 with content
-* [HASH] +1 [TIME] Add file 1 with content
+* [HASH] +1 -1 [TIME] (feature) Commit for preview navig
* [HASH] +2 [TIME] (HEAD -> main) Initial commit
diff --git a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_main_diff_list.snap b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_main_diff_list.snap
deleted file mode 100644
index 4261be0b8..000000000
--- a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_main_diff_list.snap
+++ /dev/null
@@ -1,8 +0,0 @@
----
-source: tests/integration_tests/switch_picker.rs
-expression: list
----
->
- Branch Status HEAD± main↕ main…± Remot
- @ main ^
-> + feature ↑ ↑2 +10
diff --git a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_main_diff_preview.snap b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_main_diff_preview.snap
deleted file mode 100644
index 147ed3efa..000000000
--- a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_main_diff_preview.snap
+++ /dev/null
@@ -1,31 +0,0 @@
----
-source: tests/integration_tests/switch_picker.rs
-expression: preview
----
-1 2 3: main…± 4 5 6 7
-Enter: switch | ctrl-u/d: scroll | Tab/alt-1…7: preview | a
-
- feature_code.rs | 6 ++++++
- tests.rs | 4 ++++
- 2 files changed, 10 insertions(+)
-diff --git a/feature_code.rs b/feature_code.rs
-new file mode 100644
-index [HASH]..[HASH]
---- /dev/null
-+++ b/feature_code.rs
-@@ -0,0 +1,6 @@
-+fn new_feature() {
-+ println!("This is a new feature!");
-+ let x = 42;
-+ let y = x * 2;
-+ println!("Result: {}", y);
-+}
-diff --git a/tests.rs b/tests.rs
-new file mode 100644
-index [HASH]..[HASH]
---- /dev/null
-+++ b/tests.rs
-@@ -0,0 +1,4 @@
-+#[test]
-+fn test_new_feature() {
-+ assert_eq!(42 * 2, 84);
diff --git a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_summary_disabled_preview.snap b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_summary_disabled_preview.snap
deleted file mode 100644
index 23bc8d06b..000000000
--- a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_summary_disabled_preview.snap
+++ /dev/null
@@ -1,14 +0,0 @@
----
-source: tests/integration_tests/switch_picker.rs
-expression: preview
----
-1 2 3 4 5: summary 6 7
-Enter: switch | ctrl-u/d: scroll | Tab/alt-1…7: preview | a
-
-Summaries off
-
-Enable summaries in:
-[TEST_CONFIG]
-
- [list]
- summary = true
diff --git a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_summary_list.snap b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_summary_list.snap
deleted file mode 100644
index 68fab444d..000000000
--- a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_summary_list.snap
+++ /dev/null
@@ -1,8 +0,0 @@
----
-source: tests/integration_tests/switch_picker.rs
-expression: list
----
->
- Branch Status HEAD± main↕ main…± Remot
- @ main ^
-> + feature ↑ ↑1 +1
diff --git a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_summary_preview.snap b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_summary_preview.snap
deleted file mode 100644
index 6bfad660c..000000000
--- a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_summary_preview.snap
+++ /dev/null
@@ -1,17 +0,0 @@
----
-source: tests/integration_tests/switch_picker.rs
-expression: preview
----
-1 2 3 4 5: summary 6 7
-Enter: switch | ctrl-u/d: scroll | Tab/alt-1…7: preview | a
-
-Summaries not configured
-
-Add a [commit.generation] command in:
-[TEST_CONFIG]
-
- [commit.generation]
- command = "llm -m haiku"
-
- [list]
- summary = true
diff --git a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_uncommitted_list.snap b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_uncommitted_list.snap
deleted file mode 100644
index 2ce30b77e..000000000
--- a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_uncommitted_list.snap
+++ /dev/null
@@ -1,8 +0,0 @@
----
-source: tests/integration_tests/switch_picker.rs
-expression: list
----
->
- Branch Status HEAD± main↕ main…± Remot
- @ main ^
-> + feature ! ↑ +3 -1 ↑1 +1
diff --git a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_uncommitted_preview.snap b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_uncommitted_preview.snap
deleted file mode 100644
index 67b52dc9a..000000000
--- a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_uncommitted_preview.snap
+++ /dev/null
@@ -1,18 +0,0 @@
----
-source: tests/integration_tests/switch_picker.rs
-expression: preview
----
-1: HEAD± 2 3 4 5 6 7
-Enter: switch | ctrl-u/d: scroll | Tab/alt-1…7: preview | a
-
- tracked.txt | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-diff --git a/tracked.txt b/tracked.txt
-index [HASH]..[HASH] 100644
---- a/tracked.txt
-+++ b/tracked.txt
-@@ -1 +1,3 @@
--Original content
-+Modified content
-+New line added
-+Another line
diff --git a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_with_branches_list.snap b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_with_branches_list.snap
deleted file mode 100644
index 848b9b019..000000000
--- a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_with_branches_list.snap
+++ /dev/null
@@ -1,9 +0,0 @@
----
-source: tests/integration_tests/switch_picker.rs
-expression: list
----
->
- Branch Status HEAD± main↕ main…
-> @ main ^
- + active-worktree _
- / orphan-branch /_
diff --git a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_with_branches_preview.snap b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_with_branches_preview.snap
deleted file mode 100644
index d3cfb2703..000000000
--- a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_with_branches_preview.snap
+++ /dev/null
@@ -1,8 +0,0 @@
----
-source: tests/integration_tests/switch_picker.rs
-expression: preview
----
-1: HEAD± 2 3 4 5 6 7
-Enter: switch | ctrl-u/d: scroll | Tab/alt-1…7: preview | a
-
-○ main has no uncommitted changes