@@ -22,6 +22,7 @@ import { PullRequestOperationError } from "@t3tools/contracts";
2222import * as ProjectionSnapshotQuery from "../orchestration/Services/ProjectionSnapshotQuery.ts" ;
2323import { SqlitePersistenceMemory } from "../persistence/Layers/Sqlite.ts" ;
2424import * as PullRequestFilesViewed from "../persistence/PullRequestFilesViewed.ts" ;
25+ import * as RepositoryIdentityResolver from "../project/RepositoryIdentityResolver.ts" ;
2526import * as SourceControlProviderRegistry from "../sourceControl/SourceControlProviderRegistry.ts" ;
2627import * as SourceControlRateLimit from "../sourceControl/SourceControlRateLimit.ts" ;
2728import { ForgejoCli } from "../sourceControl/ForgejoCli.ts" ;
@@ -402,6 +403,7 @@ function makeService(input: {
402403 readonly projects : ReadonlyArray < OrchestrationProjectShell > ;
403404 readonly providers : ReadonlyArray < PullRequestProviderApi > ;
404405 readonly resolveHandle ?: SourceControlProviderRegistry . SourceControlProviderRegistry [ "Service" ] [ "resolveHandle" ] ;
406+ readonly resolveRepositoryIdentity ?: RepositoryIdentityResolver . RepositoryIdentityResolver [ "Service" ] [ "resolve" ] ;
405407} ) {
406408 // Built into the test's own scope rather than provided call by call: the marks store owns a
407409 // database, and `Effect.provide` would close it the moment the service was handed back.
@@ -422,6 +424,9 @@ function makeService(input: {
422424 getProjectShellById : ( projectId ) =>
423425 Effect . succeed ( Option . fromNullishOr ( input . projects . find ( ( p ) => p . id === projectId ) ) ) ,
424426 } ) ,
427+ Layer . mock ( RepositoryIdentityResolver . RepositoryIdentityResolver ) ( {
428+ resolve : input . resolveRepositoryIdentity ?? ( ( ) => Effect . succeed ( null ) ) ,
429+ } ) ,
425430 SourceControlRateLimit . layer ,
426431 // The real store over a database of its own, so the environment-kept marks are exercised
427432 // through the SQL that holds them rather than through a stand-in that agrees with itself.
@@ -2184,6 +2189,33 @@ it.effect("rejects a different Forgejo HTTP port for an HTTP checkout", () =>
21842189 } ) ,
21852190) ;
21862191
2192+ it . effect ( "resolves a project's repository identity when its shell has none cached" , ( ) =>
2193+ Effect . gen ( function * ( ) {
2194+ const resolved = project ( {
2195+ id : "web" ,
2196+ title : "web" ,
2197+ workspaceRoot : "/web" ,
2198+ repository : "acme/web" ,
2199+ } ) ;
2200+ const service = yield * makeService ( {
2201+ projects : [ { ...resolved , repositoryIdentity : null } ] ,
2202+ providers : [
2203+ fakeProvider ( "github" , {
2204+ getChangeRequestSummary : ( ) => Effect . succeed ( changeRequest ( 7 , "2026-07-02T00:00:00Z" ) ) ,
2205+ } ) ,
2206+ ] ,
2207+ resolveRepositoryIdentity : ( ) => Effect . succeed ( resolved . repositoryIdentity ?? null ) ,
2208+ } ) ;
2209+
2210+ const summary = yield * service . summary (
2211+ { projectId : "web" as ProjectId , host : "github.com" , repository : "acme/web" , number : 7 } ,
2212+ { recoverTransientFailure : false } ,
2213+ ) ;
2214+
2215+ assert . strictEqual ( summary . number , 7 ) ;
2216+ } ) ,
2217+ ) ;
2218+
21872219it . effect ( "routes a hosted reference to another repository through a project on that host" , ( ) =>
21882220 Effect . gen ( function * ( ) {
21892221 const seen : Array < { cwd : string ; repository : string ; host : string } > = [ ] ;
0 commit comments