goon/alembic/versions/20260705_0027_playback_event_error_detail.py
goon-foss e215b48255 fix(watchporn): re-resolve stale CDN URL in-player, drop WebView page fallback
The zload CDN URL (remote_control.php) is a valid faststart progressive mp4 that
ExoPlayer plays fine when fresh: 206, no IP/referer binding, ~2h token TTL,
verified from a residential IP. Real-device failures (player_error/gone
telemetry) come from the static URL going stale: a rotated or dead CDN node, or
an expired token.

Instead of falling back to the tube page in a WebView (removed, it papered over
the real issue), PlayerScreen now re-resolves the scene fresh via the backend on
initial-load error for backend-native KVS tubes (watchporn). That yields a live
node plus a fresh token and stays on the native direct stream (0 VPS bandwidth).
For these origins a CDN 'gone' (404) means stale URL, not deleted, so we
re-resolve on gone too; a genuinely deleted post raises HosterDead (410) and
falls through to the normal fallback chain.

Also: add playback_events.error_detail (raw ExoPlayer message) to pin down the
exact failure of tubes we cannot reproduce on the emulator. Keep FLAG_SECURE on
release builds only (!__DEV__) so debug builds stay screenshottable for local UI
verification.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 01:18:08 +02:00

33 lines
1.2 KiB
Python

"""playback_events.error_detail: raw native-player error message
Revision ID: 0027_playback_event_error_detail
Revises: 0026_scene_backfill_flag
Create Date: 2026-07-05
`error_kind` grupuje błędy odtwarzania zgrubnie ('player_error'/'gone'/...), ale do
diagnozy realnych padów niereprodukowalnych na emulatorze potrzebna jest surowa treść
błędu z native playera (ExoPlayer message). `error_detail` (ucięte do 512) zbiera ją
z urządzeń przy status='error'.
Idempotentne (IF NOT EXISTS): prod dostał kolumnę 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 = "0027_playback_event_error_detail"
down_revision: str | None = "0026_scene_backfill_flag"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None
def upgrade() -> None:
op.execute(
"ALTER TABLE playback_events ADD COLUMN IF NOT EXISTS error_detail varchar(512)"
)
def downgrade() -> None:
op.execute("ALTER TABLE playback_events DROP COLUMN IF EXISTS error_detail")