Skip to content

chore: migrate BEPs analysis to BAML v1 - #4288

Merged
sxlijin merged 1 commit into
canaryfrom
agent/migrate-beps-to-baml-v1
Jul 30, 2026
Merged

chore: migrate BEPs analysis to BAML v1#4288
sxlijin merged 1 commit into
canaryfrom
agent/migrate-beps-to-baml-v1

Conversation

@sxlijin

@sxlijin sxlijin commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • migrate BEPs version analysis from the legacy engine BAML client to quickstart-era BAML v1
  • generate the TypeScript SDK during Vercel builds with an exact pinned toolchain instead of committing baml_sdk
  • use the BAML v1 Node bridge from Convex and update the workspace build policy and lockfiles

Why

BEPs version analysis was still using the legacy generated client from engine/. This moves the feature to the current baml_language/ toolchain and makes deployment builds generate the SDK reproducibly.

Validation

  • baml check
  • TypeScript typecheck
  • ESLint (0 errors; 15 pre-existing warnings)
  • pnpm install --frozen-lockfile
  • clean Bun/Vercel-style build without a pre-generated baml_sdk
  • BAML bridge Anthropic request smoke test

Summary by CodeRabbit

  • New Features

    • Added automated BAML validation and SDK generation during development and builds.
    • Updated version-analysis prompts and configuration for the latest BAML toolchain.
    • Analysis jobs now use the newly generated analysis client.
  • Documentation

    • Updated prerequisites and development commands for BAML setup and generation.
  • Chores

    • Added generated SDK files to ignore lists.
    • Updated runtime integration and build configuration for improved compatibility.

@vercel
vercel Bot temporarily deployed to Preview – beps July 30, 2026 19:31 Inactive
@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
beps Ready Ready Preview Jul 30, 2026 8:00pm
promptfiddle2 Ready Ready Preview Jul 30, 2026 8:00pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The BEPs package migrates from the legacy generated BAML client to a generated BAML SDK, updates BAML source syntax, adds pinned toolchain generation scripts, adjusts Convex integration, and updates package, lint, documentation, and workspace configuration.

Changes

BEPs BAML migration

