Extract detached-blob guard into its own file

Separate the attachment existence check from the broadcast suppression
override so each file has a single responsibility. The guard now lives
in ActiveStorageAnalyzeJobSkipDetached with its own documentation
explaining the upload-then-delete race condition.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Joseph Hale
2026-03-02 14:38:19 -07:00
parent 143508fc22
commit c61f49cce9
3 changed files with 18 additions and 3 deletions
@@ -1,6 +1,6 @@
require "test_helper"
class ActiveStorageAnalyzeJobSuppressBroadcastsTest < ActiveSupport::TestCase
class ActiveStorageAnalyzeJobSkipDetachedTest < ActiveSupport::TestCase
test "skips analysis when blob has no attachments" do
blob = ActiveStorage::Blob.create_and_upload!(
io: StringIO.new("x" * 1024), filename: "orphan.txt", content_type: "text/plain"