* feat(#3661): make the code-review hook point configurable Add `workflow.code_review_point` (`execute:post` default, or `execute:wave:post`) so a multi-wave phase can run code review once per wave instead of once at the end, scoped to what changed since the phase's prior review. The code-review capability now declares its step at both loop points via a new generic `pointFrom` step field: `pointFrom` names an enum config key, and the step is only active at its own `point` when that key resolves to a matching value. `_resolvePointGate` (capability-activation.cts) is the single shared implementation consumed identically by loop-resolver.cts and capability-state.cts, and capability-validator.cjs enforces that `pointFrom` references an enum key whose values cover the declaring step's own point. code-review.md's manual-invocation gate now reads `workflow.code_review` directly instead of probing registry presence at the hardcoded execute:post point (so manual `/gsd-code-review` keeps working regardless of which automatic point is configured), and its file-scope tiers narrow to what changed since the phase's last review commit when one exists. execute-phase.md's wave-post step dispatch gets a small, precedented carve-out so the code-review skill still receives its required phase argument when dispatched generically (caught by the isolated spec review). Closes #3661 Emitted-Drift-Ack-Growth: code-review.md — #3661 adds a point-aware config gate check and LAST_REVIEW_COMMIT-based incremental scoping to the file-scope tiers. Emitted-Drift-Ack-Growth: execute-phase.md — #3661 adds one carve-out sentence so the wave-post generic step dispatch passes PHASE_NUMBER to the code-review skill. * docs: backfill changeset PR number for #3661 (#4159) * fix: scope tests/io.test.cjs's fs.writeSync fault-injection mocks by fd Five fault-injection mocks in the "bug #1008" describe blocks intercepted every fs.writeSync call regardless of file descriptor, and several threw or truncated unconditionally on the first call. This surfaced as an intermittent macOS CI failure: node:test's own IPC channel back to the parent process (which also goes through fs.writeSync internally) could get a bogus injected error or truncated write if node's internal machinery called it while one of these mocks was active, corrupting the message frame the parent tried to deserialize ("Unable to deserialize cloned data.", location tests/io.test.cjs:1:1, uncaughtException — a whole-file IPC crash, not a test assertion failure). Root cause confirmed by a working counter-example already in the same file: the "#3912 A6" mocks gate on `fd !== 2` before any fault injection and were never implicated. Applied the same fd-scoped pattern to the five unscoped mocks (four output()-targeting tests gate on fd 1, one error()-targeting test gates on fd 2), and added a regression test proving an unrelated fd passes through untouched while the fault-injection mock is active. Found while verifying #3661; unrelated to that change's own diff. --------- Co-authored-by: sim <sim@local>
This commit is contained in:
@@ -124,9 +124,41 @@ function _resolveActivationValue(
|
||||
return r.found ? Boolean(r.value) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve a step's optional `pointFrom` gate (#3661): a step declaring
|
||||
* `pointFrom: "<dotted enum key>"` is only active for ITS OWN `point` when the
|
||||
* resolved value of that config key equals `point` exactly. This lets a
|
||||
* capability register the same logical step at more than one loop point and
|
||||
* have config select which registration is live — without teaching the
|
||||
* shared `when` grammar an equality operator (`when` stays a plain boolean
|
||||
* gate on a dotted key everywhere else).
|
||||
*
|
||||
* No `pointFrom` → true (unconditional; every existing step is unaffected).
|
||||
* Present but not a non-empty string → false (malformed, mirrors `when`).
|
||||
* Present and resolved → true only on an exact match against `point`.
|
||||
*
|
||||
* Single-owner precedence engine: called from both `loop-resolver.cts`
|
||||
* (`isActive`) and `capability-state.cts` (`processHooks`) so the two
|
||||
* consumers can never diverge on activation (see
|
||||
* `tests/capability-precedence-parity.test.cjs`).
|
||||
*/
|
||||
function _resolvePointGate(
|
||||
pointFrom: unknown,
|
||||
point: string,
|
||||
config: Record<string, unknown>,
|
||||
cwd: string | undefined,
|
||||
registry: Record<string, unknown>,
|
||||
): boolean {
|
||||
if (pointFrom === undefined || pointFrom === null) return true;
|
||||
if (typeof pointFrom !== 'string' || pointFrom.length === 0) return false;
|
||||
const r = resolveConfigKey(pointFrom, { config, cwd, registry });
|
||||
return r.found && r.value === point;
|
||||
}
|
||||
|
||||
export = {
|
||||
_getNestedConfigValue,
|
||||
_readRawConfigKey,
|
||||
_resolveActivationValue,
|
||||
_resolvePointGate,
|
||||
resolveConfigKey,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user