Layer / File(s) Summary
BAML source and prompt contracts
typescript2/app-beps/baml.toml, typescript2/app-beps/baml_src/*
BAML client, retry policy, type declarations, and prompt templates use the updated syntax while preserving configured values, fields, and analysis semantics.
BAML generation workflow
typescript2/app-beps/scripts/generate-baml.sh, typescript2/app-beps/package.json, typescript2/app-beps/.gitignore, typescript2/app-beps/eslint.config.mjs, typescript2/app-beps/README.md
Pinned toolchain checks, verified platform wrapper downloads, SDK generation commands, generated-output ignores, and setup documentation are added.
Convex analysis SDK integration
typescript2/app-beps/convex.json, typescript2/app-beps/convex/analysisJobsNode.ts
Convex uses @boundaryml/baml-bridge and invokes generated AnalyzeVersionChanges_async instead of the removed b client.
Workspace build configuration
typescript2/pnpm-workspace.yaml
protobufjs is explicitly disabled in pnpm build approvals.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AnalysisJob
  participant BAMLSDK
  participant JobState
  AnalysisJob->>BAMLSDK: AnalyzeVersionChanges_async(input)
  BAMLSDK-->>AnalysisJob: analysis result
  AnalysisJob->>JobState: update completed or failed status
Loading

Possibly related PRs

Poem

A rabbit hops where old clients slept,
New BAML scripts are neatly kept.
Prompts now shimmer, braces flee,
Async SDKs run happily.
“Generate!” I cheer, and wiggle my feet!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: migrating BEPs analysis to BAML v1.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/migrate-beps-to-baml-v1

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

⏭️ Performance benchmarks were skipped

Perf benchmarks (CodSpeed) are opt-in on pull requests — they no longer run on every push. They always run automatically after merge to canary/main.

To run them on this PR, do any of the following, then push a commit (or re-run CI):

  • Add RUN_CODSPEED=1 to the PR description, or
  • Include run-perf or /perf in the PR title or any commit message.

@sxlijin
sxlijin force-pushed the agent/migrate-beps-to-baml-v1 branch from 8d167af to f0f2649 Compare July 30, 2026 19:32
@vercel
vercel Bot temporarily deployed to Preview – beps July 30, 2026 19:33 Inactive
@sxlijin
sxlijin force-pushed the agent/migrate-beps-to-baml-v1 branch from f0f2649 to 1075199 Compare July 30, 2026 19:36
@vercel
vercel Bot temporarily deployed to Preview – beps July 30, 2026 19:38 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 July 30, 2026 19:46 Inactive
@sxlijin
sxlijin force-pushed the agent/migrate-beps-to-baml-v1 branch from 1075199 to e753269 Compare July 30, 2026 19:51
@vercel
vercel Bot temporarily deployed to Preview – beps July 30, 2026 19:53 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 July 30, 2026 20:00 Inactive
@sxlijin
sxlijin marked this pull request as ready for review July 30, 2026 22:00
@sxlijin
sxlijin added this pull request to the merge queue Jul 30, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e7532698a3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

/build

# generated BAML SDK
/baml_sdk/

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Generate the SDK before deploying Convex

On a fresh checkout, this rule leaves baml_sdk absent while convex/analysisJobsNode.ts imports it, but the documented bunx convex deploy command does not invoke baml:generate. The Convex CLI states that deploy typechecks and bundles dependencies and runs an extra command only when --cmd is supplied, so deployment fails with Cannot find module '../baml_sdk' before pushing; the documented standalone dev:convex script has the same problem. Add a Convex deployment hook/--cmd, generate before dev:convex, or retain the generated SDK.

Useful? React with 👍 / 👎.

"prebuild": "npm run baml:generate",
"dev": "npm-run-all --parallel dev:next dev:convex",
"baml:check": "baml check",
"baml:generate": "sh scripts/generate-baml.sh",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep BAML generation runnable on native Windows

On native Windows, every dev and build now starts by executing this command through sh, which is not normally available, and even Git Bash cannot help because generate-baml.sh rejects its MINGW* system value as unsupported. The previous npm-provided BAML CLI shipped Windows binaries, and the README still presents Bun or Node without an OS restriction, so this blocks the application workflow for Windows developers; use a cross-platform launcher or add a Windows implementation.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@typescript2/app-beps/package.json`:
- Around line 6-11: Add a dedicated Convex deployment script that runs
baml:generate before invoking convex deploy, ensuring baml_sdk exists for
convex/analysisJobsNode.ts imports. Keep the existing dev and build scripts
unchanged, and make the wrapper usable for standalone deployments.

In `@typescript2/app-beps/scripts/generate-baml.sh`:
- Around line 24-46: Update the wrapper download flow around the manifest lookup
and archive verification to avoid trusting URLs and SHA-256 values supplied
solely by the live manifest. Use committed, version-pinned trusted artifact URLs
and hashes for each supported platform, or validate a signed, pinned manifest
before downloading; ensure "$tmp/bin/baml" is executed only after that trusted
verification succeeds.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 60fcf14f-89cb-41a3-af47-7e839f8f454f

📥 Commits

Reviewing files that changed from the base of the PR and between 8f1fa6f and e753269.

⛔ Files ignored due to path filters (3)
  • typescript2/app-beps/bun.lock is excluded by !**/*.lock
  • typescript2/app-beps/package-lock.json is excluded by !**/package-lock.json
  • typescript2/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (27)
  • typescript2/app-beps/.gitignore
  • typescript2/app-beps/README.md
  • typescript2/app-beps/baml.toml
  • typescript2/app-beps/baml_client/async_client.ts
  • typescript2/app-beps/baml_client/async_request.ts
  • typescript2/app-beps/baml_client/config.ts
  • typescript2/app-beps/baml_client/globals.ts
  • typescript2/app-beps/baml_client/index.ts
  • typescript2/app-beps/baml_client/inlinedbaml.ts
  • typescript2/app-beps/baml_client/parser.ts
  • typescript2/app-beps/baml_client/partial_types.ts
  • typescript2/app-beps/baml_client/sync_client.ts
  • typescript2/app-beps/baml_client/sync_request.ts
  • typescript2/app-beps/baml_client/tracing.ts
  • typescript2/app-beps/baml_client/type_builder.ts
  • typescript2/app-beps/baml_client/types.ts
  • typescript2/app-beps/baml_client/watchers.ts
  • typescript2/app-beps/baml_src/clients.baml
  • typescript2/app-beps/baml_src/generators.baml
  • typescript2/app-beps/baml_src/types.baml
  • typescript2/app-beps/baml_src/version_analysis.baml
  • typescript2/app-beps/convex.json
  • typescript2/app-beps/convex/analysisJobsNode.ts
  • typescript2/app-beps/eslint.config.mjs
  • typescript2/app-beps/package.json
  • typescript2/app-beps/scripts/generate-baml.sh
  • typescript2/pnpm-workspace.yaml
