Repository navigation
fix: a thread counts as synced only when the store confirms its row (GIT-117) - #52
Merged
2 commits merged intoSep 23, 2026
Merged
2 commits merged into
2 commits merged into
Conversation
…GIT-117) syncThreadsToSupabase called create/resolve/touch helpers that caught their own failures and returned null/false/void, which the loop never read. So a thread whose write the store rejected was counted as synced: session_close reported COMPLETE, pruned threads.json and deleted the session files, and a local-only thread was dropped as stale 24 h later. - The loop uses throwing variants: a create counts when directUpsert returns the row; a resolve or touch counts only when the PATCH returns a row (0 rows = failed); a thread the store doesn't have is a failure, not a no-op. touchThreadsInSupabase reports per-thread outcomes. - Partial sync: the close says PARTIAL (session saved, threads not) and names the failed ids; threads.json keeps them marked sync_pending. - session_start keeps sync_pending threads whatever their age and prefers their local state over the store's (so an unwritten resolution survives) until a later close writes them; a full sync clears the flag. thread-sync-result.test.ts: the GIT-70 tests only failed the lookup, the one call that propagated. +6 tests fail the writes; 5 fail on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ks PARTIAL + carry-forward (GIT-117) On 1.11.0 the store rejects the thread and the close says COMPLETE with no pending marker: exit 1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Sep 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A thread counts as synced only when the store confirms its row (GIT-117).
directUpsertreturns the row.touchThreadsInSupabasenow reports per-thread outcomes.create_threadandresolve_threadare unchanged.threads.jsonkeeps them markedsync_pending. Session files are retained, as before.session_startkeepssync_pendingthreads whatever their age (they were dropped as "stale" after 24 h). Their local state wins over the store's copy, so an unwritten resolution survives, until a later close writes them. A full sync clears the flag.Why
The helpers caught their own failures and returned
null/false/void, and the loop never read the result. So a thread the store rejected was counted as synced.session_closereported COMPLETE, prunedthreads.jsonand deleted the session files. A local-only thread was then discarded as stale 24 h later, and a failed resolution was overwritten by the store's still-open copy. The GIT-70 test didn't catch it because it failed only the lookup, the one call whose error propagated.How to test
Venue (
vujndhcumgroztfkkdus, v1.8.0setup.sql; production not touched). A newflowprobe makes the store really reject a thread: itssource_sessionnames a session the store has never seen, so FK 23503 fires. After the close, it restarts on the same home.origin/main1.11.0t-fk…threads.jsonsync_pending: truesession_startCarrying forward 1 thread(s) … t-fk…The probe's own intentional 409 is excluded from the failure gate; every other request still counts.
Unit tests: 1363/1363.
thread-sync-result.test.tsgains 6 tests that fail the writes (create rejected; resolve 0 rows; resolve rejected; touch rejected; one failure among three; an all-confirmed control). 5 fail onmain; the control passes on both.Existing tests
None changed. The 13 existing sync tests still pass. Their
supabase-clientmock lackeddirectPatch, so the resolve and touch paths had never been exercised (the audit's mock-blindness shape); the mock now provides it.Checklist
🤖 Generated with Claude Code