@@ -8,9 +8,11 @@ import {
88 isRootPlatformRuntimeTarget ,
99} from './daemon-platform-runtime-inventory.ts' ;
1010
11- const DEVICE_READY_TARGET = 'src/platform-runtime-device-ready.ts' ;
12- const DEVICE_READY_STUB =
13- 'export async function ensureLocalPlatformDeviceReady(device: unknown) { return false; }\n' ;
11+ // The classified pair these fixtures plant is the claim-recovery gateway factory: the composition
12+ // edge this port introduced, and the shortest one whose symbols the rule still classifies.
13+ const CLASSIFIED_TARGET = 'src/platform-runtime-claim-recovery.ts' ;
14+ const CLASSIFIED_STUB = 'export const createClaimRecoveryGateway = () => ({});\n' ;
15+ const CLASSIFIED_IMPORTER = 'src/daemon/server/daemon-runtime.ts' ;
1416
1517function violations ( sources : Record < string , string > ) : LayeringViolation [ ] {
1618 return checkDaemonPlatformRuntimeInventory ( resolveImportEdges ( new Map ( Object . entries ( sources ) ) ) ) ;
@@ -22,12 +24,12 @@ function edgeViolations(sources: Record<string, string>, file: string): Layering
2224
2325test ( 'R76 accepts a classified edge with the exact recorded symbols' , ( ) => {
2426 const sources = {
25- [ DEVICE_READY_TARGET ] : DEVICE_READY_STUB ,
26- 'src/daemon/device/device-ready.ts' :
27- "import { ensureLocalPlatformDeviceReady } from '../../platform-runtime-device-ready .ts';\n" +
28- 'void ensureLocalPlatformDeviceReady ;\n' ,
27+ [ CLASSIFIED_TARGET ] : CLASSIFIED_STUB ,
28+ [ CLASSIFIED_IMPORTER ] :
29+ "import { createClaimRecoveryGateway } from '../../platform-runtime-claim-recovery .ts';\n" +
30+ 'void createClaimRecoveryGateway ;\n' ,
2931 } ;
30- assert . deepEqual ( edgeViolations ( sources , 'src/daemon/device/device-ready.ts' ) , [ ] ) ;
32+ assert . deepEqual ( edgeViolations ( sources , CLASSIFIED_IMPORTER ) , [ ] ) ;
3133} ) ;
3234
3335for ( const [ file , target , symbol ] of [
@@ -50,20 +52,18 @@ for (const [file, target, symbol] of [
5052
5153test ( 'R76 reports every classified edge missing from the tree as stale, not the other way around' , ( ) => {
5254 const sources = {
53- [ DEVICE_READY_TARGET ] : DEVICE_READY_STUB ,
54- 'src/daemon/device/device-ready.ts' :
55- "import { ensureLocalPlatformDeviceReady } from '../../platform-runtime-device-ready .ts';\n" +
56- 'void ensureLocalPlatformDeviceReady ;\n' ,
55+ [ CLASSIFIED_TARGET ] : CLASSIFIED_STUB ,
56+ [ CLASSIFIED_IMPORTER ] :
57+ "import { createClaimRecoveryGateway } from '../../platform-runtime-claim-recovery .ts';\n" +
58+ 'void createClaimRecoveryGateway ;\n' ,
5759 } ;
5860 const stale = violations ( sources ) . filter (
5961 ( violation ) => violation . file === 'scripts/layering/daemon-platform-runtime-inventory.ts' ,
6062 ) ;
6163 assert . equal ( stale . length , DAEMON_PLATFORM_RUNTIME_EDGES . length - 1 ) ;
6264 assert . ok ( stale . every ( ( violation ) => violation . message . includes ( 'stale classified edge' ) ) ) ;
63- const deviceReadyStale = stale . find ( ( violation ) =>
64- violation . message . includes ( DEVICE_READY_TARGET ) ,
65- ) ;
66- assert . equal ( deviceReadyStale , undefined ) ;
65+ const classifiedStale = stale . find ( ( violation ) => violation . message . includes ( CLASSIFIED_TARGET ) ) ;
66+ assert . equal ( classifiedStale , undefined ) ;
6767} ) ;
6868
6969test ( 'R76 rejects an unclassified edge with the pair and its line' , ( ) => {
@@ -86,35 +86,32 @@ test('R76 rejects an unclassified edge with the pair and its line', () => {
8686
8787test ( 'R76 rejects new symbols on a classified edge' , ( ) => {
8888 const sources = {
89- [ DEVICE_READY_TARGET ] : DEVICE_READY_STUB + 'export function extraReadiness () {}\n' ,
90- 'src/daemon/device/device-ready.ts' :
91- "import { ensureLocalPlatformDeviceReady, extraReadiness } from '../../platform-runtime-device-ready .ts';\n" +
92- 'void [ensureLocalPlatformDeviceReady, extraReadiness ];\n' ,
89+ [ CLASSIFIED_TARGET ] : CLASSIFIED_STUB + 'export function extraGatewayKnob () {}\n' ,
90+ [ CLASSIFIED_IMPORTER ] :
91+ "import { createClaimRecoveryGateway, extraGatewayKnob } from '../../platform-runtime-claim-recovery .ts';\n" +
92+ 'void [createClaimRecoveryGateway, extraGatewayKnob ];\n' ,
9393 } ;
94- const found = edgeViolations ( sources , 'src/daemon/device/device-ready.ts' ) ;
94+ const found = edgeViolations ( sources , CLASSIFIED_IMPORTER ) ;
9595 assert . equal ( found . length , 1 ) ;
9696 assert . equal ( found [ 0 ] ! . rule , DAEMON_PLATFORM_RUNTIME_RULE ) ;
9797 assert . match ( found [ 0 ] ! . message , / c l a s s i f i e d s y m b o l s d r i f t e d / ) ;
98- assert . match ( found [ 0 ] ! . message , / e n s u r e L o c a l P l a t f o r m D e v i c e R e a d y , e x t r a R e a d i n e s s / ) ;
98+ assert . match ( found [ 0 ] ! . message , / c r e a t e C l a i m R e c o v e r y G a t e w a y , e x t r a G a t e w a y K n o b / ) ;
9999} ) ;
100100
101- test ( 'R76 rejects a reintroduced Android-mechanics import on the selector-dispatch edge' , ( ) => {
101+ test ( 'R76 rejects a gateway assembled from an expanded recovery edge' , ( ) => {
102102 const sources = {
103- 'src/platform-runtime-open-target .ts' :
104- 'export async function resolveSessionAppBundleIdForTarget () { return undefined; } \n' +
105- 'export async function resolveAndroidPackageForOpen () { return undefined; } \n' ,
106- 'src/daemon/handlers/session-selector-dispatch .ts' :
107- "import { resolveAndroidPackageForOpen, resolveSessionAppBundleIdForTarget } from '../../platform-runtime-open-target .ts';\n" +
108- 'void [resolveAndroidPackageForOpen, resolveSessionAppBundleIdForTarget ];\n' ,
103+ 'src/platform-runtime-claim-recovery .ts' :
104+ 'export const createClaimRecoveryGateway = () => ({}); \n' +
105+ 'export const createProviderRecoveryGateway = () => ({}); \n' ,
106+ 'src/daemon/server/daemon-runtime .ts' :
107+ "import {\n createClaimRecoveryGateway,\n createProviderRecoveryGateway,\n } from '../../platform-runtime-claim-recovery .ts';\n" +
108+ 'void [createClaimRecoveryGateway, createProviderRecoveryGateway ];\n' ,
109109 } ;
110- const found = edgeViolations ( sources , 'src/daemon/handlers/session-selector-dispatch .ts' ) ;
110+ const found = edgeViolations ( sources , 'src/daemon/server/daemon-runtime .ts' ) ;
111111 assert . equal ( found . length , 1 ) ;
112112 assert . equal ( found [ 0 ] ! . rule , DAEMON_PLATFORM_RUNTIME_RULE ) ;
113113 assert . match ( found [ 0 ] ! . message , / c l a s s i f i e d s y m b o l s d r i f t e d / ) ;
114- assert . match (
115- found [ 0 ] ! . message ,
116- / r e s o l v e A n d r o i d P a c k a g e F o r O p e n , r e s o l v e S e s s i o n A p p B u n d l e I d F o r T a r g e t / ,
117- ) ;
114+ assert . match ( found [ 0 ] ! . message , / c r e a t e C l a i m R e c o v e r y G a t e w a y , c r e a t e P r o v i d e r R e c o v e r y G a t e w a y / ) ;
118115} ) ;
119116
120117test ( 'R76 matches a destructured dynamic import by target with the recorded bindings' , ( ) => {
@@ -211,13 +208,13 @@ test('R76 rejects a namespace import alongside the recorded named binding on the
211208
212209test ( 'R76 treats the import and re-export of one classified pair as one entry' , ( ) => {
213210 const sources = {
214- [ DEVICE_READY_TARGET ] : DEVICE_READY_STUB ,
215- 'src/daemon/device/device-ready.ts' :
216- "import { ensureLocalPlatformDeviceReady } from '../../platform-runtime-device-ready .ts';\n" +
217- "export { ensureLocalPlatformDeviceReady } from '../../platform-runtime-device-ready .ts';\n" +
218- 'void ensureLocalPlatformDeviceReady ;\n' ,
211+ [ CLASSIFIED_TARGET ] : CLASSIFIED_STUB ,
212+ [ CLASSIFIED_IMPORTER ] :
213+ "import { createClaimRecoveryGateway } from '../../platform-runtime-claim-recovery .ts';\n" +
214+ "export { createClaimRecoveryGateway } from '../../platform-runtime-claim-recovery .ts';\n" +
215+ 'void createClaimRecoveryGateway ;\n' ,
219216 } ;
220- assert . deepEqual ( edgeViolations ( sources , 'src/daemon/device/device-ready.ts' ) , [ ] ) ;
217+ assert . deepEqual ( edgeViolations ( sources , CLASSIFIED_IMPORTER ) , [ ] ) ;
221218} ) ;
222219
223220test ( 'R76 ignores test-shaped and non-daemon importers' , ( ) => {
0 commit comments