Skip to content

fix(desktop): hide recent history entries without matching data#1444

Merged
saddlepaddle merged 3 commits into
mainfrom
clean-up-recent-history
Feb 12, 2026
Merged

fix(desktop): hide recent history entries without matching data#1444
saddlepaddle merged 3 commits into
mainfrom
clean-up-recent-history

Conversation

@saddlepaddle
Copy link
Copy Markdown
Collaborator

@saddlepaddle saddlepaddle commented Feb 12, 2026

Summary

  • Filter out "Recently Viewed" dropdown entries whose workspace or task data can no longer be resolved, removing the "Unknown" fallback rows
  • Empty-state check now uses the filtered list so the history button disables correctly when all entries lack data

Test plan

  • Open the history dropdown and verify entries with valid workspace/task data still appear
  • Confirm entries that previously showed "Unknown" are no longer visible
  • Delete a workspace and verify its entry disappears from recent history

Summary by CodeRabbit

  • Bug Fixes

    • History dropdown now filters out stale entries and shows only items that exist in the current workspace/task view.
  • Tests

    • Added mocked database/test setup and isolated test mocks so tests run reliably without a native DB dependency.
  • Refactor

    • Adjusted how external-app configuration is sourced to simplify imports.
  • Chores

    • CI runtime updated to a newer Bun version.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 12, 2026

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds filtering of recently viewed entries in HistoryDropdown, replacing recentEntries with filteredEntries for empty-state and list rendering. Adds test-time mocks for @superset/local-db and main/lib/local-db. Moves runtime import of EXTERNAL_APPS to @superset/local-db and makes ExternalApp a type-only import in helpers.

Changes

Cohort / File(s) Summary
History Dropdown Filtering
apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/TopBar/components/NavigationControls/components/HistoryDropdown/HistoryDropdown.tsx
Adds filteredEntries by filtering recentEntries against workspaceData and taskData; switches early-exit and rendering to use filteredEntries instead of recentEntries.
Test DB & local-db mocks
apps/desktop/test-setup.ts, apps/desktop/src/lib/trpc/routers/terminal/terminal.stream.test.ts
Adds mocks for @superset/local-db (tables/constants) and a mock main/lib/local-db localDb surface to allow tests to run without drizzle-orm/sqlite-core or native DB libs.
External apps import changes
apps/desktop/src/lib/trpc/routers/external/helpers.ts, apps/desktop/src/lib/trpc/routers/external/index.ts
Removes value export of EXTERNAL_APPS from helpers; ExternalApp is now type-only in helpers. EXTERNAL_APPS is imported directly from @superset/local-db in index.ts.
CI Bun version bump
.github/workflows/ci.yml
Updates Bun setup version from 1.3.3 to 1.3.6 across CI jobs.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • superset-sh/superset PR 161 — also modifies apps/desktop/test-setup.ts to add/adjust @superset/local-db mocks and test scaffolding.
  • superset-sh/superset PR 122 — touches desktop test/setup and terminal/history code; related to local-db mocks and history handling.
  • superset-sh/superset PR 124 — adjusts EXTERNAL_APPS handling/imports in trpc external router files.

Poem

🐰 I hop through lists both new and old,
I sift the crumbs until they're gold,
Mocks make a meadow where tests can play,
Imports find their proper way,
A jubilant rabbit cheers: "Hip-hip hooray!"

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: filtering and hiding recent history entries that lack matching workspace or task data.
Description check ✅ Passed The description provides a clear summary of changes and a detailed test plan, but lacks the formal template structure with sections like 'Related Issues', 'Type of Change', and 'Screenshots'.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch clean-up-recent-history

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 and usage tips.

