Repository navigation
fix(sync): clamp offline times + keep 60s shards cohesive (#4770, #4771) - #11094
aryanorastar wants to merge 13 commits into
Conversation
…ever future-dated (BasedHardware#4770) Mild phone-clock skew (a few minutes ahead) either rejected uploads or let started/finished times land after server now. Allow skew within SYNC_CAPTURE_MAX_FUTURE_SKEW_SECONDS, then shift the capture window so duration is preserved and conversations never appear in the future. Verification: pytest unit tests for normalize_capture_window + filename timestamp skew (5 passed). Failure-Class: none Co-authored-by: Cursor <[email protected]>
…ware#4770 clamp Failure-Class: none Co-authored-by: Cursor <[email protected]>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
BasedHardware#4770) Device RTC (SD-card / Limitless flash / ring) can run ahead of the phone clock; normalize at addExternalWal and on WAL load so the sync list and upload path see a capture window that ends at phone now. Verification: flutter test test/unit/wal_timer_start_normalize_test.dart (4 passed). Failure-Class: none Co-authored-by: Cursor <[email protected]>
|
Follow-up from deeper root-cause pass: the sync UI shows Pushed a client choke-point: |
…re#4770) Co-authored-by: Cursor <[email protected]>
There was a problem hiding this comment.
All reported issues were addressed
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
…Hardware#4770) Co-authored-by: Cursor <[email protected]>
BasedHardware#4770) Co-authored-by: Cursor <[email protected]>
|
Addressed cubic P1 on the current head:
Also fixed the Dart analyzer ratchet ( |
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for the follow-up on #4770. I reviewed the current head after the client-side clamp and the backend pre-lookup normalization changes.
This looks directionally good to me: the fix now covers both places future timestamps could surface, and the added regression coverage exercises the client clamp, mild future upload acceptance, backend capture-window normalization, and the multi-segment merge case that would otherwise split conversations. The checks are green on this head.
I don't see a blocking correctness issue in the current diff. Since this spans client + backend sync timestamp behavior, I’m marking it for maintainer review rather than formal approval, but my technical signal is positive.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
BasedHardware#4771) Independent per-window normalize collapsed successive future-skewed WALs onto [now-60, now], recreating one-minute conversation spam dated at sync time. Compute one batch shift (newest_end - now) and apply it in v1 + v2 assignment. Failure-Class: none Co-authored-by: Cursor <[email protected]>
…asedHardware#4771) Failure-Class: none Co-authored-by: Cursor <[email protected]>
|
PR Metadata Preflight failed on the product-file line-count ratchet: Pushed a baseline raise to 2060 with justification (+7 for the ordered-assignment batch shift for #4771). Pipeline baseline was already updated on the prior commit. |
…e#4770) Move maximum_future_skew_seconds into request_validation (lanes already imports from there) and use it from upload validation + pipeline staging so the env default cannot drift across the three former copies. Failure-Class: none Co-authored-by: Cursor <[email protected]>
|
Resolved the
Also landed cubic P3: @mdmohsin7 still needs code-owner review when you have a moment (#4770/#4771). |
|
@mdmohsin7 Friendly bump on the code-owner review for #4770/#4771. Current head
If the client WAL clamp + backend batch clock-shift approach looks good, an APPROVE from you clears the merge gate. Thanks! |
…Hardware#4770) MagicMock stubs of utils.request_validation (cloud_tasks / file_paths suites) were turning maximum_future_skew_seconds into a MagicMock and breaking timedelta math. Keep the single helper in utils.sync.capture_skew and unload real utils.sync.* after the file_paths AutoMock import so lanes does not leak a mocked parse_sync_filename_timestamp into later tests. Co-authored-by: Cursor <[email protected]>
|
Backend unit suite was red after Root cause: suites that AutoMock / MagicMock Fix @9bfeda37:
Focused suite (file_paths + cloud_tasks + ordered-assignment + two-lane + request_validation contracts): 170 passed. still needs code-owner review when CI goes green on this tip. |
…dware#4770) Pyright reportUnusedImport failed the backend unit contract once maximum_future_skew_seconds no longer reads env from request_validation. Co-authored-by: Cursor <[email protected]>
|
Backend unit suite was still red on @9bfeda37 — not pytest this time. Pyright contract: Dropped the unused import @Head. Should clear the 1-error pyright gate. |
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for continuing to tighten this. I reviewed the current head after the batch-shared clock-shift update.
This is a positive technical signal from me. The client-side Wal.timerStart normalization covers the on-device list/upload choke point, and the backend now accepts bounded clock skew while normalizing before closest-conversation lookup. The shared batch shift in both sync paths is the important follow-up for #4771: it preserves the relative spacing of successive ~60s offline shards instead of independently collapsing each shard onto [now-60, now].
The focused coverage looks appropriate here: client normalization tests, upload timestamp contract coverage, backend window/batch-shift regression tests, and ordered-assignment checks that both pipelines pass the shared shift into process_segment. Current CI is green.
I don’t see a blocking correctness issue in this diff. Keeping maintainer review required before merge because this changes client + backend sync timestamp semantics and has outstanding manual device/backlog validation in the PR checklist, but the implementation direction looks sound.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
|
@Git-on-my-level Thanks for the re-confirm on the batch-shared clock shift. Agreed the outstanding gap is maintainer/manual device backlog smoke (mild RTC skew + multi-minute offline shards → one cohesive convo). No further author code changes pending on @mdmohsin7 Friendly bump for code-owner review when you have a window — CI is green, @kodjima33 already APPROVED (holding merge for CO + unticked manual checks). Head also covers the #5747 60s-shard fragmentation symptom under clock skew (commented on that issue today); still tagged #4770/#4771 as the primary scope. |
Resolve product-file line-count baseline conflicts: - mcp_sse.py: take main 1968 + SCA-294 justifications - sync.py: keep 2060 + BasedHardware#4771 batch clock-shift justification - pipeline.py: keep 2520; combine soft-cap + BasedHardware#4770/BasedHardware#4771 raise text Co-authored-by: Cursor <[email protected]>
|
Resolved merge conflicts against current
Line-count ratchet OK on the PR file set. Still needs |
|
This is no longer an occuring issue and was fixed in firmware 3.0.17 when RTC was enabled for the device |
|
Hey @aryanorastar 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |
Summary
newest_end - now) before closest-conversation assignment so relative offsets and total duration survive.normalizeWalTimerStartclamps device-sourcedWal.timerStartataddExternalWaland on WAL load so the sync UI never shows a future start; duration is preserved by shifting the window to end at phone now.SYNC_CAPTURE_MAX_FUTURE_SKEW_SECONDS, default 300s) is accepted on upload; the sync pipeline shifts capture windows sostarted_at/finished_atnever exceed server now.Test plan
python3 -m pytestnormalize + batch-shift + ordered-assignment contracts (incl. 5×60s Offline Sync creating mistaken duration date conversations #4771 span)flutter test test/unit/wal_timer_start_normalize_test.dart(4 passed)Product invariants affected
none
Failure class (fixes)
Failure-Class: none
Also covers the short-shard fragmentation symptom reported in #5747 (same batch clock-shift path as #4771). Race path already fixed by #7819. Live vs offline
conversation_creation_timeoutpolicy remains a possible residual after this lands — reassess then; do not treat as full close of #5747 until that check.