Extract + Drizzle dead_letter_prs + watched_repos aggregates #842

Closed
opened 2026-05-04 20:28:32 +00:00 by claude-desktop · 0 comments
Collaborator

As a maintainer, I want the small dead_letter_prs and watched_repos aggregates split out and rewritten on Drizzle, so that webhook-secret rotation and dead-letter handling code stops living in the db.ts god-file.

Acceptance criteria

Extraction

  • New file dead-letter-prs.ts — fns upsertDeadLetterPr, removeDeadLetterPr, snoozeDeadLetterPr, plus list/get helpers (audit db.ts:1984+ for full set).
  • New file watched-repos.ts — fns listWatchedReposForRotation, updateWatchedRepoSecret, plus full CRUD audited from db.ts.
  • All callers updated (grep from.*database/db for both function sets — background/webhook-secret-rotator.ts and domain/workflow/event-handlers.ts are known callers).

Drizzle

  • schema/dead-letter-prs.ts + schema/watched-repos.ts defined.
  • All fns rewritten on Drizzle.

Tests

  • Relevant slices of db.test.ts extracted to per-file test files, green.

Out of scope

  • Other aggregates still in db.ts.

References

  • apps/server/src/infrastructure/database/db.ts:1984+ (dead-letter fns).
  • apps/server/src/background/webhook-secret-rotator.ts (caller).
  • Foundation story (#839) must merge first.
**As a** maintainer, **I want** the small `dead_letter_prs` and `watched_repos` aggregates split out and rewritten on Drizzle, **so that** webhook-secret rotation and dead-letter handling code stops living in the `db.ts` god-file. ## Acceptance criteria ### Extraction - [ ] New file `dead-letter-prs.ts` — fns `upsertDeadLetterPr`, `removeDeadLetterPr`, `snoozeDeadLetterPr`, plus list/get helpers (audit `db.ts:1984+` for full set). - [ ] New file `watched-repos.ts` — fns `listWatchedReposForRotation`, `updateWatchedRepoSecret`, plus full CRUD audited from `db.ts`. - [ ] All callers updated (grep `from.*database/db` for both function sets — `background/webhook-secret-rotator.ts` and `domain/workflow/event-handlers.ts` are known callers). ### Drizzle - [ ] `schema/dead-letter-prs.ts` + `schema/watched-repos.ts` defined. - [ ] All fns rewritten on Drizzle. ### Tests - [ ] Relevant slices of `db.test.ts` extracted to per-file test files, green. ## Out of scope - Other aggregates still in `db.ts`. ## References - `apps/server/src/infrastructure/database/db.ts:1984+` (dead-letter fns). - `apps/server/src/background/webhook-secret-rotator.ts` (caller). - Foundation story (#839) must merge first.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
charles/claude-hooks#842
No description provided.