Skip to content

Show pipeline structure in alias announcements - #2092

Merged
max-sixty merged 3 commits into
mainfrom
alias-pipeline-summary
Apr 11, 2026
Merged

max-sixty merged 3 commits into
mainfrom
alias-pipeline-summary

Conversation

@max-sixty

@max-sixty max-sixty commented Apr 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

Two follow-ups to the recently-merged unify-hook-alias work (#2089):

Pipeline announcement. Aliases now print a structured summary of their pipeline (e.g., Running alias deploy: install; build, lint) instead of the bare Running alias deploy. Hook and alias formatters share a new format_pipeline_summary_from_names helper that takes per-step names plus label closures — hooks pass source: prefixes with unnamed-count fallbacks, aliases pass plain names and skip unnamed (no natural fallback label like user/project).

Concurrent execution stays separate. I considered unifying AliasExecCtx::run (uses thread::scope because execute_shell_command is a blocking streaming call) with run_concurrent_group in run_pipeline.rs (uses raw Child handles + log-file redirection). The leaf primitives diverge — one needs threads because the streaming executor blocks, the other uses processes directly — and bridging them requires either making the streaming executor non-blocking (entangled with signal forwarding, ANSI reset, Cmd tracing) or threading background commands that don't need it. A module-level doc comment in alias.rs explains the divergence so the next person doesn't repeat the analysis.

Test escape hatch. Adds WORKTRUNK_TEST_SERIAL_CONCURRENT=1 honored by both concurrent paths, mirroring the RAYON_NUM_THREADS=1 pattern in step_prune tests. Lets snapshot tests use meaningful command output (e.g., echo INSTALL/BUILD/LINT) and still produce a deterministic ordering.

Test plan

  • 5 unit tests for format_alias_announcement (single unnamed, all-unnamed pipeline, concurrent named, pipeline named, mixed named/unnamed)
  • Integration snapshot test test_alias_pipeline_announcement exercising the alias path
  • Two integration tests in post_start_commands.rs (test_post_start_concurrent_serial_force, test_post_start_concurrent_serial_bails_on_failure) exercising the background pipeline runner's serial branch — happy path (deterministic append ordering) and failure path (bail-on-first, second never runs)
  • Existing hook formatter tests still cover the source-prefixed path via the shared helper
  • Full wt hook pre-merge --yes (3030 tests, all green)

🤖 Generated with Claude Code

Aliases now print a structured summary of their pipeline (e.g.,
`Running alias deploy: install; build, lint`) instead of the bare
`Running alias deploy`. The hook and alias formatters now share a
`format_pipeline_summary_from_names` helper that takes per-step names
plus label closures — hooks pass `source:` prefixes and unnamed-count
fallbacks, aliases pass plain names and skip unnamed.

Concurrent execution stays separate between alias (`thread::scope` +
blocking `execute_shell_command`) and the background pipeline runner
(raw `Child` handles + log-file redirect). Bridging the two would
require either making the streaming executor non-blocking or running
background commands in threads they don't need. A module-level doc
comment in `alias.rs` explains the divergence.

Adds `WORKTRUNK_TEST_SERIAL_CONCURRENT=1` (mirroring the
`RAYON_NUM_THREADS=1` pattern in `step_prune` tests), honored by both
alias and background concurrent paths, so the new integration test for
the announcement can use meaningful `echo INSTALL/BUILD/LINT` commands
and still produce a deterministic snapshot.

Co-Authored-By: Claude <[email protected]>

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The shared format_pipeline_summary_from_names refactor is clean — walking through it against the five hook tests (_named, _unnamed, _mixed_named_unnamed, _single_unnamed, _concurrent_then_concurrent) confirms the extracted helper is behaviorally equivalent for the hook side, and the new alias unit tests cover the zero-fallback variant. Nice doc comment explaining the alias vs. run_pipeline concurrency divergence.

One scope observation on run_pipeline.rs — posted inline. It's the source of the codecov/patch failure and is arguably the kind of "design for hypothetical future requirements" the CLAUDE.md guidance warns against.

Comment thread src/commands/run_pipeline.rs Resolved
Two new tests in post_start_commands.rs exercise the serial branch
added to run_concurrent_group:

- test_post_start_concurrent_serial_force: two named commands append
  to the same file; deterministic FIRST\nSECOND ordering proves they
  ran one at a time.
- test_post_start_concurrent_serial_bails_on_failure: first command
  fails; second's marker file must not appear, exercising the
  bail-on-failure path inside the serial branch.

Closes the codecov/patch gap on PR #2092.

Co-Authored-By: Claude <[email protected]>
Resolves conflicts with #2095 (refactor: unify lazy template expansion
and concurrent-group waits) which independently:

- Added `wait_first_error` and `expand_shell_template` helpers in
  command_executor.rs
- Refactored AliasExecCtx::run and the alias concurrent block
- Refactored run_concurrent_group to use the new helpers

Resolution:
- alias.rs: combine my serial-test branch with main's `wait_first_error`
  scaffolding (the non-serial path now delegates to it)
- run_pipeline.rs: my serial branch sits inside the per-command loop;
  the concurrent path uses the merged helpers (`step_context`,
  `expand_shell_template`, `wait_first_error`)

Co-Authored-By: Claude <[email protected]>
@max-sixty
max-sixty merged commit 7b91a71 into main Apr 11, 2026
24 checks passed
@max-sixty
max-sixty deleted the alias-pipeline-summary branch April 11, 2026 23:36
max-sixty added a commit that referenced this pull request Apr 12, 2026
One-line doc comment on `format_pipeline_summary_from_names` noting that
unnamed commands within a `Concurrent` step aren't reachable from config
today — TOML named tables always produce all-named commands. The
unnamed-flush logic only fires across step boundaries in practice.

Follow-up to #2092.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants