Skip to content

feat(hooks)\!: rename pre-start/post-start to pre-create/post-create - #2359

Closed
worktrunk-bot wants to merge 2 commits into
mainfrom
hooks/rename-start-to-create
Closed

worktrunk-bot wants to merge 2 commits into
mainfrom
hooks/rename-start-to-create

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Summary

Closes #1571. Renames hook names around the natural blocking-vs-background axis:

  • pre-start → pre-create (blocking, before worktree exists)
  • post-start → post-create (background, after switch)

The previous post-create → pre-start rename (v0.32.0) clarified blocking vs. background, but "start" stayed ambiguous — start of what? This finishes the job: pre-create blocks before creation, post-create runs after in the background.

Deprecation strategy (matches existing patterns)

  • TOML migration (src/config/deprecation.rs): pre-serde rewrite of pre-start → pre-create and post-start → post-create, both flat (pre-start = "...") and table ([pre-start]) forms.
  • wt config update: writes a .new file with migrated content and a deprecation warning.
  • CLI alias: wt hook pre-start / post-start continue to work.

Silent-flip risk

User configs with the previous deprecated post-create alias (which meant blocking, under the pre-start canonical name) will now parse as the new canonical post-create (background). The deprecated alias has been gone long enough that few configs are expected to still use it, and the maintainer has accepted this risk per the request in #1571.

Test plan

  • cargo test --test integration — 1540 passed
  • cargo test --lib --bins — all pass
  • cargo fmt + cargo clippy — clean
  • cargo test --features shell-integration-tests — passes minus pre-existing nushell (case_4) failures due to nu not installed in this environment (confirmed pre-existing on main).
  • Maintainer review of the silent-flip tradeoff before un-drafting.

Marked draft for consideration per issue #1571.

🤖 Generated with Claude Code

worktrunk-bot and others added 2 commits April 21, 2026 18:39
Closes #1571. The previous rename from post-create → pre-start (v0.32.0)
was intended to clarify blocking vs. background semantics, but the
`-start` suffix stayed confusing — "start" of what? This finishes the
job by renaming around the natural axis: "pre-create" blocks before
worktree creation, "post-create" runs after in the background.

Canonical names (old → new):
- pre-start  → pre-create  (blocking, runs before worktree exists)
- post-start → post-create (background, runs after switch)

Deprecation is consistent with existing patterns: TOML migration in
`src/config/deprecation.rs` rewrites old keys before serde sees them,
`wt config update` emits a `.new` file with migrated content, and CLI
`wt hook pre-start` continues to work as an alias for backward compat.

Known silent-flip risk: user configs with the previous deprecated
`post-create` alias (which meant blocking under the pre-start canonical
name) will now parse as the new canonical post-create (background). The
deprecated alias has been gone long enough that few configs are expected
to still use it; maintainer has accepted the risk.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@worktrunk-bot

Copy link
Copy Markdown
Collaborator Author

Closing in favor of the two-PR sequence per @max-sixty's choice in #1571 (comment). Superseded by upcoming PR to convert the post-create → pre-start migration to a fatal error first; rename to -create will come in a later release once the alias is gone.

max-sixty pushed a commit to max-sixty/tend that referenced this pull request Apr 21, 2026
## Summary

Extend the bang-escape workaround in `running-in-ci` to cover PR and
issue
titles. PR #318 restored the warning for comment bodies (via
`--body-file`);
titles are still uncovered because `gh pr create` has no `--title-file`
flag,
so a conventional-commits breaking-change marker in a title like
`feat(hooks)` followed by `!:` gets preprocessor-rewritten and ships
with
a literal backslash before the bang.

## Evidence

First wild post-#318 occurrence: `worktrunk-bot` opened

[max-sixty/worktrunk#2359](max-sixty/worktrunk#2359)
at 2026-04-21T18:40:19Z. Raw API confirms the title is stored with a
backslash before the bang:

```
$ gh api repos/max-sixty/worktrunk/pulls/2359 --jq '.title' | cat -A
feat(hooks)\!: rename pre-start/post-start to pre-create/post-create$
```

The corresponding commit message on the same branch is clean —
`git commit` uses `-F`/file internally, so the `!` survives there.
Only `gh pr create --title "feat(hooks)!: ..."` hit the preprocessor.

## Fix

Add one paragraph after the existing `--body-file` guidance documenting
the
command-substitution workaround. `$(cat /tmp/pr-title.txt)` is evaluated
by
bash after the preprocessor's string scan, so the bang in the file stays
literal. Same pattern covers `gh pr edit --title`, `gh issue create
--title`,
and `gh issue edit --title`.

## Gate assessment

- **Evidence level**: Critical — public-facing PR title corruption, 1
occurrence (#2359).
- **Cumulative this month**: prior occurrence was in a comment body

([worktrunk#2309](max-sixty/worktrunk#2309 (comment)))
  which PR #318 fixed; this is a different shape not yet covered.
- **Structural vs. stochastic**: structural. Any bot PR with `!` in its
title
  reproduces deterministically until the skill documents the workaround.
- **Change type**: targeted fix (one paragraph, no structural changes).
- **Both gates pass**: Critical + structural + proportionate fix.

Evidence gist:
[review-reviewers evidence: max-sixty/worktrunk
2026-04](https://gist.github.com/44ab1483b29406255dd36141650c894d).

Triggering run:
https://github.com/max-sixty/tend/actions/runs/24741474472

Co-authored-by: continuous-bot <[email protected]>
Co-authored-by: Claude Opus 4.7 <[email protected]>
max-sixty pushed a commit that referenced this pull request Apr 22, 2026
…2361)

## Summary

- Converts the `post-create` → `pre-start` silent migration into a fatal
load error. Paves the way to later reclaim `post-create` as a
background-semantics counterpart to `post-start` without the silent flip
risk.
- Project config: rejects with `ConfigError`. User config: surfaces as
`LoadError::Validation` and best-effort load continues without the file.
- `wt config show` renders the error inline instead of hiding it.

Marked as **draft for consideration** — this is step 1 of the two-PR
sequence discussed in [#1571
(comment)](#1571 (comment)).
A follow-up PR (one release later) would perform the actual `pre-start`
→ `pre-create` / `post-start` → `post-create` rename. Supersedes the
closed [#2359](#2359).

## Test plan

- [x] `cargo test --lib --bins` (601 passing)
- [x] `cargo test --test integration` (1540 passing; 10 `case_4`
failures are local `nu`-not-installed environmental, unrelated to this
PR)
- [x] `cargo clippy --all-targets --all-features` clean
- [x] New integration tests:
`test_post_create_in_project_config_is_fatal` and
`test_post_create_in_user_config_warns_and_skips`

---------

Co-authored-by: worktrunk-bot <[email protected]>
Co-authored-by: Claude Opus 4.7 <[email protected]>
@max-sixty
max-sixty deleted the hooks/rename-start-to-create branch June 18, 2026 06:00
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.

Hook names and order are not clear

1 participant