feat(web): add Syncing filter to Repositories table

Closed
MS
2mo ago
+140-19

Summary

Add a new Syncing filter option to the Repositories table status filter dropdown. This allows users to filter repositories that are currently being synced (pending or in-progress).

Changes

BullMQClient (packages/shared)

  • Add getSyncingJobIds method to fetch job IDs in pending/active states (waiting, waiting-children, prioritized, active)
  • Add getSyncingRepoIds method to extract repoId from pending jobs (catches pending reindex for already-indexed repos)
  • Add corresponding tests

Repositories Table (packages/web)

  • Add "syncing" to the StatusFilter type and getStatusFilter validation
  • Add "Syncing" option to the status filter dropdown (placed between "Filter by status" and "Failed")
  • Add statusSchema validation for the "syncing" query parameter
  • Implement syncing filter logic in page.tsx:
    • Filter repos with latestIndexingJobId in the set of syncing job IDs (active jobs)
    • Filter repos with id in the set of syncing repo IDs (pending reindex jobs)
    • Filter repos with indexedAt: null AND firstIndexingJobFinishedAt: null (first-time syncing, excludes failed-first-index)
  • Add empty state message: "No repositories are currently syncing."
  • Add tests for the new filter functionality

Review Comments Addressed

1. Syncing filter overlaps Failed (fixed)

The original indexedAt: null clause matched repos whose first index failed. Fixed by adding firstIndexingJobFinishedAt: null constraint, which excludes repos that already finished their first indexing job (whether succeeded or failed).

2. Pending reindex on already-indexed repos invisible (fixed)

Added getSyncingRepoIds() that extracts data.repoId from pending jobs. The syncing filter now matches repos by ID (not just by latestIndexingJobId), catching pending reindex jobs before the worker starts.

3. Scheduled future jobs counted as syncing (fixed)

Removed delayed and paused states from syncing job queries. These states include scheduled repeat jobs (future reindexing), not actual sync operations.

Testing

  • All existing tests pass (28 reposTable tests, 17 BullMQClient tests)
  • Added tests for:
    • Reflecting syncing status filter from URL
    • Empty state message for syncing filter
    • Clear filters button visibility for syncing filter
    • getSyncingRepoIds method

E2E Validation

Tested locally with real public GitHub repos (sourcebot-dev/sourcebot, torvalds/linux, laravel/laravel, dolthub/dolt):

Syncing Filter Empty State (Fixed)

Syncing filter showing empty state when no repos are syncing

Manual Sync Shows Syncing Badge

Manual sync on laravel showing Syncing badge
Manual sync on linux showing Syncing badge

Failed Filter Still Works

Failed filter showing empty state

Results

  • Syncing filter correctly excludes failed-first-index repos (no overlap with Failed)
  • Syncing filter correctly excludes scheduled future reindex jobs
  • Manual sync triggers are correctly captured by the syncing filter
  • Failed/Warning/all filters continue to work correctly

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

Summary by cubic

Adds a Syncing filter to the Repositories table status dropdown, showing repositories with pending or in-progress indexing jobs.

  • getSyncingJobIds lists jobs in waiting, waiting-children, prioritized, and active states; getSyncingRepoIds extracts the repo IDs from those jobs.
  • A repository counts as syncing when its latest indexing job or repo ID is in that set, or when it has never been indexed (indexedAt and firstIndexingJobFinishedAt are both null).
  • Delayed and paused jobs are excluded so scheduled future reindexes don't show as syncing, and repos whose first index failed only appear under Failed.
  • Adds the "No repositories are currently syncing." empty state.

Summary by CodeRabbit

  • New Features
    • Added a Syncing status filter to the Repositories table.
    • Repositories currently being indexed or awaiting indexing are now included in Syncing results.
    • Added an empty-state message when no repositories are syncing.
    • The status filter and URL-based filtering now support Syncing alongside existing statuses.
    • Clearing filters continues to work when Syncing is selected.