@@ -6,7 +6,6 @@ import * as NodeChildProcess from "node:child_process";
66
77import * as NodeServices from "@effect/platform-node/NodeServices" ;
88import { it } from "@effect/vitest" ;
9- import * as Clock from "effect/Clock" ;
109import * as Context from "effect/Context" ;
1110import * as Effect from "effect/Effect" ;
1211import * as Deferred from "effect/Deferred" ;
@@ -66,7 +65,6 @@ import {
6665 toForgejoChangeRequest ,
6766} from "@t3tools/source-control-forgejo/server/forgejoPullRequests" ;
6867import type { SourceControlProvider } from "@t3tools/source-control-core/server/SourceControlProvider" ;
69- import * as SourceControlRateLimit from "@t3tools/source-control-core/server/SourceControlRateLimit" ;
7068import * as SourceControlProviderRegistry from "../sourceControl/SourceControlProviderRegistry.ts" ;
7169import * as ServerConfig from "../config.ts" ;
7270import * as ProjectionStore from "../orchestration-v2/ProjectionStore.ts" ;
@@ -2027,59 +2025,6 @@ it.layer(layerGitManagerTest)("GitManager", (it) => {
20272025 } ) ,
20282026 ) ;
20292027
2030- it . effect ( "resolves a user's pull request while background reads to its host are paused" , ( ) =>
2031- Effect . gen ( function * ( ) {
2032- const { service } = createGitHubProviderWithFakeGh ( {
2033- pullRequest : {
2034- number : 91 ,
2035- title : "Safe checkout PR" ,
2036- url : "https://github.com/pingdotgg/codething-mvp/pull/91" ,
2037- baseRefName : "main" ,
2038- headRefName : "feature/pr-safe" ,
2039- state : "open" ,
2040- } ,
2041- } ) ;
2042- const limits = yield * SourceControlRateLimit . make ;
2043- const key = { provider : SourceControlProviderKind . make ( "github" ) , host : "github.com" } ;
2044- yield * limits . recordRateLimit ( {
2045- ...key ,
2046- lease : 0 ,
2047- retryAt : ( yield * Clock . currentTimeMillis ) + 60_000 ,
2048- } ) ;
2049- // Gated like BitbucketApi's reads: refused during a pause unless a user is waiting.
2050- const getChangeRequest : SourceControlProvider [ "Service" ] [ "getChangeRequest" ] = ( input ) =>
2051- SourceControlRateLimit . Interactive . pipe (
2052- Effect . flatMap ( ( interactive ) =>
2053- limits . check ( key , interactive ? { allowPaused : true } : undefined ) ,
2054- ) ,
2055- Effect . mapError (
2056- ( cause ) =>
2057- new SourceControlProviderFailure ( {
2058- provider : key . provider ,
2059- operation : "getChangeRequest" ,
2060- cwd : input . cwd ,
2061- detail : cause . detail ,
2062- cause,
2063- } ) ,
2064- ) ,
2065- Effect . andThen ( service . getChangeRequest ( input ) ) ,
2066- ) ;
2067- const background = yield * Effect . flip (
2068- getChangeRequest ( { cwd : process . cwd ( ) , reference : "91" } ) ,
2069- ) ;
2070- expect ( background . cause ) . toMatchObject ( { _tag : "SourceControlRateLimitPausedError" } ) ;
2071-
2072- const { manager } = yield * makeManager ( {
2073- sourceControlProvider : { ...service , getChangeRequest } ,
2074- } ) ;
2075- const { pullRequest } = yield * manager . resolvePullRequest ( {
2076- cwd : process . cwd ( ) ,
2077- reference : "91" ,
2078- } ) ;
2079- expect ( pullRequest . number ) . toBe ( 91 ) ;
2080- } ) ,
2081- ) ;
2082-
20832028 it . effect (
20842029 "status ignores unrelated fork PRs when the current branch tracks the same repository" ,
20852030 ( ) =>
0 commit comments