Repository navigation
fix(desktop): project embedding into the compacted backfill CTE - #11885
Merged
Merged
Conversation
`getCompactedScreenshotsMissingEmbeddings` filtered `ranked` on `embedding
IS NULL`, but the CTE selected only id, ocrText, appName, windowTitle and
bucketRank. SQLite resolves that at prepare time, so the statement failed
with `no such column: embedding` on every call for every user, independent
of whether any bucket had a winner. The throw propagates out of
`OCREmbeddingService.runBackfill`, so no account on the lossless-compaction
path has ever backfilled a screen vector.
Reproduced deterministically in isolation before the change and green after:
xcrun swift test --package-path Desktop \
--filter 'ScreenshotEmbeddingBackfillRecoveryTests/'
The existing regression test already covered this. It read as a CI flake
because the desktop Swift phase only runs when a PR touches `desktop/`, so
the intervening green `main` runs had skipped the suite rather than passed
it. #11865 merged at 18:40Z with both desktop Swift checks red, which is
how the defect reached `main` at all.
Ranking still precedes the filter, preserving idempotency: a bucket's
winner is chosen among all its rows and drops out once it has an embedding.
The two sibling CTEs in this file and in ScreenActivitySyncService were
audited and each already projects every column its outer query references.
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
getCompactedScreenshotsMissingEmbeddingsfiltered its CTE onembedding IS NULLwhile the CTE projected only
id, ocrText, appName, windowTitle, bucketRank.SQLite resolves column references at prepare time, so the statement failed with
no such column: embeddingon every call, for every user, independent of data.The throw propagates out of
OCREmbeddingService.runBackfill, so no account on thelossless-compaction path has ever backfilled a screen vector — paid-tier screen
search was silently inert for those users.
Failure-Class: new
Evidence
Reproduced deterministically in isolation, red before and green after the change:
The existing regression test already covered this. It read as a CI flake because the
desktop Swift phase only runs when a PR touches
desktop/; the intervening greenmainruns had skipped the suite, not passed it.The defect reached
mainbecause #11865 merged at 18:40Z with both desktop Swiftchecks red.
mainhas no required status checks.Scope
Ranking still precedes the filter, so idempotency is unchanged: a bucket's winner is
chosen among all its rows and drops out once it has an embedding. The two sibling CTEs
(the
EXISTSvariant in this file, andScreenActivitySyncService) were audited andeach already projects every column its outer query references.
🤖 Generated with Claude Code