File size: 2,899 Bytes
a1c39ac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
"""Persistent backend package for the IMDb offline clone (stage: backend).

Owns runtime configuration for the persistent full-stack candidate: the
SQLite data directory (always outside the candidate clone/ tree), the frozen
clock, and the isolated admin/reset boundary. Public authentication uses the
vendored ``websitebench.site_backend`` integration seam.

Nothing in this package ever contacts IMDb or its GraphQL API; all state is
local fixture state and dated source aggregates are never mutated by local
actions.
"""

from __future__ import annotations

import os
from pathlib import Path

SITE_ID = "imdb"
STAGE = "backend"
# Stable task 901–905 runtime identity; current completion evidence is carried
# by the WebsiteBench manifest and artifact hashes rather than renaming it.
VERSION = "imdb-r3-backend-2026-07-25.1"
FIXTURE_ID = "imdb-v2-901-905-r2"
FROZEN_CLOCK = "2026-07-25T12:00:00-04:00"
CAPTURE_DATE = "2026-07-25"
ASSETS_BASE = "/static/assets/source-current/2026-07-25"
CATALOG_ASSETS_BASE = "/static/assets/source-current/2026-08-10"

SESSION_COOKIE = "clawbench_imdb_session"  # tasks 901–905 compatibility alias
PRIMARY_SESSION_COOKIE = "__Host-websitebench-imdb-session"
CSRF_VALUE = "imdb-r2-public-fixture"
DEFAULT_ADMIN_TOKEN = "imdb-admin-dev-token"
ADMIN_TOKEN_HEADER = "X-WebsiteBench-Admin-Token"
LEGACY_ADMIN_TOKEN_HEADER = "X-Clawbench-Admin-Token"
DEFAULT_PORT = 8457

SEED_AUTH_ACCOUNTS = (
    {
        "subject_id": "alex",
        "email": "alex.green@example.test",
        "display_name": "Alex Green",
        "password": os.environ.get(
            "WEBSITEBENCH_EVALUATOR_PRIMARY_SECRET", "Alex-local-2026!"
        ),
    },
    {
        "subject_id": "jordan",
        "email": "jordan.lee@example.test",
        "display_name": "Jordan Lee",
        "password": os.environ.get(
            "WEBSITEBENCH_EVALUATOR_SECONDARY_SECRET", "Jordan-local-2026!"
        ),
    },
)

# materials/<site>/clone/backend/__init__.py -> materials/<site>
SITE_DIR = Path(__file__).resolve().parents[2]

LOCAL_RATING_DISCLOSURE = (
    "Local rating \u2014 never affects real IMDb aggregates"
)


def data_dir() -> Path:
    """Resolve the persistent data directory (env-overridable, lazy).

    Defaults to materials/imdb/data, which is intentionally outside the
    candidate root clone/ so verification fingerprints never include runtime state.
    """
    override = (
        os.environ.get("WEBSITEBENCH_DATA_DIR", "").strip()
        or os.environ.get("CLAWBENCH_DATA_DIR", "").strip()
    )
    if override:
        return Path(override)
    return SITE_DIR / "data"


def db_path() -> Path:
    return data_dir() / "imdb.sqlite3"


def admin_token() -> str:
    return (
        os.environ.get("WEBSITEBENCH_ADMIN_TOKEN", "").strip()
        or os.environ.get("CLAWBENCH_ADMIN_TOKEN", "").strip()
        or (
        DEFAULT_ADMIN_TOKEN
        )
    )