{{ message }}
Fix malware scan status stuck at Scanning after draft activation#771
Merged
Conversation
Contributor
Contributor
There was a problem hiding this comment.
The PR introduces a two-phase scan-then-update-all-entities approach to fix a real race condition, but has several substantive correctness issues: the unconditional "update all" loop can stamp unrelated attachments that appear between SELECT and UPDATE; findAndScanAttachment relies on re-reading an already-iterated Result object whose re-readability is untested; and a test's name/assertions directly contradict its intent, obscuring the actual behaviour under review.
PR Bot Information
Version: 1.19.9 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback
- File Content Strategy: Full file content
- Correlation ID:
d3dddd80-2c4e-11f1-9772-da3e87f9e8b3 - Event Trigger:
pull_request.opened - LLM:
anthropic--claude-4.6-sonnet
lisajulia
approved these changes
Mar 31, 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.

Summary
status: ScanningforeverCloses #770
Root Cause
scanAttachment()selected the attachment row before the scan, then updated the same entity after the scan. If the draft was activated during the scan, the draft row was deleted and the update hit 0 rows. The active entity was skipped because it had 0 rows at select time.Fix
Split
scanAttachment()into two phases:An UPDATE against a table with no matching row is a harmless 0-row no-op. The table that has the row gets updated.