Skip to content

docs(hook): teach pipelines as [[hook]] blocks; add TOML notes to config::commands - #2149

Merged
max-sixty merged 13 commits into
mainfrom
explain-toml-hook-types
Apr 13, 2026
Merged

max-sixty merged 13 commits into
mainfrom
explain-toml-hook-types

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Cut over hook pipeline docs from inline-list form (hook = [{name = "..."}, ...]) to [[hook]] array-of-tables blocks. The deserializer already accepts this shape — no code changes were needed; the change is purely teaching. This mirrors what landed for aliases in #2144.

The summary in Pipeline Ordering now foregrounds the TOML shape progression instead of a labeled taxonomy:

  • post-start = "npm install" — one command
  • [post-start] — one section of concurrent commands
  • [[post-start]] — one of multiple sections, run in order

The bracket count itself tracks the structural escalation (value → section → array-of-sections).

Also adds a module-level doccomment to src/config/commands.rs describing the three primitive TOML shapes the hook deserializer accepts (string / dict / list) and the asymmetry between dict-at-top (always Concurrent) vs dict-in-list (1-entry → Single(named)). This is the analysis that motivated the cutover and is retained so future readers can orient on the deserialization rules without re-deriving them.

The Databases example in hook.md and tips-patterns.md got its first pipeline step named (set-vars) since [[post-start]] blocks can't hold anonymous bare strings the way inline lists could.

This was written by Claude Code on behalf of Maximilian

max-sixty and others added 13 commits April 12, 2026 15:15
Adds `output::concurrent::run_concurrent_commands`, a shared executor
that spawns N shell children with piped stdout+stderr, streams each
child's output to the terminal with a per-command colored prefix, waits
for all, and surfaces the first failure. Signal forwarding to every
child's process group; deterministic serial fallback under
`WORKTRUNK_TEST_SERIAL_CONCURRENT` for snapshot testing.

Alias concurrent groups (`HookStep::Concurrent`) previously used
`std::thread::scope` + per-child `execute_shell_command`, which
interleaved bytes from each child with no labeling. They now go through
the new executor and get labeled lines: `build │ Compiling foo`.
Semantics unchanged — wait all, first error wins.

The foreground hook path stays serial for now; flipping it is a
user-visible breaking change for `[pre-merge]`-style tables and is
gated on the in-progress `deprecate-pre-hook-table-form` deprecation.
A separate branch (`pipeline-form-pre-concurrent`) will introduce the
flip for the pipeline-form variant only, which has narrower reach.

Also extracts `hook_command_str` in hooks.rs for the lazy-vs-eager
template choice so the function body is one expression per branch.

Co-Authored-By: Claude <[email protected]>
Document the primitive-type view of hook deserialization, the asymmetry
between top-level dicts (always Concurrent) and one-entry dicts in a list
(Single named), and why [[hook]] header form is not a full alternative to
inline pipeline form.

Co-Authored-By: Claude <[email protected]>
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]>
Cut over every inline-list pipeline example (`hook = [{...}, {...}]`) to
`[[hook]]` block form. Tables (`[post-merge]`, etc.) are untouched — the
change is only about the pipeline teaching form.

The Databases example's first step gets a `set-vars` name (previously
anonymous) since `[[hook]]` blocks can't hold bare strings.

Co-Authored-By: Claude <[email protected]>
# Conflicts:
#	docs/content/hook.md
#	docs/content/merge.md
#	docs/content/tips-patterns.md
#	skills/worktrunk/reference/hook.md
#	skills/worktrunk/reference/merge.md
#	skills/worktrunk/reference/tips-patterns.md
#	src/cli/mod.rs
#	tests/snapshots/integration__integration_tests__help__help_md_merge.snap
#	tests/snapshots/integration__integration_tests__help__help_merge_long.snap
…tion

Replace the three-bullet "String / Table / [[hook]] blocks" taxonomy
with inline TOML snippets so the structural progression (value →
section → array-of-sections) is visible instead of labeled.

Co-Authored-By: Claude <[email protected]>
# Conflicts:
#	src/commands/alias.rs
#	src/commands/hooks.rs
… in order"

Cleaner phrasing that binds "run in order" unambiguously to the sequence
of sections rather than being misreadable as "within each section."

Co-Authored-By: Claude <[email protected]>
Was made pub for the orphaned output::concurrent module, which was
removed when main's unified foreground executor subsumed it.

