mirror of
https://github.com/affaan-m/ECC.git
synced 2026-10-21 15:31:46 +02:00
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.
This commit is contained in:
@@ -24,6 +24,7 @@ const QUESTION_IDS = Object.freeze([
|
||||
'callers',
|
||||
'no-duplicate',
|
||||
'data-schema',
|
||||
'external-contract',
|
||||
'loader',
|
||||
'behaviour-change',
|
||||
'no-duplicate-instruction',
|
||||
|
||||
@@ -156,6 +156,8 @@ const QUESTION_TEXT = Object.freeze({
|
||||
'no-duplicate': `Confirm no existing file serves the same purpose ${SEARCH_THE_TREE}`,
|
||||
'data-schema':
|
||||
'If this file reads/writes data files, show field names, structure, and date format (use redacted or synthetic values, not raw production data)',
|
||||
'external-contract':
|
||||
'Name what outside this repository decides the format, units, timezone or protocol semantics here (the consumer, the producer, or a stated convention), or state that the choice is unconstrained',
|
||||
loader: 'Name the harness/loader that reads this file (Claude Code, Codex, Cursor, OpenCode, …) and when it loads it',
|
||||
'behaviour-change': 'Describe what agent behaviour changes as a result',
|
||||
'no-duplicate-instruction': `Confirm no existing instruction, skill, or agent file already covers this ${SEARCH_THE_TREE}`,
|
||||
@@ -189,7 +191,11 @@ function codeQuestionIds(isWrite, profile) {
|
||||
const surface = !known || profile.touchesPublicSurface !== false;
|
||||
const data = !known || profile.touchesData !== false;
|
||||
const opening = isWrite ? ['callers', 'no-duplicate'] : surface ? ['importers', 'public-api'] : ['local-callers'];
|
||||
return data ? [...opening, 'data-schema'] : opening;
|
||||
// A change that handles data is usually constrained by something outside the
|
||||
// tree - a consumer's dialect, a reporting timezone, a protocol's semantics -
|
||||
// and the repository cannot settle it. data-schema asks what the change
|
||||
// touches; external-contract asks who decides what it has to be.
|
||||
return data ? [...opening, 'data-schema', 'external-contract'] : opening;
|
||||
}
|
||||
|
||||
/** True when a class's questions depend on the change profile. */
|
||||
@@ -209,7 +215,7 @@ function questionText(id) {
|
||||
}
|
||||
|
||||
const CODE_CONDENSED_HINT =
|
||||
"briefly state importers/callers, affected API, data schemas if any, and the user's verbatim instruction, then retry.";
|
||||
"briefly state importers/callers, affected API, data schemas if any, what outside the repository fixes the format or semantics, and the user's verbatim instruction, then retry.";
|
||||
|
||||
const CONDENSED_PHRASES = Object.freeze({
|
||||
importers: 'the files that import this file',
|
||||
@@ -218,6 +224,7 @@ const CONDENSED_PHRASES = Object.freeze({
|
||||
callers: 'the file(s) and line(s) that will call it',
|
||||
'no-duplicate': 'that no existing file serves the same purpose',
|
||||
'data-schema': 'the data schemas it reads or writes',
|
||||
'external-contract': 'what outside the repository fixes the format or semantics',
|
||||
'quote-instruction': "the user's verbatim instruction"
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user