Skip to content

feat(settings): add development debug page - #2047

Merged
zhangmo8 merged 6 commits into
devfrom
feat/debug-tooling
Jul 28, 2026
Merged

feat(settings): add development debug page#2047
zhangmo8 merged 6 commits into
devfrom
feat/debug-tooling

Conversation

@zhangmo8

@zhangmo8 zhangmo8 commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add a development-only Debug settings page for existing mock update, onboarding, and mock chat-session actions
  • remove mock controls from About and refuse mock desktop/update routes outside development or packaged builds
  • document the feature and add renderer coverage for navigation and controls

UI

Before:

Settings
└─ About
   ├─ product and update information
   └─ development mock controls

After:

Settings (development only)
├─ About
│  └─ product and update information
└─ Debug
   └─ development mock controls

Validation

  • pnpm run format
  • pnpm run i18n
  • pnpm run lint
  • pnpm run typecheck
  • pnpm exec vitest run --config vitest.config.renderer.ts test/renderer/components/AboutUsSettings.test.ts test/renderer/components/DebugSettings.test.ts test/renderer/components/SettingsNavigationDebug.test.ts

Summary by CodeRabbit

  • New Features
    • Added a development-only Debug page in Settings with actions for guided onboarding, mock chat creation, and mock update/clear.
    • Added development-only Debug navigation/route entries, including localized Debug labels.
  • Bug Fixes
    • Ensured Debug/mock actions are blocked outside development and when packaged; Debug controls no longer appear on the About page.
  • Tests
    • Added/updated renderer tests for the Debug page and navigation visibility; expanded main-process route dispatcher coverage for packaging checks.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d17bb3ed-6327-46d2-b1b1-7051b338d6cf

📥 Commits

Reviewing files that changed from the base of the PR and between 8f5ed95 and bc43942.

⛔ Files ignored due to path filters (2)
  • src/renderer/src/lib/icons/icon-collections.generated.ts is excluded by !**/*.generated.*
  • src/renderer/src/lib/icons/icon-whitelist.generated.ts is excluded by !**/*.generated.*
📒 Files selected for processing (1)
  • test/main/provider/modelConfig.test.ts

📝 Walkthrough

Walkthrough

Adds a development-only Debug page in Settings, moves mock controls from About, gates related main-process routes, and updates typed navigation, localization, documentation, architecture baselines, and renderer tests.

Changes

Development debug tooling

