Skip to content

Conversation

@imalsogreg
Copy link
Collaborator

fix up compiled library for non-nix systems

flake musl

baml-runtime package

@vercel
Copy link

vercel bot commented Oct 6, 2025

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

Project Deployment Preview Comments Updated (UTC)
promptfiddle Ready Ready Preview Comment Oct 6, 2025 5:59am

@entelligence-ai-pr-reviews
Copy link

🔒 Entelligence AI Vulnerability Scanner

No security vulnerabilities found!

Your code passed our comprehensive security analysis.


@entelligence-ai-pr-reviews
Copy link

Review Summary

🏷️ Draft Comments (2)

Skipped posting 2 draft comments that were valid but scored below your review threshold (>=10/15). Feel free to update them here.

engine/language_client_typescript/build.rs (2)

48-48: napi_build::setup() is always called, even if the custom symlink logic runs, which may cause duplicate or conflicting build steps on systems where the env vars are set.

📊 Impact Scores:

  • Production Impact: 3/5
  • Fix Specificity: 2/5
  • Urgency Impact: 2/5
  • Total Score: 7/15

🤖 AI Agent Prompt (Copy & Paste Ready):

In engine/language_client_typescript/build.rs, on line 48, the unconditional call to `napi_build::setup()` means it runs even when the custom symlink logic (lines 11-46) is executed, potentially causing duplicate/conflicting build steps. Refactor the code so that `napi_build::setup()` is only called if the custom env var logic does NOT run (i.e., in the else branch).

11-46: tmp_path, pkg_name, and out_dir are taken directly from environment variables and used in filesystem operations without validation, allowing path traversal or symlink attacks if an attacker controls these env vars.

📊 Impact Scores:

  • Production Impact: 3/5
  • Fix Specificity: 2/5
  • Urgency Impact: 3/5
  • Total Score: 8/15

🤖 AI Agent Prompt (Copy & Paste Ready):

In engine/language_client_typescript/build.rs, lines 11-46, environment variables `TYPE_DEF_TMP_PATH`, `CARGO_PKG_NAME`, and `OUT_DIR` are used directly in filesystem operations, which could allow path traversal or symlink attacks if an attacker controls these env vars. Add validation to ensure these variables do not contain `..`, absolute paths, or path separators before using them. If validation fails, panic with an error. Apply the fix to the relevant block.

Comment on lines +346 to +349
src = let
wheelDir = "${packages.pyLib}/lib";
wheelFile = builtins.head (builtins.attrNames (builtins.readDir wheelDir));
in "${wheelDir}/${wheelFile}";

Choose a reason for hiding this comment

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

correctness: pkgs.python3Packages.buildPythonPackage uses a dynamic wheel filename, but src is set using builtins.head (builtins.attrNames (builtins.readDir wheelDir)), which is non-deterministic and may select the wrong file if multiple wheels exist, causing incorrect or failed builds.

🤖 AI Agent Prompt for Cursor/Windsurf

📋 Copy this prompt to your AI coding assistant (Cursor, Windsurf, etc.) to get help fixing this issue

In flake.nix, lines 346-349, the code for setting the wheel file for the Python package uses 'builtins.head (builtins.attrNames (builtins.readDir wheelDir))', which is non-deterministic and may select the wrong file if multiple files exist. Update this logic to filter for files ending with '.whl' and throw an error if none are found, ensuring the correct wheel is always used. Replace the snippet with the following:
src = let
  wheelDir = "${packages.pyLib}/lib";
  wheelFiles = builtins.filter (n: pkgs.lib.hasSuffix ".whl" n) (builtins.attrNames (builtins.readDir wheelDir));
  wheelFile = if wheelFiles == [] then throw "No wheel file found in ${wheelDir}" else builtins.head wheelFiles;
in "${wheelDir}/${wheelFile}";
📝 Committable Code Suggestion

