@@ -46,6 +46,7 @@ import { v2Projection } from "./orchestrationV2TestFixtures.ts";
4646
4747const encodeThreadSnapshot = Schema . encodeSync ( OrchestrationV2ThreadDetailSnapshot ) ;
4848const encodeBoundedSnapshot = Schema . encodeSync ( OrchestrationV2ThreadBoundedSnapshot ) ;
49+ const encodeThreadTranscript = Schema . encodeSync ( OrchestrationV2ThreadTranscript ) ;
4950
5051const TARGET = new RelayConnectionTarget ( {
5152 environmentId : EnvironmentId . make ( "environment-1" ) ,
@@ -235,7 +236,7 @@ const LOADERS: ReadonlyArray<{
235236 name : "thread transcript" ,
236237 method : "GET" ,
237238 path : `/api/orchestration/threads/${ TRANSCRIPT . threadId } /transcript` ,
238- response : Schema . encodeSync ( OrchestrationV2ThreadTranscript ) ( TRANSCRIPT ) ,
239+ response : encodeThreadTranscript ( TRANSCRIPT ) ,
239240 expected : TRANSCRIPT ,
240241 load : ( input : HttpInput ) =>
241242 fetchEnvironmentThreadTranscript ( { ...input , threadId : TRANSCRIPT . threadId } ) ,
@@ -311,12 +312,9 @@ describe("authenticated environment HTTP requests", () => {
311312 ) ;
312313 }
313314 expect ( harness . authorizations ) . toEqual ( [ { expectedEnvironmentId : TARGET . environmentId } ] ) ;
315+ // The proof signs exactly the URL sent; signers drop the query for `htu`.
314316 expect ( harness . proofs ) . toEqual ( [
315- {
316- method : loader . method ,
317- url : `${ CURRENT_ORIGIN } ${ loader . path } ` ,
318- accessToken : "current-token" ,
319- } ,
317+ { method : loader . method , url : call . url , accessToken : "current-token" } ,
320318 ] ) ;
321319 if ( loader . name === "older thread history" ) {
322320 expect ( url . searchParams . get ( "cursor" ) ) . toBe ( "older-page" ) ;
@@ -332,6 +330,12 @@ describe("authenticated environment HTTP requests", () => {
332330 const MCP_THREAD_LOADERS : ReadonlyArray <
333331 Pick < ( typeof LOADERS ) [ number ] , "name" | "response" | "load" >
334332 > = [
333+ {
334+ name : "thread transcript" ,
335+ response : encodeThreadTranscript ( TRANSCRIPT ) ,
336+ load : ( input : HttpInput ) =>
337+ fetchEnvironmentThreadTranscript ( { ...input , threadId : MCP_THREAD_ID } ) ,
338+ } ,
335339 {
336340 name : "thread snapshot" ,
337341 response : encodeThreadSnapshot ( THREAD ) ,
@@ -362,10 +366,9 @@ describe("authenticated environment HTTP requests", () => {
362366 const harness = makeHarness ( ( ) => Response . json ( loader . response ) ) ;
363367 yield * loader . load ( harness . input ) . pipe ( Effect . provide ( harness . httpLayer ) ) ;
364368
365- const sent = new URL ( harness . calls [ 0 ] ! . url ) ;
366- expect ( sent . pathname ) . toContain ( "/mcp%3A3534bc83-" ) ;
367- sent . search = "" ;
368- expect ( harness . proofs . map ( ( proof ) => proof . url ) ) . toEqual ( [ sent . toString ( ) ] ) ;
369+ const sent = harness . calls [ 0 ] ! . url ;
370+ expect ( new URL ( sent ) . pathname ) . toContain ( "/mcp%3A3534bc83-" ) ;
371+ expect ( harness . proofs . map ( ( proof ) => proof . url ) ) . toEqual ( [ sent ] ) ;
369372 } ) ,
370373 ) ;
371374
@@ -425,7 +428,7 @@ describe("authenticated environment HTTP requests", () => {
425428 ) ;
426429 expect ( harness . proofs [ 1 ] ) . toEqual ( {
427430 method : "GET" ,
428- url : ` ${ RENEWED_ORIGIN } ${ loader . path } ` ,
431+ url : retried . url ,
429432 accessToken : "renewed-token" ,
430433 } ) ;
431434 if ( loader . name === "older thread history" ) {
0 commit comments