Filter out workspace and task entries from the "Recently Viewed"
dropdown when their data can no longer be resolved, instead of
showing "Unknown" fallback rows.
@saddlepaddle saddlepaddle force-pushed the clean-up-recent-history branch 4 times, most recently from 5fe35a0 to f015413 Compare February 12, 2026 17:42
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@apps/desktop/test-setup.ts`:
- Around line 148-168: The global mock defines EXTERNAL_APPS as an empty array
which causes z.enum(EXTERNAL_APPS) to throw at runtime; update the mock.module
call so EXTERNAL_APPS is a non-empty tuple of strings (e.g., include a single
representative value like "none" or "internal") to satisfy z.enum(EXTERNAL_APPS)
and any consumers that expect at least one option; ensure the value shape
matches how EXTERNAL_APPS is used elsewhere (string tuple) and adjust other
mocks if they rely on specific entries.
🧹 Nitpick comments (1)
apps/desktop/src/lib/trpc/routers/terminal/terminal.stream.test.ts (1)

88-96: Local mock diverges from the global test-setup.ts mock surface

This local mock omits tables (users, organizations, organizationMembers, tasks) and constants (BRANCH_PREFIX_MODES, TERMINAL_LINK_BEHAVIORS, FILE_OPEN_MODES) that the global mock provides. It works today because terminal tests don't touch those, but if the terminal module's dependency graph expands, you'll get silent undefined values instead of a clear failure. Consider keeping the two in sync or extracting a shared helper.

Comment thread apps/desktop/test-setup.ts Outdated
Comment on lines +148 to +168
// =============================================================================
// @superset/local-db Schema Mock (drizzle-orm/sqlite-core not available in Bun tests)
// =============================================================================

const mockTable = (name: string) => ({ id: `${name}_id` });

mock.module("@superset/local-db", () => ({
projects: mockTable("projects"),
workspaces: mockTable("workspaces"),
worktrees: mockTable("worktrees"),
settings: mockTable("settings"),
users: mockTable("users"),
organizations: mockTable("organizations"),
organizationMembers: mockTable("organization_members"),
tasks: mockTable("tasks"),
EXTERNAL_APPS: [],
EXECUTION_MODES: ["sequential", "parallel"],
BRANCH_PREFIX_MODES: ["none", "github", "author", "custom"],
TERMINAL_LINK_BEHAVIORS: ["external-editor", "file-viewer"],
FILE_OPEN_MODES: ["split-pane", "new-tab"],
}));
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.

⚠️ Potential issue | 🟡 Minor

EXTERNAL_APPS: [] will crash any test path that reaches z.enum(EXTERNAL_APPS)

In external/index.ts (line 14), z.enum(EXTERNAL_APPS) requires a non-empty tuple. An empty array causes a Zod runtime error. If any test transitively imports the external router while relying on this global mock, it will fail. Consider providing at least one representative value.

Proposed fix
 mock.module("@superset/local-db", () => ({
 	projects: mockTable("projects"),
 	workspaces: mockTable("workspaces"),
 	worktrees: mockTable("worktrees"),
 	settings: mockTable("settings"),
 	users: mockTable("users"),
 	organizations: mockTable("organizations"),
 	organizationMembers: mockTable("organization_members"),
 	tasks: mockTable("tasks"),
-	EXTERNAL_APPS: [],
+	EXTERNAL_APPS: ["cursor"],
 	EXECUTION_MODES: ["sequential", "parallel"],
 	BRANCH_PREFIX_MODES: ["none", "github", "author", "custom"],
 	TERMINAL_LINK_BEHAVIORS: ["external-editor", "file-viewer"],
 	FILE_OPEN_MODES: ["split-pane", "new-tab"],
 }));
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// =============================================================================
// @superset/local-db Schema Mock (drizzle-orm/sqlite-core not available in Bun tests)
// =============================================================================
const mockTable = (name: string) => ({ id: `${name}_id` });
mock.module("@superset/local-db", () => ({
projects: mockTable("projects"),
workspaces: mockTable("workspaces"),
worktrees: mockTable("worktrees"),
settings: mockTable("settings"),
users: mockTable("users"),
organizations: mockTable("organizations"),
organizationMembers: mockTable("organization_members"),
tasks: mockTable("tasks"),
EXTERNAL_APPS: [],
EXECUTION_MODES: ["sequential", "parallel"],
BRANCH_PREFIX_MODES: ["none", "github", "author", "custom"],
TERMINAL_LINK_BEHAVIORS: ["external-editor", "file-viewer"],
FILE_OPEN_MODES: ["split-pane", "new-tab"],
}));
// =============================================================================
// `@superset/local-db` Schema Mock (drizzle-orm/sqlite-core not available in Bun tests)
// =============================================================================
const mockTable = (name: string) => ({ id: `${name}_id` });
mock.module("@superset/local-db", () => ({
projects: mockTable("projects"),
workspaces: mockTable("workspaces"),
worktrees: mockTable("worktrees"),
settings: mockTable("settings"),
users: mockTable("users"),
organizations: mockTable("organizations"),
organizationMembers: mockTable("organization_members"),
tasks: mockTable("tasks"),
EXTERNAL_APPS: ["cursor"],
EXECUTION_MODES: ["sequential", "parallel"],
BRANCH_PREFIX_MODES: ["none", "github", "author", "custom"],
TERMINAL_LINK_BEHAVIORS: ["external-editor", "file-viewer"],
FILE_OPEN_MODES: ["split-pane", "new-tab"],
}));
🤖 Prompt for AI Agents
In `@apps/desktop/test-setup.ts` around lines 148 - 168, The global mock defines
EXTERNAL_APPS as an empty array which causes z.enum(EXTERNAL_APPS) to throw at
runtime; update the mock.module call so EXTERNAL_APPS is a non-empty tuple of
strings (e.g., include a single representative value like "none" or "internal")
to satisfy z.enum(EXTERNAL_APPS) and any consumers that expect at least one
option; ensure the value shape matches how EXTERNAL_APPS is used elsewhere
(string tuple) and adjust other mocks if they rely on specific entries.

Add mock.module for @superset/local-db in terminal.stream and
external/helpers tests. Bun's mock.module leaks across test files,
so the terminal test's mock must include EXTERNAL_APPS to avoid
breaking the helpers test when both run in the same process.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 12, 2026

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ⚠️ Neon database branch
  • ✅ Electric Fly.io app
  • ✅ Streams Fly.io app

Thank you for your contribution! 🎉

@saddlepaddle saddlepaddle merged commit 31cd1f0 into main Feb 12, 2026
15 checks passed
@Kitenite Kitenite deleted the clean-up-recent-history branch February 16, 2026 00:04
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