@@ -4,10 +4,6 @@ import { Flow } from '@pgflow/dsl';
44import { delay } from '@std/async' ;
55import { createFlowWorker } from '../../../src/flow/createFlowWorker.ts' ;
66import { createTestPlatformAdapter } from '../_helpers.ts' ;
7- import {
8- KNOWN_LOCAL_ANON_KEY ,
9- KNOWN_LOCAL_SERVICE_ROLE_KEY ,
10- } from '../../../src/shared/localDetection.ts' ;
117import type { postgres } from '../../sql.ts' ;
128
139// Define a minimal test flow
@@ -26,19 +22,15 @@ function createLogger(module: string) {
2622 } ;
2723}
2824
29- function createPlatformAdapterWithEnv (
25+ function createPlatformAdapterWithLocalEnv (
3026 sql : postgres . Sql ,
31- envOverrides : Record < string , string > = { }
27+ isLocal : boolean
3228) {
3329 const baseAdapter = createTestPlatformAdapter ( sql ) ;
34- const modifiedEnv = {
35- ...baseAdapter . env ,
36- ...envOverrides ,
37- } ;
3830
3931 return {
4032 ...baseAdapter ,
41- get env ( ) { return modifiedEnv ; } ,
33+ get isLocalEnvironment ( ) { return isLocal ; } ,
4234 } ;
4335}
4436
@@ -64,7 +56,7 @@ Deno.test(
6456 pollIntervalMs : 200 ,
6557 } ,
6658 createLogger ,
67- createPlatformAdapterWithEnv ( sql )
59+ createPlatformAdapterWithLocalEnv ( sql , false )
6860 ) ;
6961
7062 try {
@@ -121,7 +113,7 @@ Deno.test(
121113 pollIntervalMs : 200 ,
122114 } ,
123115 createLogger ,
124- createPlatformAdapterWithEnv ( sql )
116+ createPlatformAdapterWithLocalEnv ( sql , false )
125117 ) ;
126118
127119 try {
@@ -155,11 +147,8 @@ Deno.test(
155147 await sql `SELECT pgflow.add_step('test_compilation_flow', 'double')` ;
156148 await sql `SELECT pgflow.add_step('test_compilation_flow', 'different_step', deps_slugs => ARRAY['double']::text[])` ;
157149
158- // Use non-local keys to simulate production mode
159- const platformAdapter = createPlatformAdapterWithEnv ( sql , {
160- SUPABASE_ANON_KEY : 'prod-anon-key-not-local' ,
161- SUPABASE_SERVICE_ROLE_KEY : 'prod-service-key-not-local' ,
162- } ) ;
150+ // Use isLocal: false to simulate production mode
151+ const platformAdapter = createPlatformAdapterWithLocalEnv ( sql , false ) ;
163152
164153 const worker = createFlowWorker (
165154 TestCompilationFlow , // Has only 'double' step
@@ -220,11 +209,8 @@ Deno.test(
220209 await sql `SELECT pgflow.create_flow('test_compilation_flow')` ;
221210 await sql `SELECT pgflow.add_step('test_compilation_flow', 'old_step')` ;
222211
223- // Use local keys to simulate development mode
224- const platformAdapter = createPlatformAdapterWithEnv ( sql , {
225- SUPABASE_ANON_KEY : KNOWN_LOCAL_ANON_KEY ,
226- SUPABASE_SERVICE_ROLE_KEY : KNOWN_LOCAL_SERVICE_ROLE_KEY ,
227- } ) ;
212+ // Use isLocal: true to simulate development mode
213+ const platformAdapter = createPlatformAdapterWithLocalEnv ( sql , true ) ;
228214
229215 const worker = createFlowWorker (
230216 TestCompilationFlow , // Has 'double' step, not 'old_step'
0 commit comments