Skip to content

Commit bf90892

Browse files
authored
dont publish baml src on generate (#2232)
<!-- ELLIPSIS_HIDDEN --> > [!IMPORTANT] > Prevent tracing publisher from starting during BAML generation by setting `BAML_GENERATE` environment variable and update integration test scripts and configurations. > > - **Behavior**: > - Set `BAML_GENERATE` environment variable in `generate_clients()` in `generate.rs` to prevent tracing publisher from starting. > - `start_publisher()` in `publisher.rs` checks for `BAML_GENERATE` and skips publisher if set. > - **Scripts**: > - Add `build:debug` script to `package.json` and `integ-tests/typescript/package.json`. > - Update `integ-tests:ts` script in `package.json` to include `build:debug`. > - **Configuration**: > - Add `build:debug` and `integ-tests:ts` tasks to `turbo.json` with specific outputs and environment variables. > > <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=BoundaryML%2Fbaml&utm_source=github&utm_medium=referral)<sup> for f784452. You can [customize](https://app.ellipsis.dev/BoundaryML/settings/summaries) this summary. It will automatically update as commits are pushed.</sup> <!-- ELLIPSIS_HIDDEN -->
1 parent dec94be commit bf90892

File tree

5 files changed

+33
-3
lines changed

5 files changed

+33
-3
lines changed

engine/baml-runtime/src/cli/generate.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ impl GenerateArgs {
3030
}
3131

3232
fn generate_clients(&self, defaults: super::RuntimeCliDefaults) -> Result<()> {
33-
let runtime = BamlRuntime::from_directory(&self.from, std::env::vars().collect())
33+
// Set BAML_GENERATE to prevent starting the tracing publisher
34+
let mut env_vars: std::collections::HashMap<String, String> = std::env::vars().collect();
35+
env_vars.insert("BAML_GENERATE".to_string(), "1".to_string());
36+
37+
let runtime = BamlRuntime::from_directory(&self.from, env_vars)
3438
.context("Failed to build BAML runtime")?;
3539
let src_files = baml_src_files(&self.from)
3640
.context("Failed while searching for .baml files in baml_src/")?;

engine/baml-runtime/src/tracingv2/publisher/publisher.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ pub fn start_publisher(
183183
lookup: Arc<AstSignatureWrapper>,
184184
#[cfg(not(target_arch = "wasm32"))] rt: Arc<tokio::runtime::Runtime>,
185185
) {
186+
if lookup.env_var("BAML_GENERATE").is_some() {
187+
log::debug!("Skipping publisher because BAML_GENERATE is set");
188+
return;
189+
}
186190
if lookup.env_var("BOUNDARY_API_KEY").is_none() {
187191
log::debug!("Skipping publisher because BOUNDARY_API_KEY is not set");
188192
return;

integ-tests/typescript/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"integ-tests:dotenv": "tsc && pnpm test -- --silent false --testTimeout 30000",
1212
"generate": "baml-cli generate --from ../baml_src",
1313
"memory-test": "BAML_LOG=info infisical run --env=test -- pnpm test -- --silent false --testTimeout 60000 -t 'memory'",
14-
"typecheck": "tsc --noEmit"
14+
"typecheck": "tsc --noEmit",
15+
"build:debug": "cd ../../engine/language_client_typescript && pnpm build:debug"
1516
},
1617
"keywords": [],
1718
"author": "",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"format:fix": "biome check --write",
2727
"docker-build": "bash build-docker.sh",
2828
"test": "turbo run test",
29-
"integ-tests": "pnpm run generate && turbo run integ-tests"
29+
"integ-tests:ts": "turbo run build:debug --filter=@boundaryml/baml && cd integ-tests/typescript && pnpm generate && pnpm integ-tests"
3030
},
3131
"devDependencies": {
3232
"@infisical/cli": "0.41.89",

turbo.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,27 @@
191191
],
192192
"cache": false
193193
},
194+
"@boundaryml/baml#build:debug": {
195+
"outputs": ["dist/**", "build/**", "artifacts/**"],
196+
"cache": false
197+
},
198+
"integ-tests:ts": {
199+
"dependsOn": ["build:debug"],
200+
"outputs": [
201+
"coverage/**",
202+
".coverage/**",
203+
"junit.xml",
204+
"test-results/**"
205+
],
206+
"cache": false,
207+
"env": [
208+
"OPENAI_API_KEY",
209+
"ANTHROPIC_API_KEY",
210+
"GOOGLE_API_KEY",
211+
"AWS_*",
212+
"INTEG_TESTS_*"
213+
]
214+
},
194215
"integ-tests": {
195216
"dependsOn": ["build"],
196217
"outputs": [

0 commit comments

Comments
 (0)