💤 Files with no reviewable changes (15)
  • typescript2/app-beps/baml_src/generators.baml
  • typescript2/app-beps/baml_client/tracing.ts
  • typescript2/app-beps/baml_client/async_client.ts
  • typescript2/app-beps/baml_client/globals.ts
  • typescript2/app-beps/baml_client/config.ts
  • typescript2/app-beps/baml_client/async_request.ts
  • typescript2/app-beps/baml_client/sync_request.ts
  • typescript2/app-beps/baml_client/types.ts
  • typescript2/app-beps/baml_client/index.ts
  • typescript2/app-beps/baml_client/inlinedbaml.ts
  • typescript2/app-beps/baml_client/watchers.ts
  • typescript2/app-beps/baml_client/parser.ts
  • typescript2/app-beps/baml_client/partial_types.ts
  • typescript2/app-beps/baml_client/sync_client.ts
  • typescript2/app-beps/baml_client/type_builder.ts

Comment on lines +6 to +11
"baml:check": "baml check",
"baml:generate": "sh scripts/generate-baml.sh",
"dev": "bun run baml:generate && npm-run-all --parallel dev:next dev:convex",
"dev:next": "infisical run --env=test -- next dev",
"dev:convex": "infisical run --env=test -- convex dev",
"build": "next build",
"build": "bun run baml:generate && next build",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== files =="
git ls-files | sed -n '1,200p'

echo "== package manifests =="
fd 'package\.json$' . -x sh -c 'echo "--- $1"; sed -n "1,120p" "$1"' sh {}

echo "== convex import / deps =="
rg -n "baml_sdk|from ['\"].*baml_sdk|convex/analysisJobsNode|convex deploy|convex:deploy|baml:generate|scripts/generate-baml" .

echo "== relevant file slices =="
if [ -f convex/analysisJobsNode.ts ]; then sed -n '1,120p' convex/analysisJobsNode.ts; fi
if [ -f typescript2/app-beps/scripts/generate-baml.sh ]; then sed -n '1,200p' typescript2/app-beps/scripts/generate-baml.sh; fi
if [ -f typescript2/app-beps/.gitignore ]; then rg -n "baml_sdk|baml|convex" typescript2/app-beps/.gitignore || true; fi

Repository: BoundaryML/baml

Length of output: 50372


🌐 Web query:

Convex CLI bunx convex deploy generated SDK code run setup scripts first

💡 Result:

The convex deploy command (run via bunx convex deploy or npx convex deploy) does not natively run arbitrary setup scripts before it begins its internal process [1][2][3]. Instead, it follows a fixed, strictly ordered sequence of operations [1][4]: 1. Run the command specified by the --cmd flag (if provided), with the deployment URL injected as an environment variable [1][2][3]. 2. Typecheck your Convex functions [1][3]. 3. Regenerate the SDK code in the convex/_generated directory [1][3]. 4. Bundle your Convex functions and their dependencies [1][3]. 5. Push your functions, indexes, and schema to the target deployment [1][3]. 6. If deploying to a preview environment, run the function specified by --preview-run [1][3]. If you need to run setup scripts (such as environment variable configuration or database seeding) before your code is bundled and deployed, you must handle them explicitly before calling convex deploy [5]. Best practices for managing this sequence include: - Using a build/deploy wrapper script: Define a script (e.g., in package.json or a separate .js/.ts file) that performs your necessary setup tasks (like convex env set or data imports) and then executes convex deploy [6][7][8][9]. - Leveraging the --cmd flag: If your setup script is a build step (like vite build), you can pass it to the --cmd flag [1][7][8]. This ensures the build command runs while the deployment URL is available as an environment variable, which is critical for correctly pointing your frontend to the backend deployment [7][8]. - Managing Environment Variables: If you need to seed environment variables, execute npx convex env set after your deployment is provisioned but before you trigger the deployment of code [5]. If your workflow requires running code generation or deployment in a non-standard way, you can invoke individual CLI commands like npx convex codegen separately before running your final deploy command [9].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== locate app-beps files =="
fd . typescript2/app-beps -d 4 -t f | sed -n '1,120p'

