Repository navigation
refactor(settings): remove the Diagnostics page and the dry-run server Doctor - #250
Conversation
…r Doctor Report a problem already collects the recent errors and exports the diagnostics bundle, and Doctor still appears on the crash screen and the startup error screen, where it is needed. The Diagnostics tab, the /doctor command and the server half of Doctor duplicated that, and the tab's warning count was mostly requests failing while the server was starting. The desktop Doctor keeps the local repair of the safe UI keys, and a request that fails because the server was never reached is no longer recorded as a diagnostic event; a request the server rejects still is.
cccc61f to
a4f67bb
Compare
GoDiao
left a comment
There was a problem hiding this comment.
Thanks for the cleanup. Removing the Diagnostics page and the server Doctor looks right, the TypeError filter in client.ts is fine, and nothing was over-deleted: the remaining settings.diagnostics.* keys, DoctorPanel, the computer-use doctor and the problem-report endpoints are all still in use. CI is green.
A few things are still left behind, so I'm requesting changes.
Must fix
1. Item 3 of #248 isn't done: the endpoints and client methods that only the Diagnostics page used are still there. After this PR nothing calls them:
desktop/src/api/diagnostics.ts:getStatus,getEvents,openLogDir,clear(lines 54-59) and the typesDiagnosticsStatusandDiagnosticEvent. Please also removerecordEventwithDiagnosticEventInputandDiagnosticSeverity. They were already unused onmain, because the client sends events throughrawRecordDiagnosticEventinclient.ts. KeepgetProblemReport,exportBundleandrevealExport.src/server/api/diagnostics.ts:DELETE /api/diagnostics,GET /api/diagnostics/status,GET /api/diagnostics/eventsandPOST /api/diagnostics/open-log-dir. KeepPOST events,GET report,POST exportandPOST reveal-export.src/server/services/diagnosticsService.ts:getStatus, theDiagnosticsStatustype,openLogDir,clear, andgetDirectorySize, which onlygetStatususes. KeepreadRecentEvents, becauseproblemReport.tsand the export bundle use it.src/server/__tests__/diagnostics-service.test.ts(around lines 188-243): drop the status,GET eventsand clear assertions, and keep the parts coveringPOST eventsand export.scripts/repro-issue-247-real.ts:76callsGET /api/diagnostics/events. Please delete the script or update it so it doesn't depend on the removed route.
2. Several messages still tell users to run /doctor, which this PR removes. The dreamcoder doctor CLI subcommand still exists. Point these messages at it, or drop the clause:
src/utils/sandbox/sandbox-adapter.ts:584: "run /sandbox or /doctor for details". Withsandbox.failIfUnavailable, this text reaches the desktop in the CLI exit error.src/services/api/errorUtils.ts:99: "Run /doctor for details."src/skills/bundled/keybindings.ts:232, 234, 279(theSECTION_DOCTORtext).src/commands/reload-plugins/reload-plugins.ts:53src/components/mcp/MCPSettings.tsx:150src/hooks/notifs/useSettingsErrors.tsx:38src/keybindings/KeybindingProviderSetup.tsx:84
Code comments that mention /doctor in files you don't otherwise touch can stay.
Should fix
3. The English error boundary text still points at the removed page. errorBoundary.description in en.ts:438 says "The error was recorded in Diagnostics." Please reword it, for example "The error was recorded in the diagnostics log." The Chinese text (zh.ts:440) is fine as is.
4. Docs and mockups still list Diagnostics.
docs/features/ui-refresh/design-log.zh.md:339still has "本机:终端、H5 访问、Computer Use、诊断". You updated line 98 of the same file but missed this line.docs/features/ui-refresh/mockups/dreamcoder-complete-study.htmlanddreamcoder-preview.htmlstill have the 诊断 settings page (prefsDiagnosticsand itsdiagnostic-copy/diagnostic-clearactions) and/doctorin the command list. Please remove them so the mockups match the app.
5. doctorShownAtSession in src/utils/config.ts:195 is never read or written anywhere. It's an older leftover, but it belongs to the same Doctor cleanup. Please remove it.
Item 3 of GoDiao#248 was not done: the endpoints and client methods that only the Diagnostics page used were all still there with no callers left. - desktop/src/api/diagnostics.ts: drop getStatus, getEvents, openLogDir, clear and recordEvent, plus the types they needed. getProblemReport, exportBundle and revealExport stay. - server: drop DELETE /api/diagnostics, GET status, GET events and POST open-log-dir, with the service methods and getDirectorySize that only served them. readRecentEvents stays for the problem report and the export bundle. - the API test keeps POST events and the export, and scripts/repro-issue-247-real.ts reads the log through the service instead of the removed route. Messages that sent users to the removed /doctor slash command now name the `dreamcoder doctor` CLI subcommand, which still renders the same screen: sandbox-adapter, errorUtils, the bundled keybindings skill, reload-plugins, MCPSettings, useSettingsErrors and KeybindingProviderSetup. Also: the English error boundary text no longer says the error was recorded "in Diagnostics" (its test follows), design-log.zh.md line 339 and both UI mockups drop the Diagnostics tab, and the unused doctorShownAtSession config field is gone.
|
Done in 2bace5b. All five points. 1. Item 3 of #248 — the orphaned surface is gone.
I checked callers before deleting rather than after: 2. The 3. 4. 5. Checks. Both 18 files, +34/−179. |
GoDiao
left a comment
There was a problem hiding this comment.
Thanks, all five points are addressed. Merging.
What this does
Removes the Diagnostics settings tab, the
/doctorcommand and the dry-run half of the server Doctor, keeping every part that still has a user.pages/DiagnosticsSettings.tsxand thedoctorApiclient.Settingsloses the tab (andSettingsTabloses'diagnostics'), and the desktop/doctorslash command in the composer is removed with it.runDoctorRepairbecomes the local repair only, soDoctorPanelno longer awaits a server round trip and drops its loading state.commands/doctor/and its entry incommands.ts.api/doctor.ts,services/doctorService.tsandrouter.ts'sdoctorcase.en.tsandzh.ts(the 24 that only the deleted page used, plussettings.tab.diagnostics,doctorFailed,doctorServerRan,doctorServerUnavailable). The two files stay the same size: 2111 → 2083 lines in each.docs/features/ui-refresh/that still listed the tab andpages/DiagnosticsSettings.tsxare updated to match.27 files changed, +37 / −1469, no lockfile touched.
Decisions worth reviewing
The unreachable-server guard is narrow on purpose.
reportApiFailureis now skipped whenfetchitself rejects with aTypeError, which is what an unreachable or refused server produces. It is still recorded for everything else, including timeouts:mcpDiagnostics.test.tslocks the redaction of MCP environment values on the timeout path, and a timeout means the server was reachable but slow, which is a different signal from the log the issue describes. My first version dropped every non-ApiErrorand broke those two tests; the narrower guard keeps that coverage and fixes the noise.Kept deliberately:
screens/Doctor.tsx,utils/doctorDiagnostic.tsanddoctorContextWarnings.tsstill serve thedreamcoder doctorCLI subcommand and the version notifications, not the removed page. Same forlib/diagnosticsCapture.ts(the error boundary feeds it),/api/status/diagnostics(Settings config directories) and/api/computer-use/doctor.Tests
desktop/src/api/client.test.tsgains one test: aTypeError('Failed to fetch')rejection makes exactly one request, i.e. no diagnostic event is posted. It fails without the patch:Three existing tests encoded the removed behaviour and are updated, not deleted: the
/doctoralias expectation incomposerUtils.test.ts, the ordering against the Diagnostics tab ingeneralSettings.test.tsx, and the fallback slash-command count inpages.test.tsx(14 → 13).Gates, all three from
.github/workflows/ci.yml, run locally on Windows 11 with Bun 1.3.14 (CI uses 1.4.2):bun run lint(tsc,tsc -p electron,oxlint)bun run test -- --run(desktop, vitest)mainuntouchedbun test(server + CLI)mainuntouchedThis working copy is on Windows, where those tests already fail on
mainwith no changes at all:prepare-ripgrep(5), artifact symlink and path checks (4),canvas artifacts(1),DiagnosticsService(1), plus twoActiveSessioncontext tests,LocalSlashCommandPanel,MessageListandUpdateChecker. I checkedmainout and re-ran the same files in the same checkout: the failing tests are the same ones, so none of them is part of this diff.Two failures appeared once under full-suite parallel load and not again:
KanbanPage(passes 3 of 3 in isolation on this branch, passes onmain, passes in a second full run on this branch) and twoWebSocket Chat Integration5-second timeouts (conversations.test.tsis 65 passed / 0 failed run alone on this branch). Neither is attributed to this change.Not done
dreamcoder doctorCLI subcommand stays, as it is the only caller left ofscreens/Doctor.tsx. If you want that gone too, it is a small follow-up.Resolves #248