Skip to content

Improve search preload and cache reliability#134

Closed
premsathisha wants to merge 126 commits intostylessh:mainfrom
premsathisha:prem/reliability-search-preload
Closed

Improve search preload and cache reliability#134
premsathisha wants to merge 126 commits intostylessh:mainfrom
premsathisha:prem/reliability-search-preload

Conversation

@premsathisha
Copy link
Copy Markdown
Contributor

@premsathisha premsathisha commented Apr 16, 2026

Summary

This PR improves DiffKit search, issue navigation preload, and local GitHub cache reliability:

  • Ticket number search: Lets list search match ticket numbers directly, so queries like 124 and #124 can find matching issue or pull request rows.
  • Issue-row preload: Preloads issue detail routes when an issue row is hovered, focused, or touched.
  • GitHub cache freshness: Improves GitHub signal polling so locally cached data is invalidated when a missed signal is newer than the local query data.
  • Cache version reset: Bumps the persisted GitHub query cache key so older cached payloads do not keep stale data around after the cache behavior changed.
  • Storage-full protection: Protects query-cache persistence when browser storage is unavailable or full by disabling persistence for the rest of the session instead of breaking the app.

Why

  • Search: Searching by ticket number is a common workflow, but the shared list search only matched title, repository, and author text. Numeric issue and pull request identifiers are now first-class searchable fields.
  • Navigation speed: Issue rows also needed the same fast-open path as other detail rows. Preloading the detail route on intent reduces the wait after selecting an issue without loading every issue detail upfront.
  • Reliability: The GitHub cache changes reduce the chance of showing old data after reloads or missed update signals, while the storage guard keeps the UI usable if localStorage writes fail because browser storage is full, blocked, or unavailable.

Validation

  • pnpm --filter @diffkit/dashboard check
  • pnpm --filter @diffkit/dashboard check-types
  • pnpm --filter @diffkit/dashboard build