echo "== app-beps package.json =="
sed -n '1,120p' typescript2/app-beps/package.json

echo "== app-beps gitignore =="
if [ -f typescript2/app-beps/.gitignore ]; then cat -n typescript2/app-beps/.gitignore; fi

echo "== app-beps baml generation =="
if [ -f typescript2/app-beps/scripts/generate-baml.sh ]; then cat -n typescript2/app-beps/scripts/generate-baml.sh; fi

echo "== app-beps convex imports =="
rg -n "from .*baml_sdk|from [\"']\\.\\./\\.\\./baml_sdk|convex/analysisJobsNode|analysisJobsNode" typescript2/app-beps -S | sed -n '1,200p'

echo "== app-beps convex files =="
git ls-types typescript2/app-beps/convex -q || true
git ls-files typescript2/app-beps/convex | sed -n '1,200p'
for f in $(git ls-files typescript2/app-beps/convex | sed -n '1,120p'); do
  echo "--- $f"
  sed -n '1,120p' "$f"
done

echo "== workflow/deploy mentions =="
rg -n "convex deploy|bunx convex|typescript2/app-beps|convex:deploy|baml:generate" . --glob '!baml_language/**' --glob '!node_modules/**' --glob '!dist/**' --glob '!build/**' | sed -n '1,200p'

Repository: BoundaryML/baml

Length of output: 50373


Generate the BAML SDK before deploying Convex.

baml_sdk/ is ignored, but convex/analysisJobsNode.ts imports it for AnalysisVersionChanges_async. baml:generate only runs for dev and build, and convex deploy does not source package.json scripts automatically, so use a deploy wrapper such as bun run baml:generate && convex deploy for standalone deployments.

[st稳定性_and_availability]

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@typescript2/app-beps/package.json` around lines 6 - 11, Add a dedicated
Convex deployment script that runs baml:generate before invoking convex deploy,
ensuring baml_sdk exists for convex/analysisJobsNode.ts imports. Keep the
existing dev and build scripts unchanged, and make the wrapper usable for
standalone deployments.

Comment on lines +24 to +46
curl -fsSL "https://pkg.boundaryml.com/manifest/v1/wrapper.json" -o "$manifest"

url="$(node -e 'const artifact = JSON.parse(require("fs").readFileSync(process.argv[1], "utf8")).artifacts[process.argv[2]]; if (artifact) process.stdout.write(artifact.url)' "$manifest" "$target")"
expected_sha256="$(node -e 'const artifact = JSON.parse(require("fs").readFileSync(process.argv[1], "utf8")).artifacts[process.argv[2]]; if (artifact) process.stdout.write(artifact.sha256)' "$manifest" "$target")"
if [ -z "$url" ] || [ -z "$expected_sha256" ]; then
echo "error: BAML wrapper manifest has no artifact for $target" >&2
exit 3
fi

curl -fsSL "$url" -o "$archive"
if command -v sha256sum >/dev/null 2>&1; then
actual_sha256="$(sha256sum "$archive" | awk '{print $1}')"
else
actual_sha256="$(shasum -a 256 "$archive" | awk '{print $1}')"
fi
if [ "$actual_sha256" != "$expected_sha256" ]; then
echo "error: BAML wrapper checksum mismatch" >&2
exit 4
fi

tar -xzf "$archive" -C "$tmp"
export BAML_HOME="$tmp/home"
"$tmp/bin/baml" toolchain use "$toolchain_version"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Pin a trusted wrapper digest.

The manifest supplies both the executable URL and its expected hash, so a compromised manifest service can replace both and execute arbitrary code in CI/Vercel at Line 46. Commit trusted per-platform artifact hashes/URLs, or verify a signed, version-pinned manifest before downloading.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@typescript2/app-beps/scripts/generate-baml.sh` around lines 24 - 46, Update
the wrapper download flow around the manifest lookup and archive verification to
avoid trusting URLs and SHA-256 values supplied solely by the live manifest. Use
committed, version-pinned trusted artifact URLs and hashes for each supported
platform, or validate a signed, pinned manifest before downloading; ensure
"$tmp/bin/baml" is executed only after that trusted verification succeeds.

Merged via the queue into canary with commit b98f9b1 Jul 30, 2026
38 checks passed
@sxlijin
sxlijin deleted the agent/migrate-beps-to-baml-v1 branch July 30, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant