Skip to content

fix(promptfiddle): compare log decorations by byte length#3621

Open
xuyua9 wants to merge 1 commit into
BoundaryML:canaryfrom
xuyua9:fix/wasm-log-decoration-byte-length-xuyua9
Open

fix(promptfiddle): compare log decorations by byte length#3621
xuyua9 wants to merge 1 commit into
BoundaryML:canaryfrom
xuyua9:fix/wasm-log-decoration-byte-length-xuyua9

Conversation

@xuyua9

@xuyua9 xuyua9 commented May 31, 2026

Copy link
Copy Markdown

Summary

  • Match the WASM playground log-decoration heuristic to the WebSocket path by comparing UTF-8 byte length.
  • Rust source spans are byte offsets, so this avoids hiding inline log decorations for non-ASCII values.

Testing

  • git diff --check
  • targeted static check that the worker no longer compares message.length > sourceSpanLength
  • node smoke test showing a non-ASCII value (你好世界) is detected by UTF-8 byte length where UTF-16 code-unit length failed

Summary by CodeRabbit

  • Bug Fixes
    • Improved accuracy of inline log display in the editor by fixing byte-length calculation logic.

@vercel

vercel Bot commented May 31, 2026

Copy link
Copy Markdown

@xuyua9 is attempting to deploy a commit to the Boundary Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented May 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0b7c9798-51e2-418a-b645-0e07f5801508

📥 Commits

Reviewing files that changed from the base of the PR and between 066b6cb and d5808dc.

📒 Files selected for processing (1)
  • typescript2/app-promptfiddle/src/playground/baml-lsp-worker.ts

📝 Walkthrough

Walkthrough

This PR updates the log-decoration heuristic in the BAML LSP worker to correctly compare UTF-8 byte lengths. A module-level TextEncoder is introduced, and the comparison logic now computes the byte length of formatted log messages using UTF-8 encoding instead of JavaScript string length, aligning with how Rust reports source span byte offsets.

Changes

UTF-8 byte length encoding for log decorations

Layer / File(s) Summary
UTF-8 byte length encoding and comparison
typescript2/app-promptfiddle/src/playground/baml-lsp-worker.ts
Module-level TextEncoder constant added and log-decoration heuristic updated to compute UTF-8 byte length of formatted messages and compare against Rust source span byte offsets.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A encoder takes the stage so fine,
UTF-8 bytes in perfect line,
Log decorations now align,
With Rust's true span—no more design! 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing log decoration comparison logic by switching from UTF-16 string length to UTF-8 byte length comparison.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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 and usage tips.

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