Commit Graph
12 Commits
Author SHA1 Message Date
haelyra a0b286011a test: preserve Windows GateGuard corpus denial policy 2026-10-11 06:15:49 -04:00
montjeffrey 6dbf6e6883 fix(gateguard): report fresh-process failures and fail the gate on them
The previous fix stopped a throwing hook from aborting the cold replay by
recording it as an allow, matching the warm path. But coldSummary only counted
disagreements, so a failure on a step the worker also allowed was no
disagreement and left no trace: the report showed no failure, a run with no
measured step reported a cold latency of 0 ms because percentile of an empty
list is 0, and the exit status passed. Trading a crash for a clean-looking
success hid exactly the failure the crash had exposed.

coldSummary now counts errors and samples, and reports no latency when nothing
was measured rather than a 0 that reads as a fast hook. The report prints "no
valid sample" in place of a latency and adds a line for steps that failed in a
fresh process, beside the existing disagreement line. The exit check moves into
gateFails, which fails on cold errors as it already did on warm errors and cold
disagreements, and is exported with coldSummary so both can be tested.

The render test builds its report from summarize([]), the real summary shape,
so it keeps working as metrics are added.
2026-10-04 22:34:30 -04:00
montjeffrey 3a4a574609 fix(gateguard): a throwing hook no longer ends the fresh-process replay
measureColdLatency ran each step in a fresh process through execFileSync,
inside try/finally with no catch. A hook that threw made the child exit
non-zero, execFileSync threw, and the error left measureColdLatency and then
evaluate, so neither the report nor the requested SARIF was written for a run
that had hit a single bad step.

The probe now catches a throwing require or run itself and records it the way
workerMain does: the raw payload stands in for the result, so the step reads as
an allow, and the error is kept. Matching the warm path matters because
coldSummary counts every cold decision that differs from the warm one as a
disagreement; any other choice would have reported disagreements that do not
exist. A child that dies without writing parseable output is caught outside the
probe and recorded the same way with no latency, and coldSummary leaves
unmeasured steps out of the percentiles while still counting them.

The new tests run a hook that always throws through both passes. They fail
against the previous code, 2 of 17, and pass against this one.
2026-10-04 22:22:50 -04:00
montjeffrey 8a7d61299c feat(gateguard): ask what outside the repository fixes a format or semantics
Across 240 evaluation trials every question the gate raised was about code
structure - importers, callers, public API, data schemas - while every deciding
fact in the hidden-intent corpus was an external contract: a consumer's CSV
dialect, a reporting timezone, retry safety against a non-idempotent endpoint,
collation rules, a quota policy. Obtaining the deciding fact predicted the
outcome almost perfectly in both arms, and the gate did not reliably cause it.

Add an external-contract question for code targets whose change profile touches
data, beside data-schema rather than replacing it: data-schema asks what the
change touches, external-contract asks who decides what it has to be. It reuses
the existing touchesData signal, so it stays as selective as the question it
sits with and adds no new detection, and it therefore does not reach a change
with no data involvement - pure retry semantics, for instance - which is a known
limit to be measured rather than guessed at.

Code edits that touch data now ask four questions instead of three, so the
condensed hint for an unknown profile changes too. That string was pinned by a
test as legacy-stable; the pin is updated deliberately, because a hint that
names fewer questions than the gate asks is worse than a hint that changed.

Suites: target-class 31, fact-force 1019, scenario-gate 25, eval 15, and the two
effectiveness suites 29 and 26, all passing. The 23 relevantQuestions
annotations that listed data-schema now list external-contract as well.
2026-10-04 18:13:02 -04:00
Jeffrey Montoya b821262997 feat(gateguard): compare hook latency with confidence intervals 2026-09-30 20:27:36 -04:00
Jeffrey Montoya d95aa3425e feat(gateguard): measure hook latency in fresh processes 2026-09-30 11:35:49 -04:00
Jeffrey Montoya 3055eb3746 fix(gateguard): link SARIF findings to the evaluated corpus 2026-09-30 00:04:11 -04:00
Jeffrey Montoya 216fe89c36 feat(gateguard): write scenario gate results as SARIF 2026-09-29 22:20:41 -04:00
Jeffrey Montoya 10639a0c9e fix(gateguard): gate NotebookEdit and hard-linked targets
NotebookEdit is gated as a first-touch edit of notebook_path.
A file with more than one hard link gets no credit, trivial, sibling or cap allowance.
2026-09-29 21:50:26 -04:00
Jeffrey Montoya 42e9072136 feat(gateguard): credit test files by their module stem
Drop the hardcoded baseline alias from the evaluation script and refresh the results.
2026-09-29 21:50:23 -04:00
Jeffrey Montoya 0301055327 feat(gateguard): build condensed code hints from the question ids 2026-09-29 21:50:21 -04:00
Jeffrey Montoya f7e4735cca feat(gateguard): add scenario corpus and evaluation script
Replays 16 labelled sessions against the working tree and git-ref baselines.
2026-09-29 21:50:20 -04:00