Some checks are pending
Backend tests / test (push) Waiting to run
Addresses the ultra-review findings on this branch:
Player (PlayerScreen.tsx): the new recoveryPending mirrored the fallback-chain guards
by hand and could deadlock into a permanent "Reconnecting" spinner with no way to Mark
broken — for gone (410) sources on IP-bound tubes (re-resolve bails before setting
reResolveDone) and for any post-load error on those tubes (re-resolve is initial-load
only). Derive one reResolveApplicable flag (IP-bound AND initial-load AND not-gone) and
use it for both the chain gate and the spinner, so gone/post-load errors fall through to
proxy/WebView or the terminal error card. Seek-recovery now falls through to the chain
when player.replace() throws instead of returning.
Quick-play (SceneDetail): the autoplay route param persisted and autoPlay={i===0} re-fired
when the source list reordered (e.g. after Mark broken drops the dead source), bouncing the
user into the player. Consume it once via onAutoPlayConsumed -> nav.setParams({autoplay:false}).
Backfill semantics: performer-driven direct-scraper "backward fill" now tags scenes
backfill=True (search-by-name pulls the whole old catalog); merge coalesces backfill
(keep AND drop) so a fresh scene merged into a dead dup keeps NEW; deep-crawl only tags
backfill on a tube's FIRST sweep (swept_once) so re-sweep catalog growth stays genuine;
pilot script tags backfill.
Perf/migration: migration 0026 is now idempotent (IF NOT EXISTS; prod got the column via
manual ALTER) and adds ix_scene_performers_performer_id (favorites count filtered
performer_id with no index); index also created on prod.
Cleanup: deleted dead FavoriteSceneRow (unused import in two screens, stale isNew without
the backfill guard); removed em-dashes from all lines this branch added (user CLAUDE.md
rule), including the user-facing changelog / Settings / player-overlay strings.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
41 lines
1.6 KiB
Python
41 lines
1.6 KiB
Python
"""scene backfill flag: exclude bulk catalog imports from "new"
|
|
|
|
Revision ID: 0026_scene_backfill_flag
|
|
Revises: 0025_source_ranking
|
|
Create Date: 2026-07-02
|
|
|
|
Tube'y podają datę importu jako release_date, więc masowy backfill starego katalogu
|
|
(deep-crawl głębokie strony) udawał świeżość i zawyżał licznik "+N nowych" w ulubionych.
|
|
`scenes.backfill` oznacza takie sceny (pozostają widoczne, ale nie liczą się jako nowe).
|
|
Dodatkowo indeks na scene_performers(performer_id) pod zapytanie licznika ulubionych
|
|
(PK to (scene_id, performer_id), więc filtr po samym performer_id był full scanem).
|
|
|
|
Idempotentne (IF NOT EXISTS): prod dostał kolumnę/indeksy ręcznym ALTER-em zanim ta
|
|
migracja powstała, a deploy nie odpala alembic; guard chroni przed DuplicateColumn gdyby
|
|
`alembic upgrade` puszczono na prodzie albo na dumpie z prod.
|
|
"""
|
|
from collections.abc import Sequence
|
|
|
|
from alembic import op
|
|
|
|
revision: str = "0026_scene_backfill_flag"
|
|
down_revision: str | None = "0025_source_ranking"
|
|
branch_labels: str | Sequence[str] | None = None
|
|
depends_on: str | Sequence[str] | None = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.execute(
|
|
"ALTER TABLE scenes ADD COLUMN IF NOT EXISTS backfill boolean NOT NULL DEFAULT false"
|
|
)
|
|
op.execute("CREATE INDEX IF NOT EXISTS ix_scenes_backfill ON scenes (backfill)")
|
|
op.execute(
|
|
"CREATE INDEX IF NOT EXISTS ix_scene_performers_performer_id "
|
|
"ON scene_performers (performer_id)"
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.execute("DROP INDEX IF EXISTS ix_scene_performers_performer_id")
|
|
op.execute("DROP INDEX IF EXISTS ix_scenes_backfill")
|
|
op.execute("ALTER TABLE scenes DROP COLUMN IF EXISTS backfill")
|