Layer / File(s) Summary
Typed navigation and route wiring
src/shared/settingsNavigation.ts, src/shared/contracts/..., src/renderer/settings/..., src/types/i18n.d.ts, src/renderer/src/i18n/*/routes.json
Adds the settings-debug route, development-only filtering, /debug resolution, lazy loading, route labels, and locale typing.
Debug page and relocated controls
src/renderer/settings/components/DebugSettings.vue, src/renderer/settings/components/AboutUsSettings.vue, test/renderer/components/*
Moves guided onboarding, mock chat, and mock update actions to the Debug page and verifies About no longer renders them.
Main-process route guards
src/main/desktop/routes.ts, src/main/upgrade/routes.ts, test/main/routes/dispatcher.test.ts
Returns inactive responses for guided onboarding and mock update routes outside development or in packaged apps.
Localized copy and supporting records
src/renderer/src/i18n/*/settings.json, docs/features/debug-tooling/*, docs/architecture/baselines/*
Adds Debug page strings across locales, documents the implementation, and updates renderer import-boundary counts.
Model configuration test updates
test/main/provider/modelConfig.test.ts
Replaces broad priority-chain coverage with provider/user override checks and parameterized invalid-input defaults.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding a development-only debug settings page.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/debug-tooling
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch feat/debug-tooling

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 3

🧹 Nitpick comments (1)
src/renderer/settings/components/DebugSettings.vue (1)

68-129: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicate try/catch/toast pattern across three action handlers.

startGuidedOnboarding, mockDownloadedUpdate, and clearMockUpdate all repeat the same shape: call client, check a boolean, toast on falsy, catch+log+toast on throw. Extracting a shared helper would cut duplication and make it trivial to add a consistent busy/disabled guard to all three buttons (currently only createMockChat guards against re-entrant clicks via isCreatingMockChat).

♻️ Suggested helper
+const runMockAction = async (
+  action: () => Promise<boolean>,
+  failureMessageKey: string,
+  logLabel: string
+) => {
+  try {
+    const ok = await action()
+    if (!ok) {
+      showToastError(t(failureMessageKey))
+    }
+  } catch (error) {
+    console.error(`[DebugSettings] ${logLabel}`, error)
+    showToastError(error instanceof Error ? error.message : t(failureMessageKey))
+  }
+}
+
-const mockDownloadedUpdate = async () => {
-  try {
-    const updated = await upgradeClient.mockDownloadedUpdate()
-    if (!updated) {
-      showToastError(t('settings.debug.unavailableDescription'))
-    }
-  } catch (error) {
-    console.error('[DebugSettings] Failed to create mock update', error)
-    showToastError(error instanceof Error ? error.message : t('settings.debug.guidance.failed'))
-  }
-}
+const mockDownloadedUpdate = () =>
+  runMockAction(
+    upgradeClient.mockDownloadedUpdate,
+    'settings.debug.unavailableDescription',
+    'Failed to create mock update'
+  )
🤖 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 `@src/renderer/settings/components/DebugSettings.vue` around lines 68 - 129,
Extract the repeated action handling from startGuidedOnboarding,
mockDownloadedUpdate, and clearMockUpdate into a shared helper that performs the
client call, falsy-result toast, error logging, and error toast. Update each
handler to use the helper while preserving its existing client method and
translation messages, and add a consistent busy/re-entrancy guard for these
three actions alongside the existing createMockChat guard.
🤖 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 `@src/renderer/src/i18n/da-DK/settings.json`:
- Around line 3188-3204: The settings.debug block remains English in all
affected locale bundles. Add complete, natural translations for every
settings.debug.* value in src/renderer/src/i18n/da-DK/settings.json (lines
3188-3204), src/renderer/src/i18n/de-DE/settings.json (lines 3179-3195),
src/renderer/src/i18n/es-ES/settings.json (lines 3179-3195),
src/renderer/src/i18n/fa-IR/settings.json (lines 3188-3204),
src/renderer/src/i18n/fr-FR/settings.json (lines 3188-3204), and
src/renderer/src/i18n/he-IL/settings.json (lines 3188-3204), covering all
titles, descriptions, labels, and failure messages while preserving the existing
JSON structure and keys.

In `@src/renderer/src/i18n/id-ID/settings.json`:
- Around line 3178-3195: Translate every user-facing string in the debug
subtree, including description, unavailableTitle, unavailableDescription, splash
labels and failure text, and guidance labels and failure text, in
src/renderer/src/i18n/id-ID/settings.json lines 3178-3195,
src/renderer/src/i18n/it-IT/settings.json lines 3178-3195,
src/renderer/src/i18n/ja-JP/settings.json lines 3187-3204,
src/renderer/src/i18n/ko-KR/settings.json lines 3187-3204,
src/renderer/src/i18n/ms-MY/settings.json lines 3178-3195,
src/renderer/src/i18n/pl-PL/settings.json lines 3178-3195, and
src/renderer/src/i18n/pt-BR/settings.json lines 3187-3204, preserving the
existing JSON keys and structure while using Indonesian, Italian, Japanese,
Korean, Malay, Polish, and Brazilian Portuguese respectively.

In `@src/renderer/src/i18n/ru-RU/settings.json`:
- Around line 3188-3204: Translate every newly added settings.debug string into
its target language while preserving the existing keys and JSON structure: in
src/renderer/src/i18n/ru-RU/settings.json#L3188-L3204 use Russian, in
src/renderer/src/i18n/tr-TR/settings.json#L3179-L3195 use Turkish, and in
src/renderer/src/i18n/vi-VN/settings.json#L3179-L3195 use Vietnamese.

---

Nitpick comments:
In `@src/renderer/settings/components/DebugSettings.vue`:
- Around line 68-129: Extract the repeated action handling from
startGuidedOnboarding, mockDownloadedUpdate, and clearMockUpdate into a shared
helper that performs the client call, falsy-result toast, error logging, and
error toast. Update each handler to use the helper while preserving its existing
client method and translation messages, and add a consistent busy/re-entrancy
guard for these three actions alongside the existing createMockChat guard.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 011746f2-b785-4ad9-98d1-6003402a80f3

📥 Commits

Reviewing files that changed from the base of the PR and between 33914b2 and 8ae2516.

📒 Files selected for processing (57)
  • docs/features/debug-tooling/plan.md
  • docs/features/debug-tooling/spec.md
  • docs/features/debug-tooling/tasks.md
  • src/main/desktop/routes.ts
  • src/main/upgrade/routes.ts
  • src/renderer/settings/App.vue
  • src/renderer/settings/components/AboutUsSettings.vue
  • src/renderer/settings/components/DebugSettings.vue
  • src/renderer/settings/main.ts
  • src/renderer/settings/settingsRouteComponents.ts
  • src/renderer/src/i18n/da-DK/routes.json
  • src/renderer/src/i18n/da-DK/settings.json
  • src/renderer/src/i18n/de-DE/routes.json
  • src/renderer/src/i18n/de-DE/settings.json
  • src/renderer/src/i18n/en-US/routes.json
  • src/renderer/src/i18n/en-US/settings.json
  • src/renderer/src/i18n/es-ES/routes.json
  • src/renderer/src/i18n/es-ES/settings.json
  • src/renderer/src/i18n/fa-IR/routes.json
  • src/renderer/src/i18n/fa-IR/settings.json
  • src/renderer/src/i18n/fr-FR/routes.json
  • src/renderer/src/i18n/fr-FR/settings.json
  • src/renderer/src/i18n/he-IL/routes.json
  • src/renderer/src/i18n/he-IL/settings.json
  • src/renderer/src/i18n/id-ID/routes.json
  • src/renderer/src/i18n/id-ID/settings.json
  • src/renderer/src/i18n/it-IT/routes.json
  • src/renderer/src/i18n/it-IT/settings.json
  • src/renderer/src/i18n/ja-JP/routes.json
  • src/renderer/src/i18n/ja-JP/settings.json
  • src/renderer/src/i18n/ko-KR/routes.json
  • src/renderer/src/i18n/ko-KR/settings.json
  • src/renderer/src/i18n/ms-MY/routes.json
  • src/renderer/src/i18n/ms-MY/settings.json
  • src/renderer/src/i18n/pl-PL/routes.json
  • src/renderer/src/i18n/pl-PL/settings.json
  • src/renderer/src/i18n/pt-BR/routes.json
  • src/renderer/src/i18n/pt-BR/settings.json
  • src/renderer/src/i18n/ru-RU/routes.json
  • src/renderer/src/i18n/ru-RU/settings.json
  • src/renderer/src/i18n/tr-TR/routes.json
  • src/renderer/src/i18n/tr-TR/settings.json
  • src/renderer/src/i18n/vi-VN/routes.json
  • src/renderer/src/i18n/vi-VN/settings.json
  • src/renderer/src/i18n/zh-CN/routes.json
  • src/renderer/src/i18n/zh-CN/settings.json
  • src/renderer/src/i18n/zh-HK/routes.json
  • src/renderer/src/i18n/zh-HK/settings.json
  • src/renderer/src/i18n/zh-TW/routes.json
  • src/renderer/src/i18n/zh-TW/settings.json
  • src/shared/contracts/events/settings.events.ts
  • src/shared/contracts/routes/system.routes.ts
  • src/shared/settingsNavigation.ts
  • src/types/i18n.d.ts
  • test/renderer/components/AboutUsSettings.test.ts
  • test/renderer/components/DebugSettings.test.ts
  • test/renderer/components/SettingsNavigationDebug.test.ts
💤 Files with no reviewable changes (1)
  • src/renderer/settings/components/AboutUsSettings.vue

Comment thread src/renderer/src/i18n/da-DK/settings.json
Comment thread src/renderer/src/i18n/id-ID/settings.json
Comment thread src/renderer/src/i18n/ru-RU/settings.json
@zhangmo8
zhangmo8 merged commit 2101770 into dev Jul 28, 2026
12 checks passed
@zhangmo8
zhangmo8 deleted the feat/debug-tooling branch July 28, 2026 05:31
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