Skip to content

fix(graph): resolve root-qualified namespaced function calls#3997

Open
jubjub727 wants to merge 1 commit into
BoundaryML:canaryfrom
jubjub727:codex/fix-graph-root-namespace
Open

fix(graph): resolve root-qualified namespaced function calls#3997
jubjub727 wants to merge 1 commit into
BoundaryML:canaryfrom
jubjub727:codex/fix-graph-root-namespace

Conversation

@jubjub727

@jubjub727 jubjub727 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Author Comment

I found a bug with namespaces where referencing them with root results in graph view breaking. Fixed it by adding a single helper function that matches the name shape with what the downstream code consuming it expects by stripping the leading "root." from the name.

Codex Summary

Cross-namespace BAML calls use root-qualified paths such as root.task_routing.ChooseTask(...). These calls compile and run correctly, but the graph analyzer retained the leading root. while its function resolver expected the playground-qualified name task_routing.ChooseTask.

The lookup therefore failed to recognize the callee as an LLM function. Graph preparation intentionally preserves LLM calls while pruning ordinary helper calls without //# headers. Consequently, the misclassified call was removed and affected workflows could appear as only a root node.

This change removes one leading root. before graph lookup. The normalization applies both to requested graph entry points and to callees extracted from the AST. It is limited to static graph analysis and does not change runtime name resolution or displayed source labels.

The regression test verifies that:

  • A root-qualified namespaced workflow can be used as a graph entry point.
  • A cross-namespace root.* call resolves as NodeType::LlmFunction.
  • The LLM call survives visualization pruning without a //# header.

Tested with:

cargo test -p baml_project test_root_qualified_llm_call_is_resolved_and_rendered --lib

Summary by CodeRabbit

  • Bug Fixes
    • Fixed workflow calls using root-qualified names so they resolve correctly.
    • Ensured namespaced language-model functions remain visible in workflow visualizations.

@vercel

vercel Bot commented Jul 13, 2026

Copy link
Copy Markdown

@jubjub727 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 Jul 13, 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: b2fd7522-5db8-46e9-9005-66a8ba7b26bd

📥 Commits

Reviewing files that changed from the base of the PR and between 124952b and 082e9e3.

📒 Files selected for processing (1)
  • baml_language/crates/baml_project/src/db.rs

📝 Walkthrough

Walkthrough

ProjectDatabase now strips a leading root. prefix when resolving graph functions and call-site callees. A unit test verifies that an absolute root-qualified workflow call resolves to an LlmFunction and survives visualization pruning.

Changes

Graph Name Normalization

Layer / File(s) Summary
Normalize graph lookups
baml_language/crates/baml_project/src/db.rs
Graph expansion and function matching normalize leading root. prefixes.
Normalize call sites and validate resolution
baml_language/crates/baml_project/src/db.rs
Callee paths are normalized consistently, with coverage for root-qualified LLM calls and visualization output.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

I nibbled the root from a name so bright,
The graph found its LLM node just right.
Through workflow paths the call now flows,
And pruning leaves the function it knows.
Hop, hop—clean graphs in sight!

🚥 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 clearly summarizes the main change: resolving root-qualified namespaced function calls in graph handling.
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 unit tests (beta)
  • Create PR with unit tests

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.

@aaronvg

aaronvg commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Thanks for the PR!

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