Co-Authored-By: Claude <[email protected]>
@max-sixty
max-sixty merged commit 7e12435 into main Apr 13, 2026
22 checks passed
@max-sixty
max-sixty deleted the explain-toml-hook-types branch April 13, 2026 01:12
max-sixty added a commit to max-sixty/tend that referenced this pull request Apr 13, 2026
#263)

## Summary

Two `tend-review` runs on `max-sixty/worktrunk` this hour completed with
conclusion `success` but posted zero reviews on trivial
`max-sixty`-authored PRs. Session logs show identical hallucinated
reasoning: the bot concluded "PR is self-authored by the owner
(max-sixty), I'll not submit a review (GitHub rejects self-approval)."
The bot's login is `worktrunk-bot` — a distinct account from `max-sixty`
— and other runs in the same hour correctly approved
`max-sixty`-authored PRs (#2140, #2141, #2143, #2146, #2147, #2148). The
conflation of "repo owner" with "self" is the bug.

## Evidence

| Run | PR | Author | Bot output |
|---|---|---|---|
|
[24320901871](https://github.com/max-sixty/worktrunk/actions/runs/24320901871)
| [#2149](max-sixty/worktrunk#2149) (docs-only,
8 lines) | `max-sixty` | no review, ran ~10 min then exited |
|
[24320033081](https://github.com/max-sixty/worktrunk/actions/runs/24320033081)
| [#2142](max-sixty/worktrunk#2142) (7-line TODO
comment) | `max-sixty` | no review, ran ~10 min then exited |

Both sessions substantively reviewed the code, found no concerns, and
then rationalized skipping with the incorrect "self-approval" reasoning.
Excerpt from run 24320901871:

> Since the PR is self-authored by the owner, I'll not submit a review
(GitHub rejects self-approval) and instead skip to CI monitoring per the
workflow.

Both PRs merged without any automated review. No user-visible harm
(max-sixty merged them), but the bot spent ~20 minutes of compute
producing nothing.

## Gate assessment

- **Evidence level**: High — 2 occurrences this hour with identical
reasoning chain across two different PRs. No matching precedent in the
`review-reviewers-tracking: 2026-04` tracking issue (prior
"self-authored" entries there describe genuinely bot-authored PRs being
handled correctly).
- **Failure class**: Stochastic, but with a consistent trigger — trivial
PRs where the bot finds nothing substantive to comment on seem to push
the model toward fabricating an escape hatch.
- **Proposed change type**: Targeted clarification (7 new lines, no
restructuring).
- **Gate 1**: High evidence, 2 occurrences ≥ 2–3 minimum → passes.
- **Gate 2**: Targeted fix to an existing paragraph → normal bar,
passes.

## Fix

The existing guidance at
`plugins/tend-ci-runner/skills/review/SKILL.md:177` already defines
self-authored as `PR_AUTHOR == BOT_LOGIN`, but the model still
pattern-matched "self" onto "repo owner." Add an explicit negative:
human authors (including the owner and maintainers) are **not**
self-authored; approve normally.

## Test plan

- [ ] Verify skill still renders correctly (pre-commit passes).
- [ ] Monitor `tend-review` runs on `max-sixty/worktrunk` over the next
few days — trivial human-authored PRs should either get an APPROVE or a
`+1` reaction, not a silent 10-minute no-op.

---------

Co-authored-by: continuous-bot <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
Co-authored-by: Maximilian Roos <[email protected]>
max-sixty added a commit that referenced this pull request Apr 13, 2026
Collapses the three-sentence deprecation note above Project vs user
hooks into a single sentence. Now that the preceding section teaches
`[[hook]]` blocks as the canonical pipeline form (PR #2149), the note
can name them directly and drop the serial-vs-concurrent explanation —
that mechanics detail is already covered in Pipeline Ordering further
down.

Before:

> For pre-* hooks, prefer pipeline form over table form. Table form for
pre-* hooks currently runs serially rather than concurrently — this
inconsistency is deprecated and will change in a future version. Using
pipeline form avoids the upcoming behavior change.

After:

> Table form for pre-* hooks is deprecated and its behavior will change
in a future version — use `[[hook]]` blocks instead.

> _This was written by Claude Code on behalf of Maximilian_

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.

1 participant