[GH-ISSUE #8] Implement the persistent bounded SQLite queue #7

Open
opened 2026-10-23 18:09:15 +02:00 by jayanezj · 0 comments
Owner

Originally created by @jayanezj on GitHub (Oct 23, 2026).
Original GitHub issue: https://github.com/jayanezj/traccar-client-macos/issues/8

Goal

Keep selected tracking positions across disconnections and process restarts while bounding local retention.

Scope

  • Store the queue in SQLite under Application Support, separately from UserDefaults and Keychain.
  • Preserve original capture time and available measurements, an internal row identifier and stable queue ordering. Associate entries with their destination/identity configuration without duplicating secrets unnecessarily.
  • Enforce both limits: 10,000 pending positions and 30 calendar days from original capture. Remove expired/oldest entries and track discard counts.
  • Make insertion and capacity enforcement transactional; use parameterized SQL and serialized database access.
  • Version the schema and define an initial migration path. Remove confirmed positions by their specific internal ID, not by blindly deleting the current head after an asynchronous upload.

Acceptance criteria

  • Pending positions survive close/relaunch and retain their original fields and order.
  • Boundary tests cover capacity, expiry, old timestamps and combined limits without waiting real days or inserting real locations.
  • Cleanup occurs on open/resume, enqueue and before sending, without waking a sleeping Mac.
  • A confirmed-position deletion cannot delete a different row after cleanup or concurrent state changes.
  • Discard counts and explicit Clear pending positions work without keeping a second location history.
  • Database errors are surfaced without silently resetting the queue.

Validation

Use temporary databases, a controllable clock and synthetic records for persistence, transactions, migrations and failure cases. SQLite alone must not be described as application-level encryption.

Add or extend this feature's meaningful deterministic tests in the CI workflow from PROTO-002 as part of the same implementation, without waiting for the final milestone. Keep physical-Mac checks explicitly manual.

References

Pinned official source references for implementation comparison; mobile APIs are not assumed available on macOS.

Dependencies

Originally created by @jayanezj on GitHub (Oct 23, 2026). Original GitHub issue: https://github.com/jayanezj/traccar-client-macos/issues/8 ## Goal Keep selected tracking positions across disconnections and process restarts while bounding local retention. ## Scope - Store the queue in SQLite under Application Support, separately from UserDefaults and Keychain. - Preserve original capture time and available measurements, an internal row identifier and stable queue ordering. Associate entries with their destination/identity configuration without duplicating secrets unnecessarily. - Enforce both limits: **10,000 pending positions** and **30 calendar days from original capture**. Remove expired/oldest entries and track discard counts. - Make insertion and capacity enforcement transactional; use parameterized SQL and serialized database access. - Version the schema and define an initial migration path. Remove confirmed positions by their specific internal ID, not by blindly deleting the current head after an asynchronous upload. ## Acceptance criteria - [ ] Pending positions survive close/relaunch and retain their original fields and order. - [ ] Boundary tests cover capacity, expiry, old timestamps and combined limits without waiting real days or inserting real locations. - [ ] Cleanup occurs on open/resume, enqueue and before sending, without waking a sleeping Mac. - [ ] A confirmed-position deletion cannot delete a different row after cleanup or concurrent state changes. - [ ] Discard counts and explicit Clear pending positions work without keeping a second location history. - [ ] Database errors are surfaced without silently resetting the queue. ## Validation Use temporary databases, a controllable clock and synthetic records for persistence, transactions, migrations and failure cases. SQLite alone must not be described as application-level encryption. Add or extend this feature's meaningful deterministic tests in the CI workflow from [PROTO-002](https://github.com/jayanezj/traccar-client-macos/issues/2) as part of the same implementation, without waiting for the final milestone. Keep physical-Mac checks explicitly manual. ## References Pinned official source references for implementation comparison; mobile APIs are not assumed available on macOS. - [Official source 1](https://github.com/traccar/traccar-client-sdk/blob/a297767642e98193eb7939cbb4d54c101ff23610/core/src/commonMain/kotlin/org/traccar/client/DatabaseQueue.kt) - [Official source 2](https://github.com/traccar/traccar-client-sdk/blob/a297767642e98193eb7939cbb4d54c101ff23610/core/src/commonMain/sqldelight/org/traccar/client/db/Position.sq) ## Dependencies - [PROTO-003](https://github.com/jayanezj/traccar-client-macos/issues/3) <!-- planning-id: PROTO-008 -->
jayanezj added this to the M4 - Reliable tracking and persistence milestone 2026-10-23 18:09:15 +02:00
jayanezj added the area:storagetype:featurepriority:high labels 2026-10-23 18:09:15 +02:00
jayanezj added type:feature and removed type:feature labels 2026-10-30 18:01:09 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jayanezj/traccar-client-macos#7