* fix(hooks): warn on unsupported async execution (#5669)
Report the js/wasm unsupported-hook sentinel at Runner.Run's fire-and-forget boundary while preserving synchronous errors, tracing, and native behavior.
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Ewen Cuthiell
Signed-off-by: Ewen Cuthiell <ewencuthiell@gmail.com>
* fix(hooks): isolate asynchronous warning capture (saa-cgh.82)
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of Ewen Cuthiell
* test(hooks): pin the refusal guard's polarity and Run's production route
Maintainer review fixes for the adopt-pr review of #5673, iteration 1.
Test-only; production code is byte-identical.
major / Test Evidence Quality. Nothing rejected widening runAsync's
errors.Is(err, errHookExecutionUnsupported) to a bare err != nil. On js/wasm
runHook is an unconditional stub whose only return is that sentinel, so the two
predicates agree for every input there and no wasm test can tell them apart; on
unix/windows runHook returns real exec errors, so the loosening would print
`warning: hook "..." was not run: exit status 1` for a hook that did run --
false, and a break of the fire-and-forget silence runAsync's own comment states.
Adds TestRunAsync_SilentOnHookFailure to hooks_test.go, skipped on Windows for
the reason TestRun_Async already documents and on js/wasm, which has no
executed-but-failed outcome to observe. An executable hook writes a marker and
exits 1, runAsync is called directly with an injected buffer, and the buffer must
stay empty; the marker is what separates "ran and failed" from "never ran", which
would also be silent and would pass for the wrong reason. Measured: under the
err != nil mutation this is the only test in the linux package that reds, and the
required js/wasm lane stays green -- which is the gap itself.
minor / Change Impact. No test drove the production route Run -> runAsync, so the
new warning could have been inert on the platform it exists for: the pre-existing
subtest calls runAsync directly with a hookPath it never creates. Adds a nested
subtest under TestRunHookReportsUnsupportedExecution that writes the hook at 0755
and calls Run. The exec bit was measured to survive on this js/wasm host (Node
v25.9.0, mode -rwxr-xr-x), so Run does reach the warning there. The subtest
asserts whichever outcome the host's own file mode implies rather than skipping,
because both required lanes' count guards reject a SKIP line as well as a FAIL.
Injecting the unreachable-route defect reds only this subtest while the
pre-existing one stays green, so it adds coverage rather than duplicating it.
nit / Debuggability. The sync assertion calls runHook, so its failure message now
says runHook instead of RunSync.
Per the synthesis scope note this leaves the exec-bit preflight at hooks.go:75-77
and the CI selector and its count guards untouched. Both required js/wasm lanes
(pr.yml and bazel.yml, run verbatim) still report runs=1 passes=1 nonpasses=0,
the full js/wasm package keeps the same 5 base-preexisting failures with no new
one, and gazelle leaves internal/hooks/BUILD.bazel byte-identical.
---------
Signed-off-by: Ewen Cuthiell <ewencuthiell@gmail.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>