Home

boring / v2

publicBoring-Software-Inc/v2
Overview Code History Branches Pull requestsIssuesInsights Campfire Docs
main
HomeOverview Code PRsIssues

fix(db): stamp reviewer/label syncs even when the result is empty

closed
#186 opened by detail-app[bot]detail/bug-fix/fix-db-stamp-reviewer-label-syncs-even-when-the-re-894ed2→main
Conversation4
detail-app[bot]
Commits
0
Files changed…
opened this pull request
Author
· 2 weeks ago

Detail bug report: View on Detail

Closes #173

Bug

When a reviewer (or label) sync produced zero results, replaceRepoReviewers/replaceRepoLabels deleted all rows and inserted none, so the sync timestamp was never recorded. Freshness was derived solely from max(row.synced_at) across per-item rows — an empty set has no rows, so syncedAt stayed null forever. The read path treats null as "never synced," so every open of the reviewer/label panel re-queued a sync, defeating the 24-hour (reviewers) and 60-second (labels) staleness throttle. The worker job had the same gap: it returned early without stamping when GitHub reads were disabled or the repo was on a non-GitHub forge.

Fix

Added a repo_sync_stamps table (per-repo, per-kind, composite PK) that records the sync time unconditionally — following the convention already used by upsertRepoSuggestions, which stamps updatedAt even for empty results.

  • replaceRepoReviewers/replaceRepoLabels upsert the stamp inside their transaction, even when the result set is empty
  • listRepoReviewers/listRepoLabels/lastReviewerSync return max(stamp, max(row.synced_at))
  • The worker jobs stamp the sync when GitHub reads are disabled or the repo is on a non-GitHub forge (previously returned without stamping); missing/removed repos and failed reads still skip the stamp
  • New stampRepoReviewerSync/stampRepoLabelSync functions let the worker record a stamp without touching the per-item rows

Testing

  • New integration tests in reviewers.integration.test.ts: empty sync records the timestamp and engages the throttle; repeated empty syncs update the stamp; empty-after-non-empty and non-empty-after-empty both work; stampRepoReviewerSync records without touching rows; cascade-delete clears the stamp
  • New worker integration tests for both reviewers and labels: disabled reads stamp the sync, non-GitHub repos stamp the sync, empty result lists stamp the sync, missing repos and failed reads do not stamp
  • Existing tests for non-empty syncs, dedup, contract validation, per-repo isolation, and cascade-delete behavior still pass (no regression)
  • Verified the end-to-end flow against a real Postgres 17 database: a never-synced repo reads null/stale, an empty sync records the stamp and stops re-queueing, a second read stays fresh, 25h later it's stale again, and disabled reads (http: null) also stamp correctly — same for labels
  • Unit tests, typecheck (all 15 workspaces), biome lint/format, boundary check, and full test suite (3909 tests) all pass; the new migration applies cleanly on both Postgres and PGlite

Automatic Fixes PRs can be configured here.

unkey-deploy[bot]commented· 2 weeks ago

The latest updates on your projects. Learn more about Unkey Deploy

NameStatusPreviewInspectUpdated (UTC)
tripwire / web (preview)ReadyVisit PreviewInspectNov 7, 2026 6:57am

Changes requested

tripwire-sh[bot] · 2 weeks ago

Blocked. See the comment.

tripwire-sh[bot]commented· 2 weeks ago

@detail-app[bot], Tripwire blocked this change request.

Rate limit: You opened 61 change requests in a short time. Wait before you open another.

View on Tripwire

How do I fix this?

A new commit will not fix this.

If you think it should merge anyway, say so in a comment. A maintainer will decide.

detail-app[bot]commented· 2 weeks ago

Re: github.com/Boring-Software-Inc/…/186

This is an infra rate-limit block (61 change requests opened in a short window), not a code issue — the tripwire run itself states a new commit will not fix it. No PR-side change can resolve it, so I'm leaving the merge decision to a maintainer.

Sign in to comment.

Merge readiness

Checking mergeability after the indexing worker computes the current branch state.

Autopilot

Debug

Reviews

Approved0
ReviewersNone yet

Configure an OpenRouter key in repository settings.