Skip to content

fix: dataconnect_build MCP tool returns error even with no compiler error - #10941

Open
chkuang-g wants to merge 1 commit into
mainfrom
chkuang/dataconnect-build
Open

fix: dataconnect_build MCP tool returns error even with no compiler error#10941
chkuang-g wants to merge 1 commit into
mainfrom
chkuang/dataconnect-build

Conversation

@chkuang-g

@chkuang-g chkuang-g commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes a bug where the dataconnect_build MCP tool returned compilation errors on successful compile because compileErrors() returns "" when there are no errors, resulting in [""] which has a length > 0. This change adds .filter(Boolean) to filter out those empty strings.

Also update tool description with more details.

Scenarios Tested

  • Ran npm run lint:changed-files
  • Ran npm run build
  • Verified compiler output doesn't incorrectly trigger error status when compiling successfully.
  • Manual verify the tool not returning error when there is no compiler error.

Sample Commands

N/A

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request updates the compilation error handling in src/mcp/tools/dataconnect/compile.ts by adding a .filter(Boolean) call to filter out falsy values. The reviewer pointed out that the .flat() call is redundant because compileErrors returns a single string, meaning Promise.all already resolves to a flat array, and suggested removing it to simplify the code.

Comment thread src/mcp/tools/dataconnect/compile.ts Outdated
@chkuang-g
chkuang-g requested a review from joehan August 15, 2026 01:04
@joehan

joehan commented Aug 15, 2026

Copy link
Copy Markdown
Member

/joe-review

@joehan joehan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

⚠️ Disclaimer: This draft review was generated by an experimental AI review agent. Please verify all findings before acting on them.

Code Review Summary: firebase/firebase-tools PR #10941

🟢 Strengths & LGTM Aspects

  • The fix correctly addresses the bug where compileErrors returning an empty string "" (indicating no errors) was treated as an error because [""] has length > 0. Adding .filter(Boolean) effectively removes these empty strings.
  • The change is minimal and targeted.

🔴 Overview of Findings & Blocking Items

  • Testing Discipline: The PR lacks unit tests for this tool. I have verified that the tool can be easily tested by stubbing pickServices and compileErrors. I suggest adding a spec file to prevent future regressions.
  • CHANGELOG.md: A changelog entry should be added since this is a user-facing (or agent-facing) bug fix for the dataconnect_build MCP tool.

🟡 Nits

  • None.

Comment thread src/mcp/tools/dataconnect/compile.ts Outdated
@chkuang-g
chkuang-g force-pushed the chkuang/dataconnect-build branch from 55ac877 to d7a0c23 Compare August 15, 2026 01:29
…d MCP tool

### Description
- Fixes a bug where the `dataconnect_build` MCP tool returned compilation errors on successful compile because `compileErrors()` returns `""` when there are no errors, resulting in `[""]` which has a length > 0. Added `.filter(Boolean)` to filter out those empty strings and removed the redundant `.flat()` call.
- Updated the tool's description with structured markdown formatting detailing prerequisites, when/how to use, and examples.
- Updated `CHANGELOG.md`.

### Scenarios Tested
- Added unit tests in `src/mcp/tools/dataconnect/compile.spec.ts` covering successful and failed compilation states.
- Verified that all unit tests pass with `mocha`.
- Ran `npm run lint:changed-files` and `npm run build` to confirm clean builds.
@chkuang-g
chkuang-g force-pushed the chkuang/dataconnect-build branch from d7a0c23 to a7c9a41 Compare August 15, 2026 01:32
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.

3 participants