Repository navigation
fix(backend): merged-away sync donors no longer appear in conversation lists, counts or exports - #15346
Merged
Conversation
PR #15193 left merged-away conversations on every list/count path because readers never evaluated deleted. Stamp discarded=True on donors for the indexed hide, drop deleted rows even when include_discarded=True, and keep sync_merged_into redirects working. Failure-Class: FC-record-lifetime-enforced-by-one-reader Co-authored-by: Cursor <[email protected]>
GET-by-id now 404s tombstones, but the search/finalize router suite stubs database.conversations with a truthy MagicMock, so every live fixture 404d. Failure-Class: FC-record-lifetime-enforced-by-one-reader Co-authored-by: Cursor <[email protected]>
Git-on-my-level
force-pushed
the
fix/sync-donor-tombstone-visibility
branch
from
September 21, 2026 07:25
4011d8a to
6b4c5ac
Compare
…one-visibility # Conflicts: # backend/database/conversations.py # backend/tests/unit/test_check_conversation_lifecycle_writes.py
A pre-commit formatter rewrote conversation_detail_provider.dart and speaker_summary_refresh_test.dart during an earlier merge commit, so this backend-only PR carried a Dart reformat it never intended and CI's Formatting check rejected it. Restore both to origin/main byte-for-byte. Co-Authored-By: Claude Opus 5 <[email protected]>
This backend-only PR carried a Dart reformat it never made. The local pre-commit formatter cannot resolve package:flutter_lints/flutter.yaml in this worktree, so it runs dart format without the project's analysis options and rewrites any staged Dart file into a style CI's Formatting check rejects. Committed with --no-verify because that hook is the defect here, not a check being evaded: it rewrites the files on every commit. Both files are verified byte-identical to origin/main afterwards, which is a stricter assertion than the hook makes. Co-Authored-By: Claude Opus 5 <[email protected]>
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.
Summary
discarded == Falseand neverdeleted. Assignment now stampsdiscarded=Trueon redirect tombstones (indexed hide) and every user-facing reader dropsdeletedrows even wheninclude_discarded=True.include_discarded=Truelist fills visible rows instead of post-filtering afterlimit/offset, so a donor cannot steal a page slot. Counts subtractdeleted==Truedocuments that would have matched.sync_merged_intoredirects still resolve.backend/scripts/backfill_sync_donor_tombstone_discarded.pystampsdiscarded=Trueon existing production tombstones. Do not run it against production from an agent session.Failure-Class
Failure-Class: FC-record-lifetime-enforced-by-one-reader
#15193 introduced a stored lifetime (
deleted=True+sync_merged_into) that decides whether a conversation may still be shown. Only sync/listen internals evaluated it. List, count, search hydration, export, MCP, folders, and GET-by-id kept returning a well-formed donor row. That is the same "lifetime enforced by one reader" contract: the write path looked finished while every unchecked reader kept the expired record in front of the user.Line-Count-Exception
Line-Count-Exception: backend/database/conversations.py | 2695 -> 2859 | Shared visibility predicate, visible-row pagination, and tombstone count subtraction have to live next to the list/count queries they guard.
Line-Count-Exception: backend/routers/conversations.py | 2110 -> 2113 | GET-by-id must 404 a redirect tombstone so user-facing routes cannot fetch a merged-away donor.
Test plan
test_sync_donor_tombstone_visibility.py— 4 visibility tests failed, redirect passed.test_sync_capture_continuity.py,test_sync_live_stub_intake.py,test_sync_cross_job_assignment.py,test_sync_bridge_lifecycle.py) passed; count, archive, list-budget, typesense, lifecycle-write, backfill, export, reprocess tombstone tests passed.OMI_PR_BODY_FILE=<this file> .githooks/pre-push origin </dev/nullbackend/scripts/backfill_sync_donor_tombstone_discarded.py(not from this session; do not write production Firestore).Backfill (operator)
Dry-run is default. Resume with
--start-after. Find rows with per-userconversations.where(deleted==True)and skip those alreadydiscarded=True. Expected volume is genuine bridges since 2026-09-21T03:17:42Z, not the whole conversations collection.Notes
Did not edit
backend/utils/sync/bridge.pyor memory files (sibling #15340, now on main).🤖 Generated with Claude Code