Repository navigation
[AI Improvement] [Task] Clear src/mcp no-floating-promises by typing the MCP logger as void (lint: no-floating-promises, slice 1) - #11470
Conversation
…ses (b/582886458)
There was a problem hiding this comment.
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'.
| // Initial connection and project load catch all errors and report status via setStatus | ||
| void (async () => { |
There was a problem hiding this comment.
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
- Write high-signal comments that explain why, not what. Do not narrate self-evident code. (link)
| // Initial connection and project load catch all errors and report status via showStatus | ||
| void (async () => { |
There was a problem hiding this comment.
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
- Write high-signal comments that explain why, not what. Do not narrate self-evident code. (link)
Description
Resolves Buganizer b/582886458 (Part of
@typescript-eslint/no-floating-promisescleanup, slice 1:src/mcp).Clears all 36
@typescript-eslint/no-floating-promiseswarnings undersrc/mcpwithout modifying.eslintrc.js(the"warn"override stays in place until remaining directory slices are cleared):src/mcp/index.ts(get logger()):get logger()fromRecord<LoggingLevel, (message: unknown) => Promise<void>>toRecord<LoggingLevel, (message: unknown) => void>to match whatlogAtLevelactually returns (void). This clears 33 caller-site floating-promise warnings acrosssrc/mcpwith no behavior change.void-prefixedthis.server.sendLoggingMessage(...)calls insideget logger()(both in the_pendingMessagesflush 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.src/mcp/apps/init/mcp-app.ts&src/mcp/apps/update_environment/mcp-app.ts:voidand 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-promiseswarnings (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 52672EADDRINUSEcollision insrc/apiv2.spec.tswith a proxy).Sample Commands
N/A (internal typing and lint cleanup)