fix: reopen the gap for a grab whose torrent vanished (#98)
ci / web (push) Successful in 55s
ci / rust (push) Failing after 3m50s
e2e / e2e (push) Failing after 1m32s

This commit was merged in pull request #98.
This commit is contained in:
2026-08-23 02:31:50 +01:00
parent 55ae44fa7b
commit bc2da22ea5
11 changed files with 384 additions and 54 deletions
@@ -0,0 +1,25 @@
-- #86: a grab whose torrent Transmission no longer reports (manual removal,
-- not a policy failure) gets its own state. Distinct from 'failed' so it
-- does not feed the needs_decision attention queue (attention.rs), which
-- counts 'failed' as a hard-fail signal. SQLite cannot alter a CHECK, so the
-- table is rebuilt (see 0010).
CREATE TABLE grabs_new (
id INTEGER PRIMARY KEY,
release_id INTEGER NOT NULL REFERENCES releases (id),
target_kind TEXT NOT NULL CHECK (target_kind IN ('movie', 'episode', 'season')),
target_id INTEGER NOT NULL,
infohash TEXT NOT NULL UNIQUE,
state TEXT NOT NULL DEFAULT 'sent'
CHECK (state IN ('sent', 'downloaded', 'imported', 'failed', 'vanished')),
grabbed_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')),
imported_at TEXT
) STRICT;
INSERT INTO grabs_new (id, release_id, target_kind, target_id, infohash, state, grabbed_at, imported_at)
SELECT id, release_id, target_kind, target_id, infohash, state, grabbed_at, imported_at FROM grabs;
DROP TABLE grabs;
ALTER TABLE grabs_new RENAME TO grabs;
CREATE INDEX grabs_state ON grabs (state);
CREATE INDEX grabs_target ON grabs (target_kind, target_id);