Skip to content

Improved stdlib matrix app - #4349

Merged
2kai2kai2 merged 12 commits into
canaryfrom
kai/stdlib-similarity-matrix
Aug 8, 2026
Merged

Improved stdlib matrix app#4349
2kai2kai2 merged 12 commits into
canaryfrom
kai/stdlib-similarity-matrix

Conversation

@2kai2kai2

@2kai2kai2 2kai2kai2 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor
  • Fixes CI deployment issues
  • Use expanded typescript API surface across both node and web
  • LLM judgement only, no name-based matching as it was not a very reliable heuristic
  • baml describe gets a --search flag which will also fuzzy-search doc comments
  • Improved tool-calling loop for determining what BAML code would be equivalent to each typescript standard library item.

Summary by CodeRabbit

  • New Features
    • Added symbol and documentation search to baml describe, with ranked results, limits, text/JSON output, and suggestions.
    • Added session-based standard library alignment with filtering, iterative investigation, validation, retries, and failure reporting.
    • Added read-only inspection tools for symbols, examples, documentation, and type-system guidance.
    • Added richer matrix visualizations for matches, divergences, unnecessary items, missing counterparts, and unjudged symbols.
  • Improvements
    • Expanded TypeScript coverage across modules, namespaces, functions, and members.
    • Improved report handling, coverage tracking, revision reuse, diagnostics, and deployment validation.
  • Documentation
    • Updated CLI help and standard library matrix guidance.

Now has both web and node modules, and they are better categorized
Also added "unnecessary" classification
It was an unreliable heuristic that is better achieved by just letting
the LLM decide and provide documentation
If an agent doesn't know the exact name of something it can try to find
items that talk about the concept.
@vercel

vercel Bot commented Aug 7, 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 Aug 8, 2026 12:15am
promptfiddle2 Ready Ready Preview Aug 8, 2026 12:15am

Request Review

@github-actions

github-actions Bot commented Aug 7, 2026

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.

@coderabbitai

coderabbitai Bot commented Aug 7, 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 Plus

Run ID: 1f406da7-bd4e-477a-8657-e5474874c9a8

📥 Commits

Reviewing files that changed from the base of the PR and between 0b9f703 and 1304b1c.

📒 Files selected for processing (11)
  • .github/workflows/stdlib-matrix.yml
  • baml_language/crates/baml_cli/src/describe_search.rs
  • tools/stdlib-matrix/baml_src/align.baml
  • tools/stdlib-matrix/baml_src/entry.baml
  • tools/stdlib-matrix/baml_src/models.baml
  • tools/stdlib-matrix/baml_src/references.baml
  • tools/stdlib-matrix/baml_src/symbols.baml
  • tools/stdlib-matrix/baml_src/tests.baml
  • tools/stdlib-matrix/baml_src/toolbox.baml
  • tools/stdlib-matrix/run
  • typescript2/app-stdlib-matrix/src/components/matrix-symbol.ts
💤 Files with no reviewable changes (1)
  • tools/stdlib-matrix/baml_src/models.baml
🚧 Files skipped from review as they are similar to previous changes (7)
  • tools/stdlib-matrix/run
  • .github/workflows/stdlib-matrix.yml
  • tools/stdlib-matrix/baml_src/entry.baml
  • baml_language/crates/baml_cli/src/describe_search.rs
  • tools/stdlib-matrix/baml_src/align.baml
  • typescript2/app-stdlib-matrix/src/components/matrix-symbol.ts
  • tools/stdlib-matrix/baml_src/toolbox.baml

📝 Walkthrough

Walkthrough

This PR adds full-text search to baml describe and replaces the stdlib matrix’s BAML-first alignment with TypeScript-first interactive sessions. It updates symbol extraction, report and revision models, workflow validation, markdown output, and the web matrix UI.

Changes

CLI symbol search

