chore: migrate BEPs analysis to BAML v1 - #4288
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThe 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. ChangesBEPs BAML migration
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
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
⏭️ Performance benchmarks were skippedPerf benchmarks (CodSpeed) are opt-in on pull requests — they no longer run on every push. They always run automatically after merge to To run them on this PR, do any of the following, then push a commit (or re-run CI):
|
8d167af to
f0f2649
Compare
f0f2649 to
1075199
Compare
1075199 to
e753269
Compare
There was a problem hiding this comment.
💡 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/ |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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
⛔ Files ignored due to path filters (3)
typescript2/app-beps/bun.lockis excluded by!**/*.locktypescript2/app-beps/package-lock.jsonis excluded by!**/package-lock.jsontypescript2/pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (27)
typescript2/app-beps/.gitignoretypescript2/app-beps/README.mdtypescript2/app-beps/baml.tomltypescript2/app-beps/baml_client/async_client.tstypescript2/app-beps/baml_client/async_request.tstypescript2/app-beps/baml_client/config.tstypescript2/app-beps/baml_client/globals.tstypescript2/app-beps/baml_client/index.tstypescript2/app-beps/baml_client/inlinedbaml.tstypescript2/app-beps/baml_client/parser.tstypescript2/app-beps/baml_client/partial_types.tstypescript2/app-beps/baml_client/sync_client.tstypescript2/app-beps/baml_client/sync_request.tstypescript2/app-beps/baml_client/tracing.tstypescript2/app-beps/baml_client/type_builder.tstypescript2/app-beps/baml_client/types.tstypescript2/app-beps/baml_client/watchers.tstypescript2/app-beps/baml_src/clients.bamltypescript2/app-beps/baml_src/generators.bamltypescript2/app-beps/baml_src/types.bamltypescript2/app-beps/baml_src/version_analysis.bamltypescript2/app-beps/convex.jsontypescript2/app-beps/convex/analysisJobsNode.tstypescript2/app-beps/eslint.config.mjstypescript2/app-beps/package.jsontypescript2/app-beps/scripts/generate-baml.shtypescript2/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
| "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", |
There was a problem hiding this comment.
🩺 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; fiRepository: 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:
- 1: https://docs.convex.dev/cli/reference/deploy
- 2: https://docs.convex.dev/cli/overview
- 3: https://docs.convex.dev/cli/reference/deploy.md
- 4: https://github.com/get-convex/convex-js/blob/main/src/cli/deploy.ts
- 5: https://docs.convex.dev/cli/agent-mode
- 6: https://docs.convex.dev/production/multiple-deployments
- 7: https://github.com/pingdotgg/lawn/blob/main/docs/deployment.md
- 8: https://mintlify.wiki/pingdotgg/lawn/setup/deployment
- 9: https://github.com/rahmanef63/resource-site/blob/main/scripts/deploy-convex-functions.mjs
🏁 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.
| 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" |
There was a problem hiding this comment.
🔒 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.
Summary
baml_sdkWhy
BEPs version analysis was still using the legacy generated client from
engine/. This moves the feature to the currentbaml_language/toolchain and makes deployment builds generate the SDK reproducibly.Validation
baml checkpnpm install --frozen-lockfilebaml_sdkSummary by CodeRabbit
New Features
Documentation
Chores