[BUG] Automatic goal sync skips goal.completed webhooks

Aperta
#4,073 2 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@Dhruvdesai793 ci sta già lavorando.

Dal 3/12/2026.

  • #4079 di @Dhruvdesai793 — aperta

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

bug needs-triage status:assigned
What happened?

Activity-derived goals can reach their target during automatic GitHub sync without dispatching the configured goal.completed webhook. src/lib/goals-sync.ts updates progress but does not detect the incomplete-to-complete transition or dispatch the event. The manual goal PATCH route dispatches completion notifications, but activity-derived progress is updated through /api/goals/sync and the cron route, so subscribers receive no completion event.

Expected: Completing an activity-derived goal through sync emits the same goal.completed event as a manual completion.

Proposed solution: Compare the stored and newly synced progress against the target, dispatch on the first incomplete-to-complete transition, and make repeated syncs idempotent. Add tests for a sync that reaches the target and a repeat sync that must not duplicate the event.

Steps to reproduce
  1. Configure a webhook subscription for goal.completed.
  2. Create an activity-derived goal with a target of one commit.
  3. Record matching GitHub activity and run goal sync (or wait for the cron sync).
  4. Observe that goal progress reaches the target but no completion webhook is sent.
Where is it?

Goals

Where did you see it?

Local development

Browser and device

Not browser-specific: server-side sync/webhook behavior. Local development on Linux x86_64, Node v26.13.1, Vitest 4.1.12.

Screenshots, console errors or logs

No screenshot applies to this server-side behavior. Validation: ./node_modules/.bin/tsc --noEmit completed successfully. Focused existing tests ./node_modules/.bin/vitest run test/goals-sync-lib.test.ts test/weekly-summary-combined.test.ts --reporter=dot passed (2 files, 28 tests), but do not assert webhook dispatch when automatic sync crosses the target. Full ./node_modules/.bin/vitest run: 3,405 passed, 54 failed; all failures were six component suites where JSDOM lacked localStorage, unrelated to goal sync. The sync transition/webhook regression described above is not currently covered.

Want to fix it?
  • I'd like to work on this. A maintainer will assign you; please don't start before that.
Lingua principale
TypeScript
Stelle
246
Fork
436
Merge medio
9h 33m
PR unite (30g)
213

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Priyanshu-byte-coder/devtrack

Tutte le issue di Priyanshu-byte-coder/devtrack

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.