@@ -369,6 +369,12 @@ export interface SupportedProject {
369369 * Unique where `repository` is not: Azure's is a bare name that repeats across an organisation.
370370 */
371371 readonly remote : string ;
372+ /**
373+ * The host's own key for this checkout's repository (`api.repositoryKey`), normalized, or null
374+ * where `owner/name` on the host identifies it. When set, only a reference whose key matches
375+ * is served by this checkout.
376+ */
377+ readonly repositoryKey : string | null ;
372378}
373379
374380/**
@@ -589,6 +595,7 @@ function withRateLimitBackoff(
589595 ...( api . mergeMessageRewrite === undefined
590596 ? { }
591597 : { mergeMessageRewrite : api . mergeMessageRewrite } ) ,
598+ ...( api . repositoryKey === undefined ? { } : { repositoryKey : api . repositoryKey } ) ,
592599 // Refused during a pause like any other read, except for the caller that asks for the
593600 // bypass: a lookup that failed is not held, so letting every background read through would
594601 // spawn this host's CLI on each of them and re-extend the pause it was already in.
@@ -852,10 +859,9 @@ export const make = Effect.gen(function* () {
852859 if ( roots === undefined ) viewerRoots . set ( host , [ project . workspaceRoot ] ) ;
853860 else if ( ! roots . includes ( project . workspaceRoot ) ) roots . push ( project . workspaceRoot ) ;
854861 }
855- const key = listCursorKey (
856- host ,
857- kind === "azure-devops" ? identity . canonicalKey : repository ,
858- ) ;
862+ const repositoryKey =
863+ api ?. repositoryKey ?.( { canonicalKey : identity . canonicalKey } ) ?? null ;
864+ const key = listCursorKey ( host , repositoryKey ?? repository ) ;
859865 if ( seen . has ( key ) ) continue ;
860866 seen . add ( key ) ;
861867 if ( api === null ) {
@@ -870,10 +876,9 @@ export const make = Effect.gen(function* () {
870876 api : withRateLimitBackoff ( api , host , rateLimits ) ,
871877 repository,
872878 host,
873- remote :
874- kind === "azure-devops"
875- ? identity . canonicalKey
876- : normalizeGitRemoteUrl ( `https://${ host } /${ repository } ` ) ,
879+ remote : repositoryKey ?? normalizeGitRemoteUrl ( `https://${ host } /${ repository } ` ) ,
880+ repositoryKey :
881+ repositoryKey === null ? null : canonicalRepositoryKey ( repositoryKey . toLowerCase ( ) ) ,
877882 } ) ;
878883 }
879884 return { supported, unimplemented, viewerRoots } ;
@@ -922,25 +927,21 @@ export const make = Effect.gen(function* () {
922927 const route =
923928 supported . find (
924929 ( candidate ) =>
925- candidate . api . kind === "azure-devops" &&
926- candidate . project . repositoryIdentity != null &&
927- canonicalRepositoryKey (
928- candidate . project . repositoryIdentity . canonicalKey . toLowerCase ( ) ,
929- ) === repositoryKey ,
930+ candidate . repositoryKey !== null && candidate . repositoryKey === repositoryKey ,
930931 ) ??
931932 onHost . find (
932933 ( candidate ) =>
933- candidate . api . kind !== "azure-devops" &&
934+ candidate . repositoryKey === null &&
934935 candidate . repository . toLowerCase ( ) === repository . toLowerCase ( ) ,
935936 ) ??
936- onHost . find ( ( candidate ) => candidate . api . kind !== "azure-devops" ) ;
937+ onHost . find ( ( candidate ) => candidate . repositoryKey === null ) ;
937938 if ( route === undefined ) {
938939 return Effect . fail (
939940 new PullRequestUnavailableError ( { reason : "provider-unsupported" } ) ,
940941 ) ;
941942 }
942943 return Effect . succeed (
943- route . api . kind === "azure-devops" ||
944+ route . repositoryKey !== null ||
944945 route . repository . toLowerCase ( ) === repository . toLowerCase ( )
945946 ? route
946947 : {
@@ -2099,9 +2100,7 @@ export const make = Effect.gen(function* () {
20992100 ) ,
21002101 Effect . mapError ( toPullRequestError ( "runAction" ) ) ,
21012102 Effect . as (
2102- project . api . kind === "azure-devops"
2103- ? input . repository . trim ( )
2104- : project . repository ,
2103+ project . repositoryKey !== null ? input . repository . trim ( ) : project . repository ,
21052104 ) ,
21062105 ) ,
21072106 ) ,
0 commit comments