fix(#3606): validate hook-kind coverage at call sites and dispatch generically (#3687)

* test(#3606): pin hook-kind coverage in the wired guard

* fix(#3606): validate hook-kind coverage at call sites and dispatch generically

* fix(#3606): address review - segment-granular narrowing, zero-coverage diagnosis, quick.md, fragment extraction

* fix(#3606): drop stale shrink-ack, export HOOK_GROUP_KINDS, dedupe scanner regex

* chore(#3606): regenerate install-tree fixtures for new wave-post fragment

* chore(#3606): sync canonical launcher preamble into new fragment

* fix(#3606): keep fragment preamble ahead of first gsd_run mention

* fix(#3606): revert sync script's preamble move in explore.md

* chore(#3606): regenerate derived manifests post-rebase

* chore(#3606): allowlist peer test files - base was red on the count lane

* chore(#3606): regenerate inventory for peer's verify-command-grounding doc

* chore(#3606): grounding test maps to its own module by longest prefix

* chore(#3606): backfill changeset pr number

---------

Co-authored-by: sim <sim@local>
This commit is contained in:
Tom Boucher
2026-08-19 16:41:27 -04:00
committed by GitHub
parent 79781e68eb
commit ea594300d9
35 changed files with 546 additions and 86 deletions

View File

@@ -33,8 +33,8 @@ const CONFIG_SCHEMA_PATH = path.join(ROOT, 'gsd-core', 'bin', 'shared', 'config-
// registry generator and the loop-host-contract generator share one source of truth.
const { LOOP_HOST_CONTRACT } = require('../gsd-core/bin/lib/loop-host-contract.cjs');
// Wired-points helper — tells us which points actually have render-hooks call sites.
const { getWiredLoopPoints } = require('./gen-loop-host-contract.cjs');
// Wired-kinds helper — per point, which hook kinds the render-hooks call sites' dispatch text covers.
const { getWiredKinds } = require('./gen-loop-host-contract.cjs');
// Capability validator — shared runtime-callable module extracted per ADR-1244 D2.
const capValidator = require('../gsd-core/bin/lib/capability-validator.cjs');
@@ -419,9 +419,11 @@ function loadAndValidate(centralKeys, capabilitiesDir, centralPatterns) {
return { capMap, errors, warnings };
}
// Compute wired points ONCE before iterating capabilities so the filesystem
// scan is not repeated per-capability. ROOT is the repo root (defined at top of file).
const wiredSet = getWiredLoopPoints(ROOT);
// Compute wired points + covered kinds ONCE before iterating capabilities so
// the filesystem scan is not repeated per-capability. ROOT is the repo root
// (defined at top of file). #3606: the kinds map carries, per point, which
// hook kinds the call sites' dispatch text actually covers.
const wiredKinds = getWiredKinds(ROOT);
const folderEntries = fs.readdirSync(resolvedCapDir, { withFileTypes: true })
.filter((e) => e.isDirectory())
@@ -459,7 +461,7 @@ function loadAndValidate(centralKeys, capabilitiesDir, centralPatterns) {
}
// Gen-time wired guard: reject hooks that declare a valid point with no call site.
const wiredErrors = validateHooksWired(cap, wiredSet);
const wiredErrors = validateHooksWired(cap, wiredKinds);
if (wiredErrors.length > 0) {
for (const e of wiredErrors) errors.push(folderId + '/capability.json: ' + e);
continue;