Skip to content

Commit e615de3

Browse files
committed
test(gates): pin the Android test-only fixture consumer gate
Mirror the mechanics/adb-host facet tests: a test or integration file importing @agent-device/platform-android/snapshot-capture-fixtures passes R13, while the same import from production files (src/commands/ and src/core/interactors/, the latter proving production files ride no fixture seam) is denied. Guards the ANDROID_TEST_ONLY_SUBPATHS predicate added for the review's P2.
1 parent 50b411d commit e615de3

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

‎scripts/layering/platform-package-policy.test.ts‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,31 @@ test('the Android mechanics facet is the named consumer seam and adb host wiring
430430
);
431431
});
432432

433+
test('the Android test-only fixture subpaths accept test consumers and deny production ones', () => {
434+
const fixtureImport =
435+
"import { createAndroidSnapshotCapture } from '@agent-device/platform-android/snapshot-capture-fixtures';";
436+
const allowed = validSources();
437+
allowed.set('src/__tests__/android-ui-hierarchy.test.ts', fixtureImport);
438+
allowed.set('src/daemon/__tests__/android-system-dialog-occlusion.test.ts', fixtureImport);
439+
allowed.set('test/integration/provider-scenarios/android.test.ts', fixtureImport);
440+
assert.deepEqual(
441+
messages(allowed).filter((message) => message.includes('may import')),
442+
[],
443+
);
444+
445+
// Production consumers ride no facet seam: importing a fixture is an R13 violation, even
446+
// from a file the mechanics facet would otherwise accept.
447+
for (const file of ['src/commands/replay/index.ts', 'src/core/interactors/android.ts']) {
448+
const denied = validSources();
449+
denied.set(file, fixtureImport);
450+
assert.match(
451+
messages(denied).join('\n'),
452+
/may import '@agent-device\/platform-android\/snapshot-capture-fixtures'/,
453+
file,
454+
);
455+
}
456+
});
457+
433458
test('contracts never depend on a concrete platform package in production or tests', () => {
434459
for (const statement of [
435460
"import { applePlatformMetadata } from '@agent-device/platform-apple';",

0 commit comments

Comments
 (0)