Skip to content

Debounce GitHub sync after Board card moves #194

@joryirving

Description

@joryirving

Goal

Keep the nice UX where moving a card eventually syncs with GitHub, but avoid calling `POST /api/sync` immediately after every single card move.

Problem

Dragging a card currently calls the move endpoint, then triggers a full issue sync. This is useful from a user perspective because the board catches up without requiring a manual Sync Issues click, but it can be too heavy and now collides with protected sync auth.

Desired behavior

  • Moving a card should update Dispatch immediately.
  • The UI should refresh board state from Dispatch after the move.
  • GitHub issue sync should still happen automatically, but debounced/rate-limited/batched.
  • Multiple card moves in a short window should result in one sync, not one sync per move.
  • Sync failures should be surfaced gently, not silently swallowed.

Suggested implementation

  • Replace immediate `POST /api/sync` after every move with a debounced sync request.
  • Consider a 5-15 second debounce window.
  • Prefer syncing only the affected repo if possible.
  • If user auth is not implemented yet, avoid calling protected sync directly from client-side JavaScript unless there is a safe server-side/operator-auth path.
  • Refresh board state from `/api/issues` after successful moves.

Tests

Add/update tests for:

  • card move updates Dispatch/board state
  • multiple moves only schedule one sync within debounce window
  • sync is repo-scoped if implemented
  • sync failure displays a warning
  • no agent token is exposed to client-side JavaScript

Acceptance criteria

  • Moving a card still feels automatic to the user.
  • User does not need to manually click Sync Issues after every move.
  • Multiple moves are batched/debounced.
  • Board state refreshes from Dispatch after move.
  • GitHub sync behavior is auth-safe.
  • Tests pass.

Validation

Run:

  • `npm ci`
  • `npx prisma generate`
  • `npm run lint`
  • `npm run typecheck`
  • `npm run test`
  • `npm run build`

Do not cut a release in this task.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions