Skip to content

Commit 79e04ea

Browse files
committed
refactor(registry): flip react-devtools to none (Wave 6 residue, #2042)
react-devtools's only platform execution was its CLI-injected dispatch to `runtime port-reverse`. Now that `runtime` is fully migrated to device-runtime (R31), that execution is accounted for under runtime's own descriptor rather than hidden behind react-devtools's — so it owns no unmigrated platform execution of its own. Refines the CLI-route mode-dominance gate to match: it now rejects a `none` route only when its dispatch target is still `legacy`, not merely non-none. Dispatching to an already-migrated command (device-runtime/inventory/host) is accounted-for execution, not hidden legacy work.
1 parent 494f1c5 commit 79e04ea

2 files changed

Lines changed: 30 additions & 12 deletions

File tree

‎src/core/command-descriptor/__tests__/platform-execution-cli-route.test.ts‎

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ import { commandDescriptors } from '../registry.ts';
1515
* The registry entry gate inspects one descriptor at a time, so it cannot see a command
1616
* whose own module holds no platform code while its CLI route injects a *different*
1717
* command that does. Mode dominance closes that: if a CLI route dispatches command D,
18-
* the route's command may declare `none` only when D is `none` too.
18+
* the route's command may declare `none` only when D is not itself still `legacy`.
19+
*
20+
* Mode dominance is scoped to hidden *legacy* execution, not to migration mode in general: a
21+
* route may declare `none` while its CLI-injected dispatch target is already `device-runtime`,
22+
* `inventory`, or `host` — that target's execution is accounted for under its own descriptor,
23+
* not hidden behind the route's. Dispatching to a still-`legacy` command is the one shape this
24+
* gate rejects, since that really would let unmigrated execution hide behind a `none` label.
1925
*
2026
* The dispatched pairs are read from the typed table at the construction seam rather
2127
* than recovered from syntax. The second test keeps that seam singular, which is what
@@ -48,7 +54,7 @@ function dominanceFailures(
4854
table: DispatchTable = CLI_INJECTED_DAEMON_DISPATCHES,
4955
): string[] {
5056
return declaredPairs(table)
51-
.filter(({ route, dispatched }) => kindOf(route) === 'none' && kindOf(dispatched) !== 'none')
57+
.filter(({ route, dispatched }) => kindOf(route) === 'none' && kindOf(dispatched) === 'legacy')
5258
.map(
5359
({ route, dispatched }) =>
5460
`${route} declares platformExecution none but its CLI route dispatches ${dispatched} (${String(kindOf(dispatched))})`,
@@ -254,16 +260,24 @@ function cliModulePaths(): string[] {
254260
}
255261

256262
describe('platform-execution coherence across CLI route delegation', () => {
257-
test('no none command dispatches a platform-executing command', () => {
263+
test('no none command dispatches a still-legacy command', () => {
264+
expect(dominanceFailures(registryKind)).toEqual([]);
265+
});
266+
267+
test('a none route dispatching an already-migrated command is not a dominance failure', () => {
268+
// react-devtools dispatches `runtime`, which is fully migrated (`device-runtime`, R31) — not
269+
// hidden legacy execution — so react-devtools may honestly declare `none`.
270+
expect(registryKind('runtime')).toBe('device-runtime');
271+
expect(registryKind('react-devtools')).toBe('none');
258272
expect(dominanceFailures(registryKind)).toEqual([]);
259273
});
260274

261-
test('planted red: react-devtools declared none is rejected by the declared pair', () => {
262-
const plantedNone: PlatformExecutionKindOf = (command) =>
263-
command === 'react-devtools' ? 'none' : registryKind(command);
275+
test('planted red: a route dispatching a still-legacy command is rejected', () => {
276+
const plantedLegacyRuntime: PlatformExecutionKindOf = (command) =>
277+
command === 'runtime' ? 'legacy' : registryKind(command);
264278

265-
expect(dominanceFailures(plantedNone)).toEqual([
266-
'react-devtools declares platformExecution none but its CLI route dispatches runtime (device-runtime)',
279+
expect(dominanceFailures(plantedLegacyRuntime)).toEqual([
280+
'react-devtools declares platformExecution none but its CLI route dispatches runtime (legacy)',
267281
]);
268282
});
269283

‎src/core/command-descriptor/registry.ts‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,10 +1555,14 @@ export const RAW_COMMAND_DESCRIPTORS = [
15551555
timeoutPolicy: DEFAULT_TIMEOUT_POLICY,
15561556
batchable: false,
15571557
mcpExposed: false,
1558-
// `react-devtools start` on a Limrun Android instance dispatches internal
1559-
// `runtime port-reverse`, which reaches a provider device runtime. Platform
1560-
// execution delegated through another command is still platform execution.
1561-
platformExecution: LEGACY_PLATFORM_EXECUTION,
1558+
// Wave 6 residue: `react-devtools start` on a Limrun Android instance dispatches internal
1559+
// `runtime port-reverse` through the CLI-injected dispatch seam. `runtime` is itself fully
1560+
// migrated (`device-runtime`, R31), so the dispatched execution is accounted for under its
1561+
// own descriptor rather than hidden behind this one — this route owns no unmigrated platform
1562+
// execution of its own. The CLI-route dominance gate
1563+
// (`__tests__/platform-execution-cli-route.test.ts`) still rejects a `none` route whose
1564+
// CLI-injected dispatch target is still `legacy`.
1565+
platformExecution: NO_PLATFORM_EXECUTION,
15621566
},
15631567
{
15641568
name: 'web',

0 commit comments

Comments
 (0)