‼️ Ensure you review the code suggestion before committing it to the branch. Make sure it replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
src = let
wheelDir = "${packages.pyLib}/lib";
wheelFile = builtins.head (builtins.attrNames (builtins.readDir wheelDir));
in "${wheelDir}/${wheelFile}";
src = let
wheelDir = "${packages.pyLib}/lib";
wheelFiles = builtins.filter (n: pkgs.lib.hasSuffix ".whl" n) (builtins.attrNames (builtins.readDir wheelDir));
wheelFile = if wheelFiles == [] then throw "No wheel file found in ${wheelDir}" else builtins.head wheelFiles;
in "${wheelDir}/${wheelFile}";

@github-actions
Copy link

github-actions bot commented Oct 6, 2025

flake improvements

fix up compiled library for non-nix systems

flake musl

baml-runtime package
@imalsogreg imalsogreg force-pushed the greg/flake-improvements branch from e8d4ef0 to 41a9da0 Compare October 6, 2025 05:25
@imalsogreg imalsogreg temporarily deployed to boundary-tools-dev October 6, 2025 05:25 — with GitHub Actions Inactive
@imalsogreg imalsogreg temporarily deployed to boundary-tools-dev October 6, 2025 05:25 — with GitHub Actions Inactive
@imalsogreg imalsogreg temporarily deployed to boundary-tools-dev October 6, 2025 05:25 — with GitHub Actions Inactive
@github-actions
Copy link

github-actions bot commented Oct 6, 2025

@codecov
Copy link

codecov bot commented Oct 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@imalsogreg imalsogreg added this pull request to the merge queue Oct 6, 2025
Merged via the queue into canary with commit a2f2b96 Oct 6, 2025
24 of 25 checks passed
@imalsogreg imalsogreg deleted the greg/flake-improvements branch October 6, 2025 05:46
@github-actions
Copy link

github-actions bot commented Oct 6, 2025

AntennaeVY pushed a commit to AntennaeVY/baml that referenced this pull request Oct 16, 2025
fix up compiled library for non-nix systems

flake musl

baml-runtime package
AntennaeVY pushed a commit to AntennaeVY/baml that referenced this pull request Oct 16, 2025
fix up compiled library for non-nix systems

flake musl

baml-runtime package
AntennaeVY pushed a commit to AntennaeVY/baml that referenced this pull request Oct 17, 2025
fix up compiled library for non-nix systems

flake musl