Layer / File(s) Summary
Search engine and ranking
baml_language/crates/baml_cli/src/describe_search.rs
Adds whole-word, camelCase-aware search over symbol names, documentation, and paths. Results use weighted ranking, stable ordering, summaries, and limits.
Command integration
baml_language/crates/baml_cli/src/describe_command.rs, baml_language/crates/baml_cli/src/lib.rs
Adds --search and --limit, handles searches before target resolution, and renders text or JSON results.

TypeScript-first stdlib matrix

Layer / File(s) Summary
Surface and symbol extraction
tools/stdlib-matrix/extractors/ts-surface.mjs, tools/stdlib-matrix/baml_src/models.baml, tools/stdlib-matrix/baml_src/ts_symbols.baml, tools/stdlib-matrix/baml_src/ingest.baml, tools/stdlib-matrix/baml_src/surface.baml, tools/stdlib-matrix/baml_src/references.baml
Changes the surface format to module-based version 2 data with containers, functions, metadata, qualified IDs, and explicit symbol origins.
Matrix and revision contracts
tools/stdlib-matrix/baml_src/report.baml, tools/stdlib-matrix/baml_src/revision.baml
Keys judgements by TypeScript symbols, supports multiple BAML counterparts and examples, adds verdict aggregation, and revises carry-forward invalidation rules.
Interactive alignment and toolbox
tools/stdlib-matrix/baml_src/align.baml, tools/stdlib-matrix/baml_src/toolbox.baml, tools/stdlib-matrix/baml_src/entry.baml, tools/stdlib-matrix/run
Replaces proposal, sweep, and verification passes with chunked sessions that use compiler, repository, documentation, and BAML tools. Sessions validate findings, retry incomplete answers, support --only, and report failures.
Rendering and composition visualization
tools/stdlib-matrix/baml_src/render.baml, typescript2/app-stdlib-matrix/src/types.ts, typescript2/app-stdlib-matrix/src/composition.ts, typescript2/app-stdlib-matrix/src/components/*, typescript2/app-stdlib-matrix/src/signature.ts, typescript2/app-stdlib-matrix/src/index.css
Reorients output around TypeScript symbols and adds state-based swatches, one-to-many counterparts, examples, and scaled composition bars.
Workflow, tests, and documentation
.github/workflows/stdlib-matrix.yml, tools/stdlib-matrix/README.md, tools/stdlib-matrix/baml_src/tests.baml
Updates report version handling and coverage-based publication checks. Documentation and tests cover the new surface, sessions, revisions, rendering, tools, and filtering.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant TypeScriptExtractor
  participant AlignmentSessions
  participant BAMLToolbox
  participant Compiler
  participant MatrixReport
  participant MatrixUI
  TypeScriptExtractor->>AlignmentSessions: provide module-qualified symbols
  AlignmentSessions->>BAMLToolbox: request symbol and documentation lookups
  BAMLToolbox->>Compiler: compile returned examples
  Compiler-->>BAMLToolbox: validation diagnostics
  BAMLToolbox-->>AlignmentSessions: tool answers and validation results
  AlignmentSessions->>MatrixReport: store TypeScript-keyed judgements
  MatrixReport->>MatrixUI: provide states, counterparts, and examples
Loading

Possibly related PRs

Poem

A rabbit checks each symbol’s trail,
Through tools and docs, both broad and frail.
BAML links bloom in bars of light,
TypeScript rows now face the right.
Failed sessions leave a trace—
And search hops neatly into place.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 57.14% 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 identifies the main scope: improvements to the standard library matrix application.
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 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch kai/stdlib-similarity-matrix

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.

@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 August 7, 2026 23:16 Inactive

@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: 9

🧹 Nitpick comments (5)
tools/stdlib-matrix/baml_src/align.baml (2)

373-384: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Update the stale comment that names session_final.

No session_final function exists in this file. The final round calls the same session_step, which returns Step, so the model can still return Investigate. The shape of the call does not enforce an answer-only turn; only the prompt text does. Correct the comment so a reader does not assume a schema-level guarantee.

🤖 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 `@tools/stdlib-matrix/baml_src/align.baml` around lines 373 - 384, Update the
comment above the round == lookup_rounds() branch to remove the incorrect
references to session_final and schema-enforced answer-only behavior. State that
the final round still uses session_step and relies on the prompt text to request
an answer without further lookups.

329-349: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove the duplicated documentation paragraph.

Lines 331-333 and lines 347-349 state the same rule twice. Keep one copy.

🤖 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 `@tools/stdlib-matrix/baml_src/align.baml` around lines 329 - 349, Remove the
repeated “A session that will not answer is a failure…” documentation paragraph
from the surrounding session documentation, keeping a single copy while
preserving the other explanatory paragraphs unchanged.
.github/workflows/stdlib-matrix.yml (1)

197-202: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

The coverage gate compares absolute counts across different TypeScript surfaces.

.counts.unjudged is compared directly between the deployed report and this run. The two reports can describe different surfaces: this workflow runs after a release, and a TypeScript or @types/node upgrade adds symbols. New symbols are unjudged until a session reaches them, so unjudged can rise while coverage is equal or better. The gate then blocks publishing, and the deployed report stays stale until someone forces a run.

Compare judged coverage as a proportion of ts_symbols, or skip the comparison when ts_symbols differs between the two reports.

🤖 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 @.github/workflows/stdlib-matrix.yml around lines 197 - 202, Update the
coverage gate around the now and before jq reads to account for differing
TypeScript surfaces: compare unjudged coverage as a proportion of each report’s
ts_symbols, or skip the regression check when ts_symbols values differ. Preserve
the existing failure message and exit behavior only for a genuine proportional
regression.
tools/stdlib-matrix/baml_src/tests.baml (2)

979-985: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

The snippet-compilation test hard-fails when the debug CLI is not built.

baml.sys.panic runs when ../../baml_language/target/debug/baml-cli is missing. Any contributor who runs the suite without first building baml_cli gets a failing test rather than a skipped one. The path also assumes a debug profile and the project directory as the working directory.

If the test framework supports skipping, skip when the binary is absent. Otherwise document the cargo build -p baml_cli --bin baml-cli prerequisite in tools/stdlib-matrix/README.md.

🤖 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 `@tools/stdlib-matrix/baml_src/tests.baml` around lines 979 - 985, Update the
snippet-compilation test around the compiler existence check to skip the test
when the debug baml-cli binary is absent, using the test framework’s supported
skip mechanism instead of baml.sys.panic. Preserve the existing compiler path
and build_toolbox flow when the binary exists; if skipping is unavailable,
document the cargo build prerequisite in the stdlib-matrix README.

877-890: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Align optional fields in Finding literals.

BAML allows omitting optional struct fields, so fixture_finding is valid. Add example: null here if project style prefers all explicit optional assignments in Finding literals.

🤖 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 `@tools/stdlib-matrix/baml_src/tests.baml` around lines 877 - 890, Add the
optional example field explicitly as null in the Finding literal returned by
fixture_finding, matching the project’s convention for fully specifying optional
Finding fields while preserving the existing values.
🤖 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 @.github/workflows/stdlib-matrix.yml:
- Around line 119-125: Update the previous.json parsing around the version
assignment in the matrix workflow to handle jq decode failures without
triggering set -e. Treat malformed or unreadable JSON exactly like an
unsupported report: set the have output to false, emit the existing cold-run
notice or equivalent, remove previous.json, and exit successfully.

In `@baml_language/crates/baml_cli/src/describe_search.rs`:
- Around line 137-149: Update the item path construction in the candidate
closure to prepend the item's package before its namespace and name, producing
the documented fully qualified path such as baml.sys.exec. Preserve the existing
namespace and name formatting while ensuring the package is included in every
Candidate.path result.

In `@tools/stdlib-matrix/baml_src/align.baml`:
- Around line 725-744: Update baml_finding_names so collisions for
strip_kind_prefix(symbol.id) are handled like display-name collisions: preserve
the existing mapping when the stripped path resolves to the same symbol, but set
it to "" when different symbols share that path. Do not allow the current direct
names.set call to overwrite an existing conflicting stripped-path entry.
- Around line 428-455: Move the held-findings drain from the attempts-exhaustion
branch to the post-loop path, using without_example for each entry in held and
marking its id covered. Ensure this cleanup runs whenever the loop ends,
including round-budget exhaustion, before the final !answered &&
collected.length() == 0 check; avoid draining the same findings twice.

In `@tools/stdlib-matrix/baml_src/entry.baml`:
- Around line 239-243: Update the ToolReport construction in dump_tools to avoid
calling load_skill, which can throw after answers have been computed. Read the
cached skill file directly for skill_bytes, or use 0 when the cache is
unavailable, while preserving the existing answers and other report fields.
- Around line 273-284: Update the subject-selection condition in the session
request loop to use the same case-insensitive substring matching as --only,
rather than exact equality. Ensure chunked labels such as "<subject> (part 1 of
2)" still populate sample and keep dump_plan selection consistent with --only.

In `@tools/stdlib-matrix/baml_src/references.baml`:
- Around line 299-318: Update attach_ts_references to resolve each node
container’s bare signature names within its module scope, using the symbol’s
module as the scope passed to resolve_reference/resolve_all. Keep global and web
resolution behavior unchanged, while ensuring names such as Readable resolve to
qualified ids like node:stream.Readable so references are recorded for freshness
checks.

In `@tools/stdlib-matrix/baml_src/toolbox.baml`:
- Around line 355-367: Update fetch_skill to pass an explicit finite timeout to
baml.http.fetch, matching the timeout parameter convention and duration used by
comparable calls elsewhere in the file. Preserve the existing error handling and
empty-string fallback behavior.

In `@typescript2/app-stdlib-matrix/src/components/matrix-symbol.ts`:
- Around line 318-325: Update the rendering flow in the matrix-symbol component
so far-side BAML IDs are rendered independently from judgement-level metadata.
Extend the endpoint rendering to include IDs from unnecessary judgements, while
rendering each judgement’s reason, example, and provenance only once rather than
once per ID. Adjust the counterparts/counterpart and unnecessary rendering paths
accordingly, preserving existing absence handling.

---

Nitpick comments:
In @.github/workflows/stdlib-matrix.yml:
- Around line 197-202: Update the coverage gate around the now and before jq
reads to account for differing TypeScript surfaces: compare unjudged coverage as
a proportion of each report’s ts_symbols, or skip the regression check when
ts_symbols values differ. Preserve the existing failure message and exit
behavior only for a genuine proportional regression.

In `@tools/stdlib-matrix/baml_src/align.baml`:
- Around line 373-384: Update the comment above the round == lookup_rounds()
branch to remove the incorrect references to session_final and schema-enforced
answer-only behavior. State that the final round still uses session_step and
relies on the prompt text to request an answer without further lookups.
- Around line 329-349: Remove the repeated “A session that will not answer is a
failure…” documentation paragraph from the surrounding session documentation,
keeping a single copy while preserving the other explanatory paragraphs
unchanged.

In `@tools/stdlib-matrix/baml_src/tests.baml`:
- Around line 979-985: Update the snippet-compilation test around the compiler
existence check to skip the test when the debug baml-cli binary is absent, using
the test framework’s supported skip mechanism instead of baml.sys.panic.
Preserve the existing compiler path and build_toolbox flow when the binary
exists; if skipping is unavailable, document the cargo build prerequisite in the
stdlib-matrix README.
- Around line 877-890: Add the optional example field explicitly as null in the
Finding literal returned by fixture_finding, matching the project’s convention
for fully specifying optional Finding fields while preserving the existing
values.
🪄 Autofix

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: 97279ea9-132d-4785-9215-a2da66ca33e4

📥 Commits

Reviewing files that changed from the base of the PR and between a071bd8 and 0b9f703.

⛔ Files ignored due to path filters (1)
  • baml_language/crates/baml_cli/src/snapshots/baml_cli__help_command__tests__describe_detailed_help.snap is excluded by !**/*.snap
