Skip to content

Commit 9d7d60c

Browse files
authored
test(coverage): declare every public command's coverage judgments once (#2418)
* test(coverage): declare every public command's six platform coverage judgments once One row per public command in test/integration/command-coverage/declarations.ts carries the android-emulator, ios-simulator, macOS, tvOS, web and Linux classifications with the same fields the six per-platform manifests use today. Each platform's Record<PublicCommand, ...> is projected from that table at load time by a small per-platform view module, so no projected record is committed. No judgment is derived from another platform's: all six stay authored per command. * test(coverage): read the projected per-platform coverage view The six coverage smoke tests, live harnesses and coverage reports now import the platform view module that projects the declaration table. Both the depgraph blast-radius query and the device-lane test follow the iOS and macOS paths. * test(coverage): delete the six per-platform coverage manifests Their rows now live once, per command, in the declaration table; each platform's record is projected from it at load time. * fix(check-affected): extend macos-coverage and integration-node ownership to command-coverage/ test/integration/command-coverage/declarations.ts now carries the per-command coverage judgments that used to live directly under test/integration/macos-e2e/. Its nested path wasn't matched by macosCoverageOwnership (top-level or macos-e2e/ only) or isNodeIntegrationPath (no nested segments), so it fell through to vitest-related, which can't actually run its node --test consumers. Extend both rules to also match test/integration/command-coverage/.
1 parent 871ce1b commit 9d7d60c

33 files changed

Lines changed: 1891 additions & 1526 deletions

