fix(studio): Consolidate all console statements in Studio#308
fix(studio): Consolidate all console statements in Studio#308steramae-nvidia wants to merge 8 commits into
Conversation
Signed-off-by: Sean Teramae <steramae@nvidia.com>
Signed-off-by: Sean Teramae <steramae@nvidia.com>
Signed-off-by: Sean Teramae <steramae@nvidia.com>
Signed-off-by: Sean Teramae <steramae@nvidia.com>
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughReplaces direct console.* calls with structured ChangesLogging Infrastructure Consolidation
Possibly Related PRs
Suggested Reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
web/packages/studio/src/components/filesets/hooks/useBulkDuplicate.ts (1)
154-154: ⚡ Quick win
String(err)loses stack traces.Original
console.error('Bulk duplicate failed', err)preserved the error object. IfwebsiteLogger.erroraccepts multiple arguments likeconsole.error, passerrseparately instead of stringifying.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/packages/studio/src/components/filesets/hooks/useBulkDuplicate.ts` at line 154, In useBulkDuplicate.ts, update the error logging in the bulk-duplicate failure handler to stop stringifying the error; call websiteLogger.error with the descriptive message and the actual err object as a separate argument (i.e., pass err instead of String(err)) so the logger can preserve stack and other error properties — locate the call to websiteLogger.error in the useBulkDuplicate failure path and change the single string argument to two arguments (message, err).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@web/packages/studio/src/components/filesets/hooks/useBulkDownload.ts`:
- Line 74: The log call in useBulkDownload.ts is converting the error to a
string which drops the stack; update the websiteLogger.error invocation to pass
the Error object (or include err.stack in the single message) instead of
String(err) so the stack is preserved—locate the websiteLogger.error call in
useBulkDownload (where err is caught) and replace the string interpolation with
a single-argument call that logs the Error object (or a message concatenated
with err.stack).
---
Nitpick comments:
In `@web/packages/studio/src/components/filesets/hooks/useBulkDuplicate.ts`:
- Line 154: In useBulkDuplicate.ts, update the error logging in the
bulk-duplicate failure handler to stop stringifying the error; call
websiteLogger.error with the descriptive message and the actual err object as a
separate argument (i.e., pass err instead of String(err)) so the logger can
preserve stack and other error properties — locate the call to
websiteLogger.error in the useBulkDuplicate failure path and change the single
string argument to two arguments (message, err).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 830bb427-ade2-4dd0-a74d-548aa601607d
📒 Files selected for processing (25)
web/eslint.config.jsweb/packages/studio/src/api/datasets/useDatasetFileContent.tsweb/packages/studio/src/components/DatasetInputFile/index.tsxweb/packages/studio/src/components/FilesetActionMenu/index.tsxweb/packages/studio/src/components/ModelComparePrompts/index.tsxweb/packages/studio/src/components/WorkspaceDropdown/index.tsxweb/packages/studio/src/components/evaluation/Configurations/form/InputFile.tsxweb/packages/studio/src/components/evaluation/Jobs/ActionMenu.tsxweb/packages/studio/src/components/evaluation/Jobs/DetailsPanel.tsxweb/packages/studio/src/components/evaluation/Jobs/EvaluationJobBulkDeleteModal.tsxweb/packages/studio/src/components/filesets/AddToFolderModal/index.tsxweb/packages/studio/src/components/filesets/FilesetFileExplorer/BulkDeleteModal/index.tsxweb/packages/studio/src/components/filesets/FilesetFileExplorer/DatasetFileDropzone/index.tsxweb/packages/studio/src/components/filesets/hooks/useBulkDownload.tsweb/packages/studio/src/components/filesets/hooks/useBulkDuplicate.tsweb/packages/studio/src/components/sidePanels/AgentPanels/AgentPanel/DeploymentLogsView.tsxweb/packages/studio/src/mocks/node.tsweb/packages/studio/src/routes/DeploymentsListRoute/useDeleteDeploymentAndConfig.tsweb/packages/studio/src/routes/FilesetListRoute/ActionMenu/index.tsxweb/packages/studio/src/routes/FilesetListRoute/DatasetBulkDeleteModal/index.tsxweb/packages/studio/src/routes/SafeSynthesizerNewRoute/index.tsxweb/packages/studio/src/routes/agents/AgentSuggestionsRoute/utils.tsweb/packages/studio/src/util/files.tsweb/packages/studio/src/util/llm.tsweb/packages/studio/src/util/strings.ts
Signed-off-by: Sean Teramae <steramae@nvidia.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/packages/studio/src/routes/SafeSynthesizerNewRoute/index.tsx (1)
97-100: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winInconsistent error logging pattern.
Line 65 passes
erroras the second argument (cause) but line 98 stringifieserrorsinto the message. Passerrorsas the cause for structured OTEL attributes.Suggested fix
- websiteLogger.error(`Form validation errors: ${String(errors)}`); + websiteLogger.error('Form validation errors', errors);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/packages/studio/src/routes/SafeSynthesizerNewRoute/index.tsx` around lines 97 - 100, handleSubmitError currently stringifies the validation errors into the log message; change websiteLogger.error to pass the errors object as the second argument (the cause) instead of embedding it in the message so OTEL can capture structured attributes (update the call in handleSubmitError to mirror the pattern used elsewhere where an error is passed as the second argument), leaving setErrorMessage as-is.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@web/packages/studio/src/routes/SafeSynthesizerNewRoute/index.tsx`:
- Around line 97-100: handleSubmitError currently stringifies the validation
errors into the log message; change websiteLogger.error to pass the errors
object as the second argument (the cause) instead of embedding it in the message
so OTEL can capture structured attributes (update the call in handleSubmitError
to mirror the pattern used elsewhere where an error is passed as the second
argument), leaving setErrorMessage as-is.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: a64a49fe-65cb-42fc-9879-3331fc9712d8
📒 Files selected for processing (23)
web/packages/studio/e2e-tests/pages/project-datasets.tsweb/packages/studio/src/api/datasets/useDatasetFileContent.tsweb/packages/studio/src/components/FilesetActionMenu/index.tsxweb/packages/studio/src/components/ModelComparePrompts/index.tsxweb/packages/studio/src/components/evaluation/Configurations/form/InputFile.tsxweb/packages/studio/src/components/evaluation/Jobs/ActionMenu.tsxweb/packages/studio/src/components/evaluation/Jobs/DetailsPanel.tsxweb/packages/studio/src/components/evaluation/Jobs/EvaluationJobBulkDeleteModal.tsxweb/packages/studio/src/components/filesets/FilesetFileExplorer/BulkDeleteModal/index.tsxweb/packages/studio/src/components/filesets/FilesetFileExplorer/DatasetFileDropzone/index.tsxweb/packages/studio/src/components/filesets/hooks/useBulkDownload.tsweb/packages/studio/src/components/filesets/hooks/useBulkDuplicate.tsweb/packages/studio/src/components/sidePanels/AgentPanels/AgentPanel/DeploymentLogsView.tsxweb/packages/studio/src/routes/DeploymentsListRoute/useDeleteDeploymentAndConfig.tsweb/packages/studio/src/routes/FilesetListRoute/ActionMenu/index.tsxweb/packages/studio/src/routes/FilesetListRoute/DatasetBulkDeleteModal/index.tsxweb/packages/studio/src/routes/SafeSynthesizerNewRoute/index.tsxweb/packages/studio/src/routes/agents/AgentSuggestionsRoute/api.tsweb/packages/studio/src/routes/agents/AgentSuggestionsRoute/useOptimizerSuggestions.tsweb/packages/studio/src/routes/agents/ClaudeCodeChatRoute/stream.tsweb/packages/studio/src/util/llm.tsweb/packages/studio/src/util/logger.tsweb/packages/studio/src/workers/LargeFileWorker.ts
✅ Files skipped from review due to trivial changes (5)
- web/packages/studio/src/routes/DeploymentsListRoute/useDeleteDeploymentAndConfig.ts
- web/packages/studio/src/components/evaluation/Jobs/DetailsPanel.tsx
- web/packages/studio/e2e-tests/pages/project-datasets.ts
- web/packages/studio/src/util/llm.ts
- web/packages/studio/src/components/FilesetActionMenu/index.tsx
🚧 Files skipped from review as they are similar to previous changes (9)
- web/packages/studio/src/routes/FilesetListRoute/ActionMenu/index.tsx
- web/packages/studio/src/routes/FilesetListRoute/DatasetBulkDeleteModal/index.tsx
- web/packages/studio/src/components/evaluation/Jobs/ActionMenu.tsx
- web/packages/studio/src/components/filesets/hooks/useBulkDuplicate.ts
- web/packages/studio/src/components/filesets/FilesetFileExplorer/BulkDeleteModal/index.tsx
- web/packages/studio/src/components/evaluation/Configurations/form/InputFile.tsx
- web/packages/studio/src/api/datasets/useDatasetFileContent.ts
- web/packages/studio/src/components/filesets/FilesetFileExplorer/DatasetFileDropzone/index.tsx
- web/packages/studio/src/components/ModelComparePrompts/index.tsx
Signed-off-by: Sean Teramae <steramae@nvidia.com>
Signed-off-by: Sean Teramae <steramae@nvidia.com>
We wrap the console to ensure that anything logged to console is also passed to the optional telemetry service. There are still some exceptions but nearly all statements should now be wrapped.
Summary by CodeRabbit
Chores
Tests