Repository navigation
Find and replace console.logs to use logger.ts - #149
Conversation
- Use console.logs in testing files for CI - Add production/development env vars in esbuild
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis pull request centralizes logging across the codebase by replacing direct console calls with a centralized logger module. Additionally, the logger.ts module is updated to enable debug logging under new conditions (CI=true, NODE_ENV=test) and removes message prefixes. The esbuild configuration is updated to propagate NODE_ENV to the browser bundle, and the useWebSocket.ts interface is expanded with new state fields. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/web/client/useWebSocket.ts (1)
49-49: Avoid logging full WebSocket payload objects.Line 49 currently logs the entire parsed message;
conflict-datapayloads can be large and may contain sensitive notebook content. Prefer logging only message kind (type/command).💡 Suggested change
- logger.debug('[MergeNB] Received:', msg); + const messageLabel = + 'type' in msg + ? `type=${msg.type}` + : 'command' in msg + ? `command=${msg.command}` + : 'unknown'; + logger.debug(`[MergeNB] Received WebSocket message (${messageLabel})`);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/web/client/useWebSocket.ts` at line 49, The current logger.debug in useWebSocket logs the full parsed WebSocket message object (msg) which can include large/sensitive `conflict-data`; change it to log only the message kind/type/command instead of the full payload: in the useWebSocket handler replace the logger.debug('[MergeNB] Received:', msg) usage with a log that extracts and logs a single identifying field (e.g., msg.kind or msg.type or msg.command, whichever the protocol uses) and avoid including msg.payload or other full data fields; if the identifying field may be missing, guard and log a fallback like '[unknown]'.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/logger.ts`:
- Around line 19-24: The isDebugEnabled function reads process.env unguarded and
throws in browsers; update isDebugEnabled to first check typeof process !==
'undefined' && process.env before accessing variables (e.g., guard checks for
__VSCODE_EXTENSION_DEVELOPMENT__, CI, NODE_ENV), returning false if process or
process.env is missing; modify the logger.debug callers need not change—only
update isDebugEnabled in logger.ts to safely read environment flags.
In `@src/web/client/useWebSocket.ts`:
- Line 8: The logger currently reads
process.env.__VSCODE_EXTENSION_DEVELOPMENT__ and process.env.CI directly inside
isDebugEnabled(), which throws in browser bundles; change isDebugEnabled() to
guard those reads with typeof checks (e.g., typeof process !== 'undefined' &&
typeof process.env !== 'undefined' && typeof
process.env.__VSCODE_EXTENSION_DEVELOPMENT__ !== 'undefined') before accessing
them, or alternately add definitions for __VSCODE_EXTENSION_DEVELOPMENT__ and CI
in the web build define map used for the client bundle; update the
logger.isDebugEnabled() function to use the guarded access so the web client
import of logger no longer triggers ReferenceError.
---
Nitpick comments:
In `@src/web/client/useWebSocket.ts`:
- Line 49: The current logger.debug in useWebSocket logs the full parsed
WebSocket message object (msg) which can include large/sensitive
`conflict-data`; change it to log only the message kind/type/command instead of
the full payload: in the useWebSocket handler replace the
logger.debug('[MergeNB] Received:', msg) usage with a log that extracts and logs
a single identifying field (e.g., msg.kind or msg.type or msg.command, whichever
the protocol uses) and avoid including msg.payload or other full data fields; if
the identifying field may be missing, guard and log a fallback like '[unknown]'.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (12)
esbuild.jssrc/conflictDetector.tssrc/extension.tssrc/gitIntegration.tssrc/logger.tssrc/resolver.tssrc/web/WebConflictPanel.tssrc/web/client/CellContent.tsxsrc/web/client/index.tsxsrc/web/client/markdown.tssrc/web/client/useWebSocket.tssrc/web/webServer.ts
- Address coderabbit comments
Summary by CodeRabbit
Release Notes
New Features
Refactor