Skip to content

fix(config): reject post-create hook instead of silently migrating - #2361

Merged
max-sixty merged 3 commits into
mainfrom
hooks/post-create-fatal
Apr 22, 2026
Merged

max-sixty merged 3 commits into
mainfrom
hooks/post-create-fatal

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

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). A follow-up PR (one release later) would perform the actual pre-start → pre-create / post-start → post-create rename. Supersedes the closed #2359.

Test plan

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

`post-create` was renamed to `pre-start` in v0.32.0 with a silent structural
rewrite in the deprecation pipeline. That rewrite is now removed: configs
containing `post-create` fail with a fatal error that names the replacement
key.

Paving the way to later reclaim `post-create` as a background-semantics
counterpart to `post-start` without the silent flip risk (see #1571) — user
configs that still carry `post-create` would otherwise switch from blocking
to background semantics across releases without any warning.

- `check_and_migrate` returns Err when `post-create` is detected.
- Project config: propagates as fatal `ConfigError`.
- User config: propagates as `LoadError::Validation` (non-fatal, best-effort
  load continues without this file).
- `wt config show`: renders the error inline alongside the file contents.
- Integration tests confirm both the project-fatal and user-skip paths.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
Adds an integration test that exercises the two new Err branches in
render_user_config and render_project_config, closing the codecov/patch gap
on PR #2361.
Comment thread tests/integration_tests/config_show.rs Outdated
}

/// The `post-create` hook key was renamed to `pre-start` in v0.32.0. The silent
/// migration was removed in the following release: project configs that still

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

not quite correct

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

You're right — "in the following release" suggested the silent migration went away in v0.33.0, but it actually lived from v0.32.0 through v0.42.0 (17 releases) and is only being removed now. Rewrote the docstring to keep the rename context and drop the release-timing claim: 882c2872.

@max-sixty
max-sixty marked this pull request as ready for review April 21, 2026 20:47
@max-sixty max-sixty changed the title fix(config)\!: reject post-create hook instead of silently migrating fix(config): reject post-create hook instead of silently migrating Apr 21, 2026
The docstring implied the silent migration was removed in the release
following v0.32.0, but it lived through 17 releases (v0.32.0–v0.42.0)
before this PR. Keep the rename context, drop the release-timing claim.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@max-sixty
max-sixty merged commit 04db9ab into main Apr 22, 2026
25 checks passed
@max-sixty
max-sixty deleted the hooks/post-create-fatal branch April 22, 2026 00:46
max-sixty added a commit to max-sixty/tend that referenced this pull request Apr 22, 2026
## Summary

Upstreams the fix from worktrunk PR
[max-sixty/worktrunk#2386](max-sixty/worktrunk#2386)
into the bundled notifications skill.

Step 4a of the dedup check currently finds *completed* bot activity
(comments, reviews, timeline cross-references). It does not see a
dedicated workflow that is still running. `tend-mention` sessions that
involve real implementation routinely run past the 10-minute freshness
gate — when the notifications bot proceeds, it re-implements in-progress
work.

Evidence (from worktrunk, finding in #2386):

- Run
[24742688091](https://github.com/max-sixty/worktrunk/actions/runs/24742688091)
— ~79 min, ~$25, 279 turns. Re-implemented [PR
#2361](max-sixty/worktrunk#2361) while
tend-mention was still pushing; last-step dedup caught the collision and
cleaned up, but the session cost had already been incurred.
- Run
[24519963858](https://github.com/max-sixty/worktrunk/actions/runs/24519963858)
— ~16 min, ~$9, 168 turns. Same pattern on PR #2263 / issue #2261.

## Change

Adds an **In-flight check** sub-step to step 4a of
`plugins/tend-ci-runner/skills/notifications/SKILL.md`, sitting between
the freshness gate and the dedup check. It queries
`actions/runs?status=in_progress`, filters to `tend-*` runs, excludes
`$GITHUB_RUN_ID`, and matches on `display_title` (the workflow_run
payload does not expose the triggering issue number for `issue_comment`
/ `pull_request_review` events without an extra API call per run). On
hit, skip without marking read — same disposition as the freshness gate.

The two bash-tool caveats from the overlay are preserved inline: `gh api
--jq` does not accept `--arg`/`--argjson`, and the Bash tool's bang
rewriting can still bite outside heredocs, so the jq uses `(X) | not`
rather than the not-equal operator.

## Why this lives in tend, not as a per-repo overlay

The precedence rule codified in CLAUDE.md ("Skill precedence: repo >
bundled") and in `running-in-ci/SKILL.md`
([#306](#306)) says overlays are
for repo-specific policy/convention/taste. This fix is generic: any tend
consumer whose `tend-mention` runs can exceed 10 minutes will hit the
same race. That makes it a bundled-skill defect, not an overlay.

## Follow-up on worktrunk

Once this lands,
[worktrunk#2386](max-sixty/worktrunk#2386) is
redundant — the bundled skill now covers what its overlay added. A human
should close #2386 and revert the overlay section it added to
`.claude/skills/running-tend/SKILL.md`. I have not touched worktrunk.

## Test plan

- [x] `pre-commit run --all-files` passes
- [x] jq query verified against worktrunk's
`actions/runs?status=in_progress` (returns 0 when no concurrent tend run
matches the subject title, which is the current state)
- [ ] Next time a same-repo mention triggers a long `tend-mention` run,
verify a concurrent notifications run sees `IN_PROGRESS > 0` and exits
cleanly

> _This was written by Claude Code on behalf of @max-sixty_

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Apr 23, 2026
Every other 0.44.0 bullet ends with its implementing PR; leaving #2361 off
made this one the odd one out and dropped the only pointer to the code
change. Keep the Breaking parenthetical removed.

Co-Authored-By: Claude <[email protected]>
max-sixty added a commit that referenced this pull request Apr 27, 2026
…` alias (#2436)

Both surfaces previously mapped silently to their canonical
replacements, so users had no signal to migrate before eventual removal.
Emit per-invocation warnings to stderr matching the existing pattern
used by `wt select`, `--no-verify`, and `wt hook approvals`.

The config-section `[hooks.post-create]` warning path is unchanged —
that already errors at config load (#2361). This only adds a warning for
the bare CLI alias `wt hook post-create`, which still maps to
`pre-start` after warning.

One UX consideration: `--claude-code` is read on every Claude Code
statusline redraw, so users with the deprecated form in their statusline
integration will see the warning each redraw until they migrate. That's
the intent (surface the deprecation), but worth noting.

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

---------

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