@@ -135,6 +135,9 @@ test("Cloudflare publication contracts are host-independent, immutable, and boun
135135 assert . equal ( validatePublishedRevision ( { ...publication , schema : "wp-codebox/published-revision/v1" , routes : [ { route : "/" , objectKey } ] } ) . routes [ 0 ] . canonicalRevision , canonicalRevision )
136136 assert . equal ( validatePublishedRevision ( { ...publication , schema : "wp-codebox/published-revision/v2" , canonicalVersion : undefined } ) . canonicalVersion , 0 )
137137 assert . deepEqual ( validatePublishedRevision ( { ...publication , routes : [ ] } ) . routes , [ ] )
138+ const sourceJob = `sites/default/publications/jobs/00000000000000000007-${ canonicalRevision } .json`
139+ assert . equal ( validatePublishedRevision ( { ...publication , sourceJob } ) . sourceJob , sourceJob )
140+ assert . throws ( ( ) => validatePublishedRevision ( { ...publication , sourceJob : "sites/default/publications/jobs/foreign.json" } ) , / i n v a l i d / )
138141 assert . throws ( ( ) => normalizePublishedRoutes ( [ ] ) , / b o u n d e d r o u t e s a r r a y / )
139142 assert . throws ( ( ) => validatePublishedRevision ( { ...publication , routes : [ { route : "/" , objectKey : "sites/default/pages/foreign.json" } ] } ) , / r o u t e i s i n v a l i d / )
140143} )
@@ -440,9 +443,12 @@ test("Cloudflare runtime injects composable coordinators without moving PHP out
440443 assert . match ( worker , / c o o r d i n a t o r \. c o m m i t t e d \( c a n d i d a t e \. c o o r d i n a t o r V e r s i o n \) / )
441444 assert . match ( worker , / \. l i s t \( \{ p r e f i x : ` \$ \{ s i t e S t o r a g e K e y s \( s i t e \) \. p u b l i c a t i o n J o b P r e f i x \} \/ ` , l i m i t : 1 6 \} \) / )
442445 assert . match ( worker , / c a n o n i c a l V e r s i o n : j o b \. c o o r d i n a t o r V e r s i o n / )
446+ assert . match ( worker , / s o u r c e J o b : j o b \. k e y / )
443447 assert . match ( worker , / r e a d W o r d P r e s s P a g e S n a p s h o t \( e n v \. W O R D P R E S S _ S T A T E _ B U C K E T , o b j e c t K e y , j o b \. c a n o n i c a l \. r e v i s i o n , r o u t e \) / )
444448 assert . match ( worker , / i f \( ! a w a i t r e a d W o r d P r e s s P a g e S n a p s h o t \( e n v \. W O R D P R E S S _ S T A T E _ B U C K E T , o b j e c t K e y , j o b \. c a n o n i c a l \. r e v i s i o n , r o u t e \) \) t h r o w e r r o r / )
445449 const publicationDrain = worker . slice ( worker . indexOf ( "async function drainNextPublicationJob" ) , worker . indexOf ( "async function compilePublicationRoutes" ) )
450+ assert . match ( publicationDrain , / c o n s t r e c o v e r e d P r o m o t i o n = c u r r e n t \? \. p u b l i c a t i o n \. c a n o n i c a l V e r s i o n = = = j o b \. c o o r d i n a t o r V e r s i o n [ \s \S ] * c u r r e n t \. p u b l i c a t i o n \. c a n o n i c a l R e v i s i o n = = = j o b \. c a n o n i c a l \. r e v i s i o n [ \s \S ] * c u r r e n t \. p u b l i c a t i o n \. s o u r c e J o b = = = j o b \. k e y / )
451+ assert . match ( publicationDrain , / i f \( r e c o v e r e d P r o m o t i o n \) [ \s \S ] * s t a t u s : " p r o m o t e d " [ \s \S ] * o p e r a t i o n s \? \. r e c o n c i l e P u b l i c a t i o n \( s i t e \. i d , j o b \. k e y , " p r o m o t e d " , c u r r e n t \. p u b l i c a t i o n \. r e v i s i o n \) / )
446452 assert . match ( publicationDrain , / b o o t R u n t i m e \( e n v \. W O R D P R E S S _ S T A T E _ B U C K E T , j o b \. c a n o n i c a l , s i t e \. o r i g i n / )
447453 assert . match ( publicationDrain , / c o m p i l e P u b l i c a t i o n R o u t e s \( r u n t i m e , \[ r o u t e \] , s i t e \. o r i g i n \) / )
448454 assert . doesNotMatch ( worker , / r u n t i m e S i t e O r i g i n | r e q u i r e ' \/ w o r d p r e s s \/ w p - l o a d \. p h p ' ; e c h o g e t _ o p t i o n \( ' h o m e ' \) / )
0 commit comments