‎scripts/check-affected/device-lanes.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ test('the macOS coverage manifest selects its executable gate and macOS replay l
6363
'macos-coverage',
6464
'replay-macos',
6565
]);
66-
assert.deepEqual(lanes('test/integration/macos-e2e/coverage-manifest.ts'), [
66+
assert.deepEqual(lanes('test/integration/macos-e2e/coverage.ts'), [
6767
'macos-coverage',
6868
'replay-macos',
6969
]);

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ test('root node-integration support modules select the node integration suite',
6969
assert.ok(ids(['test/integration/test-helpers.ts']).includes('integration-node'));
7070
});
7171

72+
test('the shared coverage declaration table selects the node integration suite and the macOS lane', () => {
73+
const result = ids(['test/integration/command-coverage/declarations.ts']);
74+
assert.ok(result.includes('integration-node'), 'expected integration-node ownership');
75+
assert.ok(result.includes('macos-coverage'), 'expected macos-coverage ownership');
76+
assert.ok(
77+
!result.includes('vitest-related'),
78+
'declarations.ts is resolved by node --test, not by Vitest',
79+
);
80+
});
81+
7282
test('android-adb stub test delegates project ownership to Vitest', () => {
7383
const result = ids(['packages/platform-android/src/__tests__/notifications.test.ts']);
7484
assert.ok(result.includes('vitest-related'));

‎scripts/check-affected/model.ts‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,12 @@ const srcProdGate: OwnershipRule = ({ file, isSrcProd }) => {
270270
};
271271

272272
function isNodeIntegrationPath(file: string): boolean {
273-
return (
274-
file.startsWith('test/integration/') &&
275-
!file.slice('test/integration/'.length).includes('/') &&
276-
file.endsWith('.ts')
277-
);
273+
if (!file.startsWith('test/integration/') || !file.endsWith('.ts')) return false;
274+
const rest = file.slice('test/integration/'.length);
275+
// command-coverage/ holds the single declaration table every platform's node --test
276+
// coverage smoke test projects its record from (#2411): a change there feeds all six
277+
// smoke tests even though the file itself sits one level below test/integration/.
278+
return !rest.includes('/') || rest.startsWith('command-coverage/');
278279
}
279280

280281
const vitestRelatedOwnership: OwnershipRule = ({ file, isTs, underSrc, underTest }) =>
@@ -351,7 +352,11 @@ const nodeIntegrationOwnership: OwnershipRule = ({ file }) =>
351352

352353
const macosCoverageOwnership: OwnershipRule = ({ file }) =>
353354
file === 'test/integration/smoke-macos-coverage.test.ts' ||
354-
file.startsWith('test/integration/macos-e2e/')
355+
file.startsWith('test/integration/macos-e2e/') ||
356+
// The per-command coverage judgments (macOS included) are declared once here and
357+
// projected into macos-e2e/coverage.ts at load time (#2411), so a table edit must
358+
// still select the macOS lane the way editing the old macos-e2e manifest did.
359+
file.startsWith('test/integration/command-coverage/')
355360
? [
356361
reason(
357362
'macos-coverage',

‎scripts/depgraph/affected-run.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const HANDLER_CHAIN_FILE = 'src/daemon/request-handler-chain.ts';
5555
* needs — command name to owning scenario — so this lane does not depend on the rest of that
5656
* manifest's vocabulary, and reports honestly when it is not in the tree yet.
5757
*/
58-
const LIVE_COVERAGE_MANIFEST = 'test/integration/ios-simulator-e2e/coverage-manifest.ts';
58+
const LIVE_COVERAGE_MANIFEST = 'test/integration/ios-simulator-e2e/coverage.ts';
5959
const LIVE_COVERAGE_EXPORT = 'IOS_SIMULATOR_E2E_COVERAGE';
6060

6161
type LiveCoverageEntry = { level: string; owner: unknown; assertion: string };

‎test/integration/android-emulator-coverage-report.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import path from 'node:path';
55
import test from 'node:test';
66

77
import { PUBLIC_COMMANDS } from '@agent-device/command-registry/catalog';
8-
import { ANDROID_EMULATOR_COVERAGE_CLASSIFICATION_SUMMARY } from './android-emulator-e2e/coverage-manifest.ts';
8+
import { ANDROID_EMULATOR_COVERAGE_CLASSIFICATION_SUMMARY } from './android-emulator-e2e/coverage.ts';
99
import type { LiveContext } from './android-emulator-e2e/live-harness.ts';
1010
import { writeCoverageReport } from './android-emulator-e2e/live-coverage-report.ts';
1111

‎test/integration/android-emulator-e2e/coverage-manifest.ts‎

Lines changed: 0 additions & 226 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { projectCoverage } from '../command-coverage/declarations.ts';
2+
import type { PublicCommand } from '../command-coverage/entries.ts';
3+
import { buildCoverageClassificationSummary } from '../support/coverage-classification.ts';
4+
5+
/**
6+
* One primary, observable owner for every public command on an Android emulator.
7+
*
8+
* Projected from the command-owned declaration table; the rows are authored there.
9+
*/
10+
export const ANDROID_EMULATOR_E2E_COVERAGE = projectCoverage('androidEmulator');
11+
12+
export const ANDROID_EMULATOR_COVERAGE_CLASSIFICATION_SUMMARY = buildCoverageClassificationSummary(
13+
Object.values(ANDROID_EMULATOR_E2E_COVERAGE),
14+
);
15+
16+
export function liveCommandsForScenario(scenarioId: string): PublicCommand[] {
17+
return Object.entries(ANDROID_EMULATOR_E2E_COVERAGE)
18+
.filter(([, entry]) => entry.level === 'live' && entry.scenario === scenarioId)
19+
.map(([command]) => command as PublicCommand);
20+
}

‎test/integration/android-emulator-e2e/live-coverage-report.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
import {
1010
ANDROID_EMULATOR_COVERAGE_CLASSIFICATION_SUMMARY,
1111
liveCommandsForScenario,
12-
} from './coverage-manifest.ts';
12+
} from './coverage.ts';
1313
import type { LiveContext } from './live-harness.ts';
1414

1515
export function assertCoverageComplete(

‎test/integration/android-emulator-e2e/live-harness.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
type LiveDeviceContext,
1111
} from '../live-device-e2e/runtime.ts';
1212
import type { AndroidEmulatorBehaviorId } from './behavior-coverage.ts';
13-
import { liveCommandsForScenario } from './coverage-manifest.ts';
13+
import { liveCommandsForScenario } from './coverage.ts';
1414
import { liveBehaviorsForScenario, writeCoverageReport } from './live-coverage-report.ts';
1515

1616
export { assertCoverageComplete, writeCoverageReport } from './live-coverage-report.ts';

0 commit comments

Comments
 (0)