Skip to content

fix: debounce board move sync#217

Merged
joryirving merged 2 commits into
mainfrom
saffron/issue-194-debounce-board-sync
May 26, 2026
Merged

fix: debounce board move sync#217
joryirving merged 2 commits into
mainfrom
saffron/issue-194-debounce-board-sync

Conversation

@itsmiso-ai

Copy link
Copy Markdown
Contributor

Fixes #194

Summary

  • refresh board state from Dispatch after successful card moves
  • debounce automatic GitHub sync for moved cards and scope it to affected repos
  • surface a warning if the delayed sync fails

Validation

  • npm ci --include=dev
  • npx prisma generate
  • npm run lint
  • npm run typecheck
  • npm run test
  • npm run build

@its-miso

its-miso Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

Automated recommendation: APPROVE

Analysis engine: MiniMax-M2.7@https://litellm.jory.dev/v1 (anthropic)

PR Review: fix: debounce board move sync

Recommendation: Approve

This PR fully satisfies the requirements of linked issue #194. The implementation replaces immediate POST /api/sync after every card move with a 10-second debounced sync that batches multiple moves and scopes to affected repos. Board state refreshes from Dispatch immediately after moves via doRefresh(). All acceptance criteria from #194 are addressed.

Changes

src/components/kanban-board.tsx:

  • Added MOVE_SYNC_DEBOUNCE_MS = 10_000 constant (within the suggested 5-15s window) with clear comments explaining the 10s debounce rationale
  • Added pendingSyncReposRef (Set) and syncTimerRef to track repos and debounce timer
  • New scheduleSync(repoFullName) callback that accumulates repos and fires a single sync after the debounce window
  • Cleanup effect to clear timer on unmount
  • Move handler now calls await doRefresh() then scheduleSync(issue.repository.fullName) instead of immediate sync

src/components/kanban-board.test.tsx:

  • Enhanced dnd-kit mock to capture onDragEnd prop for programmatic triggering
  • Added 4 new tests covering all issue acceptance criteria

Standards Compliance

Requirement Status
Error handling via error instanceof Error pattern ✅ Uses authedFetch wrapper safely
No secrets in client-side code ✅ Uses authedFetch (no agent token exposed to JS)
TypeScript types for refs ✅ Properly typed useRef<Set<string>> and `useRef<ReturnType
React hook cleanup ✅ useEffect returns cleanup for timer
Component modularity scheduleSync is properly scoped

Linked Issue Fit

Issue Requirement Implementation
Moving a card updates Dispatch immediately await doRefresh() after move
UI refreshes board state from Dispatch ✅ Calls doRefresh() to fetch fresh issues
GitHub sync is debounced ✅ 10s MOVE_SYNC_DEBOUNCE_MS
Multiple moves batch into one sync pendingSyncReposRef Set deduplicates
Sync failures surfaced gently ✅ Notification: "GitHub sync failed. Board changes were saved; try Sync Issues or refresh later."
5-15 second debounce window ✅ 10 seconds (middle of range)
Repo-scoped sync ✅ Sends { repoFullName: repo }
No agent token exposed to client JS ✅ Uses authedFetch (safe client-side wrapper)

Evidence Provider Findings

No evidence providers configured; no findings to evaluate.

Tool Harness Findings

No tool requests were executed; this is a static review of the provided corpus. The patch and test diff provide sufficient evidence to evaluate correctness.

Tests Verification

The 4 new tests cover all required scenarios from the issue's Tests section:

  1. "refreshes after a card move and debounces repo-scoped GitHub sync": Verifies immediate /api/issues fetch, no immediate /api/sync, and deferred sync after 10s with repoFullName.

  2. "batches multiple moves in one debounce window into one sync per repo": Verifies 2 moves at t=0 and t=5s result in exactly 1 /api/sync call at t=10s. Confirms zero sync calls at t=9.999s.

  3. "shows a warning when debounced GitHub sync fails": Verifies error notification appears after failed sync response.

  4. "does not expose agent token in the debounced GitHub sync request": Verifies sync request headers do not contain Authorization: Bearer — ensures client-side code uses safe auth mechanism.

Unknowns / Needs Verification

@joryirving joryirving merged commit ab7c58b into main May 26, 2026
3 checks passed
@joryirving joryirving deleted the saffron/issue-194-debounce-board-sync branch May 26, 2026 02:35
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.

Debounce GitHub sync after Board card moves

2 participants