Skip to content

fix: contact aging destroyed by watermark reset + full-dump re-upserts - #41

Merged
sg merged 1 commit into
mainfrom
fix/contact-sync-watermark
Jul 6, 2026
Merged

fix: contact aging destroyed by watermark reset + full-dump re-upserts#41
sg merged 1 commit into
mainfrom
fix/contact-sync-watermark

Conversation

@sg

@sg sg commented Jul 6, 2026

Copy link
Copy Markdown
Owner

What changed

  • sync_contacts watermark is now advance-only: an incremental response with no changed contacts carries lastmod=0 in its CONTACT_END frame; storing it reset the watermark, so the next dirty sync did a full ~350-contact dump.
  • The contacts upsert now refreshes last_synced_at only when the radio-side lastmod actually changed, so full dumps (legit or accidental) can no longer stamp every contact with the same time.
  • New tests/test_contact_sync.py (4 tests, incl. a repro of the field log's zero-then-full-dump cycle); suite 110 passing.

Why

Field log: sync at 15:07:25 returned 0 contacts (watermark zeroed), sync at 15:09:25 full-dumped 342 contacts — flattening last_synced_at, the primary staleness signal for radio eviction, the DB contact-cap trim, and the Manage→Contacts 'last synced' column. The cycle repeated every time a no-op sync ran.

Breaking changes

None. Existing flattened ages will re-differentiate as contacts genuinely change.

🤖 Generated with Claude Code

@sg
sg merged commit a3cb5f1 into main Jul 6, 2026
1 check passed
@sg
sg deleted the fix/contact-sync-watermark branch July 6, 2026 15:41
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.

1 participant