Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
perf(list): plan background tasks from the columns being rendered (#3274)
Worktrunk Botd5be156092ee
diff --git a/dev/config.example.toml b/dev/config.example.tomlindex 6afddfd1f..381c2c5af 100644--- a/dev/config.example.toml+++ b/dev/config.example.toml@@ -105,30 +105,38 @@# timeout-ms = 0 # Wall-clock budget for the entire collect phase; 0 disables## `columns` selects and orders the columns to render; omit it for the default set.-# It is designed to be driven by an alias (https://worktrunk.dev/extending/#aliases) that sets it-# per invocation — a body like `wt --config-set 'list.columns=[…]' list` gives a-# named view (run as `wt <alias>`) without disturbing the default `wt list`.-# Setting it statically in the config file uses the same key and works, but is not-# the intended use: it pins one layout over a table that otherwise adapts to-# `--full` and terminal width.-#-# Valid built-in names are `branch`, `status`, `working-diff`, `ahead-behind`,-# `branch-diff`, `summary`, `upstream`, `ci`, `path`, `url`, `commit`, `age`, and-# `message`. A custom column (#custom-columns) is named by its `[list.custom-columns]`-# header, so a selection mixes built-ins and custom columns in one ordered list-# (`columns = ["branch", "Ticket", "ci"]`). When `columns` is set it is exhaustive-# — only the listed columns render, so a custom column omitted from a non-empty-# list is hidden (omit `columns` entirely to keep the default set, where custom-# columns append automatically). A built-in name wins over a custom header that-# collides with it. The gutter type indicator always shows.-#-# Listing a column requests it but does not force it on: a column gated off-# elsewhere stays hidden — `ci` needs `--full`, `summary` needs-# `[commit.generation]` — so `columns` only narrows which columns may appear.-#-# The selection drives the rendered table and the `wt switch` picker.-# `wt list --format json` ignores it, always emitting every field, built-in and-# custom.+# It is meant to drive a per-invocation alias (https://worktrunk.dev/extending/#aliases)+# (`wt --config-set 'list.columns=[…]' list`), giving a named view without+# disturbing the default `wt list`. A static setting works but pins one layout+# over a table that otherwise adapts to `--full` and terminal width.+#+# Valid built-in names:+#+# - `branch` — The branch name+# - `status` — Git status symbols, plus any user-defined status+# - `working-diff` — Uncommitted line changes against `HEAD` (header `HEAD±`)+# - `ahead-behind` — Commits ahead of and behind the default branch (header `main↕`)+# - `branch-diff` — Line changes against the default branch (header `main…±`)+# - `summary` — An LLM-generated summary of the branch+# - `upstream` — Commits ahead of and behind the upstream tracking branch (header `Remote⇅`)+# - `ci` — CI status of the head commit+# - `path` — The worktree's path+# - `url` — Dev-server URL from the `[list] url` template+# - `commit` — The head commit's short hash+# - `age` — Time since the last commit+# - `message` — The head commit's subject+#+# A selection mixes built-ins with custom columns (#custom-columns), each named+# by its `[list.custom-columns]` header (`columns = ["branch", "Ticket", "ci"]`),+# and is exhaustive: only the listed columns render. Omit `columns` to keep the+# default set, where custom columns append automatically. A built-in name wins a+# header collision; the gutter type indicator always shows.+#+# Listing a column requests it but cannot force it on: a gated column stays hidden+# (`ci` needs `--full`, `summary` needs `[commit.generation]`).+#+# The selection drives the table and the `wt switch` picker; `wt list --format+# json` ignores it and emits every field.## #### Custom columns [experimental]#diff --git a/docs/content/config.md b/docs/content/config.mdindex 8c821a029..098ffd90d 100644--- a/docs/content/config.md+++ b/docs/content/config.md@@ -193,30 +193,38 @@ timeout-ms = 0 # Wall-clock budget for the entire collect phase; 0 disabl````columns` selects and orders the columns to render; omit it for the default set.-It is designed to be driven by an [alias](@/extending.md#aliases) that sets it-per invocation — a body like `wt --config-set 'list.columns=[…]' list` gives a-named view (run as `wt <alias>`) without disturbing the default `wt list`.-Setting it statically in the config file uses the same key and works, but is not-the intended use: it pins one layout over a table that otherwise adapts to-`--full` and terminal width.--Valid built-in names are `branch`, `status`, `working-diff`, `ahead-behind`,-`branch-diff`, `summary`, `upstream`, `ci`, `path`, `url`, `commit`, `age`, and-`message`. A [custom column](#custom-columns) is named by its `[list.custom-columns]`-header, so a selection mixes built-ins and custom columns in one ordered list-(`columns = ["branch", "Ticket", "ci"]`). When `columns` is set it is exhaustive-— only the listed columns render, so a custom column omitted from a non-empty-list is hidden (omit `columns` entirely to keep the default set, where custom-columns append automatically). A built-in name wins over a custom header that-collides with it. The gutter type indicator always shows.--Listing a column requests it but does not force it on: a column gated off-elsewhere stays hidden — `ci` needs `--full`, `summary` needs-`[commit.generation]` — so `columns` only narrows which columns may appear.--The selection drives the rendered table and the `wt switch` picker.-`wt list --format json` ignores it, always emitting every field, built-in and-custom.+It is meant to drive a per-invocation [alias](@/extending.md#aliases)+(`wt --config-set 'list.columns=[…]' list`), giving a named view without+disturbing the default `wt list`. A static setting works but pins one layout+over a table that otherwise adapts to `--full` and terminal width.++Valid built-in names:++- `branch` — The branch name+- `status` — Git status symbols, plus any user-defined status+- `working-diff` — Uncommitted line changes against `HEAD` (header `HEAD±`)+- `ahead-behind` — Commits ahead of and behind the default branch (header `main↕`)+- `branch-diff` — Line changes against the default branch (header `main…±`)+- `summary` — An LLM-generated summary of the branch+- `upstream` — Commits ahead of and behind the upstream tracking branch (header `Remote⇅`)+- `ci` — CI status of the head commit+- `path` — The worktree's path+- `url` — Dev-server URL from the `[list] url` template+- `commit` — The head commit's short hash+- `age` — Time since the last commit+- `message` — The head commit's subject++A selection mixes built-ins with [custom columns](#custom-columns), each named+by its `[list.custom-columns]` header (`columns = ["branch", "Ticket", "ci"]`),+and is exhaustive: only the listed columns render. Omit `columns` to keep the+default set, where custom columns append automatically. A built-in name wins a+header collision; the gutter type indicator always shows.++Listing a column requests it but cannot force it on: a gated column stays hidden+(`ci` needs `--full`, `summary` needs `[commit.generation]`).++The selection drives the table and the `wt switch` picker; `wt list --format+json` ignores it and emits every field.#### Custom columnsdiff --git a/skills/worktrunk/reference/config.md b/skills/worktrunk/reference/config.mdindex 0bc2763b4..a7d33cd7b 100644--- a/skills/worktrunk/reference/config.md+++ b/skills/worktrunk/reference/config.md@@ -192,30 +192,38 @@ timeout-ms = 0 # Wall-clock budget for the entire collect phase; 0 disabl````columns` selects and orders the columns to render; omit it for the default set.-It is designed to be driven by an [alias](https://worktrunk.dev/extending/#aliases) that sets it-per invocation — a body like `wt --config-set 'list.columns=[…]' list` gives a-named view (run as `wt <alias>`) without disturbing the default `wt list`.-Setting it statically in the config file uses the same key and works, but is not-the intended use: it pins one layout over a table that otherwise adapts to-`--full` and terminal width.--Valid built-in names are `branch`, `status`, `working-diff`, `ahead-behind`,-`branch-diff`, `summary`, `upstream`, `ci`, `path`, `url`, `commit`, `age`, and-`message`. A [custom column](#custom-columns) is named by its `[list.custom-columns]`-header, so a selection mixes built-ins and custom columns in one ordered list-(`columns = ["branch", "Ticket", "ci"]`). When `columns` is set it is exhaustive-— only the listed columns render, so a custom column omitted from a non-empty-list is hidden (omit `columns` entirely to keep the default set, where custom-columns append automatically). A built-in name wins over a custom header that-collides with it. The gutter type indicator always shows.--Listing a column requests it but does not force it on: a column gated off-elsewhere stays hidden — `ci` needs `--full`, `summary` needs-`[commit.generation]` — so `columns` only narrows which columns may appear.--The selection drives the rendered table and the `wt switch` picker.-`wt list --format json` ignores it, always emitting every field, built-in and-custom.+It is meant to drive a per-invocation [alias](https://worktrunk.dev/extending/#aliases)+(`wt --config-set 'list.columns=[…]' list`), giving a named view without+disturbing the default `wt list`. A static setting works but pins one layout+over a table that otherwise adapts to `--full` and terminal width.++Valid built-in names:++- `branch` — The branch name+- `status` — Git status symbols, plus any user-defined status+- `working-diff` — Uncommitted line changes against `HEAD` (header `HEAD±`)+- `ahead-behind` — Commits ahead of and behind the default branch (header `main↕`)+- `branch-diff` — Line changes against the default branch (header `main…±`)+- `summary` — An LLM-generated summary of the branch+- `upstream` — Commits ahead of and behind the upstream tracking branch (header `Remote⇅`)+- `ci` — CI status of the head commit+- `path` — The worktree's path+- `url` — Dev-server URL from the `[list] url` template+- `commit` — The head commit's short hash+- `age` — Time since the last commit+- `message` — The head commit's subject++A selection mixes built-ins with [custom columns](#custom-columns), each named+by its `[list.custom-columns]` header (`columns = ["branch", "Ticket", "ci"]`),+and is exhaustive: only the listed columns render. Omit `columns` to keep the+default set, where custom columns append automatically. A built-in name wins a+header collision; the gutter type indicator always shows.++Listing a column requests it but cannot force it on: a gated column stays hidden+(`ci` needs `--full`, `summary` needs `[commit.generation]`).++The selection drives the table and the `wt switch` picker; `wt list --format+json` ignores it and emits every field.#### Custom columns [experimental]diff --git a/src/cli/mod.rs b/src/cli/mod.rsindex bb4c245e6..c05ee84d0 100644--- a/src/cli/mod.rs+++ b/src/cli/mod.rs@@ -1919,30 +1919,38 @@ timeout-ms = 0 # Wall-clock budget for the entire collect phase; 0 disabl````columns` selects and orders the columns to render; omit it for the default set.-It is designed to be driven by an [alias](@/extending.md#aliases) that sets it-per invocation — a body like `wt --config-set 'list.columns=[…]' list` gives a-named view (run as `wt <alias>`) without disturbing the default `wt list`.-Setting it statically in the config file uses the same key and works, but is not-the intended use: it pins one layout over a table that otherwise adapts to-`--full` and terminal width.--Valid built-in names are `branch`, `status`, `working-diff`, `ahead-behind`,-`branch-diff`, `summary`, `upstream`, `ci`, `path`, `url`, `commit`, `age`, and-`message`. A [custom column](#custom-columns) is named by its `[list.custom-columns]`-header, so a selection mixes built-ins and custom columns in one ordered list-(`columns = ["branch", "Ticket", "ci"]`). When `columns` is set it is exhaustive-— only the listed columns render, so a custom column omitted from a non-empty-list is hidden (omit `columns` entirely to keep the default set, where custom-columns append automatically). A built-in name wins over a custom header that-collides with it. The gutter type indicator always shows.--Listing a column requests it but does not force it on: a column gated off-elsewhere stays hidden — `ci` needs `--full`, `summary` needs-`[commit.generation]` — so `columns` only narrows which columns may appear.--The selection drives the rendered table and the `wt switch` picker.-`wt list --format json` ignores it, always emitting every field, built-in and-custom.+It is meant to drive a per-invocation [alias](@/extending.md#aliases)+(`wt --config-set 'list.columns=[…]' list`), giving a named view without+disturbing the default `wt list`. A static setting works but pins one layout+over a table that otherwise adapts to `--full` and terminal width.++Valid built-in names:++- `branch` — The branch name+- `status` — Git status symbols, plus any user-defined status+- `working-diff` — Uncommitted line changes against `HEAD` (header `HEAD±`)+- `ahead-behind` — Commits ahead of and behind the default branch (header `main↕`)+- `branch-diff` — Line changes against the default branch (header `main…±`)+- `summary` — An LLM-generated summary of the branch+- `upstream` — Commits ahead of and behind the upstream tracking branch (header `Remote⇅`)+- `ci` — CI status of the head commit+- `path` — The worktree's path+- `url` — Dev-server URL from the `[list] url` template+- `commit` — The head commit's short hash+- `age` — Time since the last commit+- `message` — The head commit's subject++A selection mixes built-ins with [custom columns](#custom-columns), each named+by its `[list.custom-columns]` header (`columns = ["branch", "Ticket", "ci"]`),+and is exhaustive: only the listed columns render. Omit `columns` to keep the+default set, where custom columns append automatically. A built-in name wins a+header collision; the gutter type indicator always shows.++Listing a column requests it but cannot force it on: a gated column stays hidden+(`ci` needs `--full`, `summary` needs `[commit.generation]`).++The selection drives the table and the `wt switch` picker; `wt list --format+json` ignores it and emits every field.#### Custom columns [experimental]diff --git a/src/commands/list/collect/execution.rs b/src/commands/list/collect/execution.rsindex 7a8cd35b5..89b4e5d2d 100644--- a/src/commands/list/collect/execution.rs+++ b/src/commands/list/collect/execution.rs@@ -13,7 +13,7 @@//! gate's required fields on `ListItem` / `WorktreeData` as they become//! `Some`. Tasks that *will* run are written by the drain as their results//! arrive. Tasks that will *not* run (stale branches skip expensive tasks,-//! unborn branches skip commit-dependent tasks, `--skip-tasks` filters,+//! unborn branches skip commit-dependent tasks, the column plan excludes them,//! branches with no worktree have no worktree-only tasks) have their fields//! seeded here via [`seed_skipped_task_defaults`] with conservative defaults//! — otherwise the fields would stay `None` forever and their gate would@@ -154,7 +154,7 @@ impl ExpectedResults {////// `refresh_status_symbols` keeps gates at `None` while their inputs are/// unloaded, which renders as the `·` placeholder. For tasks that will-/// *never* run (stale branch, user `--skip-tasks`, unborn item missing+/// *never* run (stale branch, a task no rendered column needs, unborn item missing/// commit-dependent tasks, prunable worktree), seeding a conservative/// default up front lets the gate resolve normally instead of showing `·`/// forever.@@ -328,9 +328,9 @@ pub fn work_items_for_worktree(return vec![];}- let skip = &options.skip_tasks;+ let run = &options.tasks;- let include_url = !skip.contains(&TaskKind::UrlStatus);+ let include_url = run.contains(&TaskKind::UrlStatus);// Expand URL template for this item (only if URL status is enabled).let item_url = if include_url {@@ -400,9 +400,7 @@ pub fn work_items_for_worktree(TaskKind::WouldMergeAdd,TaskKind::SummaryGenerate,] {- let will_skip = skip.contains(&kind)- || (!has_commits && COMMIT_TASKS.contains(&kind))- || (kind == TaskKind::SummaryGenerate && options.llm_command.is_none());+ let will_skip = !run.contains(&kind) || (!has_commits && COMMIT_TASKS.contains(&kind));if will_skip {seed_skipped_task_defaults(item, kind);continue;@@ -469,7 +467,7 @@ pub fn work_items_for_branch(is_remote,} = branch;- let skip = &options.skip_tasks;+ let run = &options.tasks;let branch_ref = if is_remote {BranchRef::remote_branch(branch_name, commit_sha)@@ -505,9 +503,7 @@ pub fn work_items_for_branch(TaskKind::WouldMergeAdd,TaskKind::SummaryGenerate,] {- let will_skip = skip.contains(&kind)- || (kind == TaskKind::SummaryGenerate && options.llm_command.is_none());- if will_skip {+ if !run.contains(&kind) {seed_skipped_task_defaults(item, kind);continue;}@@ -544,7 +540,6 @@ pub fn work_items_for_branch(mod tests {use super::*;use crate::commands::list::collect::build_worktree_item;- use std::collections::HashSet;#[test]fn test_skip_url_status_suppresses_placeholder_and_task() {@@ -560,11 +555,17 @@ mod tests {prunable: None,};- let skip_tasks: HashSet<TaskKind> = [TaskKind::UrlStatus].into_iter().collect();+ // The `url` column isn't rendered (gate off), so UrlStatus isn't planned+ // — even though a template is configured.+ let gates = crate::commands::list::columns::ColumnGates {+ show_full: true,+ summary_enabled: true,+ has_llm_command: true,+ has_url_template: false,+ };let options = CollectOptions {- skip_tasks,url_template: Some("http://localhost/{{ branch }}".to_string()),- ..Default::default()+ ..CollectOptions::for_columns(crate::commands::list::columns::all_columns(), &gates)};let expected_results = Arc::new(ExpectedResults::default());@@ -588,33 +589,10 @@ mod tests {assert!(items.iter().all(|w| w.ctx.item_url.is_none()));}- #[test]- fn test_no_llm_command_skips_summary_generate() {- let test = worktrunk::testing::TestRepo::new();- let repo = Repository::at(test.path()).expect("repo");- let wt = WorktreeInfo {- path: test.path().to_path_buf(),- head: "deadbeef".to_string(),- branch: Some("main".to_string()),- bare: false,- detached: false,- locked: None,- prunable: None,- };-- // No llm_command, no skip_tasks — SummaryGenerate should still be skipped- let options = CollectOptions::default();-- let expected_results = Arc::new(ExpectedResults::default());- let (tx, _rx) = chan::unbounded::<Result<TaskResult, TaskError>>();- let mut item = build_worktree_item(&wt, true, false, false);-- let items =- work_items_for_worktree(&repo, &wt, 0, &options, &expected_results, &tx, &mut item);-- assert!(- !items.iter().any(|w| w.kind == TaskKind::SummaryGenerate),- "SummaryGenerate should be skipped when llm_command is None"- );- }+ // No spawn-level test for "no LLM → no Summary": the column plan is the+ // single authority, and `test_required_tasks_for_render` pins that the gate+ // drops SummaryGenerate when no LLM is configured. The spawn loop's "skip+ // what isn't planned" rule is covered by the UrlStatus test above. If a+ // caller plans Summary without a command anyway, `SummaryGenerateTask`+ // returns a clean error rather than misbehaving (tasks.rs).}diff --git a/src/commands/list/collect/mod.rs b/src/commands/list/collect/mod.rsindex 3e9ab7f09..7c1d5530c 100644--- a/src/commands/list/collect/mod.rs+++ b/src/commands/list/collect/mod.rs@@ -413,14 +413,22 @@ fn print_buffered_table(header: &str, rows: &[String], summary: &str) {////// This is operation parameters for a single `wt list` invocation, not a cache./// For cached repo data, see Repository's global cache.-#[derive(Clone, Default)]+#[derive(Clone)]pub struct CollectOptions {- /// Tasks to skip (not compute). Empty set means compute everything.+ /// The background tasks to run, derived from the columns that will render+ /// (`columns::required_tasks_for_render`). `collect` plans this once from the+ /// `[list] columns` selection and the gates; nothing hand-writes a task set.///- /// This controls both:- /// - Work item generation (in `work_items_for_worktree`/`work_items_for_branch`)- /// - Column visibility (layout filters columns via `ColumnSpec::requires_task`)- pub skip_tasks: std::collections::HashSet<TaskKind>,+ /// This drives both work-item generation (the spawn loops in+ /// `work_items_for_worktree` / `work_items_for_branch`) and column visibility+ /// (the layout filter calls `ColumnKind::renders_given_run`). A task runs iff+ /// some rendered column needs it, so an unrendered column's tasks never run.+ ///+ /// There is no blanket default: `collect` plans this from the `[list] columns`+ /// selection, and single-item callers (statusline) declare their columns via+ /// [`CollectOptions::for_columns`]. A caller states which columns it renders;+ /// the tasks follow.+ pub tasks: std::collections::HashSet<TaskKind>,/// URL template from project config (e.g., "http://localhost:{{ branch | hash_port }}")./// Expanded per-item in task spawning (post-skeleton) to minimize time-to-skeleton.@@ -460,6 +468,31 @@ pub struct CollectOptions {pub include_untracked_in_working_diff: bool,}+impl CollectOptions {+ /// Build options whose task plan is derived from the columns that will+ /// render under `gates` — the canonical "declare the columns, get the tasks"+ /// entry, so nothing hand-writes a task set. The context fields (url+ /// template, llm command, snapshot, …) start empty; callers set what they+ /// need (e.g. `CollectOptions { url_template, ..for_columns(cols, &gates) }`).+ ///+ /// `collect` builds its options directly — it has the context fields already+ /// resolved — so this is for the single-item callers (statusline).+ pub fn for_columns(+ rendered: impl IntoIterator<Item = super::columns::ColumnKind>,+ gates: &super::columns::ColumnGates,+ ) -> Self {+ Self {+ tasks: super::columns::required_tasks_for_render(rendered, gates),+ url_template: None,+ llm_command: None,+ default_branch: None,+ integration_targets: None,+ snapshot: None,+ include_untracked_in_working_diff: false,+ }+ }+}+fn worktree_branch_set(worktrees: &[WorktreeInfo]) -> HashSet<&str> {worktrees.iter()@@ -539,10 +572,13 @@ pub trait PickerProgressHandler: Send + Sync {/// Controls how show flags (branches/remotes/full) are determined in [`collect`].pub enum ShowConfig {/// Flags already resolved by the caller (used by the picker).+ ///+ /// The picker is always `wt list --full` (`show_full` is implicit): it+ /// fetches every field for its preview tabs, so it has no skip set to pass —+ /// `collect` derives the task set from the columns like every other caller.Resolved {show_branches: bool,show_remotes: bool,- skip_tasks: HashSet<TaskKind>,command_timeout: Option<std::time::Duration>,/// Wall-clock deadline for the collect phase. `None` uses the default/// [`DRAIN_TIMEOUT`](results::DRAIN_TIMEOUT) and shows a warning on timeout.@@ -801,7 +837,7 @@ pub fn collect(let (show_branches,show_remotes,- skip_tasks,+ show_full,command_timeout,collect_deadline,list_width,@@ -811,7 +847,6 @@ pub fn collect(ShowConfig::Resolved {show_branches,show_remotes,- skip_tasks,command_timeout,collect_deadline,list_width,@@ -819,15 +854,16 @@ pub fn collect(} => (show_branches,show_remotes,- skip_tasks,+ // Picker is the only `Resolved` caller and is `wt list --full`: it+ // fetches every field for its preview tabs regardless of which+ // columns render. Like default `wt list` (but unlike `--full`) it+ // opts out of the untracked-inclusive working diff — the last tuple+ // field — so the two `show_full`-shaped values aren't the same bucket.+ true,command_timeout,collect_deadline,list_width,progressive_handler,- // Picker is the only `Resolved` caller. Like default `wt list` it- // opts out of the untracked-inclusive working diff; unlike it, the- // picker keeps the CiStatus task (see `handle_picker`'s skip set),- // so this is not the same bucket.false,),ShowConfig::DeferredToParallel {@@ -839,18 +875,6 @@ pub fn collect(let show_branches = cli_branches || config.list.branches();let show_remotes = cli_remotes || config.list.remotes();let show_full = cli_full || config.list.full();- let skip_tasks: HashSet<TaskKind> = if show_full {- HashSet::new()- } else {- // BranchDiff (the `main…±` column) is pure local git — a cached- // `git diff --shortstat` against the merge-base — so it always- // runs, under the non-`--full` timeout below as a backstop.- // `--full` gates only the off-machine columns: CI status- // (network) and LLM branch summaries.- [TaskKind::CiStatus, TaskKind::SummaryGenerate]- .into_iter()- .collect()- };// Resolve timeouts from merged config (--full disables both)let (command_timeout, collect_deadline) = if show_full {(None, None)@@ -862,7 +886,7 @@ pub fn collect((show_branches,show_remotes,- skip_tasks,+ show_full,command_timeout,collect_deadline,None,@@ -1109,18 +1133,10 @@ pub fn collect(.map(|(name, sha)| ListItem::new_remote_branch(sha.clone(), name.clone())),);- // If no URL template configured, add UrlStatus to skip_tasks- let mut effective_skip_tasks = skip_tasks.clone();- if url_template.is_none() {- effective_skip_tasks.insert(TaskKind::UrlStatus);- }-- // Skip SummaryGenerate unless summary is enabled and an LLM command is configured+ // Gate inputs for the task-planning decision below. `llm_command` also flows+ // into each `TaskContext` (the per-item SummaryGenerate guard) further down.let config = repo.config();let llm_command = config.commit_generation.command.clone();- if !config.list.summary() || llm_command.is_none() {- effective_skip_tasks.insert(TaskKind::SummaryGenerate);- }// Custom [list.custom-columns] values expand before layout: their inputs// (branch, worktree identity, vars from the bulk config snapshot) are@@ -1167,6 +1183,35 @@ pub fn collect(Err(e) => return Err(e),};+ // Decide, in one place, which background tasks to run: the union of the+ // tasks every column the table will render needs. This is the canonical+ // "what do we need" stage — the spawn loop fires exactly this set, and the+ // layout filter renders exactly the columns it feeds.+ //+ // The rendered set is the `[list] columns` selection for the table; the+ // picker and JSON ignore it (`all_columns`) because their consumers — the+ // picker's preview tabs, JSON's every-field contract in `src/cli/mod.rs` —+ // need the full data set, not just what renders. The gates (`--full`,+ // `[list] summary` + `[commit.generation]`, a url template) then drop a+ // column and its tasks regardless of selection.+ //+ // So a branch/path `ls` alias over many dirty worktrees runs no `git status`+ // / diffs / ahead-behind walks (#3133), while a column gated off elsewhere+ // stays off — selection narrows the work, never forces it on.+ let gates = super::columns::ColumnGates {+ show_full,+ summary_enabled: config.list.summary(),+ has_llm_command: llm_command.is_some(),+ has_url_template: url_template.is_some(),+ };+ let prune_to_selection =+ render_table && progressive_handler.is_none() && !selected_columns.is_empty();+ let tasks = if prune_to_selection {+ super::columns::required_tasks_for_render(selected_columns.iter().copied(), &gates)+ } else {+ super::columns::required_tasks_for_render(super::columns::all_columns(), &gates)+ };+// The picker primes its CI cells from the local cache so the column paints// instantly, then the live `CiStatus` task (which the picker keeps — see// `handle_picker`) overwrites each cell as results stream in. Uncached rows@@ -1182,7 +1227,8 @@ pub fn collect(// the skeleton can't size the column without it). Whatever fetch wrote a// cache entry also ratcheted this maximum, so the hint already covers any// number the prime above reads back.- let max_pr_number = (!effective_skip_tasks.contains(&TaskKind::CiStatus))+ let max_pr_number = tasks+ .contains(&TaskKind::CiStatus).then(|| super::ci_status::MaxPrNumber::read(repo)).flatten();@@ -1191,7 +1237,7 @@ pub fn collect(// terminal — the rest belongs to the preview pane.let layout = super::layout::calculate_layout_with_width(&all_items,- &effective_skip_tasks,+ &tasks,list_width.or_else(crate::display::terminal_width).unwrap_or(usize::MAX),@@ -1208,12 +1254,12 @@ pub fn collect(// keeps rows untruncated rather than wrapping at a guessed widthlet max_width = crate::display::terminal_width().unwrap_or(usize::MAX);- // Create collection options from skip set. `integration_targets` is- // patched in after the parallel phase below extracts it — at this+ // Create collection options from the planned task set. `integration_targets`+ // is patched in after the parallel phase below extracts it — at this// point we haven't yet resolved it, but task spawning doesn't happen// until line 1090+ so late population is safe.let mut options = CollectOptions {- skip_tasks: effective_skip_tasks,+ tasks,url_template: url_template.clone(),llm_command,default_branch: default_branch.clone(),@@ -2074,8 +2120,9 @@ pub fn populate_item(// Populate default_branch / snapshot / integration_targets if the// caller didn't. Tasks read these through `TaskContext`; `None`// values tell them to skip (see collect()'s stale-default-branch- // path). Single-item callers like statusline pass- // `CollectOptions::default()` and expect the repo-derived values.+ // path). Single-item callers like statusline build options via+ // `CollectOptions::for_columns` (these fields start `None`) and expect+ // the repo-derived values.if options.default_branch.is_none() {options.default_branch = repo.default_branch();}@@ -2373,17 +2420,16 @@ mod tests {fn test_render_reveal_picks_renderer_per_row() {use super::super::layout::calculate_layout_with_width;use super::super::model::ListItem;- use std::collections::HashSet;use std::path::Path;let items = vec![ListItem::new_branch("aaa".into(), "row-zero".into()),ListItem::new_branch("bbb".into(), "row-one".into()),];- let skip_tasks: HashSet<TaskKind> = HashSet::new();+ let tasks = super::super::columns::all_tasks();let layout = calculate_layout_with_width(&items,- &skip_tasks,+ &tasks,80,Path::new("/tmp"),None,diff --git a/src/commands/list/collect/types.rs b/src/commands/list/collect/types.rsindex 1304810b2..8b6f3bd77 100644--- a/src/commands/list/collect/types.rs+++ b/src/commands/list/collect/types.rs@@ -26,7 +26,7 @@ use super::super::model::{#[strum_discriminants(name(TaskKind),vis(pub),- derive(Hash, Ord, PartialOrd, strum::IntoStaticStr),+ derive(Hash, Ord, PartialOrd, strum::IntoStaticStr, strum::EnumIter),strum(serialize_all = "kebab-case"))]pub(crate) enum TaskResult {diff --git a/src/commands/list/columns.rs b/src/commands/list/columns.rsindex 0a56d0aae..0830be7fb 100644--- a/src/commands/list/columns.rs+++ b/src/commands/list/columns.rs@@ -105,6 +105,140 @@ impl ColumnKind {.filter_map(|spec| spec.kind.config_name()).collect()}++ /// Background tasks whose results feed this column.+ ///+ /// The single source of the column→task relationship, in both directions:+ /// [`required_tasks_for_render`] unions it over the rendered columns to+ /// decide which tasks `wt list` runs at all, and [`ColumnKind::renders_given_run`]+ /// reads it to hide a column whose tasks were skipped. So a narrowed view+ /// does less git work rather than computing cells it then hides.+ ///+ /// `Status` aggregates almost every status-feeding task (the five+ /// `refresh_status_symbols` gates); identity columns (Branch, Path, Commit,+ /// Age, Message), the always-on Gutter, and custom columns are derived+ /// without any task.+ ///+ /// Drift guard: `test_required_tasks_cover_every_task` asserts the union+ /// across all built-ins is exactly the full `TaskKind` set, so a new task+ /// (or a new consumer of one) can't silently fall out of the mapping — and+ /// since this map now gates spawning, a task with no consumer would never+ /// run, not merely be computed and discarded.+ pub fn required_tasks(self) -> &'static [TaskKind] {+ match self {+ // Gate 1 (working tree) ← WorkingTreeDiff; gate 2 (operation) ←+ // WorkingTreeDiff + GitOperation; gate 3 (main state) ← AheadBehind,+ // WorkingTreeDiff, MergeTreeConflicts, WorkingTreeConflicts, and the+ // integration signals (CommittedTreesMatch, HasFileChanges,+ // WouldMergeAdd, IsAncestor); gate 4 (upstream) ← Upstream; gate 5+ // (user marker) ← UserMarker. See `model::item::refresh_status_symbols`.+ ColumnKind::Status => &[+ TaskKind::WorkingTreeDiff,+ TaskKind::GitOperation,+ TaskKind::AheadBehind,+ TaskKind::MergeTreeConflicts,+ TaskKind::WorkingTreeConflicts,+ TaskKind::CommittedTreesMatch,+ TaskKind::HasFileChanges,+ TaskKind::WouldMergeAdd,+ TaskKind::IsAncestor,+ TaskKind::Upstream,+ TaskKind::UserMarker,+ ],+ ColumnKind::WorkingDiff => &[TaskKind::WorkingTreeDiff],+ ColumnKind::AheadBehind => &[TaskKind::AheadBehind],+ ColumnKind::BranchDiff => &[TaskKind::BranchDiff],+ ColumnKind::Upstream => &[TaskKind::Upstream],+ ColumnKind::CiStatus => &[TaskKind::CiStatus],+ ColumnKind::Url => &[TaskKind::UrlStatus],+ ColumnKind::Summary => &[TaskKind::SummaryGenerate],+ ColumnKind::Gutter+ | ColumnKind::Branch+ | ColumnKind::Path+ | ColumnKind::Commit+ | ColumnKind::Time+ | ColumnKind::Message+ | ColumnKind::Custom(_) => &[],+ }+ }++ /// Whether this column renders, given the set of tasks that will run.+ ///+ /// A column renders when it consumes no task (identity columns, Gutter,+ /// custom — always shown) or at least one of its tasks is in the run set.+ /// The layout filter applies this to every built-in, dropping any whose+ /// tasks were all left out of the plan: a column gated off (`--full`, a+ /// missing template/LLM), or — under a `[list] columns` selection — an+ /// unselected column (whose tasks aren't planned either, though the separate+ /// selection filter also removes it).+ pub fn renders_given_run(self, run: &std::collections::HashSet<TaskKind>) -> bool {+ let required = self.required_tasks();+ required.is_empty() || required.iter().any(|task| run.contains(task))+ }+}++/// Every built-in column, in registry order — the rendered set when no+/// `[list] columns` selection narrows it (and for the picker / JSON, which+/// fetch every field regardless of selection). Custom columns are omitted: they+/// consume no background task, so they never change the task set.+pub fn all_columns() -> impl Iterator<Item = ColumnKind> {+ COLUMN_SPECS.iter().map(|spec| spec.kind)+}++/// Every background task — the full plan, equivalent to rendering every column+/// with all gates open. Test-only: it's the "render everything" plan the+/// picker's single-row layout tests pass. Production `wt list` and statusline+/// derive their plan from the columns they actually show (no blanket "all").+#[cfg(test)]+pub fn all_tasks() -> std::collections::HashSet<TaskKind> {+ use strum::IntoEnumIterator;+ TaskKind::iter().collect()+}++/// Gates that hide a column independent of the `[list] columns` selection — the+/// data source is off, so neither the column nor its tasks appear.+#[derive(Clone, Copy, Debug)]+pub struct ColumnGates {+ /// `--full` (or `[list] full`): CI status and LLM summaries are off without it.+ pub show_full: bool,+ /// `[list] summary`: the summary column is opt-in even under `--full`.+ pub summary_enabled: bool,+ /// An LLM command is configured (`[commit.generation]`).+ pub has_llm_command: bool,+ /// A `[list] url` template is configured.+ pub has_url_template: bool,+}++/// Whether a column's data source is available under `gates`. `false` hides the+/// column and skips its tasks regardless of selection: `ci` and `summary` need+/// `--full`; `summary` additionally needs an LLM command and `[list] summary`;+/// `url` needs a template. Every other column always renders.+fn column_renders(kind: ColumnKind, gates: &ColumnGates) -> bool {+ match kind {+ ColumnKind::CiStatus => gates.show_full,+ ColumnKind::Summary => gates.show_full && gates.summary_enabled && gates.has_llm_command,+ ColumnKind::Url => gates.has_url_template,+ _ => true,+ }+}++/// The one place that decides which background tasks `wt list` runs.+///+/// `rendered` is the column set the table will lay out — the `[list] columns`+/// selection, or [`all_columns`] when nothing narrows it. The task set is+/// exactly the union of the [`required_tasks`](ColumnKind::required_tasks) of+/// the columns that survive the gates (`column_renders`). `collect` stores this+/// set directly on [`CollectOptions::tasks`](super::collect::CollectOptions::tasks); the spawn loops and layout filter+/// consume it as-is, so a task runs iff some rendered column needs it.+pub fn required_tasks_for_render(+ rendered: impl IntoIterator<Item = ColumnKind>,+ gates: &ColumnGates,+) -> std::collections::HashSet<TaskKind> {+ rendered+ .into_iter()+ .filter(|&kind| column_renders(kind, gates))+ .flat_map(|kind| kind.required_tasks().iter().copied())+ .collect()}/// Parse the `[list] columns` selection into an ordered list of columns.@@ -176,19 +310,16 @@ pub enum DiffVariant {pub struct ColumnSpec {pub kind: ColumnKind,pub base_priority: u8,- /// Task required for this column's data. If Some and task is skipped, column is hidden.- pub requires_task: Option<TaskKind>,/// If true, the column can shrink below its ideal width (down to header width)/// instead of being dropped entirely when space is tight.pub shrinkable: bool,}impl ColumnSpec {- pub const fn new(kind: ColumnKind, base_priority: u8, requires_task: Option<TaskKind>) -> Self {+ pub const fn new(kind: ColumnKind, base_priority: u8) -> Self {Self {kind,base_priority,- requires_task,shrinkable: false,}}@@ -204,20 +335,20 @@ impl ColumnSpec {/// Note: base_priority determines truncation order (lower = kept longer),/// which is independent of display order (position in array).pub const COLUMN_SPECS: &[ColumnSpec] = &[- ColumnSpec::new(ColumnKind::Gutter, 0, None),- ColumnSpec::new(ColumnKind::Branch, 1, None).shrinkable(),- ColumnSpec::new(ColumnKind::Status, 2, None),- ColumnSpec::new(ColumnKind::WorkingDiff, 3, None),- ColumnSpec::new(ColumnKind::AheadBehind, 4, None),- ColumnSpec::new(ColumnKind::BranchDiff, 6, Some(TaskKind::BranchDiff)),- ColumnSpec::new(ColumnKind::Summary, 10, Some(TaskKind::SummaryGenerate)),- ColumnSpec::new(ColumnKind::Upstream, 8, None),- ColumnSpec::new(ColumnKind::CiStatus, 5, Some(TaskKind::CiStatus)),- ColumnSpec::new(ColumnKind::Path, 7, None),- ColumnSpec::new(ColumnKind::Url, 9, Some(TaskKind::UrlStatus)),- ColumnSpec::new(ColumnKind::Commit, 11, None),- ColumnSpec::new(ColumnKind::Time, 12, None),- ColumnSpec::new(ColumnKind::Message, 13, None),+ ColumnSpec::new(ColumnKind::Gutter, 0),+ ColumnSpec::new(ColumnKind::Branch, 1).shrinkable(),+ ColumnSpec::new(ColumnKind::Status, 2),+ ColumnSpec::new(ColumnKind::WorkingDiff, 3),+ ColumnSpec::new(ColumnKind::AheadBehind, 4),+ ColumnSpec::new(ColumnKind::BranchDiff, 6),+ ColumnSpec::new(ColumnKind::Summary, 10),+ ColumnSpec::new(ColumnKind::Upstream, 8),+ ColumnSpec::new(ColumnKind::CiStatus, 5),+ ColumnSpec::new(ColumnKind::Path, 7),+ ColumnSpec::new(ColumnKind::Url, 9),+ ColumnSpec::new(ColumnKind::Commit, 11),+ ColumnSpec::new(ColumnKind::Time, 12),+ ColumnSpec::new(ColumnKind::Message, 13),];/// Sort key for display order: (slot in `COLUMN_SPECS`, sub-order).@@ -267,45 +398,35 @@ mod tests {}#[test]- fn columns_gate_on_required_tasks() {- let branch_diff = COLUMN_SPECS- .iter()- .find(|c| c.kind == ColumnKind::BranchDiff)- .unwrap();- assert_eq!(branch_diff.requires_task, Some(TaskKind::BranchDiff));-- let url = COLUMN_SPECS- .iter()- .find(|c| c.kind == ColumnKind::Url)- .unwrap();- assert_eq!(url.requires_task, Some(TaskKind::UrlStatus));-- let ci_status = COLUMN_SPECS- .iter()- .find(|c| c.kind == ColumnKind::CiStatus)- .unwrap();- assert_eq!(ci_status.requires_task, Some(TaskKind::CiStatus));-- let summary = COLUMN_SPECS- .iter()- .find(|c| c.kind == ColumnKind::Summary)- .unwrap();- assert_eq!(summary.requires_task, Some(TaskKind::SummaryGenerate));-- // All other columns should not require a background task to render+ fn test_renders_given_run() {+ // The layout filter renders a column iff at least one of its tasks is in+ // the run set (or it consumes none). With every task running, every+ // column renders.+ let all = all_tasks();for spec in COLUMN_SPECS {- if spec.kind != ColumnKind::BranchDiff- && spec.kind != ColumnKind::Url- && spec.kind != ColumnKind::CiStatus- && spec.kind != ColumnKind::Summary- {- assert!(- spec.requires_task.is_none(),- "{:?} unexpectedly requires a task",- spec.kind- );- }+ assert!(+ spec.kind.renders_given_run(&all),+ "{:?} should render when every task runs",+ spec.kind+ );}++ // Drop one gated task from the plan: only its own column stops+ // rendering; identity columns (no task) are untouched.+ let mut without_ci = all.clone();+ without_ci.remove(&TaskKind::CiStatus);+ assert!(!ColumnKind::CiStatus.renders_given_run(&without_ci));+ assert!(ColumnKind::Branch.renders_given_run(&without_ci));++ // Status renders while any of its many signals is planned, and drops+ // only when none of them is. CiStatus is not one of its signals.+ let one_status_signal: HashSet<TaskKind> = [TaskKind::AheadBehind].into_iter().collect();+ assert!(ColumnKind::Status.renders_given_run(&one_status_signal));+ let no_status_signal: HashSet<TaskKind> = [TaskKind::CiStatus].into_iter().collect();+ assert!(!ColumnKind::Status.renders_given_run(&no_status_signal));++ // An identity column renders even with an empty run set.+ assert!(ColumnKind::Branch.renders_given_run(&HashSet::new()));}#[test]@@ -434,6 +555,111 @@ mod tests {assert!(cased.to_string().contains("Unknown column"), "{cased}");}+ #[test]+ fn test_required_tasks_cover_every_task() {+ use strum::IntoEnumIterator;++ // Every TaskKind must feed at least one built-in column. Otherwise a+ // task is either dead work (computed, rendered nowhere) or a missing+ // entry in `required_tasks()` that selection-driven pruning would skip+ // while its consuming column is shown. The union is checked exactly+ // equal so the mapping can't drift in either direction as tasks or+ // columns are added.+ let covered: HashSet<TaskKind> = COLUMN_SPECS+ .iter()+ .flat_map(|spec| spec.kind.required_tasks().iter().copied())+ .collect();+ let all: HashSet<TaskKind> = TaskKind::iter().collect();+ assert_eq!(+ covered, all,+ "required_tasks() union must equal the full TaskKind set"+ );+ }++ #[test]+ fn test_required_tasks_for_render() {+ use strum::IntoEnumIterator;++ // Every gate open: every column can render.+ let open = ColumnGates {+ show_full: true,+ summary_enabled: true,+ has_llm_command: true,+ has_url_template: true,+ };+ let all: HashSet<TaskKind> = TaskKind::iter().collect();++ // The default set (all built-ins) under open gates needs every task —+ // the planner is exhaustive, so nothing falls out silently.+ assert_eq!(required_tasks_for_render(all_columns(), &open), all);++ // A branch/path `ls` view needs no background task at all.+ assert!(+ required_tasks_for_render([ColumnKind::Branch, ColumnKind::Path], &open).is_empty(),+ "identity columns need no task"+ );++ // Selecting Status keeps every status-feeding task; the independent+ // columns' tasks are not pulled in.+ let status = required_tasks_for_render([ColumnKind::Status], &open);+ assert!(status.contains(&TaskKind::AheadBehind));+ assert!(status.contains(&TaskKind::WorkingTreeDiff));+ assert!(!status.contains(&TaskKind::BranchDiff));+ assert!(!status.contains(&TaskKind::CiStatus));++ // A custom column consumes no task, like the identity columns.+ assert!(required_tasks_for_render([ColumnKind::Custom(0)], &open).is_empty());++ // Gates drop a column's tasks even when it is explicitly selected —+ // "select narrows the work, never forces it on".+ assert_eq!(+ required_tasks_for_render([ColumnKind::CiStatus], &open),+ HashSet::from([TaskKind::CiStatus]),+ "ci runs under --full"+ );+ let no_full = ColumnGates {+ show_full: false,+ ..open+ };+ assert!(+ required_tasks_for_render([ColumnKind::CiStatus], &no_full).is_empty(),+ "ci is gated off without --full"+ );+ let no_template = ColumnGates {+ has_url_template: false,+ ..open+ };+ assert!(+ required_tasks_for_render([ColumnKind::Url], &no_template).is_empty(),+ "url needs a template"+ );+ // Summary needs --full AND an LLM command AND [list] summary.+ for gates in [+ ColumnGates {+ show_full: false,+ ..open+ },+ ColumnGates {+ has_llm_command: false,+ ..open+ },+ ColumnGates {+ summary_enabled: false,+ ..open+ },+ ] {+ assert!(+ required_tasks_for_render([ColumnKind::Summary], &gates).is_empty(),+ "summary is gated off when a precondition is missing"+ );+ }+ assert_eq!(+ required_tasks_for_render([ColumnKind::Summary], &open),+ HashSet::from([TaskKind::SummaryGenerate]),+ "summary runs when every precondition holds"+ );+ }+#[test]fn test_parse_selected_columns_with_custom() {// Custom columns are selectable by header, mixed freely with built-ins,diff --git a/src/commands/list/layout.rs b/src/commands/list/layout.rsindex c36ef0acd..01e50fa62 100644--- a/src/commands/list/layout.rs+++ b/src/commands/list/layout.rs@@ -108,9 +108,9 @@//! 1. **CiStatus** and **Summary** - Visibility gate (`show_full` flag)//! - Both require `show_full=true` — they reach off-machine (CI status over//! the network, branch summaries via the LLM), so they're hidden by default-//! - Gated via `skip_tasks`: when `show_full=false`, their `TaskKind` is in-//! `skip_tasks` and the column is filtered out entirely (bypasses the tier-//! system)+//! - Gated via the run plan (`tasks`): when `show_full=false`, their+//! `TaskKind` is absent from `tasks`, so `renders_given_run` filters the+//! column out entirely (bypasses the tier system)//! - **BranchDiff** (`main…±`) is pure local git, so it is *not* gated — it//! shows by default and follows the normal two-tier priority (6/16);//! CiStatus is 5/15@@ -142,7 +142,7 @@//! // Build candidates from centralized COLUMN_SPECS registry//! let mut candidates: Vec<ColumnCandidate> = COLUMN_SPECS//! .iter()-//! .filter(|spec| /* visibility gate: skip_tasks */)+//! .filter(|spec| /* visibility gate: renders_given_run(tasks) */)//! .map(|spec| ColumnCandidate {//! spec,//! priority: if spec.kind.has_data(&data_flags) {@@ -634,7 +634,7 @@ fn estimate_url_width(url_template: Option<&str>, hyperlinks_supported: bool) ->/// without requiring a data scan.fn build_estimated_widths(max_branch: usize,- skip_tasks: &HashSet<TaskKind>,+ tasks: &HashSet<TaskKind>,has_branch_worktree_mismatch: bool,url_width: usize,max_pr_number: Option<u64>,@@ -667,15 +667,15 @@ fn build_estimated_widths(//// Exceptions that we can compute instantly from items:// - path: true only if any worktree has branch_worktree_mismatch- // - branch_diff/ci_status: false if their required task is skipped+ // - branch_diff/ci_status: false if their task isn't in the run planlet data_flags = ColumnDataFlags {status: true,working_diff: true,ahead_behind: true,- branch_diff: !skip_tasks.contains(&TaskKind::BranchDiff),+ branch_diff: tasks.contains(&TaskKind::BranchDiff),upstream: true,- url: !skip_tasks.contains(&TaskKind::UrlStatus),- ci_status: !skip_tasks.contains(&TaskKind::CiStatus),+ url: tasks.contains(&TaskKind::UrlStatus),+ ci_status: tasks.contains(&TaskKind::CiStatus),path: has_branch_worktree_mismatch,};@@ -753,7 +753,7 @@ fn display_sort_key(kind: ColumnKind, selected: Option<&[ColumnKind]>) -> (usize/// with pre-allocated width estimates for expensive-to-compute columns.fn allocate_columns_with_priority(metadata: &LayoutMetadata,- skip_tasks: &HashSet<TaskKind>,+ tasks: &HashSet<TaskKind>,max_path_width: usize,commit_width: usize,terminal_width: usize,@@ -780,11 +780,14 @@ fn allocate_columns_with_priority(Some(order) => order.contains(&ColumnKind::Custom(i as u8)),None => true,})- .map(|(i, column)| ColumnSpec::new(ColumnKind::Custom(i as u8), column.priority, None))+ .map(|(i, column)| ColumnSpec::new(ColumnKind::Custom(i as u8), column.priority)).collect();// Build candidates with priorities.- // - Filter out columns whose required task is being skipped.+ // - Filter out columns whose tasks were all left out of the run plan (gated+ // off by `--full`, a missing template/LLM). `renders_given_run` reads the+ // same `required_tasks()` map that chose the plan, so a rendered column's+ // tasks always ran and only a gated-off column drops here.// - When `[list] columns` selects a subset, keep only the chosen built-ins// (Gutter is structural — always kept). This filters WITHOUT renumbering// base_priority, so the Summary drop loop and EMPTY_PENALTY tiers below@@ -794,10 +797,7 @@ fn allocate_columns_with_priority(// built-ins and customs in one ordered set.let mut candidates: Vec<ColumnCandidate> = COLUMN_SPECS.iter()- .filter(|spec| {- spec.requires_task- .is_none_or(|task| !skip_tasks.contains(&task))- })+ .filter(|spec| spec.kind.renders_given_run(tasks)).filter(|spec| match selected {Some(order) => spec.kind == ColumnKind::Gutter || order.contains(&spec.kind),None => true,@@ -1050,7 +1050,7 @@ fn allocate_columns_with_priority(/// - URL: estimated from template + longest branchpub fn calculate_layout_with_width(items: &[super::model::ListItem],- skip_tasks: &HashSet<TaskKind>,+ tasks: &HashSet<TaskKind>,terminal_width: usize,main_worktree_path: &Path,url_template: Option<&str>,@@ -1109,7 +1109,7 @@ pub fn calculate_layout_with_width(// Build pre-allocated width estimates (same as buffered mode)let metadata = build_estimated_widths(max_branch,- skip_tasks,+ tasks,has_branch_worktree_mismatch,url_width,max_pr_number,@@ -1120,7 +1120,7 @@ pub fn calculate_layout_with_width(allocate_columns_with_priority(&metadata,- skip_tasks,+ tasks,max_path_width,commit_width,terminal_width,@@ -1383,10 +1383,10 @@ mod tests {#[test]fn test_pre_allocated_width_estimates() {// Test that build_estimated_widths() returns correct pre-allocated estimates- // Empty skip set means all tasks are computed (equivalent to --full)+ // Full run plan means all tasks are computed (equivalent to --full)// has_branch_worktree_mismatch=true to test the path flag is passed through// url_width=0 since we're not testing URL column here- let metadata = build_estimated_widths(20, &HashSet::new(), true, 0, None, Vec::new());+ let metadata = build_estimated_widths(20, &full_run_tasks(), true, 0, None, Vec::new());let widths = metadata.widths;// Line diffs (Signs variant: +/-) allocate 3 digits for 100-999 range@@ -1457,11 +1457,11 @@ mod tests {fn test_ci_column_width_from_max_pr_number() {// Cached largest number sizes the column: "#12345" → 6let metadata =- build_estimated_widths(20, &HashSet::new(), false, 0, Some(12345), Vec::new());+ build_estimated_widths(20, &full_run_tasks(), false, 0, Some(12345), Vec::new());assert_eq!(metadata.widths.ci_status, 6);// Never below header width ("CI" → 2)- let metadata = build_estimated_widths(20, &HashSet::new(), false, 0, Some(1), Vec::new());+ let metadata = build_estimated_widths(20, &full_run_tasks(), false, 0, Some(1), Vec::new());assert_eq!(metadata.widths.ci_status, 2);}@@ -1526,13 +1526,11 @@ mod tests {};let items = vec![item];- let skip_tasks: HashSet<TaskKind> = [TaskKind::BranchDiff, TaskKind::CiStatus]- .into_iter()- .collect();+ let tasks = run_except(&[TaskKind::BranchDiff, TaskKind::CiStatus]);let main_worktree_path = PathBuf::from("/test");let layout = calculate_layout_with_width(&items,- &skip_tasks,+ &tasks,terminal_width().expect("COLUMNS=80 is set in .cargo/config.toml"),&main_worktree_path,None,@@ -1643,13 +1641,11 @@ mod tests {};let items = vec![item];- let skip_tasks: HashSet<TaskKind> = [TaskKind::BranchDiff, TaskKind::CiStatus]- .into_iter()- .collect();+ let tasks = run_except(&[TaskKind::BranchDiff, TaskKind::CiStatus]);let main_worktree_path = PathBuf::from("/home/user/project");let layout = calculate_layout_with_width(&items,- &skip_tasks,+ &tasks,terminal_width().expect("COLUMNS=80 is set in .cargo/config.toml"),&main_worktree_path,None,@@ -1774,12 +1770,12 @@ mod tests {}}- /// Helper: compute layout with explicit terminal width and skip_tasks.- fn layout_at_width(width: usize, skip_tasks: &HashSet<TaskKind>) -> LayoutConfig {+ /// Helper: compute layout with explicit terminal width and run plan.+ fn layout_at_width(width: usize, tasks: &HashSet<TaskKind>) -> LayoutConfig {let items = vec![make_test_item("feature-branch")];calculate_layout_with_width(&items,- skip_tasks,+ tasks,width,Path::new("/test"),None,@@ -1791,17 +1787,22 @@ mod tests {)}- /// Default skip_tasks for non-full mode (CI and Summary skipped; BranchDiff- /// runs and the `main…±` column shows by default).- fn non_full_skip_tasks() -> HashSet<TaskKind> {- [TaskKind::CiStatus, TaskKind::SummaryGenerate]- .into_iter()- .collect()+ /// The run plan with every task except those named — the positive form the+ /// layout consumes (a column renders iff one of its tasks is present).+ fn run_except(absent: &[TaskKind]) -> HashSet<TaskKind> {+ use strum::IntoEnumIterator;+ TaskKind::iter().filter(|k| !absent.contains(k)).collect()+ }++ /// Non-full mode: CI and Summary aren't planned (BranchDiff still runs, so+ /// the `main…±` column shows by default).+ fn non_full_run_tasks() -> HashSet<TaskKind> {+ run_except(&[TaskKind::CiStatus, TaskKind::SummaryGenerate])}- /// Full mode skip_tasks (nothing skipped).- fn full_skip_tasks() -> HashSet<TaskKind> {- HashSet::new()+ /// Full mode: every task runs.+ fn full_run_tasks() -> HashSet<TaskKind> {+ run_except(&[])}fn find_column(layout: &LayoutConfig, kind: ColumnKind) -> Option<&ColumnLayout> {@@ -1817,7 +1818,7 @@ mod tests {let selected = [ColumnKind::Time, ColumnKind::Branch, ColumnKind::Commit];let layout = calculate_layout_with_width(&items,- &full_skip_tasks(),+ &full_run_tasks(),300,Path::new("/test"),None,@@ -1876,7 +1877,7 @@ mod tests {];let layout = calculate_layout_with_width(&items,- &full_skip_tasks(),+ &full_run_tasks(),300,Path::new("/test"),None,@@ -1919,7 +1920,7 @@ mod tests {}];let layout = calculate_layout_with_width(&items,- &full_skip_tasks(),+ &full_run_tasks(),300,Path::new("/test"),None,@@ -1938,13 +1939,14 @@ mod tests {#[test]fn test_selected_columns_cannot_force_a_gated_column() {// Selection narrows the candidate set; it can't force on a column gated- // off by skip_tasks. `ci` needs --full: with CiStatus skipped, selecting- // it leaves a gutter-only table (the skip_tasks filter runs first).+ // off by the run plan. `ci` needs --full: with CiStatus absent from the+ // plan, selecting it leaves a gutter-only table (renders_given_run runs+ // first).let items = vec![make_test_item("feature-branch")];let selected = [ColumnKind::CiStatus];let gated = calculate_layout_with_width(&items,- &non_full_skip_tasks(),+ &non_full_run_tasks(),200,Path::new("/test"),None,@@ -1965,7 +1967,7 @@ mod tests {// renders CI.let full = calculate_layout_with_width(&items,- &full_skip_tasks(),+ &full_run_tasks(),200,Path::new("/test"),None,@@ -1990,7 +1992,7 @@ mod tests {let selected = [ColumnKind::Message, ColumnKind::Branch];let layout = calculate_layout_with_width(&items,- &full_skip_tasks(),+ &full_run_tasks(),24,Path::new("/test"),None,@@ -2012,8 +2014,8 @@ mod tests {#[test]fn test_summary_absent_when_skipped() {- // Non-full mode: SummaryGenerate in skip_tasks → no Summary column- let layout = layout_at_width(200, &non_full_skip_tasks());+ // Non-full mode: SummaryGenerate absent from the run plan → no Summary column+ let layout = layout_at_width(200, &non_full_run_tasks());assert!(find_column(&layout, ColumnKind::Summary).is_none(),@@ -2028,7 +2030,7 @@ mod tests {#[test]fn test_summary_present_in_full_mode() {- let layout = layout_at_width(200, &full_skip_tasks());+ let layout = layout_at_width(200, &full_run_tasks());assert!(find_column(&layout, ColumnKind::Summary).is_some(),@@ -2041,7 +2043,7 @@ mod tests {fn test_summary_expands_before_message() {// At a moderate width, Summary should expand toward its max (70)// before Message gets leftover space.- let layout = layout_at_width(200, &full_skip_tasks());+ let layout = layout_at_width(200, &full_run_tasks());let summary = find_column(&layout, ColumnKind::Summary);let message = find_column(&layout, ColumnKind::Message);@@ -2064,7 +2066,7 @@ mod tests {#[test]fn test_summary_capped_at_max() {// Very wide terminal: Summary should cap at MAX_SUMMARY (70)- let layout = layout_at_width(500, &full_skip_tasks());+ let layout = layout_at_width(500, &full_run_tasks());let summary = find_column(&layout, ColumnKind::Summary).unwrap();assert_eq!(summary.width, 70, "Summary should cap at MAX_SUMMARY (70)");@@ -2074,7 +2076,7 @@ mod tests {#[test]fn test_message_capped_at_max() {// Very wide terminal: Message should cap at MAX_MESSAGE (100)- let layout = layout_at_width(500, &full_skip_tasks());+ let layout = layout_at_width(500, &full_run_tasks());let message = find_column(&layout, ColumnKind::Message).unwrap();assert_eq!(@@ -2087,8 +2089,8 @@ mod tests {#[test]fn test_message_gets_more_space_when_summary_skipped() {// Compare Message width with and without Summary- let with_summary = layout_at_width(200, &full_skip_tasks());- let without_summary = layout_at_width(200, &non_full_skip_tasks());+ let with_summary = layout_at_width(200, &full_run_tasks());+ let without_summary = layout_at_width(200, &non_full_run_tasks());let msg_with = find_column(&with_summary, ColumnKind::Message).unwrap()@@ -2108,7 +2110,7 @@ mod tests {#[test]fn test_summary_display_order() {// Summary should appear between BranchDiff and Upstream in display order- let layout = layout_at_width(500, &full_skip_tasks());+ let layout = layout_at_width(500, &full_run_tasks());let kinds: Vec<ColumnKind> = layout.columns.iter().map(|c| c.kind).collect();@@ -2137,7 +2139,7 @@ mod tests {// At wide widths where Summary >= 50, they can appear.let mut found_below = false;for width in 80..200 {- let l = layout_at_width(width, &full_skip_tasks());+ let l = layout_at_width(width, &full_run_tasks());if let Some(s) = find_column(&l, ColumnKind::Summary)&& s.width < 50{@@ -2162,7 +2164,7 @@ mod tests {assert!(found_below, "no width produced Summary < 50");// At 200, Summary is well above threshold and all columns appear.- let l = layout_at_width(200, &full_skip_tasks());+ let l = layout_at_width(200, &full_run_tasks());assert!(find_column(&l, ColumnKind::Summary).unwrap().width >= 50);assert!(find_column(&l, ColumnKind::Commit).is_some());assert!(find_column(&l, ColumnKind::Time).is_some());@@ -2173,7 +2175,7 @@ mod tests {fn test_narrow_terminal_drops_flexible_columns() {// At a very narrow width, neither Summary nor Message should fit// after the critical fixed columns are allocated.- let layout = layout_at_width(40, &full_skip_tasks());+ let layout = layout_at_width(40, &full_run_tasks());// At 40 chars, only Gutter (2) + Branch (~14) can fitassert!(@@ -2258,12 +2260,12 @@ mod tests {let main_path = Path::new("/test/worktrunk");// Full mode: all columns enabled- let skip = full_skip_tasks();+ let tasks = full_run_tasks();// At very wide terminals: both Path and Summary coexistlet layout_wide = calculate_layout_with_width(&items,- &skip,+ &tasks,300,main_path,None,@@ -2287,7 +2289,7 @@ mod tests {// leaving Summary at ~48 and dropping Message entirely.let layout_170 = calculate_layout_with_width(&items,- &skip,+ &tasks,170,main_path,None,@@ -2433,11 +2435,11 @@ mod tests {),];let main_path = Path::new("/test/worktrunk");- let skip = full_skip_tasks();+ let tasks = full_run_tasks();let layout = calculate_layout_with_width(&items,- &skip,+ &tasks,170,main_path,None,@@ -2468,14 +2470,14 @@ mod tests {let items = vec![make_test_item("feature/very-long-branch-name-that-exceeds-available-space",)];- let skip = non_full_skip_tasks();+ let tasks = non_full_run_tasks();let main_path = Path::new("/test");// At 30 cols, ideal branch width (~57) can't fit, but Branch should still// be allocated at a reduced width rather than dropped.let layout = calculate_layout_with_width(&items,- &skip,+ &tasks,30,main_path,None,@@ -2499,7 +2501,7 @@ mod tests {// At 80 cols, Branch should fit comfortablylet layout = calculate_layout_with_width(&items,- &skip,+ &tasks,80,main_path,None,@@ -2518,11 +2520,11 @@ mod tests {#[test]fn test_summary_skipped_preserves_other_full_columns() {- // Even with SummaryGenerate skipped, other full-mode columns should still appear- let mut skip_only_summary: HashSet<TaskKind> = HashSet::new();- skip_only_summary.insert(TaskKind::SummaryGenerate);+ // Even with SummaryGenerate dropped from the plan, other full-mode+ // columns should still appear.+ let run_without_summary = run_except(&[TaskKind::SummaryGenerate]);- let layout = layout_at_width(300, &skip_only_summary);+ let layout = layout_at_width(300, &run_without_summary);assert!(find_column(&layout, ColumnKind::Summary).is_none(),@@ -2563,7 +2565,7 @@ mod tests {let layout = calculate_layout_with_width(&items,- &non_full_skip_tasks(),+ &non_full_run_tasks(),300,Path::new("/test"),None,@@ -2597,15 +2599,15 @@ mod tests {item.custom_values = vec![String::new()];let items = vec![item];- // Skip UrlStatus like collect does when no URL template is- // configured; otherwise the zero-width Url candidate counts as a+ // Drop UrlStatus from the plan like collect does when no URL template+ // is configured; otherwise the zero-width Url candidate counts as a// hidden column and obscures the assertion below.- let mut skip_tasks = non_full_skip_tasks();- skip_tasks.insert(TaskKind::UrlStatus);+ let mut tasks = non_full_run_tasks();+ tasks.remove(&TaskKind::UrlStatus);let layout = calculate_layout_with_width(&items,- &skip_tasks,+ &tasks,300,Path::new("/test"),None,@@ -2631,7 +2633,7 @@ mod tests {let narrow = calculate_layout_with_width(&items,- &non_full_skip_tasks(),+ &non_full_run_tasks(),30,Path::new("/test"),None,diff --git a/src/commands/picker/mod.rs b/src/commands/picker/mod.rsindex a4660d1e0..dabfe0dbe 100644--- a/src/commands/picker/mod.rs+++ b/src/commands/picker/mod.rs@@ -1267,7 +1267,6 @@ struct PipelineFactory {preview_dims: (usize, usize),skim_list_width: usize,command_timeout: Option<std::time::Duration>,- skip_tasks: std::collections::HashSet<collect::TaskKind>,llm_command: Option<String>,summary_hint: Option<String>,show_branches: bool,@@ -1366,7 +1365,6 @@ impl PipelineFactory {let bg_handler: Arc<dyn collect::PickerProgressHandler> = handler.clone();let bg_repo = spawn_repo.clone();- let bg_skip_tasks = self.skip_tasks.clone();let show_branches = self.show_branches;let show_remotes = self.show_remotes;let command_timeout = self.command_timeout;@@ -1379,7 +1377,6 @@ impl PipelineFactory {collect::ShowConfig::Resolved {show_branches,show_remotes,- skip_tasks: bg_skip_tasks,command_timeout,collect_deadline: None,list_width: Some(skim_list_width),@@ -1571,19 +1568,19 @@ pub fn handle_picker(orchestrator.spawn_preview(Arc::new(item), PreviewMode::WorkingTree, dims);}- // Run every task — the picker is `wt list --full`. `main…±` (BranchDiff) is- // now a default `wt list` column, so the picker surfaces it too; it's local- // git keyed by a persistent content-addressed cache, so warm rows are instant- // and a cold row computes once in the background (its merge-base walk streams- // in behind the frame, never blocking the picker). CiStatus is primed from- // the local cache so the first frame shows cached status (see- // `populate_from_cache`), then fetched live and streamed in — the same- // 30–60s-TTL cache plus live fetch as `wt list --full`. The picker's lifetime- // is bounded by the user, so a slow forge call never blocks anything (see the- // "Network Access" notes in CLAUDE.md). The `pr` preview tab reads the same- // live status. `--prs` rows carry their own number from the explicit `--prs`- // forge call.- let skip_tasks: std::collections::HashSet<collect::TaskKind> = std::collections::HashSet::new();+ // The picker runs every task — it is `wt list --full` (`ShowConfig::Resolved`+ // forces `show_full`, so `collect` plans the full task set from all columns).+ // `main…±` (BranchDiff) is a default `wt list` column, so the picker surfaces+ // it too; it's local git keyed by a persistent content-addressed cache, so+ // warm rows are instant and a cold row computes once in the background (its+ // merge-base walk streams in behind the frame, never blocking the picker).+ // CiStatus is primed from the local cache so the first frame shows cached+ // status (see `populate_from_cache`), then fetched live and streamed in — the+ // same 30–60s-TTL cache plus live fetch as `wt list --full`. The picker's+ // lifetime is bounded by the user, so a slow forge call never blocks anything+ // (see the "Network Access" notes in CLAUDE.md). The `pr` preview tab reads+ // the same live status. `--prs` rows carry their own number from the explicit+ // `--prs` forge call.// Per-task command timeout (bounds any single git invocation) from// shared `[list]` config. Still applies in progressive mode.@@ -1702,7 +1699,6 @@ pub fn handle_picker(preview_dims,skim_list_width,command_timeout,- skip_tasks,llm_command,summary_hint,show_branches,@@ -2858,7 +2854,7 @@ pub mod tests {*remover.layout_slot.lock().unwrap() =Some(crate::commands::list::layout::calculate_layout_with_width(std::slice::from_ref(&*item_arc),- &std::collections::HashSet::new(),+ &crate::commands::list::columns::all_tasks(),80,Path::new("/test"),None,@@ -2895,7 +2891,6 @@ pub mod tests {preview_dims: (80, 24),skim_list_width: 80,command_timeout: None,- skip_tasks: std::collections::HashSet::new(),llm_command: None,summary_hint: None,show_branches: false,@@ -3643,7 +3638,7 @@ pub mod tests {}));let layout = crate::commands::list::layout::calculate_layout_with_width(std::slice::from_ref(&worktree_item),- &std::collections::HashSet::new(),+ &crate::commands::list::columns::all_tasks(),80,Path::new("/test"),None,diff --git a/src/commands/statusline.rs b/src/commands/statusline.rsindex af5fbe7c0..76bd6d15a 100644--- a/src/commands/statusline.rs+++ b/src/commands/statusline.rs@@ -879,16 +879,23 @@ fn run_json() -> Result<()> {// Load URL template from project config (if configured)let url_template = repo.url_template();- // Build collect options with URL template (compute everything for complete data)+ // The statusline renders the full column set condensed (status, diffs,+ // ahead/behind, upstream, CI, URL — see `format_statusline_segments`) but no+ // LLM summary, so its plan is every column's tasks under full gates: CI runs,+ // summary doesn't. URL is gated on a configured template like everywhere else.+ let gates = list::columns::ColumnGates {+ show_full: true,+ summary_enabled: false,+ has_llm_command: false,+ has_url_template: url_template.is_some(),+ };let options = CollectOptions {url_template,// Match `wt list --full`: include untracked files in the working// diff (`HEAD±`) so the segment counts the same lines `wt step- // diff` would show. Statusline already runs the full task set;- // this keeps the diff number consistent with the rest of the- // statusline data.+ // diff` would show, consistent with the rest of the statusline data.include_untracked_in_working_diff: true,- ..Default::default()+ ..CollectOptions::for_columns(list::columns::all_columns(), &gates)};// Populate computed fields (parallel git operations)@@ -1000,20 +1007,25 @@ fn git_status_segments(// Load URL template from project config (if configured)let url_template = repo.url_template();- // Build collect options with URL template+ // Same plan as the other statusline path: the full column set condensed+ // (CI included), no LLM summary. See `format_statusline_segments`.+ let gates = list::columns::ColumnGates {+ show_full: true,+ summary_enabled: false,+ has_llm_command: false,+ has_url_template: url_template.is_some(),+ };let options = CollectOptions {url_template,// Match `wt list --full`: include untracked files in the working// diff (`HEAD±`) so the segment counts the same lines `wt step- // diff` would show. Statusline already runs the full task set;- // this keeps the diff number consistent with the rest of the- // statusline data.+ // diff` would show, consistent with the rest of the statusline data.include_untracked_in_working_diff: true,- ..Default::default()+ ..CollectOptions::for_columns(list::columns::all_columns(), &gates)};- // Populate computed fields (parallel git operations)- // Compute everything (same as --full) for complete status symbols+ // Populate computed fields (parallel git operations) — the full plan above+ // gives complete status symbols.list::populate_item(repo, &mut item, options)?;// Get prioritized segmentsdiff --git a/tests/integration_tests/list_config.rs b/tests/integration_tests/list_config.rsindex 43e792866..1d6561f4c 100644--- a/tests/integration_tests/list_config.rs+++ b/tests/integration_tests/list_config.rs@@ -1000,6 +1000,119 @@ template = "{{ branch | codename }}"});}+/// A narrowed `[list] columns` selection prunes the git work that fed only the+/// hidden columns — not just the rendered cells (#3133). With `["branch", "age"]`+/// no column consumes a background task, so `git status` (run by the+/// working-tree-diff task) never fires; the default set still runs it. Mirrors+/// the trace-based diagnosis on the issue, asserted on the `$ git …` debug log.+#[rstest]+fn test_list_config_columns_prune_unused_tasks(repo: TestRepo) {+ let run_list = |config: &str| -> String {+ if config.is_empty() {+ // Default column set: leave any prior config file out of the way.+ let _ = fs::remove_file(repo.test_config_path());+ } else {+ fs::write(repo.test_config_path(), config).unwrap();+ }+ let mut cmd = wt_command();+ repo.configure_wt_cmd(&mut cmd);+ // The working-tree task's `git … status --porcelain` is logged only+ // under debug; capture it from stderr.+ cmd.env("RUST_LOG", "worktrunk=debug");+ cmd.arg("list").current_dir(repo.root_path());+ let output = cmd.output().unwrap();+ let stderr = String::from_utf8_lossy(&output.stderr);+ assert!(+ output.status.success(),+ "exit code should be 0 for config {config:?}: {stderr}"+ );+ stderr.into_owned()+ };++ // Control: the default set shows the Status column, so the working-tree+ // task runs `git status --porcelain`.+ assert!(+ run_list("").contains("status --porcelain"),+ "default columns should run `git status` for the Status column"+ );++ // Branch + Age consume no task: nothing should run `git status`.+ let narrowed = run_list(+ r#"[list]+columns = ["branch", "age"]+"#,+ );+ assert!(+ !narrowed.contains("status --porcelain"),+ "a branch/age selection must not run `git status`:\n{narrowed}"+ );+}++/// The task prune must not reach the JSON path. `wt list --format json` ignores+/// `[list] columns` and always emits every field (the `after_long_help`+/// contract in `src/cli/mod.rs`), so a narrowed selection that drops the Status+/// column from the table must not strip the status fields it feeds from JSON.+/// Regression for the review on #3274: the prune originally fired on every+/// non-picker render, silently nulling `working_tree`/`main`/`main_state` in+/// JSON for a configured column subset.+#[rstest]+fn test_list_json_ignores_columns_selection(repo: TestRepo) {+ // Dirty a worktree so its `working_tree` field carries an observable value;+ // that field is fed by the working-tree task the prune would skip.+ let feature_dir = repo.root_path().parent().unwrap().join("repo.feature-a");+ fs::write(feature_dir.join("dirty.txt"), "uncommitted\n").unwrap();++ let run_json = |config: &str| -> serde_json::Value {+ if config.is_empty() {+ let _ = fs::remove_file(repo.test_config_path());+ } else {+ fs::write(repo.test_config_path(), config).unwrap();+ }+ let mut cmd = wt_command();+ repo.configure_wt_cmd(&mut cmd);+ cmd.args(["list", "--format=json"])+ .current_dir(repo.root_path());+ let output = cmd.output().unwrap();+ assert!(+ output.status.success(),+ "exit code should be 0 for config {config:?}: {}",+ String::from_utf8_lossy(&output.stderr)+ );+ serde_json::from_slice(&output.stdout).unwrap()+ };++ let working_tree_of = |json: &serde_json::Value| -> serde_json::Value {+ json.as_array()+ .unwrap()+ .iter()+ .find(|i| i["branch"] == "feature-a")+ .expect("feature-a row present")["working_tree"]+ .clone()+ };++ // Control: the default set emits the working_tree field, with the untracked+ // change visible.+ let default = run_json("");+ assert_eq!(+ working_tree_of(&default)["untracked"],+ serde_json::Value::Bool(true),+ "default columns should emit working_tree.untracked = true in JSON"+ );++ // A narrowed selection drops Status from the rendered table but must not+ // change JSON output: working_tree stays exactly as the default set emits.+ let narrowed = run_json(+ r#"[list]+columns = ["branch", "age"]+"#,+ );+ assert_eq!(+ working_tree_of(&narrowed),+ working_tree_of(&default),+ "`--format json` must ignore `[list] columns` and emit working_tree regardless of the selection"+ );+}+/// TODO(list-columns-env): `WORKTRUNK__LIST__COLUMNS` is not wired up yet. The/// env overlay can only deliver a scalar, which the `Vec<String>` field rejects,/// so the override is dropped — but with a warning naming the var, not silentlydiff --git a/tests/snapshots/integration__integration_tests__help__help_config_create.snap b/tests/snapshots/integration__integration_tests__help__help_config_create.snapindex 8fcf1a8a2..620117dfc 100644--- a/tests/snapshots/integration__integration_tests__help__help_config_create.snap+++ b/tests/snapshots/integration__integration_tests__help__help_config_create.snap@@ -171,30 +171,38 @@ Creates [2m~/.config/worktrunk/config.toml[0m with the following content:[107m [0m [2m# timeout-ms = 0 # Wall-clock budget for the entire collect phase; 0 disables[0m[107m [0m [2m#[0m[107m [0m [2m# `columns` selects and orders the columns to render; omit it for the default set.[0m-[107m [0m [2m# It is designed to be driven by an alias (https://worktrunk.dev/extending/#aliases) that sets it[0m-[107m [0m [2m# per invocation — a body like `wt --config-set 'list.columns=[…]' list` gives a[0m-[107m [0m [2m# named view (run as `wt <alias>`) without disturbing the default `wt list`.[0m-[107m [0m [2m# Setting it statically in the config file uses the same key and works, but is not[0m-[107m [0m [2m# the intended use: it pins one layout over a table that otherwise adapts to[0m-[107m [0m [2m# `--full` and terminal width.[0m-[107m [0m [2m#[0m-[107m [0m [2m# Valid built-in names are `branch`, `status`, `working-diff`, `ahead-behind`,[0m-[107m [0m [2m# `branch-diff`, `summary`, `upstream`, `ci`, `path`, `url`, `commit`, `age`, and[0m-[107m [0m [2m# `message`. A custom column (#custom-columns) is named by its `[list.custom-columns]`[0m-[107m [0m [2m# header, so a selection mixes built-ins and custom columns in one ordered list[0m-[107m [0m [2m# (`columns = ["branch", "Ticket", "ci"]`). When `columns` is set it is exhaustive[0m-[107m [0m [2m# — only the listed columns render, so a custom column omitted from a non-empty[0m-[107m [0m [2m# list is hidden (omit `columns` entirely to keep the default set, where custom[0m-[107m [0m [2m# columns append automatically). A built-in name wins over a custom header that[0m-[107m [0m [2m# collides with it. The gutter type indicator always shows.[0m-[107m [0m [2m#[0m-[107m [0m [2m# Listing a column requests it but does not force it on: a column gated off[0m-[107m [0m [2m# elsewhere stays hidden — `ci` needs `--full`, `summary` needs[0m-[107m [0m [2m# `[commit.generation]` — so `columns` only narrows which columns may appear.[0m-[107m [0m [2m#[0m-[107m [0m [2m# The selection drives the rendered table and the `wt switch` picker.[0m-[107m [0m [2m# `wt list --format json` ignores it, always emitting every field, built-in and[0m-[107m [0m [2m# custom.[0m+[107m [0m [2m# It is meant to drive a per-invocation alias (https://worktrunk.dev/extending/#aliases)[0m+[107m [0m [2m# (`wt --config-set 'list.columns=[…]' list`), giving a named view without[0m+[107m [0m [2m# disturbing the default `wt list`. A static setting works but pins one layout[0m+[107m [0m [2m# over a table that otherwise adapts to `--full` and terminal width.[0m+[107m [0m [2m#[0m+[107m [0m [2m# Valid built-in names:[0m+[107m [0m [2m#[0m+[107m [0m [2m# - `branch` — The branch name[0m+[107m [0m [2m# - `status` — Git status symbols, plus any user-defined status[0m+[107m [0m [2m# - `working-diff` — Uncommitted line changes against `HEAD` (header `HEAD±`)[0m+[107m [0m [2m# - `ahead-behind` — Commits ahead of and behind the default branch (header `main↕`)[0m+[107m [0m [2m# - `branch-diff` — Line changes against the default branch (header `main…±`)[0m+[107m [0m [2m# - `summary` — An LLM-generated summary of the branch[0m+[107m [0m [2m# - `upstream` — Commits ahead of and behind the upstream tracking branch (header `Remote⇅`)[0m+[107m [0m [2m# - `ci` — CI status of the head commit[0m+[107m [0m [2m# - `path` — The worktree's path[0m+[107m [0m [2m# - `url` — Dev-server URL from the `[list] url` template[0m+[107m [0m [2m# - `commit` — The head commit's short hash[0m+[107m [0m [2m# - `age` — Time since the last commit[0m+[107m [0m [2m# - `message` — The head commit's subject[0m+[107m [0m [2m#[0m+[107m [0m [2m# A selection mixes built-ins with custom columns (#custom-columns), each named[0m+[107m [0m [2m# by its `[list.custom-columns]` header (`columns = ["branch", "Ticket", "ci"]`),[0m+[107m [0m [2m# and is exhaustive: only the listed columns render. Omit `columns` to keep the[0m+[107m [0m [2m# default set, where custom columns append automatically. A built-in name wins a[0m+[107m [0m [2m# header collision; the gutter type indicator always shows.[0m+[107m [0m [2m#[0m+[107m [0m [2m# Listing a column requests it but cannot force it on: a gated column stays hidden[0m+[107m [0m [2m# (`ci` needs `--full`, `summary` needs `[commit.generation]`).[0m+[107m [0m [2m#[0m+[107m [0m [2m# The selection drives the table and the `wt switch` picker; `wt list --format[0m+[107m [0m [2m# json` ignores it and emits every field.[0m[107m [0m [2m#[0m[107m [0m [2m# #### Custom columns [experimental][0m[107m [0m [2m#[0mdiff --git a/tests/snapshots/integration__integration_tests__help__help_config_long.snap b/tests/snapshots/integration__integration_tests__help__help_config_long.snapindex 03d4f5b48..217d4d517 100644--- a/tests/snapshots/integration__integration_tests__help__help_config_long.snap+++ b/tests/snapshots/integration__integration_tests__help__help_config_long.snap@@ -219,30 +219,38 @@ Persistent flag values for [2mwt list[0m. Override on command line as needed.[107m [0m [2mtimeout-ms = [0m[2m[33m0[0m[2m [0m[2m# Wall-clock budget for the entire collect phase; 0 disables[0m[2mcolumns[0m selects and orders the columns to render; omit it for the default set.-It is designed to be driven by an alias that sets it-per invocation — a body like [2mwt --config-set 'list.columns=[…]' list[0m gives a-named view (run as [2mwt <alias>[0m) without disturbing the default [2mwt list[0m.-Setting it statically in the config file uses the same key and works, but is not-the intended use: it pins one layout over a table that otherwise adapts to-[2m--full[0m and terminal width.--Valid built-in names are [2mbranch[0m, [2mstatus[0m, [2mworking-diff[0m, [2mahead-behind[0m,-[2mbranch-diff[0m, [2msummary[0m, [2mupstream[0m, [2mci[0m, [2mpath[0m, [2murl[0m, [2mcommit[0m, [2mage[0m, and-[2mmessage[0m. A custom column is named by its [2m[list.custom-columns][0m-header, so a selection mixes built-ins and custom columns in one ordered list-([2mcolumns = ["branch", "Ticket", "ci"][0m). When [2mcolumns[0m is set it is exhaustive-— only the listed columns render, so a custom column omitted from a non-empty-list is hidden (omit [2mcolumns[0m entirely to keep the default set, where custom-columns append automatically). A built-in name wins over a custom header that-collides with it. The gutter type indicator always shows.--Listing a column requests it but does not force it on: a column gated off-elsewhere stays hidden — [2mci[0m needs [2m--full[0m, [2msummary[0m needs-[2m[commit.generation][0m — so [2mcolumns[0m only narrows which columns may appear.--The selection drives the rendered table and the [2mwt switch[0m picker.-[2mwt list --format json[0m ignores it, always emitting every field, built-in and-custom.+It is meant to drive a per-invocation alias+([2mwt --config-set 'list.columns=[…]' list[0m), giving a named view without+disturbing the default [2mwt list[0m. A static setting works but pins one layout+over a table that otherwise adapts to [2m--full[0m and terminal width.++Valid built-in names:++- [2mbranch[0m — The branch name+- [2mstatus[0m — Git status symbols, plus any user-defined status+- [2mworking-diff[0m — Uncommitted line changes against [2mHEAD[0m (header [2mHEAD±[0m)+- [2mahead-behind[0m — Commits ahead of and behind the default branch (header [2mmain↕[0m)+- [2mbranch-diff[0m — Line changes against the default branch (header [2mmain…±[0m)+- [2msummary[0m — An LLM-generated summary of the branch+- [2mupstream[0m — Commits ahead of and behind the upstream tracking branch (header [2mRemote⇅[0m)+- [2mci[0m — CI status of the head commit+- [2mpath[0m — The worktree's path+- [2murl[0m — Dev-server URL from the [2m[list] url[0m template+- [2mcommit[0m — The head commit's short hash+- [2mage[0m — Time since the last commit+- [2mmessage[0m — The head commit's subject++A selection mixes built-ins with custom columns, each named+by its [2m[list.custom-columns][0m header ([2mcolumns = ["branch", "Ticket", "ci"][0m),+and is exhaustive: only the listed columns render. Omit [2mcolumns[0m to keep the+default set, where custom columns append automatically. A built-in name wins a+header collision; the gutter type indicator always shows.++Listing a column requests it but cannot force it on: a gated column stays hidden+([2mci[0m needs [2m--full[0m, [2msummary[0m needs [2m[commit.generation][0m).++The selection drives the table and the [2mwt switch[0m picker; [2mwt list --format[0m+json[2m ignores it and emits every field.[0m[1mCustom columns [experimental][0m