@@ -42,6 +42,13 @@ export type VercelSettingsResult = {
4242 autoAssignCustomDomains ?: boolean | null ;
4343 /** URL to manage Vercel integration access (project sharing) on vercel.com */
4444 vercelManageAccessUrl ?: string ;
45+ /** The currently pinned TRIGGER_VERSION on Vercel production, if set. Used to surface
46+ * the pin in the UI and prompt the user to clear it when atomic deployments are disabled. */
47+ currentTriggerVersion ?: string | null ;
48+ /** True when the Vercel lookup for TRIGGER_VERSION failed (network/auth/etc). Distinct
49+ * from "no pin set" — the UI uses this to warn the user and still prompt them on disable
50+ * so they can manually verify that production isn't pinned. */
51+ currentTriggerVersionFetchFailed ?: boolean ;
4552} ;
4653
4754export type VercelAvailableProject = {
@@ -248,13 +255,17 @@ export class VercelSettingsPresenter extends BasePresenter {
248255 customEnvironments : VercelCustomEnvironment [ ] ;
249256 autoAssignCustomDomains : boolean | null ;
250257 vercelManageAccessUrl ?: string ;
258+ currentTriggerVersion : string | null ;
259+ currentTriggerVersionFetchFailed : boolean ;
251260 } > => {
252261 if ( ! orgIntegration ) {
253- return { customEnvironments : [ ] , autoAssignCustomDomains : null } ;
262+ return { customEnvironments : [ ] , autoAssignCustomDomains : null , currentTriggerVersion : null , currentTriggerVersionFetchFailed : false } ;
254263 }
255264 const clientResult = await VercelIntegrationRepository . getVercelClient ( orgIntegration ) ;
256265 if ( clientResult . isErr ( ) ) {
257- return { customEnvironments : [ ] , autoAssignCustomDomains : null } ;
266+ // We couldn't even build a Vercel client — treat as fetch failure so the UI
267+ // still prompts the user when they disable atomic deployments.
268+ return { customEnvironments : [ ] , autoAssignCustomDomains : null , currentTriggerVersion : null , currentTriggerVersionFetchFailed : true } ;
258269 }
259270 const client = clientResult . value ;
260271 const teamId = await VercelIntegrationRepository . getTeamIdFromIntegration ( orgIntegration ) ;
@@ -275,10 +286,10 @@ export class VercelSettingsPresenter extends BasePresenter {
275286 }
276287
277288 if ( ! connectedProject ) {
278- return { customEnvironments : [ ] , autoAssignCustomDomains : null , vercelManageAccessUrl } ;
289+ return { customEnvironments : [ ] , autoAssignCustomDomains : null , vercelManageAccessUrl, currentTriggerVersion : null , currentTriggerVersionFetchFailed : false } ;
279290 }
280291
281- const [ customEnvsResult , autoAssignResult ] = await Promise . all ( [
292+ const [ customEnvsResult , autoAssignResult , triggerVersionResult ] = await Promise . all ( [
282293 VercelIntegrationRepository . getVercelCustomEnvironments (
283294 client ,
284295 connectedProject . vercelProjectId ,
@@ -289,18 +300,44 @@ export class VercelSettingsPresenter extends BasePresenter {
289300 connectedProject . vercelProjectId ,
290301 teamId
291302 ) ,
303+ VercelIntegrationRepository . getVercelEnvironmentVariableValues (
304+ client ,
305+ connectedProject . vercelProjectId ,
306+ teamId ,
307+ "production" ,
308+ ( key ) => key === "TRIGGER_VERSION"
309+ ) ,
292310 ] ) ;
311+
312+ let currentTriggerVersion : string | null = null ;
313+ let currentTriggerVersionFetchFailed = false ;
314+ if ( triggerVersionResult . isOk ( ) ) {
315+ const match = triggerVersionResult . value . find (
316+ ( envVar ) => envVar . key === "TRIGGER_VERSION" && envVar . target . includes ( "production" )
317+ ) ;
318+ currentTriggerVersion = match ?. value ?? null ;
319+ } else {
320+ currentTriggerVersionFetchFailed = true ;
321+ logger . warn ( "Failed to fetch current TRIGGER_VERSION from Vercel — surfacing as unknown" , {
322+ projectId,
323+ vercelProjectId : connectedProject . vercelProjectId ,
324+ error : triggerVersionResult . error . message ,
325+ } ) ;
326+ }
327+
293328 return {
294329 customEnvironments : customEnvsResult . isOk ( ) ? customEnvsResult . value : [ ] ,
295330 autoAssignCustomDomains : autoAssignResult . isOk ( ) ? autoAssignResult . value : null ,
296331 vercelManageAccessUrl,
332+ currentTriggerVersion,
333+ currentTriggerVersionFetchFailed,
297334 } ;
298335 } ;
299336
300337 return fromPromise (
301338 fetchVercelData ( ) ,
302339 ( error ) => ( { type : "other" as const , cause : error } )
303- ) . map ( ( { customEnvironments, autoAssignCustomDomains, vercelManageAccessUrl } ) => ( {
340+ ) . map ( ( { customEnvironments, autoAssignCustomDomains, vercelManageAccessUrl, currentTriggerVersion , currentTriggerVersionFetchFailed } ) => ( {
304341 enabled : true ,
305342 hasOrgIntegration,
306343 authInvalid : false ,
@@ -311,6 +348,8 @@ export class VercelSettingsPresenter extends BasePresenter {
311348 customEnvironments,
312349 autoAssignCustomDomains,
313350 vercelManageAccessUrl,
351+ currentTriggerVersion,
352+ currentTriggerVersionFetchFailed,
314353 } as VercelSettingsResult ) ) ;
315354 } ) . mapErr ( ( error ) => {
316355 // Log the error and return a safe fallback
0 commit comments