Recast hooks as general event handlers, not a release-only feature - #334
Conversation
Hooks are repository-owned event handlers at .buildvana/hooks/<context>/<event>.cs; 'release' merely names the one context that exists today. Docs, changelog, and comments no longer present the mechanism as release-specific: docs/ReleaseHooks.md becomes docs/Hooks.md and leads with the general model, and generic 'release hook' mentions become just 'hooks'. The event-handler parallel also renames the data a hook receives to its event args: - PostReleaseHookContext -> PostReleaseHookArgs; Command/Moment -> Context/Event - WellKnownPaths: HookContextsDirectory -> HookArgsDirectory (.buildvana-temp/hook-args/), GetHookContextFile -> GetHookArgsFile(context, event) - HookRunner.RunHookAsync takes (context, event, args); ReleaseCommand names the hook via the new constants Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #334 +/- ##
==========================================
- Coverage 53.86% 53.83% -0.04%
==========================================
Files 151 151
Lines 4394 4399 +5
Branches 787 787
==========================================
+ Hits 2367 2368 +1
- Misses 1927 1931 +4
Partials 100 100 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
3d32788 to
bf65661
Compare
|
@claude please review this PR. |
|
Claude finished @rdeago's task in 4m 4s —— View job Review: Recast hooks as general event handlers
Ric, the framing change is a clear win — "context/event/args" reads as a coherent model in a way "command/moment/context" never did, and the CorrectnessNo behavioral change found. I checked the things a rename of this shape usually breaks:
Two missed renames1. This is the file that pins 2. One call to make before this ships
Your call: keeping Suggestion (optional, fits this PR's thesis)The hook file path is still built inline — On the Codecov deltaThe −0.05% is an artifact, not a regression. The 6 "missing" lines in Not verifiedI could not run Also, heads up: my checkout shows • branch |
The Hooks module comment is the SDK-side description of the contract that PostReleaseHookArgs renamed away from context; it kept the old term only because the phrase wraps across two lines. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The fixture name is arbitrary, but it was the last hook-context string in the tree; renaming it keeps future greps for the old terminology from reporting phantom work. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The args half of the hook convention already lived in WellKnownPaths
(HookArgsDirectory, GetHookArgsFile) while the hook file half was
built inline by HookRunner, forcing doc comments to spell out the
.buildvana/hooks/{context}/{event}.cs convention in prose. A sibling
HooksDirectory const and GetHookFile helper put both halves of the
contract in one place, and are public API that repository-owned
tooling can reasonably want.
As a side effect, the hook path in HookRunner messages now uses
forward slashes on every platform, matching the WellKnownPaths
contract, instead of platform-specific separators.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Thanks for the review — all four points addressed, one commit each:
Sanity gate re-run after the changes: @claude please take another look. |
|
Claude finished @rdeago's task in 4m 15s —— View job Re-review: three follow-up commits
Ric, all four points check out, and 926b2ac is better than what I suggested — routing Verified49bb64f — 42a4948 — fixture renamed. A full-tree sweep for
926b2ac — reviewed as new public API, not just a refactor:
One new finding
The claim is pre-existing, but this PR edited the tail of that same sentence ("last hook context included" → "last hook args file included"), so it's a natural place to correct it — and Minor / optional
Not verified
Beyond the --- • branch |
The doc claimed bv clean runs dotnet clean on each hook file; it never does. CleanBuildCaches deletes each hook's file-based-app artifacts directory directly, so a reader following the doc to clear the cache by hand would reach for the wrong command. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The segment was spelled twice in the assembly: inline in HooksDirectory and as BuildvanaConfig's private SubdirectoryName. The new public const is named after what the directory is per DirectoryStructure.md - the optional grouping directory for Buildvana files - not ConfigDirectory, since the configuration file can also live at the home root and the directory holds hooks and Directory.Build files too. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Hook args being shorter than hook contexts left line 8 starting with a lone args. and the paragraph unevenly filled; move hook down one line. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The doc described hook and args paths purely in prose; now that HooksDirectory and GetHookFile are public alongside the args-side members, tell readers the paths are available as API. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The entry said constants while WellKnownPaths now also exposes the per-hook path helper methods. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Thanks — all five points taken, one commit each:
Sanity gate re-run after the changes: @claude please take another look. |
|
Claude finished @rdeago's task in 4m 35s —— View job Re-review: five follow-up commits
Ric, five for five, nothing blocking. One thing I learned while checking 34593c6 is worth passing on, but it's pre-existing and out of scope. Verifiedd3c9378 — 34593c6 —
079f85b — measured the paragraph: the wrapped lines run 100/101/100 chars, and the reflow takes lines 7-8 from 98/short to 93/98. Moving 04efb05 — accurate on both halves ("hook and args directories" = 5ffde88 — "(directory constants and per-hook path helpers)" now covers what the type actually exposes. ✓ Sweep — Worth knowing: the fold is per-assemblyYour commit message says the assembly spells
These four have to agree or the SDK finds a home directory A related rules gap I tripped over on the way there: Two doc notes, take or leave
Not verified
Ship it. |
The four-candidate configuration-file probe was spelled out at three C# sites. BuildvanaConfig's file-name consts are now public API, and every site C# can reach composes the probe from WellKnownPaths.BuildvanaDirectory plus BuildvanaConfig.JsonFileName / JsoncFileName. Buildvana.Core.HomeDirectory gains a Buildvana.Runtime reference for the purpose. Sdk.props stays hand-mirrored by necessity, fenced by the existing MUST-match warning in HomeDirectoryDiscovery. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The Core tier bullet listed only sibling Core libraries and BCL/NuGet dependencies, so a strict reading forbade the Core -> Runtime reference Buildvana.Core.Configuration already has. Spell out that the direction is allowed (Runtime's BCL-only closure keeps the tier host-agnostic) and that the Runtime -> Core prohibition is one-directional. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
BuildvanaDirectory and ScratchDirectory compose the two directory trees four lines apart, inviting the reading that they are branches of one tree. Say outright that .buildvana-temp sits beside .buildvana, not inside it: one is checked in, the other is gitignored. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The class summary named only bv and hooks, but the SDK probes BuildvanaDirectory for the configuration file and its tasks read the same candidates when fingerprinting versions. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Thanks — all four taken, and the fold went one step further than asked:
Sanity gate re-run after the changes: Closing the loop here — thanks for three rounds of genuinely useful findings. |
Proposed changes
Hooks are a general mechanism — repository-owned event handlers that
bvruns at well-known paths of the form.buildvana/hooks/<context>/<event>.cs— but code and docs presented them as a feature ofbv release.<context>names the context an event belongs to (today, always the invoking command, though nothing ties a context to being a command) and<event>names the moment of execution that triggers the hook: if Buildvana were an object and hooks were functions,.buildvana/hooks/release/post-release.cswould be theRelease_PostReleasehandler.release/post-releaseis merely the first event, not the shape of the feature.Completing the event-handler parallel, the data a hook receives is its event args, freeing "context" to mean only the
<context>path segment:PostReleaseHookContext→PostReleaseHookArgs; itsCommand/Momentconstants →Context/Event.WellKnownPaths.HookContextsDirectory→HookArgsDirectory, with the on-disk path renamed from.buildvana-temp/hook-contexts/to.buildvana-temp/hook-args/;GetHookContextFile(command, moment)→GetHookArgsFile(context, event).HookRunner.RunHookAsynctakes(context, event, args);ReleaseCommandnames the hook via the new constants instead of string literals.docs/ReleaseHooks.md→docs/Hooks.md, retitled and leading with the general model; the dogfooding motivation moved into therelease/post-releasesection. Generic "release hook" mentions in docs, changelog, and code comments now say just "hooks"; the changelog introduces the mechanism first andrelease/post-releaseas its first event.Everything renamed is unshipped (
PublicAPI.Unshipped.txt), so there are no compatibility concerns; user-visible strings (error messages, theDetaillog line, the args file path) change accordingly.Checklist of related issues / discussions
Types of changes
This pull request introduces the following types of changes:
docsdirectory) updateOther: rename of not-yet-shipped public API (types, constants, method, on-disk path) — a refactor in spirit, but the unshipped API surface does change syntactically, so the "Refactor" box would be inaccurate.
Breaking changes
This pull request introduces breaking changes:
Checklist
docsdirectory) only:🤖 Generated with Claude Code