📒 Files selected for processing (27)
  • .github/workflows/stdlib-matrix.yml
  • baml_language/crates/baml_cli/src/describe_command.rs
  • baml_language/crates/baml_cli/src/describe_search.rs
  • baml_language/crates/baml_cli/src/lib.rs
  • tools/stdlib-matrix/README.md
  • tools/stdlib-matrix/baml_src/align.baml
  • tools/stdlib-matrix/baml_src/entry.baml
  • tools/stdlib-matrix/baml_src/ingest.baml
  • tools/stdlib-matrix/baml_src/models.baml
  • tools/stdlib-matrix/baml_src/pools.baml
  • tools/stdlib-matrix/baml_src/references.baml
  • tools/stdlib-matrix/baml_src/render.baml
  • tools/stdlib-matrix/baml_src/report.baml
  • tools/stdlib-matrix/baml_src/revision.baml
  • tools/stdlib-matrix/baml_src/surface.baml
  • tools/stdlib-matrix/baml_src/tests.baml
  • tools/stdlib-matrix/baml_src/toolbox.baml
  • tools/stdlib-matrix/baml_src/ts_symbols.baml
  • tools/stdlib-matrix/extractors/ts-surface.mjs
  • tools/stdlib-matrix/run
  • typescript2/app-stdlib-matrix/src/components/matrix-app.ts
  • typescript2/app-stdlib-matrix/src/components/matrix-group.ts
  • typescript2/app-stdlib-matrix/src/components/matrix-symbol.ts
  • typescript2/app-stdlib-matrix/src/composition.ts
  • typescript2/app-stdlib-matrix/src/index.css
  • typescript2/app-stdlib-matrix/src/signature.ts
  • typescript2/app-stdlib-matrix/src/types.ts