baml-runtime package
AntennaeVY added a commit to AntennaeVY/baml that referenced this pull request Oct 17, 2025
commit 351017d
Author: Tianzhi Jin <[email protected]>
Date:   Thu Oct 16 07:12:46 2025 +0800

    Correct link in README.md (BoundaryML#2615)

    Signed-off-by: Tianzhi Jin <[email protected]>

commit ddb1272
Author: Greg Hale <[email protected]>
Date:   Wed Oct 15 15:26:07 2025 -0700

    Rename emit to watch (BoundaryML#2614)

commit 7037524
Author: Sam Lijin <[email protected]>
Date:   Wed Oct 15 10:36:58 2025 -0700

    chore: remove some cargo warnings (BoundaryML#2617)

commit 700bd39
Author: aaronvg <[email protected]>
Date:   Tue Oct 14 15:00:27 2025 -0700

    actually emit the version when opening baml file (BoundaryML#2612)

    <!-- CURSOR_SUMMARY -->
    > [!NOTE]
    > Emit generator version on BAML file open and track the last active
    BAML file in VS Code to scope version updates; improve reload/logging
    and simplify debug/telemetry handling.
    >
    > - **Engine (LSP)**:
    > - **didOpen**: Reload project and send `baml_src_generator_version`;
    add tracing around generator version retrieval.
    > - **didSave**: Add info log when no generator version map is
    available.
    > - **Session.reload**: Enhance logging (per-project and total file
    counts) during initial reload.
    > - **VS Code Extension**:
    > - **Active file tracking**: Introduce `LAST_ACTIVE_BAML_FILE` and
    update it on cursor selection; use it to validate
    `baml_src_generator_version` root before acting.
    > - **Debug/telemetry**: Replace `isDebugOrTestSession` with
    `isDebugMode`; always initialize telemetry; adjust disposal condition;
    add debug-mode CLI logs.
    >
    > <sup>Written by [Cursor
    Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
    95dc502. This will update automatically
    on new commits. Configure
    [here](https://cursor.com/dashboard?tab=bugbot).</sup>
    <!-- /CURSOR_SUMMARY -->

commit 07a0bb6
Author: Sam Lijin <[email protected]>
Date:   Tue Oct 14 12:35:28 2025 -0700

    feat/unreleased: annotate viz nodes using //# not # (BoundaryML#2610)

commit ac0ede8
Author: aaronvg <[email protected]>
Date:   Mon Oct 13 16:08:51 2025 -0700

    Fix issue where a test would stay stuck in running if there was a wasm panic (BoundaryML#2601)

    - Fixes also stop buttons
    - Fixes telemetry

    <!-- CURSOR_SUMMARY -->
    ---

    > [!NOTE]
    > Adds WASM panic -> JS callback handling, test Stop/cancel controls
    with auto-cancel on panic, and LSP/VSCode generator/version telemetry
    with smarter CLI resolution.
    >
    > - **WASM Runtime/Runtime Bridge**:
    > - Replace simple panic hook with custom `std::panic::set_hook` that
    notifies JS via `__onWasmPanic` then calls `console_error_panic_hook`.
    >   - Expose `on_wasm_panic(msg: &str)` to JS.
    > - **Language Server + VSCode Extension**:
    > - Extend `baml_src_generator_version` payload to include `generators`
    metadata and send it from server.
    > - VSCode client: store version + generators; add periodic
    `baml.version_report` telemetry; wrap CLI resolution in
    `trackCliResolution` with success/failure/error events; reduce/target
    webview telemetry to key commands.
    > - Swap 30s polling to `publishBamlVersionReport` and add scheduled
    reports; telemetry reporter logs events.
    > - **Playground (UI/Tests)**:
    > - Introduce WASM panic atoms/hooks (`wasmPanicAtom`,
    `useWasmPanicHandler`); optional `WasmPanicNotification` component; wire
    handler in app.
    > - Auto-cancel running tests on panic; clear panic on new runs;
    propagate cancel via `AbortController`.
    > - Add Stop/Run toggle buttons across toolbar, cards, tables, sidebar,
    and menu; improve per-test cancel behavior and labels.
    > - Error UX: new WASM panic renderer in `EnhancedErrorRenderer`; minor
    scrolling/height tweaks.
    > - **Package/Exports**:
    > - Export new atoms and `WasmPanicNotification` from
    `@baml/playground-common`.
    >
    > <sup>Written by [Cursor
    Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
    26bad01. This will update automatically
    on new commits. Configure
    [here](https://cursor.com/dashboard?tab=bugbot).</sup>
    <!-- /CURSOR_SUMMARY -->

commit 5202bbd
Author: Sam Lijin <[email protected]>
Date:   Mon Oct 13 15:22:01 2025 -0700

    chore: fix some integ tests (BoundaryML#2607)

    openai batch is not a meaningful test, remove LLM deps for the others

commit af24513
Author: Fern Support <[email protected]>
Date:   Sun Oct 12 16:43:59 2025 -0400

    Update Fern CLI to configure settings from docs.yml (BoundaryML#2606)

    These settings were previously controlled in an internal configuration.
    Now, we have transferred these settings to be controllable from the
    `docs.yml`. This PR adds the settings currently enabled in the internal
    configuration for Boundary to the `docs.yml` file.

    We will be deprecating the internal configuration in the coming weeks.
    Please merge to avoid any disruption in these settings.

    ---------

    Signed-off-by: Fern Support <[email protected]>

commit cfa2034
Author: Greg Hale <[email protected]>
Date:   Sat Oct 11 20:41:39 2025 -0700

    chore: Bump version to 0.211.2 (BoundaryML#2604)

    Bump version to 0.211.2

    ❌ Typescript integ tests
    ❌ Python integ tests

    Generated by bump-version script.

commit 39b1cf6
Author: Greg Hale <[email protected]>
Date:   Sat Oct 11 19:29:52 2025 -0700

    Fix emit ts codegen bug (BoundaryML#2603)

    This fixes a bug in the 0.211.1 release in which events.ts is generated
    conditionally on the existence of an `@emit` in the user's baml source,
    but importing `event.ts` is unconditional (causing a module lookup
    error).

commit 666c36f
Author: Greg Hale <[email protected]>
Date:   Fri Oct 10 16:30:24 2025 -0700

    Implement streaming for emit values (BoundaryML#2595)

    This works (although it uses the toy emitter from BoundaryML#2593, real dependency
    tracking in the VM is WIP), meaning that when values are emitted,
    streams are emitted too, and when the stream is from an assignment of an
    LLM function return value to a variable, the chunks are streamed.

    I will take some time to see if it can be simplified (the implementation
    is more complicated than I'd like).

commit 2fdbf8e
Author: Greg Hale <[email protected]>
Date:   Fri Oct 10 14:38:49 2025 -0700

    use protoc-gen-go 1.34.2 in flake (BoundaryML#2600)

    Gets in line with the protoc-gen-go version used elsewhere on the team,
    to avoid repeatedly changed generated client code.

commit f0230d0
Author: Samuel Lijin <[email protected]>
Date:   Fri Oct 10 13:52:08 2025 -0700

    chore: bump version to 0.211.1 (BoundaryML#2599)

commit 10fd013
Author: Roey Ben Chaim <[email protected]>
Date:   Fri Oct 10 11:33:25 2025 -0700

    feat: added endpoint_url to amazon bedrock (BoundaryML#2555)

    Added support to endpoint_url when calling amazon bedrock. This is
    needed to support private endpoints behind VPCs on aws.

    ---------

    Signed-off-by: Roey Ben Chaim <[email protected]>
    Co-authored-by: Sam Lijin <[email protected]>

commit 40bc568
Author: Greg Hale <[email protected]>
Date:   Wed Oct 8 12:25:49 2025 -0700

    Typescript codegen for emit (BoundaryML#2593)

    - Add codegen for emitted variables
    - Sketch of client-side implementation and FFI for integrating with
    generated code
    - Toy event emitter in the THIR interpreter (enough to play with emit
    internally, but very broken)

commit 73bc201
Author: Eric Winer <[email protected]>
Date:   Wed Oct 8 13:23:46 2025 -0400

    Docs: fix TypeScript tool call example (BoundaryML#2550)

    The TypeScript example at
    https://docs.boundaryml.com/examples/prompt-engineering/tools-function-calling#create-an-agent-that-utilizes-these-tools
    had broken syntax. This change cleans up that example, showing that
    union type resolution works out of the box, and attempts to maintain the
    original intent.

    I've tested it locally – AFAIK there's no automated testing on example
    code in the docs at this point.

    <!-- CURSOR_SUMMARY -->
    ---

    > [!NOTE]
    > Fixes the TypeScript agent example by correcting the import path and
    replacing broken conditionals with intent-based switch handling for
    `WeatherAPI` and `CalculatorAPI`.
    >
    > - **Docs – TypeScript agent example
    (`fern/01-guide/06-prompt-engineering/tools.mdx`)**:
    > - **Agent loop logic**: Replace broken mixed conditionals with a clean
    `switch (toolResponse.intent)` handling `"weather_request"` and
    `"basic_calculator"`, routing to `handleWeather`/`handleCalculator` with
    proper `break`s.
    > - **Types**: Remove ad-hoc type checks/casts in favor of intent-based
    dispatch and direct handler calls.
    > - **Imports**: Fix incorrect path from `"@/baml-client/types"` to
    `"@/baml_client/types"`.
    >
    > <sup>Written by [Cursor
    Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
    18ce880. This will update automatically
    on new commits. Configure
    [here](https://cursor.com/dashboard?tab=bugbot).</sup>
    <!-- /CURSOR_SUMMARY -->

    Co-authored-by: aaronvg <[email protected]>

commit 8074499
Author: Caio Lang <[email protected]>
Date:   Wed Oct 8 14:23:38 2025 -0300

    Docs | Fix variable name of LLM response in modular-api.mdx docs (BoundaryML#2579)

    Just a small typo in an example variable name :)

    Didn't find any specific guidelines for small doc fixes on
    `CONTRIBUTING.md`, please let me know if I should do anything
    differently.

    <!-- CURSOR_SUMMARY -->
    ---

    > [!NOTE]
    > Corrects Python example to parse LLM response from `res.json()`
    instead of undefined `response.json()`.
    >
    > <sup>Written by [Cursor
    Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
    776b2d7. This will update automatically
    on new commits. Configure
    [here](https://cursor.com/dashboard?tab=bugbot).</sup>
    <!-- /CURSOR_SUMMARY -->

    Signed-off-by: Caio Lang <[email protected]>
    Co-authored-by: aaronvg <[email protected]>

commit c322b64
Author: Greg Hale <[email protected]>
Date:   Tue Oct 7 14:38:41 2025 -0700

    remove the BamlRuntime/InternalBamlRuntime split (BoundaryML#2588)

    The API boundary originally established between `BamlRuntime` and
    `InternalBamlRuntime` hasn't been followed, and so the internal runtime
    is now used in many non-internal places. The split between these two
    APIs became confusing.

    So this PR just removes `InternalBamlRuntime` and make `BamlRuntime` the
    main entrypoint to the runtime.

    In the future, we may want to rename this to `LLMRuntime`, to highlight
    the fact that it only serves LLM functions, not more general expression
    functions. Expression functions need their own runtime, which is often
    aliased to `CoreBamlRuntime`. Renaming `BamlRuntime` to `LLMRuntime`
    would remove this additional confusing name.

commit e4ae745
Author: aaronvg <[email protected]>
Date:   Tue Oct 7 13:05:34 2025 -0700

    chore: Bump version to 0.211.0 (BoundaryML#2589)

    Bump version to 0.211.0

    ❌ Typescript integ tests
    ❌ Python integ tests

    Generated by bump-version script.

    <!-- CURSOR_SUMMARY -->
    ---

    > [!NOTE]
    > Bumps the project to 0.211.0 with changelog updates, regenerated
    code/artifacts (notably Go CFFI protobuf), a small dependency tweak, and
    refreshed test outputs.
    >
    > - **Release 0.211.0**:
    > - Changelog: multiple bug fixes (compiler diagnostics duplication, CLI
    screen exit, JSON parser, Python log config, env var errors,
    Promptfiddle UI) and tracing improvements; docs updates (description
    tags, Next.js 15).
    > - **Version bumps**:
    > - Updates versions to `0.211.0` across Rust workspace,
    Go/Python/Ruby/TypeScript clients, VS Code/JetBrains plugins, and integ
    test generators/configs.
    > - **Codegen/Artifacts**:
    > - Regenerates Go `cffi.pb.go` (protoc-gen-go output changes) and
    updates various inlined/generator files.
    > - **Dependencies**:
    > - `dir-writer`: switch `pathdiff` from `0.2.3` to `0.1.0` in
    Cargo.lock.
    > - **Tests/Reports**:
    > - Refreshes TypeScript JUnit report and test suites; updates
    integration test snapshots/outputs to reflect new release.
    >
    > <sup>Written by [Cursor
    Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
    5a5f23b. This will update automatically
    on new commits. Configure
    [here](https://cursor.com/dashboard?tab=bugbot).</sup>
    <!-- /CURSOR_SUMMARY -->

commit 5e8371a
Author: aaronvg <[email protected]>
Date:   Mon Oct 6 22:50:32 2025 -0700

    sep 29 studio (BoundaryML#2576)

    - **type fixes**
    - **use blak3 hash when hashing blobs**
    - **fix streams being null in studio**
    - **http metadata was serialized incorrectly**
    - **Fix issue with python exceptions not counting as exceptions in
    studio, http bodies serialized as byte arrays, add test for checking
    publisher spans**

    <!-- CURSOR_SUMMARY -->
    ---

    > [!NOTE]
    > Switches blob hashing to blake3, fixes HTTP body serialization and
    Python exception handling, adds trace function
    summaries/match-highlights and blob fetch API, enables optional trace
    event file dump, and adjusts stream/function end payloads.
    >
    > - **Tracing/Serialization**:
    > - Serialize `HTTPBody.raw` bytes as UTF-8 string with flexible
    deserializer; fix HTTP metadata typing and headers shapes.
    > - Treat Python exceptions as errors in function end events; propagate
    proper error to tracer.
    > - Stream end events now carry parsed value meta instead of always
    null.
    > - Optional local trace dump via `BAML_TRACE_FILE` (writes
    newline-delimited JSON events).
    > - **Blobs**:
    >   - Use `blake3` for blob hashing; replace SHA-256 and add dependency.
    > - New UI API/types `ui_blobs` with `GetBlobRequest/Response` and
    `BlobFormat`.
    > - **UI/Types**:
    > - TS type refinements (`any` -> `unknown`, header maps stricter) and
    added `http_metadata_summary`.
    > - Traces API: add `matched_descendant_ids` field and
    `include_match_highlights` flag.
    > - New endpoint: `/v1/traces/function-summaries` with request/response
    and `FunctionSummary` aggregates.
    > - **Tests/Infra**:
    > - Python tests verify publisher span counts via file, adjust stream
    test name, and add session flush.
    >   - Ignore trace debug files in git.
    >
    > <sup>Written by [Cursor
    Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
    29e202f. This will update automatically
    on new commits. Configure
    [here](https://cursor.com/dashboard?tab=bugbot).</sup>
    <!-- /CURSOR_SUMMARY -->

    ---------

    Signed-off-by: aaronvg <[email protected]>

commit 5b87fb5
Author: Greg Hale <[email protected]>
Date:   Mon Oct 6 20:08:54 2025 -0700

    Env Var check override (BoundaryML#2587)

    Fixes a promptfiddle issue due to checking required env vars, while env
    vars aren't actually required in promptfiddle.

    Does so by disabling the env var check whenever a proxy server is
    specified.

commit 69e4fba
Author: Greg Hale <[email protected]>
Date:   Mon Oct 6 15:51:11 2025 -0700

    Use Expr Runtimes (BoundaryML#2562)

    - Delete the old IR interpreter
    - Replace it with configurable VM bytecode interpreter / THIR
    interpreter
     - Delete code paths that merge LLM fn's and expr_fns
    - Update frontends (UI, baml-cli test) to accommodate the deleted code
    paths above

commit 007034c
Author: hellovai <[email protected]>
Date:   Mon Oct 6 12:53:40 2025 -0700

    Create citation cff file (BoundaryML#2580)

    Add a `CITATION.cff` file to enable easy and standardized citation of
    the BAML project.

    ---
    [Slack
    Thread](https://gloo-global.slack.com/archives/C09F3QMJE9G/p1759779378413399?thread_ts=1759779378.413399&cid=C09F3QMJE9G)

    <a
    href="https://cursor.com/background-agent?bcId=bc-4c1e8f0b-60b5-49af-8311-0b31f1bdc470"><picture><source
    media="(prefers-color-scheme: dark)"
    srcset="https://cursor.com/open-in-cursor-dark.svg"><source
    media="(prefers-color-scheme: light)"
    srcset="https://cursor.com/open-in-cursor-light.svg"><img alt="Open in
    Cursor"
    src="https://cursor.com/open-in-cursor.svg"></picture></a>&nbsp;<a
    href="https://cursor.com/agents?id=bc-4c1e8f0b-60b5-49af-8311-0b31f1bdc470"><picture><source
    media="(prefers-color-scheme: dark)"
    srcset="https://cursor.com/open-in-web-dark.svg"><source
    media="(prefers-color-scheme: light)"
    srcset="https://cursor.com/open-in-web-light.svg"><img alt="Open in Web"
    src="https://cursor.com/open-in-web.svg"></picture></a>

    ---------

    Co-authored-by: Cursor Agent <[email protected]>

commit 5ea6adb
Author: Antonio Sarosi <[email protected]>
Date:   Mon Oct 6 20:29:56 2025 +0200

    Add specific error for missing required env vars in clients (BoundaryML#2570)

    Issues: BoundaryML#2054 and BoundaryML#2055

commit a2f2b96
Author: Greg Hale <[email protected]>
Date:   Sun Oct 5 22:35:25 2025 -0700

    flake improvements (BoundaryML#2577)

    fix up compiled library for non-nix systems

    flake musl

    baml-runtime package

commit c1a0b0e
Author: aaronvg <[email protected]>
Date:   Sun Oct 5 14:50:52 2025 -0700

    Fix json parser in cases where it would output intermediate representations (BoundaryML#2572)

    Summary

    Issue: GitHub BoundaryML#2567 - Streaming Bug: Parsing Artifacts in Partial
    Objects

    Root Cause: When BAML's streaming API encounters ambiguous/incomplete
    JSON during parsing, it creates an AnyOf value that contains multiple
    possible
    interpretations plus the original raw string. When this AnyOf value
    needs to be coerced to a string field, the coerce_string function was
    calling
    v.to_string() which uses the Display implementation. This caused
    internal parsing representations like "AnyOf[{,AnyOf[{,{},],]" to leak
    into the final
       output instead of using the original string content.

    Fix Location:
    /Users/aaronvillalpando/Projects/baml/engine/baml-lib/jsonish/src/deserializer/coercer/coerce_primitive.rs:150-159

    Fix Applied: Added explicit handling for Value::AnyOf in the
    coerce_string function to extract the original string (the second field
    of the AnyOf
      variant) instead of using the Display implementation.

      Tests Added:
    1. Unit test test_coerce_anyof_to_string in coerce_primitive.rs that
    directly tests the fix
    2. Integration tests test_streaming_anyof_string_field and
    test_streaming_anyof_with_markdown_partial in test_streaming.rs

    All 458 existing tests still pass, confirming the fix doesn't break any
    existing functionality.

    <!-- CURSOR_SUMMARY -->
    ---

    > [!NOTE]
    > Handle `AnyOf` during string coercion to prevent leaking parsing
    artifacts and add unit/streaming regression tests.
    >
    > - **Deserializer**:
    > - **`coerce_string`** in
    `engine/baml-lib/jsonish/src/deserializer/coercer/coerce_primitive.rs`:
    add explicit handling for `Value::AnyOf`, preferring a `String` variant
    if present; otherwise fall back to the original raw string. Preserve
    `Incomplete` flag.
    > - **Tests**:
    > - Unit: `test_coerce_anyof_to_string`,
    `test_coerce_anyof_to_string_no_string_variant` in
    `coerce_primitive.rs`.
    > - Streaming: `test_streaming_anyof_string_field`,
    `test_streaming_anyof_with_markdown_partial` in
    `engine/baml-lib/jsonish/src/tests/test_streaming.rs`.
    >
    > <sup>Written by [Cursor
    Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
    3ab0f6d. This will update automatically
    on new commits. Configure
    [here](https://cursor.com/dashboard?tab=bugbot).</sup>
    <!-- /CURSOR_SUMMARY -->

commit 7d31c37
Author: aaronvg <[email protected]>
Date:   Sun Oct 5 13:31:48 2025 -0700

    [Promptfiddle] fix play button disappearing (BoundaryML#2571)

    <!-- CURSOR_SUMMARY -->
    > [!NOTE]
    > Ensures the playground pane maintains full height (preventing controls
    from disappearing) and narrows the project sidebar width.
    >
    > - **Frontend/UI**:
    > - **Playground layout**: Use `h-full` instead of `flex-1` in
    `ProjectView.tsx` and add `min-h-0` to `PromptPreview`'s
    `SidebarProvider` to prevent overflow and keep controls visible.
    > - **Sidebar**: Change `ProjectSidebar` width from `w-64` to
    `w-[200px]`.
    >
    > <sup>Written by [Cursor
    Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
    9eafcb3. This will update automatically
    on new commits. Configure
    [here](https://cursor.com/dashboard?tab=bugbot).</sup>
    <!-- /CURSOR_SUMMARY -->

commit 5a8de50
Author: José Rafael Oses <[email protected]>
Date:   Sun Oct 5 15:53:05 2025 -0400

    fix(compiler): duplicate diagnostics when typechecking (BoundaryML#2535)

    Closes: BoundaryML#2511

    Fixes the fact that we were emitting diagnostics for error branches that
    already had emitted a diagnostic

    ---------

    Co-authored-by: Antonio Sarosi <[email protected]>

commit b911a19
Author: Greg Hale <[email protected]>
Date:   Fri Oct 3 09:14:25 2025 -0700

    Properly leave the secondary screen after non-erroring baml-cli init (BoundaryML#2565)

    Fixes BoundaryML#2564
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.

2 participants