Skip to content

Round 11 code review: sync/state-sync fixes + coverage#75

Merged
sohamM97 merged 5 commits into
mainfrom
code-review
Jul 7, 2026
Merged

Round 11 code review: sync/state-sync fixes + coverage#75
sohamM97 merged 5 commits into
mainfrom
code-review

Conversation

@sohamM97

@sohamM97 sohamM97 commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Full Round 11 code-review cycle on the code-review branch — findings → fixes → verification → test-suite. All items hand-verified; flutter analyze clean; full suite green (+1469 tests).

Fixes (6 Important, 14 Minor, R-10)

Important

  • I-48 — Today's-5 pin LWW now pushes the edit-time persisted-at stamp as the remote updated_at (was push-time now()), fixing cross-device last-write-wins inversion.
  • I-49 — Task deletions now propagate via Firestore tombstones (soft-delete + delta/full-pull reconciliation, guarding pending local adds). Previously hard-deleted tasks resurrected as orphans on other devices.
  • I-50 — Bulk sync ops (initialMigration/replaceLocalWithCloud/replaceCloudWithLocal/mergeBoth) run under the _syncing mutex, so a debounced push / periodic pull can no longer interleave with them.
  • I-51 — Uncompleting a task marked "Done today" from All Tasks now reverts the DB worked-on flag (detected via isWorkedOnToday), so it no longer bounces back to done on reload.
  • I-52getEffectiveDeadlines batched into one recursive CTE per chunk (was N+1 per deadline-less task on every refresh).
  • I-53 — Starred tree-preview card routes grandchild styling through childTextStyle and includes grandchildren in the blocked-info fetch, matching the expanded dialog (DRY rule).

Minor / Refactor — M-40…M-52 (counter-on-success, tombstone-cleanup logging, session-set cleanup, refreshSnapshots coalescing guard, addRelationship conflict-ignore, empty-nav-stack refresh fallback, triage search caching, live-text Create, listener cleanup, dead-field removal, unstar await). R-10 — atomic insertTaskWithParents. M-39 no-op by design; R-11/R-12 deferred as focused follow-ups.

Verification & tests

  • Every Important fix re-verified by hand against the code (see docs/CODE_REVIEW.md → Round 11 Fix Verification).
  • 12 coverage-gap tests added (R-10, M-45, M-46, I-48, I-50, I-53-blocked) on top of the fix commit's regression tests.
  • Manual test-suite on Linux: all 6 sections ✅ (sync/auth excluded on dev machine). Two docs/UI_VIEWS.md corrections from manual testing (inbox row tap = "File under…"; "Also show under…" root-vanish limitation).

Not covered here

  • On-device sync validation against real Firestore (I-48/I-49/I-50) — to be checked post-merge.
  • Deferred: R-11 (sync query/reconcile dedup), R-12 (picker browse-tree dedup), M-32/M-34 (low-impact N+1s).

🤖 Generated with Claude Code

Soham Marik and others added 4 commits July 6, 2026 13:30
Full-codebase review after 78 commits (1.2.15 → 1.3.9): delta-sync overhaul,
Today's-5 pin LWW + tombstones, manual Today's-5 rewrite, shared AddTaskFlow,
create-task-from-search picker unification.

6 Important (all hand-verified):
- I-48 Today's-5 LWW pushes push-time now() vs persisted-at stamp (LWW inversion)
- I-49 Task hard-deletes never reconciled on pull (deleted tasks resurrect)
- I-50 Bulk sync ops run outside the _syncing mutex (race with push/pull)
- I-51 Uncompleting an external "Done today" task doesn't revert DB worked-on flag
- I-52 getEffectiveDeadlines N+1 recursive CTE on the refresh hot path
- I-53 Starred grandchildren miss the priority/blocked styling (DRY-rule violation)

Plus M-39..M-52 minor + R-10..R-12 refactors. I-38/R-9 closed (obsolete).
flutter analyze clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Durability, correctness, and hot-path fixes across the sync layer,
Today's 5, starred view, and pickers so multi-device state stays
consistent and mutations refresh reliably.

Important:
- I-49: task deletions now propagate via Firestore-only tombstones +
  delta/full-pull reconciliation (were hard-deleted, so deleted tasks
  resurrected on other devices).
- I-48: push the persisted edit-time stamp as Today's-5 updated_at so
  cross-device LWW compares like clocks (was push-time now()).
- I-50: bulk sync ops run under the _syncing guard (_runExclusive) so
  debounced push / periodic pull can't interleave with a half-wiped DB.
- I-51: uncompleting an externally "Done today" task now reverts the DB
  worked-on flag (detect from task.isWorkedOnToday, not just session set).
- I-52: batch getEffectiveDeadlines into one recursive CTE (was N+1 on
  every refresh).
- I-53: route starred grandchild styling through childTextStyle + cover
  grandchildren in the blocked-info fetch (DRY rule).

Minor: M-40 (persist pull-cycle counter only on success), M-42 (log
tombstone-purge failures), M-43 (clear parallel session sets on remove),
M-44 (refreshSnapshots reentrancy guard), M-45 (addRelationship
ConflictAlgorithm.ignore), M-46 (refresh on empty-stack branch), M-47
(cache triage search), M-48 (Create uses live field text), M-49
(matched removeListener), M-50 (drop dead highlight field), M-51 (await
starred unstar/undo), M-52 (CLAUDE.md v23). M-39/M-41 documented.

Refactor: R-10 atomic insertTaskWithParents. R-11/R-12 deferred (see
docs/CODE_REVIEW.md).

Adds regression tests for I-49, I-51, I-52, I-53, M-48.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Independent verify pass over fix commit d499ee5:
- All 6 Important (I-48..I-53) fixed at root cause, verified by hand
- I-49 Firestore-only tombstone deviation checked end-to-end and sound
  (delta + full-pull reconciliation, pending-add guards, cleanupTombstones)
- All 14 Minor + R-10 confirmed; M-39 no-op by design, M-44 partial accepted
- R-11/R-12 deferred (reasonable); M-32/M-34 genuinely still open (low impact)
- flutter analyze clean; flutter test green (+1457, 1 skipped, 0 failures)

Merge verdict: ready to merge into main.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fills the auto-test gaps left after the Round 11 fix commit so each fixed
behavior is guarded: R-10 insertTaskWithParents atomicity (4), M-45
addRelationship conflict-ignore (2), M-46 empty-nav-stack refresh fallback (3),
I-48 push edit-time stamp, I-50 bulk-op mutex deferral, and the I-53 blocked-
grandchild card half. Full suite green (+1469).

Also corrects two UI_VIEWS.md gaps surfaced during manual testing: inbox row
tap opens "File under…" (long-press drills in), and the pre-existing DAG
"Also show under…" root-vanish limitation (root = parentless).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

…ge nit

Non-blocking follow-ups from the approving review of PR #75:
- _runExclusive now debugLogs when the 5s bounded wait times out and it
  proceeds while a push/pull still holds _syncing (the accepted TOCTOU is no
  longer silent).
- Pin the load-bearing I-49 invariant with a comment at the full-pull reconcile
  site (partial/failed remote fetch must abort before the delete loop) plus two
  sync tests: a control proving the reconcile deletes on a complete empty
  remote, and the invariant proving a failed remote fetch deletes nothing.
- triage_dialog _onSearchChanged keeps _searchFilter mutations inside setState
  on every path (was assigned once up front).

Full suite green (+1471).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sohamM97
sohamM97 merged commit 1137554 into main Jul 7, 2026
1 check passed
@sohamM97
sohamM97 deleted the code-review branch July 7, 2026 12:46
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