Skip to content

Commit 77ed03b

Browse files
committed
chore(gates): let a captured tool payload inside a package own the unit lane
A recorded tool response checked in under a package (`…/src/**/__tests__/fixtures/*.json`, or a `fixtures/` dir beside the module that parses it) has no derivable owner: nothing builds a `.json` and no `.ts` sibling names it, so editing one failed the affected gate open to the full check set. That punished adding evidence — the capture in #2683 tripped it — while the pre-existing `snapshot-source/fixtures/wire-vocabulary.json` has been sitting in the same gap. The rule names the one suite that reads such a file. Root-level and `test/` fixtures still fail open as before, which is right: nothing outside a package says who consumes them. Editing the selector model fails the gate open by design (`selector-owning`), so this change cannot narrow its own selection; the full set runs for it.
1 parent e18de1d commit 77ed03b

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

‎scripts/check-affected/model.test.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,23 @@ test('unknown path fails open to the full check set', () => {
230230
assert.equal(result.failOpenReasons[0]?.rule, 'unknown-path');
231231
});
232232

233+
test('a payload capture inside a package selects the unit lane', () => {
234+
// Recorded tool responses checked in beside the module that parses them (#2683). Before this rule
235+
// a capture edit failed the gate open, which punished adding evidence rather than the absence of it.
236+
for (const file of [
237+
'packages/platform-apple/src/core/__tests__/fixtures/ios-device-info-details.json',
238+
'packages/platform-apple/src/snapshot-source/fixtures/wire-vocabulary.json',
239+
]) {
240+
const result = plan([file]);
241+
assert.equal(result.failOpen, false, file);
242+
assert.ok(result.checks.includes('unit'), file);
243+
assert.ok(
244+
result.reasons.some((reason) => reason.rule === 'own:package-capture'),
245+
file,
246+
);
247+
}
248+
});
249+
233250
test('a non-.ts fixture under an owned root fails open (format alone is not ownership)', () => {
234251
const result = plan(['test/integration/provider-scenarios/fixtures/device.json']);
235252
assert.equal(result.failOpen, true);

‎scripts/check-affected/model.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,19 @@ const BUILD_OWNERSHIP: ReadonlyArray<{
529529
file.startsWith('examples/test-app/security/') ||
530530
file === 'examples/test-app/pnpm-workspace.yaml',
531531
},
532+
// In-package payload captures: a recorded tool response checked in under a package's fixture
533+
// directory (`packages/*/**/__tests__/fixtures/*.json`, or a `fixtures/` dir beside the module that
534+
// reads it). Nothing builds them and no `.ts` sibling names them, so without this a capture edit
535+
// fails the gate open even though exactly one suite asserts against it.
536+
{
537+
check: 'unit',
538+
rule: 'own:package-capture',
539+
detail: 'the vitest unit suite reads the captured payload',
540+
owns: (file) =>
541+
file.startsWith('packages/') &&
542+
file.endsWith('.json') &&
543+
(file.includes('/__tests__/fixtures/') || file.includes('/fixtures/')),
544+
},
532545
// TS/Swift golden tables (`contracts/fixtures/*.json`): the vitest parity test and the
533546
// runner XCTest twin both read them, so a table edit owns the unit lane and both runner
534547
// builds. Without this a `.json` under contracts/ has no derivable owner and fails open.

0 commit comments

Comments
 (0)