[BUG] Automatic goal sync skips goal.completed webhooks

Abierto
#4,073 2 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@Dhruvdesai793 ya está trabajando en esto.

Desde el 3/12/2026.

  • #4079 de @Dhruvdesai793 — abierto

Evaluación

Este issue todavía no se ha evaluado.

Descripción

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.
Lenguaje dominante
TypeScript
Estrellas
246
Forks
436
Merge medio
9 h 33 min
PR fusionados (30 d)
213

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Priyanshu-byte-coder/devtrack

Todos los issues de Priyanshu-byte-coder/devtrack

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.