@@ -1868,6 +1868,29 @@ test("batch protocol routes require the shared internal signature", async () =>
18681868 assert . equal ( forwardedPath , "/publication-batches/claim" ) ;
18691869} ) ;
18701870
1871+ test ( "batch claims reject partial dispatch metadata" , async ( ) => {
1872+ const queue = new ExactReviewQueue (
1873+ { storage : new TestStorage ( ) } ,
1874+ { EXACT_REVIEW_PUBLICATION_BATCHING_ENABLED : "1" } ,
1875+ ) ;
1876+ for ( const body of [
1877+ {
1878+ claim_id : "partial-dispatch-id" ,
1879+ lease_owner : "worker-partial" ,
1880+ dispatch_id : "publication-batch-dispatch:partial" ,
1881+ } ,
1882+ {
1883+ claim_id : "partial-dispatch-time" ,
1884+ lease_owner : "worker-partial" ,
1885+ dispatched_at : "2026-07-26T08:00:00.000Z" ,
1886+ } ,
1887+ ] ) {
1888+ const response = await queue . fetch ( batchRequest ( "/publication-batches/claim" , body ) ) ;
1889+ assert . equal ( response . status , 400 ) ;
1890+ assert . equal ( ( await response . json ( ) ) . error , "invalid_batch_dispatch_metadata" ) ;
1891+ }
1892+ } ) ;
1893+
18711894test ( "publication batch observability always retains active leases beside bounded history" , ( ) => {
18721895 const storage = new TestStorage ( ) ;
18731896 const batches = new ExactReviewPublicationBatchStore ( storage ) ;
@@ -2029,6 +2052,7 @@ test("reservation-to-claim observability traces one batch without exposing lease
20292052 batch_id : claim . batch . batch_id ,
20302053 lease_owner : "worker-secret-not-public" ,
20312054 state_commit_sha : "a" . repeat ( 40 ) ,
2055+ failure_fingerprint : "failure-body-secret-not-public" ,
20322056 state_writer : {
20332057 schema_version : 1 ,
20342058 operation_id : `batch:${ claim . batch . batch_id } ` ,
@@ -2065,10 +2089,23 @@ test("reservation-to-claim observability traces one batch without exposing lease
20652089
20662090 const stats = await ( await queue . fetch ( new Request ( "https://queue/stats" ) ) ) . json ( ) ;
20672091 const observability = stats . reservation_claim_observability ;
2092+ assert . deepEqual ( observability . publication_paths , {
2093+ cloudflare_canonical_direct : {
2094+ enabled : true ,
2095+ reservation_to_claim : "not_applicable" ,
2096+ state_writer_timing : "not_applicable" ,
2097+ } ,
2098+ legacy_state_repo_batch : {
2099+ enabled : true ,
2100+ reservation_to_claim : "tracked" ,
2101+ state_writer_timing : "tracked" ,
2102+ } ,
2103+ } ) ;
20682104 const batch = observability . batches . find (
20692105 ( entry : { batch_id : string } ) => entry . batch_id === claim . batch . batch_id ,
20702106 ) ;
20712107 assert . ok ( batch , JSON . stringify ( observability ) ) ;
2108+ assert . equal ( batch . publication_path , "legacy_state_repo_batch" ) ;
20722109 assert . equal ( batch . dispatch . id , "publication-batch-dispatch:trace-729" ) ;
20732110 assert . equal ( batch . workflow . run_id , "92729" ) ;
20742111 assert . equal ( batch . workflow . run_attempt , 3 ) ;
@@ -2088,6 +2125,7 @@ test("reservation-to-claim observability traces one batch without exposing lease
20882125 ) ;
20892126 assert . match ( JSON . stringify ( observability ) , / p u b l i c a t i o n - b a t c h - d i s p a t c h : t r a c e - 7 2 9 / ) ;
20902127 assert . doesNotMatch ( JSON . stringify ( observability ) , / w o r k e r - s e c r e t - n o t - p u b l i c / ) ;
2128+ assert . doesNotMatch ( JSON . stringify ( observability ) , / f a i l u r e - b o d y - s e c r e t - n o t - p u b l i c / ) ;
20912129 } finally {
20922130 Date . now = originalNow ;
20932131 }
0 commit comments