Repository navigation
fix(conversations-v3): compare large stored transcripts in write equality as bounded streams - #26787
Merged
Merged
Conversation
…hat the writer stores #26705 keeps v3 cards up to ~600 KB of decoded transcript, but shared chat and v3 write equality decoded through public chat's inline 512 KiB bound. Shared chat rejected those cards and write equality could not compare them, rewriting each on every unchanged re-arm. Both readers now decode within writer-sized limits (Firestore's field limit, a 16 MiB decode ceiling, 65,536 segments). Failure-Class: new
kodjima33
added a commit
that referenced
this pull request
Nov 30, 2026
…readable The review's round-3 late-growth case, now readable through #26787's writer-sized readers: the 680-line card resolves in shared chat, compares equal to itself, and unchanged re-arms write nothing.
…reams; leave shared chat on main's reader Write equality now keeps main's comparison and, when main's bounded decode refuses a transcript, compares the two stored transcripts as 64 KiB decompressed-byte streams: each field must pass the writer's own field check (estimate_firestore_value_bytes against HARD_FIELD_LIMIT) before decryption, decoding stops at 32 MiB, and a grouping sidecar falls back to a write as before. Peak memory on a 62,000-segment, 16 MB card is 1.95 MiB. Shared chat is reverted to main's bounded reader. Failure-Class: new
kodjima33
added a commit
that referenced
this pull request
Nov 30, 2026
…readable The review's round-3 late-growth case, now readable through #26787's writer-sized readers: the 680-line card resolves in shared chat, compares equal to itself, and unchanged re-arms write nothing.
…or their size A transcript main's inline decode refuses for its shape (an over-long anchor) keeps main's write; only a refusal for size (stored past 256 KiB or decoded past 512 KiB) takes the bounded streamed comparison. Fixes the emulator proof test_projection_writes_when_inline_anchor_is_rejected. Failure-Class: new
kodjima33
added a commit
that referenced
this pull request
Nov 30, 2026
…readable The review's round-3 late-growth case, now readable through #26787's writer-sized readers: the 680-line card resolves in shared chat, compares equal to itself, and unchanged re-arms write nothing.
kodjima33
marked this pull request as ready for review
November 30, 2026 16:47
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 changed and why
#26705 (live on prod
backend-sync) keeps v3 cards whole up to twice the old estimate budget, about 600 KB of decoded transcript. v3 write equality (_same_transcript) decoded stored transcripts through public chat's inline bound (256 KiB stored, 512 KiB decoded). It could not compare such a card even with itself, fell back to a write, and every unchanged re-arm rewrote the card.Change (write equality only;
backend/database/conversations_v3_write_equality.py).estimate_firestore_value_bytes≤HARD_FIELD_LIMIT, asguard_stagedmeasures) on the stored representation, before decryption.EQUALITY_UNAVAILABLE).Production measurement (metadata only, 24 h to Nov 30 15:11 UTC)
omi_conversations_v3_equality_unavailable_totalin namespacebackend-sync: 12,969 equality fallbacks.omi_conversations_v3_projection_rows,backend-sync): 680,192 written and 4,140,516 skipped as unchanged. So about 1.9% of written rows fell back.omi_fallback_event from=elide_writelog line matched nothing in 24 h.Verification
test_a_large_stored_card_compares_equal_and_unchanged_rearms_write_nothing. Production loader, real codec, strict commit fixture.test_a_large_transcript_compares_in_bounded_memory[standard|enhanced], measured withtracemalloc.test_a_transcript_field_past_the_writer_limit_is_never_equal. The enhanced case has compressed bytes within the limit but an encrypted string past it, the review's 1,203,529 B shape; a standard field is past the limit too. Neither is ever equal. It fails on 2efdc2f.test_a_large_transcript_with_a_grouping_sidecar_still_writes.test_a_small_transcript_refused_for_its_shape_still_writes, which fails on e6975ad. The emulator prooftest_projection_writes_when_inline_anchor_is_rejectedpasses locally on the Firestore emulator, 19/19 in that file.tests/unit/test_*v3*.py.Product invariants affected
none
Failure class (fixes)
Failure-Class: new
🤖 Generated with Claude Code