Repository navigation
Deprecate table form for pre-* hooks - #2135
Merged
Merged
Conversation
Multi-entry table form for pre-* hooks currently runs serially while the same form for post-* hooks runs concurrently. To unify the semantics — table form will run concurrently for all hook types in a future version — detect and auto-migrate the deprecated form to pipeline form, which is explicitly serial. Adds detection, auto-migration, warning, and `.new` file generation following the existing deprecation recipe in src/config/deprecation.rs. Updates docs to describe the three hook forms (string / table / pipeline) neutrally, with a note recommending pipeline form for pre-* hooks. Migrates existing test fixtures to canonical pipeline form. Co-Authored-By: Claude <[email protected]>
worktrunk-bot
approved these changes
Apr 12, 2026
max-sixty
added a commit
that referenced
this pull request
Apr 12, 2026
Hooks are `#[serde(flatten)]` into UserConfig and ProjectConfig, so `[hooks]` and `[projects."id".hooks]` are never real configs — serde rejects `hooks` as an unknown key. Mirror the simplification PR #2135 applied to `find_pre_hook_table_form_from_doc`: two branches only, top level and per-project subtree directly. Co-Authored-By: Claude <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Apr 12, 2026
Hooks are `#[serde(flatten)]` into `UserConfig` and `ProjectConfig`, so `[hooks]` and `[projects."id".hooks]` are never real configs — serde rejects `hooks` as an unknown key. The `find_post_create_from_doc` and `migrate_post_create_doc` helpers each checked those subtrees anyway. Mirrors the simplification #2135 applied to `find_pre_hook_table_form_from_doc`: two branches only — top level and per-project subtree directly. Unit tests that exercised the dead formats are retargeted to the real flattened layout (`[projects."id"]` with `post-create` at the project level). > _This was written by Claude Code on behalf of max-sixty_ Co-authored-by: Claude <[email protected]>
Closed
max-sixty
added a commit
that referenced
this pull request
Jun 12, 2026
…rial path (#3052) ## Summary Lands the cutover announced in v0.37.0 (#2135): a multi-entry table hook now runs its commands concurrently for every hook type. `[pre-merge]` with several keys behaves like `[post-start]` with several keys and like a single `[[pre-merge]]` block — one execution semantic for `Concurrent` steps. The serial behavior was not implemented where one might expect. The executor's serial branch (`ForegroundStep.concurrent` / `SourcedStep.is_pipeline` / `CommandConfig::is_pipeline()`) was mostly dead: the deprecation shipped with a load-time TOML migration that rewrote multi-entry pre-* tables into serial pipeline form in memory on every config load, so affected configs never reached the executor as `Concurrent` steps. Removing that migration (now a `DEPRECATION_RULES` row, after #3045) is the actual behavior change; the executor flags come out with it. ## Why no replacement runtime warning Affected configs have printed a warning on every `wt` invocation for twenty minor releases (v0.37.0, April 12 → v0.57.0), with `wt config update` offering a one-command migration that preserved serial behavior explicitly ("migrate now to keep the current serial behavior once the table form is repurposed"). A post-cutover warning has no coherent shape: table form is now legitimate concurrent config, so it would nag users who want exactly that behavior with no way to silence it, and the `wt config update` rewrite would no longer be behavior-preserving. ## Parse normalization A one-entry top-level table previously parsed as a `Concurrent` group of one; with the serial branch gone it would have picked up `name │` output prefixes. One-entry maps now parse as `Single(named)` everywhere, matching one-entry maps inside pipeline lists (removing the documented dict-at-top vs dict-in-list asymmetry), and a new `Serialize` arm keeps one-step named configs round-tripping as named tables. Single-entry table hooks render exactly as before. ## Behavior changes 1. **Multi-entry table-form pre-* hooks: serial → concurrent.** The announced change. 2. **`wt hook <post-type>` foreground runs of multi-entry table hooks: serial → concurrent.** Previously an undocumented inconsistency — the same config already ran concurrently via the background path. 3. **Single-entry table aliases (`[aliases.x]` with one key): prefixed-stderr → stdout passthrough.** Now matches the string and `[[aliases.x]]` spellings, and makes `wt <alias> | …` work for this spelling too. (2) and (3) were never deprecation-warned; all three belong in the release notes. ## Tests - `test_pre_merge_deprecated_table_runs_serially` → rewritten as `test_pre_merge_table_form_runs_concurrently`; the single-`[[pre-merge]]`-block test is deleted (both forms now parse identically, so it duplicated the rewritten test). - Fixtures that genuinely need serial ordering (`>`/`>>` chains, the signal-abort "second must not run" assertion) converted to pipeline form. - `test_user_hooks_preserve_toml_order` (#737) and `test_post_start_named_commands` keep table form and pin ordering via `WORKTRUNK_TEST_SERIAL_CONCURRENT=1`, so insertion order is still asserted through the real concurrent input ordering. - New: one-entry-table parse/round-trip unit test; `test_alias_single_entry_table_writes_to_stdout` pinning change (3). - Regenerated snapshots drop a stale `RUST_LOG: warn` env line (the harness stopped setting it in #2901). ## Known follow-up Concurrent-group announcements expose a pre-existing ANSI dim-bleed: `format_bash_with_gutter` output ends without closing the dim attribute, so back-to-back `◎ Running …` lines render dim (visible today on pipeline-form hooks and `--execute` verbose). Now that this rendering is the table-form default it's worth fixing, but the fix lives in the gutter formatter and churns every bash-gutter snapshot — separate PR. > _This was written by Claude Code on behalf of max_ --------- Co-authored-by: Claude Fable 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Multi-entry table form for pre-* hooks currently runs serially, while the same form for post-* hooks runs concurrently. The parser produces
HookStep::Concurrenteither way, but the foreground executor flattens steps and runs them serially. To unify the semantics — table form will run concurrently for all hook types in a future version — this deprecates the current form for pre-* hooks and auto-migrates it to pipeline form, which is explicitly serial.Implementation
Follows the existing deprecation recipe in
src/config/deprecation.rs:[projects."id".pre-*]).{old} → {new}pattern of existing deprecations ([merge] no-ff → ff,post-create → pre-start, etc.).wt config update.Docs
Replaces the transitional "concurrent for post-, sequential for pre-" framing with a neutral three-form description (string / table / pipeline), plus a note recommending pipeline form for pre-* hooks to avoid the upcoming behavior change.
Tests
snapshot_migrate_pre_hook_table_form— TOML migration difftest_config_show_displays_pre_hook_table_form_deprecation— full user-facingwt config showoutput, covering the "Project config" label and multi-hook list form