Skip to main content

max / makenotwork

Default items.scan_status to clean so fileless items are discoverable Run #21 tightened /discover to scan_status='clean' (from != 'quarantined'). That correctly hides unscanned uploaded files, but it also hid every item with no item-level file to scan — Text items (inline content) and items whose downloads live in `versions` — because nothing ever moves a fileless item off the default 'pending' (update_item_scan_status only fires from the scan worker / commit_upload on an audio/video/cover upload). Priced Text items silently vanished from discovery. A fileless item has nothing to scan, so 'clean' is its correct resting state (media_files already defaults to 'clean'). Migration 146 sets the items default to 'clean' and backfills existing fileless items; uploading an item-level file still flips to 'pending' via commit_upload and the scan worker writes the real verdict, so files are never surfaced before they are scanned, and per-download safety stays gated by each version's own scan_status. create_project_and_publish_item (the lone test exercising a fileless item against discover, left red by Run #21) passes again and guards the behavior. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Author: Max Johnson <me@maxj.phd> · 2026-06-17 16:01 UTC
Commit: 72ab17fb14ba01a3d4082d49453a8275a3b3f300
Parent: f4d83d8
1 file changed, +27 insertions, -0 deletions
@@ -0,0 +1,27 @@
1 + -- Fileless items should be `clean`, not stuck `pending`.
2 + --
3 + -- `items.scan_status` defaulted to 'pending' (migration 004) and is only ever
4 + -- moved to a real verdict by the scan worker / `commit_upload` when an
5 + -- item-level file (audio/video/cover) is uploaded. An item with no such file —
6 + -- Text items (inline content), and items whose downloads live in `versions`
7 + -- (which carry their own `scan_status`) — therefore stayed 'pending' forever.
8 + --
9 + -- Run #21 tightened discovery to `scan_status = 'clean'` (from `!= 'quarantined'`),
10 + -- which silently dropped every fileless item from `/discover` — including priced
11 + -- Text items. There is nothing to scan on a fileless item, so 'clean' is the
12 + -- correct resting state (this matches `media_files`, which already defaults to
13 + -- 'clean'). Uploading an item-level file still flips the item to 'pending' via
14 + -- `commit_upload`, and the scan worker writes the real verdict, so files are not
15 + -- surfaced before they are scanned. Per-download safety is independently gated
16 + -- by each version's own `scan_status` at download time.
17 + ALTER TABLE items ALTER COLUMN scan_status SET DEFAULT 'clean';
18 +
19 + -- Backfill existing fileless items that are stuck 'pending'. Items with an
20 + -- item-level file present keep their real status (a genuinely-pending scan is
21 + -- left pending; a quarantined/held item is untouched).
22 + UPDATE items
23 + SET scan_status = 'clean'
24 + WHERE scan_status = 'pending'
25 + AND audio_s3_key IS NULL
26 + AND video_s3_key IS NULL
27 + AND cover_s3_key IS NULL;