@@ -6,6 +6,7 @@ import { fileURLToPath } from "node:url";
66import {
77 classifyPetActivityTarget ,
88 earlyPayloadFor ,
9+ isCodexRendererCandidateTarget ,
910 petActivityCompatibilityPayloadFor ,
1011} from "../scripts/injector.mjs" ;
1112
@@ -234,6 +235,21 @@ assert.equal(classifyPetActivityTarget(petTarget(
234235 "Unexpected Surface" ,
235236) ) , null , "The exact native pet title is part of the auxiliary-target identity boundary." ) ;
236237
238+ const codexTarget = ( url , title = "Codex" ) => ( { type : "page" , title, url } ) ;
239+ assert . equal ( isCodexRendererCandidateTarget ( codexTarget ( "app://-/index.html" ) ) , true ) ;
240+ assert . equal ( isCodexRendererCandidateTarget ( codexTarget (
241+ "app://-/index.html?initialRoute=%2Fsettings" ,
242+ ) ) , true , "Normal Codex initial routes must remain eligible for renderer probing." ) ;
243+ for ( const target of [
244+ codexTarget ( "app://-/index.html?initialRoute=%2Favatar-overlay" ) ,
245+ codexTarget ( "app://-/index.html?initialRoute=%2Fsettings&initialRoute=%2Favatar-overlay" ) ,
246+ codexTarget ( "app://-/avatar-overlay-composition-surface.html?surfaceId=mascot-badge" ) ,
247+ codexTarget ( "https://example.com/index.html" ) ,
248+ ] ) {
249+ assert . equal ( isCodexRendererCandidateTarget ( target ) , false ,
250+ `Auxiliary or non-Codex targets must not receive operation UI or full Dream Skin: ${ target . url } ` ) ;
251+ }
252+
237253function createPetCompatibilityFixture ( href ) {
238254 const nodes = new Map ( ) ;
239255 const head = {
@@ -282,10 +298,16 @@ assert.equal(petCompatWrongSurface.style, null,
282298 "Voice, mascot, and other auxiliary surfaces must remain completely untouched." ) ;
283299const targetLoopStart = source . indexOf ( "for (const target of targets)" , source . indexOf ( "async function runWatch" ) ) ;
284300const petClassificationStart = source . indexOf ( "classifyPetActivityTarget(target)" , targetLoopStart ) ;
301+ const codexClassificationStart = source . indexOf ( "isCodexRendererCandidateTarget(target)" , petClassificationStart ) ;
285302const mainEarlyRegistrationStart = source . indexOf ( "registerEarlyForRecord(" , petClassificationStart ) ;
286303assert . ok ( targetLoopStart >= 0 && petClassificationStart > targetLoopStart
287- && mainEarlyRegistrationStart > petClassificationStart ,
288- "Pet activity surfaces must be classified before the full Dream Skin early payload is registered." ) ;
304+ && codexClassificationStart > petClassificationStart
305+ && mainEarlyRegistrationStart > codexClassificationStart ,
306+ "Pet activity surfaces must be classified first, and only a true Codex renderer may receive the full payload." ) ;
307+ const connectCodexTargetsStart = source . indexOf ( "async function connectCodexTargets" ) ;
308+ const operationUiStart = source . indexOf ( "function operationUiExpression" , connectCodexTargetsStart ) ;
309+ assert . match ( source . slice ( connectCodexTargetsStart , operationUiStart ) , / i s C o d e x R e n d e r e r C a n d i d a t e T a r g e t \( t a r g e t \) / ,
310+ "Operation UI discovery must reject the avatar-overlay root before probing or connecting it." ) ;
289311assert . match ( source , / a w a i t s e t P e t A c t i v i t y C o m p a t i b i l i t y \( p e t S e s s i o n , t r u e \) / ,
290312 "The watcher must install the bounded pet style only after live target identity verification." ) ;
291313assert . match ( source , / p e t S e s s i o n \. o n \( " P a g e \. l o a d E v e n t F i r e d " [ \s \S ] * l i v e P e t A c t i v i t y T a r g e t \( p e t S e s s i o n \) [ \s \S ] * s e t P e t A c t i v i t y C o m p a t i b i l i t y \( p e t S e s s i o n , t r u e \) / ,
0 commit comments