Summary by CodeRabbit

  • New Features

    • Numeric filtering with hash-prefix syntax (e.g., #123) and improved deduplication of search results before sorting.
  • Bug Fixes

    • Cache persistence now fails gracefully and disables further persistence after storage errors.
    • Signal-stream handling improved with stale-data detection and deduplication of updated keys.
    • Route preloading now occurs on user intent (hover, focus, touch) instead of automatic preloads.
  • Style

    • Adjusted command palette spacing and item rounding for improved layout.

stylessh added 30 commits April 7, 2026 10:32
Integrate ultracite as the Biome configuration preset across the
monorepo, replacing manual biome.json configs with extends-based
biome.jsonc files. Set up husky pre-commit hook with lint-staged
to auto-fix staged files on commit.
…tylessh#9)

- Create @quickhub/icons package wrapping @hugeicons/react with stable aliases
- Add horizontal topbar with user avatar dropdown, nav tabs, and theme switcher
- Establish layout shell: muted background surface with rounded content card
- Add surface tokens (surface-0/1/2) for layered background levels
- Tune typography: 13px body at weight 450, 500 for interactive elements
- Configure dark mode with inverted surface hierarchy and elevated popovers
- Update button, dropdown, and select components for consistent radius and transitions
- Move dashboard route from /dashboard to / with protected layout wrapper
* Share local D1 state across worktrees

* Only share local D1 state in worktrees
* Redesign overview page with metric cards and PR comment preview

Rebuild the overview page with a contained max-w-3xl layout featuring
Luma-style metric cards (open PRs, issues, review requests), a recent
pull requests list with state-colored icons and inline comment preview,
and a shared GitHub Flavored Markdown renderer in the UI package.

* Extract PullRequestRow component and add custom scrollbar

Move PullRequestRow into #/components/pulls/ for feature-based
organization. Add custom scrollbar styles with stable gutter, thumb-only
rendering, and auto-hide on inactivity. Add welcome header to overview.

* Fix markdown images breaking inline flow in table cells
Build detail pages at /$owner/$repo/pull/$id and /$owner/$repo/issues/$id
with two-column layout: content on the left (header, description, activity
timeline with comments, comment box) and metadata sidebar on the right
(reviewers, participants, assignees, milestones, details). PR view includes
merge status card with CI checks, review state, branch status, and update
branch action. Stacked participant avatars with tooltips. Smaller tooltip
styling globally. Issue rows now link internally instead of to GitHub.
* Improve dashboard caching and preloading

* Refine dashboard detail route loading
… polish (stylessh#24)

- Add shiki-based syntax highlighting to markdown code blocks with custom Vercel
  light/dark themes, copy button, and React Suspense for flash-free rendering
- Move issue labels to sidebar with theme-aware label pill styling
- Add icons to PR detail sidebar rows (calendar, clock, message, file, commit)
- Restructure PR header layout with copyable branch badges
- Add diff boxes visualization to PR stats bar
- Darken green-500 in light mode, switch to Geist Mono variable font
* Add PR review page with diff viewer, inline comments, and file tree

Introduces a dedicated code review page at /$owner/$repo/review/$pullId
powered by @pierre/diffs for syntax-highlighted diffs with multi-line
comment support via gutter drag selection. Includes resizable file tree
sidebar, review submission (Comment/Approve/Request Changes), and proper
dark/light theme integration.

* Fix CF Workers deployment: exclude shiki from server bundle

Shiki's bundled language grammars (~1.5 MB) were being included in the
server bundle via @pierre/diffs and markdown.tsx, pushing the worker
over the 3 MiB free plan limit.

- Add Vite plugin to stub shiki in SSR environment
- Lazy-load PatchDiff component to avoid SSR import chain to shiki
- Guard shiki highlighter initialization to client-only in markdown.tsx
ThaUnknown and others added 16 commits April 14, 2026 12:31
* fix: hide merge section for users without merge permissions

* feat: merge commit form, close/reopen PR, and reviewers empty state

- Add inline commit message form when merging (title + extended description, pre-filled from first commit)
- Add close/reopen PR button next to send in comment box
- Add updatePullState server function
- Pass commitTitle and commitMessage through to GitHub merge API
- Add empty state in reviews section when no reviewers added
- Style commit form with surface background to match other sections

* fix: simplify merge bypass to rely on server-provided status

Remove client-side guesswork from bypass logic. Now only uses
server-derived isMergeBlocked, canBypassProtections, and hasConflicts.
No auto-bypass — user must explicitly opt in. Bypass hidden for
conflicts since GitHub rejects those regardless of permissions.
* feat: add inbox page for GitHub notifications

Adds a split-view inbox page (Linear-style) with notification list sidebar
and content preview pane that renders actual PR/Issue detail pages.

- Notification list with unread/all filter, mark as read/done, archive actions
- Avatar stack showing all participants (author, assignees, reviewers, commenters)
- Subject state-aware icons and colors (open/closed/merged)
- Prefetch next notification's data on selection for instant navigation
- Fix closed PR merge status display in detail header and activity feed
- Repo name in preview header links to repo overview
- Hoisted regexes and memoized components for performance

* fix: use typed route params for repo link in inbox preview header

* feat: add unread notification dot to inbox tab and polish inbox list

- Show blue dot on Inbox nav tab when unread notifications exist
- Remove bottom border from last inbox list item
Render RepoActivityCards (Pull Requests, Issues, Discussions) into the
SidePanelPortal on the pulls and issues list pages, matching the repo
overview layout. Also ensure the "View all" link always appears in
activity cards even when there are no open items.
- Add "Browser extension" card in settings that detects whether the
  DiffKit extension is installed and prompts to install if not
- Guard dashboard-presence.js with an origin check so it only sets
  data-diffkit-extension on DiffKit origins (fixes Firefox injecting
  the script on all sites when broader host permissions are granted)
- Update Firefox extension store URL to canonical /addon/diffkit/ path
* feat: add test script and CI check for pull requests

Wire up `pnpm test` via Turborepo to run Vitest across all workspace
packages, and add a required Test job to the PR checks workflow.

https://claude.ai/code/session_01Tw4Aikrys2TqqyAmC9AEXe

* fix: align github.server and github-cache tests with refactored source

- Mock `@tanstack/react-start/server` in github-cache tests to avoid
  slow dynamic import that caused a timeout on the first test
- Add `Octokit.defaults` to the octokit mock so installation client
  tests can call the static method
- Mock `configureGitHubRequestPolicies` and update assertions to match
  the refactored code that delegates request policies instead of
  configuring throttle/retry inline

https://claude.ai/code/session_01Tw4Aikrys2TqqyAmC9AEXe

* chore: rename test CI check to "Test Suite"

https://claude.ai/code/session_01Tw4Aikrys2TqqyAmC9AEXe

---------

Co-authored-by: Claude <noreply@anthropic.com>
* Fix shortcut hints

* Polish shortcut navigation

* Remove PR screenshot assets

---------

Co-authored-by: Prem Sathisha Etagi <premsathisha@users.noreply.github.com>
* feat: add drag-to-reorder tabs and "close merged" context menu option

- Add native HTML drag-and-drop to reorder dashboard tabs, persisted to localStorage
- Add "Close merged" context menu option with purple PR icon to bulk-close merged PR/review tabs
- Track merged state on tabs via explicit `merged` field with iconColor fallback for existing tabs

* fix: add merged field to useRegisterTab type signature
…lob/tree routes

* feat: add file explorer with tree sidebar, syntax highlighting, and blob/tree routes

Add a split-panel code explorer accessible from the repo overview file tree.
Clicking any file or folder navigates to tree/blob routes matching GitHub's
URL convention. The explorer features:

- Resizable left sidebar with recursive file tree (lazy-loaded directories)
- Folder view with commit messages and timestamps in the right pane
- Shiki syntax-highlighted code viewer with line numbers, copy, and raw download
- File-specific latest commit bar (fetches last commit affecting that file)
- Progressive BFS prefetching of all tree nodes to eliminate loading spinners
- Mobile drawer pattern for file tree (matches review page)
- Ref parsing from splat URLs with longest-branch-match strategy

* feat: shared file search, per-entry commits, image preview, and UI polish

- Extract file search card into shared component for reuse across repo sidebar and PR review page
- Add fuzzy file search library (fuzzy-file-search.ts)
- Fetch per-entry last commit data in folder view and file tree (commit message + relative time)
- Render image files (png, jpg, gif, etc.) as media preview instead of blob content
- Add preview/code toggle for SVG files
- Fix long-line background rendering by moving overflow to outer wrapper with sticky line numbers
- Split directory node click: arrow toggles expand, name navigates to folder
- Center README content with max-w-3xl and increased vertical padding
- Use bg-surface-1 for latest commit bar
- Align search card top padding with content pane
- Add F shortcut to focus search in PR review page

* perf: optimize re-renders and batch commit queries

- Batch per-entry commit messages into a single GraphQL query with
  aliased history fields instead of N separate REST calls
- Add explorer-path-store (useSyncExternalStore) so tree nodes subscribe
  to derived isActive booleans — only 2 nodes re-render on navigation
- Memoize scope objects in route components to stop busting memo on
  every child
- Prevent same-URL navigation on already-active tree nodes
- Stabilize callbacks in RepoExplorerLayout (useCallback + imperative
  reads from store)
- Isolate pathname subscription in dashboard-tabs via
  ScrollActiveTabIntoView renderless component
- Fix branch switch in blob view navigating to tree route
- Add light-mode border to branch selector button
* feat: filter private repos by GitHub App installation access

Build a cached installation access index that tracks which repos/owners
the GitHub App is installed for. Private repos are only shown if the
owning account has an "all" installation or the specific repo is in the
"selected" set. Public repos always pass through.

- Add `installationAccess` signal key and cache policy (30 min stale)
- Webhook events (installation, installation_repositories,
  github_app_authorization) invalidate the index immediately
- `getInstallationAccessIndex` fetches installations and paginates
  selected repos, cached via getOrRevalidateGitHubResource
- `isRepoVisibleWithInstallationAccess` filter utility (fail-open
  when no app is configured)
- Apply filter in `getUserRepos` (parallel fetch with repo list)
- Expose `getInstallationAccess` server function for other consumers
- 7 new tests covering all filter scenarios

* feat: extend installation access filtering to all GitHub data flows

Add isPrivate to RepositoryRef and all GraphQL repository fragments so
the installation access filter can be applied everywhere, not just
getUserRepos.

- Add isPrivate to RepositoryRef type and GitHubGraphQLRepositoryRef
- Update buildRepositoryRef, parseRepositoryRef, mapGraphQLRepositoryRef
- Add isPrivate to GraphQL fragments for pull search, issue search,
  pull detail, and issue detail queries
- Add generic filterItemsByInstallationAccess helper and specialized
  filterMyPullsResult / filterMyIssuesResult wrappers
- Apply filter in getMyPulls, getMyIssues (parallel fetch with result)
- Apply filter in searchCommandPaletteGitHub (parallel with search)
- Apply filter in getNotifications (parallel with notification fetch)
- Apply filter in getUserPinnedRepos

* chore: add debug logs throughout installation access filtering

Add debug() calls so the access index building and filtering behavior
is fully observable in local dev:

- Log when fetching the index (cache miss vs resolved from cache)
- Log each installation's access mode (all/selected/suspended)
- Log the full built index (owners, repos, counts)
- Log whenever items are filtered out, with repo names and counts
  (getUserRepos, getMyPulls, getMyIssues, command palette,
  notifications, pinned repos)

* feat: refresh installation access cache when returning from GitHub

Add visibilitychange listener to /setup page and access dialog that
busts the server-side installation access cache and invalidates all
GitHub queries when the user returns from configuring permissions.

* fix: address review feedback on installation access filtering

- Paginate GET /user/installations (handles >100 installations)
- Let transient API errors propagate instead of silently failing open
- Use app-user client (not OAuth) for listInstallationReposForAuthenticatedUser
- Default unknown repo visibility to null instead of false (public), so
  REST search results are checked against the access index
- Wrap refreshInstallationAccess in try/finally so client-side cache
  invalidation runs even if the server call fails
Comment thread apps/dashboard/src/lib/query-client.tsx Outdated
gregor-tokarev and others added 2 commits April 16, 2026 14:59
…elect

* feat: add open current page on github shortcut and command to cmd+k select

* chore: reconsidered ui change

* feat: Do not apply extension redirects for certain referers.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ae595db7-8715-40bb-ae3f-fc4a0c90ac72

📥 Commits

Reviewing files that changed from the base of the PR and between 8df1955 and b5629b9.

📒 Files selected for processing (1)
  • apps/dashboard/src/components/filters/use-list-filters.ts

📝 Walkthrough

Walkthrough

Adds numeric (#-prefixed) search support to list filtering, changes issue-link preloading to explicit user-intent-driven preloads, makes React Query cache persistence resilient to storage errors by disabling writes for the session on failure, refines signal-stream polling to ignore newer local data and deduplicate missed keys, and tweaks Command palette padding and item rounding.

Changes

Cohort / File(s) Summary
List Filtering Enhancement
apps/dashboard/src/components/filters/use-list-filters.ts
Added optional number?: number to FilterableItem. applyFilters now normalizes queries starting with #, detects fully-numeric queries, matches numeric items by prefix when applicable, and deduplicates filtered results by item.id before sorting.
Issue Row Preloading
apps/dashboard/src/components/issues/issue-row.tsx
Imported useRouter and preloadRouteOnce; disabled automatic Link preloading (preload={false}) and added explicit preloadDetail triggered on onMouseEnter, onFocus, and onTouchStart, with error logging.
Query Cache Persistence
apps/dashboard/src/lib/query-client.tsx
Inside persistGitHubQueryCache introduced session-scoped persistenceDisabled flag; writeCache, scheduleWrite, and flushOnUnload early-return when disabled. Wrapped dehydrate/localStorage writes in try/catch to remove cached key and disable further persistence on error.
Signal Stream Polling
apps/dashboard/src/lib/use-github-signal-stream.ts
Added hasStaleLocalDataForSignal to check dataUpdatedAt against incoming signal.updatedAt; treat first-seen signal keys as missed only if local data is stale/missing. Switched updatedKeys from array to Set for deduplication and adjusted logging/invalidation call sites.
Command Palette Styling
packages/ui/src/components/command.tsx
Adjusted Tailwind classes: increased horizontal padding from px-2 to px-3 on container descendant selector and CommandItem, and added rounded-sm to items; preserved selection/disabled, layout, and icon sizing behaviors.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.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 summarizes the three primary changes: search improvements, preload optimization, and cache reliability enhancements.
Description check ✅ Passed The description covers all required template sections with comprehensive details: Summary explains each change with context, Changes section lists five specific improvements, Validation section includes test commands run, and Test Plan is marked complete.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

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: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/dashboard/src/components/filters/use-list-filters.ts`:
- Around line 246-265: The current filter branch for isHashNumberQuery is
exclusive and treats a bare "#" as matching everything; change it so
ticket-number matching is additive to the normal text checks: inside the
result.filter where isHashNumberQuery is used, only treat it as a ticket-number
check when normalizedNumberQuery is non-empty and isNumericQuery is true,
otherwise fall back to the same text checks used in the else branch; when
normalizedNumberQuery is present, return true if either the text checks
(item.title, item.repository.fullName, item.author?.login) match OR the number
check (typeof item.number === "number" &&
String(item.number).startsWith(normalizedNumberQuery)) matches so ticket
searches are additive rather than exclusive.

In `@apps/dashboard/src/components/issues/issue-row.tsx`:
- Around line 27-29: The preloadDetail handler currently discards the promise
from preloadRouteOnce(router, href) causing potential unhandled rejections;
update preloadDetail to explicitly handle errors from preloadRouteOnce(router,
href) (either by making preloadDetail async and using try/catch around await
preloadRouteOnce(...) or by attaching .catch(...) to the returned promise) and
surface the error (e.g., console.error or the app logger) so loader/network
failures are not left unhandled.

In `@apps/dashboard/src/lib/query-client.tsx`:
- Around line 212-218: When localStorage.setItem in the persistence block fails,
remove the stale entry under GITHUB_QUERY_CACHE_STORAGE_KEY before disabling
persistence so old cache won't be rehydrated; update the catch in the same block
(where persistenceDisabled is set) to perform a best-effort
window.localStorage.removeItem(GITHUB_QUERY_CACHE_STORAGE_KEY) (silently ignore
errors) and then set persistenceDisabled = true so the code in this module
(query-client.tsx) no longer persists or rehydrates the stale payload.

In `@apps/dashboard/src/lib/use-github-signal-stream.ts`:
- Around line 83-107: getLatestLocalDataTimestampForSignal currently returns the
max dataUpdatedAt across targets which hides stale targets; change it to detect
"any stale target" instead: update getLatestLocalDataTimestampForSignal to
iterate matching targets and return a boolean (e.g., hasAnyStaleLocalData) that
is true if any target has no queryState or queryState.dataUpdatedAt <
signal.updatedAt, and false otherwise, then update callers that used the
timestamp to use this boolean to add updatedKeys when any target is stale; apply
the same change to the other identical block referenced in the comment.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: dea214d0-6c7a-4d74-b5de-a564d8d495e3

📥 Commits

Reviewing files that changed from the base of the PR and between 134ab04 and 71d4d2c.

📒 Files selected for processing (4)
  • apps/dashboard/src/components/filters/use-list-filters.ts
  • apps/dashboard/src/components/issues/issue-row.tsx
  • apps/dashboard/src/lib/query-client.tsx
  • apps/dashboard/src/lib/use-github-signal-stream.ts

Comment thread apps/dashboard/src/components/filters/use-list-filters.ts
Comment thread apps/dashboard/src/components/issues/issue-row.tsx
Comment thread apps/dashboard/src/lib/query-client.tsx
Comment thread apps/dashboard/src/lib/use-github-signal-stream.ts Outdated
Copy link
Copy Markdown
Owner

some items are being duplicated on search.

@premsathisha
Copy link
Copy Markdown
Contributor Author

some items are being duplicated on search.

Fixed now

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.

6 participants