💤 Files with no reviewable changes (1)
  • tools/stdlib-matrix/baml_src/pools.baml

Comment thread .github/workflows/stdlib-matrix.yml Outdated
Comment thread baml_language/crates/baml_cli/src/describe_search.rs Outdated
Comment thread tools/stdlib-matrix/baml_src/align.baml
Comment thread tools/stdlib-matrix/baml_src/align.baml
Comment thread tools/stdlib-matrix/baml_src/entry.baml Outdated
Comment thread tools/stdlib-matrix/baml_src/entry.baml Outdated
Comment thread tools/stdlib-matrix/baml_src/references.baml
Comment thread tools/stdlib-matrix/baml_src/toolbox.baml
Comment thread typescript2/app-stdlib-matrix/src/components/matrix-symbol.ts Outdated
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Binary size checks passed

7 passed

Artifact Platform File Gzip Gated on Baseline Delta Status
baml-cli Linux 🔒 27.8 MB 11.8 MB file 27.4 MB +411.0 KB (+1.5%) OK
packed-program Linux 🔒 18.0 MB 7.4 MB file 17.7 MB +289.8 KB (+1.6%) OK
baml-cli macOS 🔒 21.6 MB 10.3 MB file 21.3 MB +312.9 KB (+1.5%) OK
packed-program macOS 🔒 14.1 MB 6.5 MB file 13.8 MB +227.5 KB (+1.6%) OK
baml-cli Windows 🔒 23.3 MB 10.5 MB file 23.0 MB +290.7 KB (+1.3%) OK
packed-program Windows 🔒 15.0 MB 6.6 MB file 14.8 MB +212.5 KB (+1.4%) OK
bridge_wasm WASM 17.1 MB 🔒 4.7 MB gzip 4.6 MB +44.3 KB (+1.0%) OK

🔒 = the size this artifact is GATED on (ceiling + delta). Binaries gate on file size (installed binary); WASM gates on gzip (download size). The other size is shown for information only.


Generated by cargo size-gate · workflow run

@vercel
vercel Bot temporarily deployed to Preview – beps August 8, 2026 00:08 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 August 8, 2026 00:15 Inactive
@2kai2kai2
2kai2kai2 added this pull request to the merge queue Aug 8, 2026
Merged via the queue into canary with commit 2d2c415 Aug 8, 2026
84 checks passed
@2kai2kai2
2kai2kai2 deleted the kai/stdlib-similarity-matrix branch August 8, 2026 00:28
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