Skip to content

[AI Improvement] [Task] Clear src/mcp no-floating-promises by typing the MCP logger as void (lint: no-floating-promises, slice 1) - #11470

Draft
joehan wants to merge 1 commit into
mainfrom
ai-improve-582886458-task-clear-src-mcp-no-floating-prom
Draft

joehan wants to merge 1 commit into
mainfrom
ai-improve-582886458-task-clear-src-mcp-no-floating-prom

Conversation

@joehan

@joehan joehan commented Nov 6, 2026

Copy link
Copy Markdown
Member

Description

Resolves Buganizer b/582886458 (Part of @typescript-eslint/no-floating-promises cleanup, slice 1: src/mcp).

Clears all 36 @typescript-eslint/no-floating-promises warnings under src/mcp without modifying .eslintrc.js (the "warn" override stays in place until remaining directory slices are cleared):

  1. src/mcp/index.ts (get logger()):
    • Updated the return type cast of get logger() from Record<LoggingLevel, (message: unknown) => Promise<void>> to Record<LoggingLevel, (message: unknown) => void> to match what logAtLevel actually returns (void). This clears 33 caller-site floating-promise warnings across src/mcp with no behavior change.
    • Replaced the bare and void-prefixed this.server.sendLoggingMessage(...) calls inside get logger() (both in the _pendingMessages flush loop and for live messages) with .catch(() => { ... }) handlers. Small behavior change: a rejected log notification (e.g., when the MCP transport is already closed) is now swallowed instead of becoming an unhandled promise rejection.
  2. src/mcp/apps/init/mcp-app.ts & src/mcp/apps/update_environment/mcp-app.ts:
    • Prefixed the top-level browser initialization async IIFEs with void and added comments noting that they catch and report all errors internally (no behavior change).

Scenarios Tested

  • npx eslint --config .eslintrc.js --ext .ts,.js src/mcp: 0 errors, 0 @typescript-eslint/no-floating-promises warnings (down from 36).
  • npx tsc --noEmit -p tsconfig.json: Passed with 0 errors.
  • npm run test:compile: Passed with 0 errors.
  • npm run build: Built MCP apps with Vite and compiled TypeScript cleanly.
  • npm run lint:quiet: Full-repo ESLint and Prettier checks passed with 0 errors.
  • npx mocha 'src/mcp/**/*.spec.ts': 180 passing.
  • npm run mocha: 5934 passing (1 pre-existing shared-host port 52672 EADDRINUSE collision in src/apiv2.spec.ts with a proxy).

Sample Commands

N/A (internal typing and lint cleanup)

@joehan joehan self-assigned this Nov 6, 2026

@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 adds error handling to logging messages in FirebaseMcpServer to prevent throwing when the transport is closed, and adds void operators to IIFEs in the MCP apps. The reviewer feedback correctly points out that the newly added comments in the mcp-app.ts files narrate self-evident code, which violates the repository style guide's rule to write high-signal comments explaining 'why' rather than 'what'.

Comment on lines +225 to +226
// Initial connection and project load catch all errors and report status via setStatus
void (async () => {

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.

medium

This comment narrates self-evident code, which is discouraged by the repository style guide. Comments should focus on explaining why rather than what.

void (async () => {
References
  1. Write high-signal comments that explain why, not what. Do not narrate self-evident code. (link)

Comment on lines +122 to +123
// Initial connection and project load catch all errors and report status via showStatus
void (async () => {

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.

medium

This comment narrates self-evident code, which is discouraged by the repository style guide. Comments should focus on explaining why rather than what.

void (async () => {
References
  1. Write high-signal comments that explain why, not what. Do not narrate self-evident code. (link)

This branch has not been deployed

No deployments
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