{ "schema_version": "offline-clone.backend-model.v1", "site_id": "crunchyroll", "status": "draft", "profile": "offline-benchmark", "database": { "engine": "sqlite", "location_policy": "runtime-data-outside-candidate", "concurrency_model": "wal-transactional-single-writer", "migration_strategy": "versioned-forward-migrations", "deterministic_reset": true, "restart_persistence": true, "site_isolation": "one-database-per-site", "proofs": [ { "obligation": "data-location", "status": "verified", "evidence": [ "clone/tests/test_app.py", "backend/runtime.json", "clone/backend/site_schema.py" ] }, { "obligation": "schema-migration", "status": "verified", "evidence": [ "clone/tests/test_app.py", "backend/runtime.json", "clone/backend/site_schema.py" ] }, { "obligation": "deterministic-reset", "status": "verified", "evidence": [ "clone/tests/test_app.py", "backend/runtime.json", "clone/backend/site_schema.py" ] }, { "obligation": "restart-persistence", "status": "verified", "evidence": [ "clone/tests/test_app.py", "backend/runtime.json", "clone/backend/site_schema.py" ] }, { "obligation": "backup-restore", "status": "verified", "evidence": [ "clone/tests/test_app.py" ] }, { "obligation": "concurrency", "status": "verified", "evidence": [ "clone/tests/test_app.py" ] } ] }, "auth_semantics": { "account_database_scope": "site-isolated", "credential_storage": "salted-scrypt-hash", "session_storage": "opaque-cookie-digest-at-rest", "registration_account_creation": "after-email-verification", "verification_challenge_storage": "salted-hash", "password_reset_enumeration": "indistinguishable-public-response", "mail_default": "LOCAL_ONLY", "mail_statuses": [ "LOCAL_ONLY", "SMTP_PENDING", "SMTP_SENT", "SMTP_FAILED" ], "smtp_activation": "explicit-complete-config-only", "smtp_delivery_ceiling": 3, "rejected_secret_journaling": "forbidden", "legacy_write_policy": "read-compatible-write-rejected" }, "common_capabilities": { "account_registration": "account-registration", "account_sign_in": "account-sign-in", "session_lifecycle": "session-lifecycle", "password_recovery": "password-recovery", "email_delivery": "email-delivery" }, "capabilities": [ { "id": "account-registration", "label": "Verified local account registration", "priority": "p0", "category": "authentication", "implementation_status": "implemented", "entities": [ { "name": "pending-registration", "identity": "opaque pending id bound to one browser session", "owner_scope": "session", "persistence": "durable" }, { "name": "local-account", "identity": "site-local account id and unique normalized email", "owner_scope": "account", "persistence": "durable" } ], "state_machine": { "kind": "challenge-lifecycle", "states": [ "collecting", "pending-verification", "verified", "account-created", "expired", "locked" ], "transitions": [ { "from": "collecting", "to": "pending-verification", "trigger": "validated registration request" }, { "from": "pending-verification", "to": "verified", "trigger": "correct unexpired code within attempt budget" }, { "from": "verified", "to": "account-created", "trigger": "transactional account creation and session rotation" }, { "from": "pending-verification", "to": "expired", "trigger": "challenge expiry" }, { "from": "pending-verification", "to": "locked", "trigger": "verification attempt budget exhausted" } ] }, "server_authorities": [ "The server normalizes identity and hashes password and code.", "An account is created only after successful verification.", "Duplicate normalized email creation is rejected transactionally." ], "external_effect": "none", "journey_ids": [ "register-mega-fan-local" ], "invariant_ids": [ "validation-before-mutation" ], "proofs": { "evidence": { "valid": [ "clone/tests/test_app.py" ], "invalid": [ "clone/tests/test_app.py" ] }, "planned": [ "duplicate", "stale", "foreign-owner", "unauthorized-role", "restart", "migration", "concurrency" ], "not_applicable": [] } }, { "id": "account-sign-in", "label": "Password-based local account sign-in", "priority": "p0", "category": "authentication", "implementation_status": "implemented", "entities": [ { "name": "local-account", "identity": "site-local account id and normalized email", "owner_scope": "account", "persistence": "durable" } ], "state_machine": { "kind": "entity-lifecycle", "states": [ "signed-out", "identified", "authenticated", "rejected" ], "transitions": [ { "from": "signed-out", "to": "identified", "trigger": "normalized email submitted" }, { "from": "identified", "to": "authenticated", "trigger": "constant-time password verification succeeds" }, { "from": "identified", "to": "rejected", "trigger": "credentials are invalid" } ] }, "server_authorities": [ "The server verifies salted password hashes.", "The server rotates the authenticated session.", "Client-selected fixture identity is not authentication." ], "external_effect": "none", "journey_ids": [ "signin-watch-resume" ], "invariant_ids": [ "account-isolation" ], "proofs": { "evidence": { "valid": [ "clone/tests/test_app.py" ], "invalid": [ "clone/tests/test_app.py" ] }, "planned": [ "duplicate", "stale", "foreign-owner", "unauthorized-role", "restart", "migration", "concurrency" ], "not_applicable": [] } }, { "id": "session-lifecycle", "label": "Anonymous and authenticated browser sessions", "priority": "p0", "category": "authentication", "implementation_status": "implemented", "entities": [ { "name": "browser-session", "identity": "opaque cookie token with digest persisted at rest", "owner_scope": "session", "persistence": "durable" } ], "state_machine": { "kind": "session-lifecycle", "states": [ "anonymous", "authenticated", "revoked", "expired" ], "transitions": [ { "from": "anonymous", "to": "authenticated", "trigger": "successful sign-in or registration rotates session" }, { "from": "authenticated", "to": "revoked", "trigger": "sign-out or security reset" }, { "from": "anonymous", "to": "expired", "trigger": "session expiry" }, { "from": "authenticated", "to": "expired", "trigger": "session expiry" } ] }, "server_authorities": [ "Raw session tokens are never stored in the database.", "Ownership is resolved from the server-side session record.", "Sign-out revokes server-side authority before deleting the cookie." ], "external_effect": "none", "journey_ids": [ "signin-watch-resume", "manage-profile-account" ], "invariant_ids": [ "account-isolation" ], "proofs": { "evidence": { "valid": [ "clone/tests/test_app.py" ], "invalid": [ "clone/tests/test_app.py" ] }, "planned": [ "duplicate", "stale", "foreign-owner", "unauthorized-role", "restart", "migration", "concurrency" ], "not_applicable": [] } }, { "id": "password-recovery", "label": "Enumeration-resistant local password recovery", "priority": "p0", "category": "authentication", "implementation_status": "implemented", "entities": [ { "name": "password-reset-challenge", "identity": "opaque reset id bound to one browser session", "owner_scope": "session", "persistence": "durable" }, { "name": "local-account", "identity": "nullable concealed account binding", "owner_scope": "account", "persistence": "durable" } ], "state_machine": { "kind": "challenge-lifecycle", "states": [ "requested", "verified", "consumed", "expired", "locked" ], "transitions": [ { "from": "requested", "to": "verified", "trigger": "correct unexpired code within attempt budget" }, { "from": "verified", "to": "consumed", "trigger": "password is replaced and sessions are revoked" }, { "from": "requested", "to": "expired", "trigger": "challenge expiry" }, { "from": "requested", "to": "locked", "trigger": "verification attempt budget exhausted" } ] }, "server_authorities": [ "Known and unknown emails receive indistinguishable public responses.", "Only the server binds a reset flow to an account.", "Password replacement revokes prior authenticated sessions." ], "external_effect": "local-only", "journey_ids": [ "auth-recovery-support" ], "invariant_ids": [ "validation-before-mutation" ], "proofs": { "evidence": { "valid": [ "clone/tests/test_app.py" ], "invalid": [ "clone/tests/test_app.py" ] }, "planned": [ "duplicate", "stale", "foreign-owner", "unauthorized-role", "restart", "migration", "concurrency" ], "not_applicable": [] } }, { "id": "email-delivery", "label": "Truthful local verification and recovery mail outbox", "priority": "p0", "category": "communication", "implementation_status": "implemented", "entities": [ { "name": "mail-outbox-entry", "identity": "site-local outbox id and purpose-bound flow id", "owner_scope": "system", "persistence": "durable" } ], "state_machine": { "kind": "delivery-lifecycle", "states": [ "local-only", "smtp-pending", "smtp-sent", "smtp-failed" ], "transitions": [ { "from": "local-only", "to": "smtp-pending", "trigger": "operator enables complete explicit SMTP configuration" }, { "from": "smtp-pending", "to": "smtp-sent", "trigger": "SMTP transport confirms delivery handoff" }, { "from": "smtp-pending", "to": "smtp-failed", "trigger": "delivery attempt fails or ceiling is reached" }, { "from": "smtp-failed", "to": "smtp-pending", "trigger": "bounded idempotent retry below the delivery ceiling" } ] }, "server_authorities": [ "Offline mode records LOCAL_ONLY and never claims external delivery.", "SMTP is disabled unless every required setting is present.", "Claim, retry, and startup replay share one delivery ceiling." ], "external_effect": "local-only", "journey_ids": [ "register-mega-fan-local", "auth-recovery-support" ], "invariant_ids": [ "account-isolation" ], "proofs": { "evidence": { "valid": [ "clone/tests/test_app.py" ], "invalid": [ "clone/tests/test_app.py" ] }, "planned": [ "duplicate", "stale", "foreign-owner", "unauthorized-role", "restart", "migration", "concurrency" ], "not_applicable": [] } }, { "id": "catalog-discovery", "label": "Deterministic local anime catalog and search", "priority": "p0", "category": "search", "implementation_status": "implemented", "entities": [ { "name": "catalog-record", "identity": "stable catalog-record identity scoped by authenticated subject_id", "owner_scope": "account", "persistence": "durable" } ], "state_machine": { "kind": "entity-lifecycle", "states": [ "available", "matched", "empty" ], "transitions": [ { "from": "available", "to": "matched", "trigger": "local query matches title or genre" }, { "from": "matched", "to": "empty", "trigger": "impossible query returns no records" } ] }, "server_authorities": [ "The server resolves the stable subject owner from the authenticated session.", "Every mutation and lookup is scoped by owner in the site SQLite database." ], "external_effect": "none", "journey_ids": [ "discover-title" ], "invariant_ids": [ "catalog-consistency" ], "proofs": { "evidence": { "valid": [ "clone/tests/test_app.py" ], "invalid": [ "clone/tests/test_app.py" ] }, "planned": [ "duplicate", "stale", "foreign-owner", "unauthorized-role", "restart", "migration", "concurrency" ], "not_applicable": [] } }, { "id": "profile-library-progress", "label": "Owner-bound profiles, watchlist and playback progress", "priority": "p0", "category": "personalization", "implementation_status": "implemented", "entities": [ { "name": "viewing-state", "identity": "stable viewing-state identity scoped by authenticated subject_id", "owner_scope": "account", "persistence": "durable" } ], "state_machine": { "kind": "idempotent-set", "states": [ "empty", "populated", "updated" ], "transitions": [ { "from": "empty", "to": "populated", "trigger": "authenticated owner adds a title or profile" }, { "from": "populated", "to": "updated", "trigger": "authenticated owner switches profile or saves progress" } ] }, "server_authorities": [ "The server resolves the stable subject owner from the authenticated session.", "Every mutation and lookup is scoped by owner in the site SQLite database." ], "external_effect": "none", "journey_ids": [ "signin-watch-resume", "manage-profile-account" ], "invariant_ids": [ "account-isolation" ], "proofs": { "evidence": { "valid": [ "clone/tests/test_app.py" ], "invalid": [ "clone/tests/test_app.py" ], "duplicate": [ "clone/tests/test_app.py" ], "foreign-owner": [ "clone/tests/test_app.py" ], "restart": [ "clone/tests/test_app.py" ] }, "planned": [ "stale", "unauthorized-role", "migration", "concurrency" ], "not_applicable": [] } }, { "id": "account-preferences", "label": "Owner-bound playback, language, notification, privacy and device preferences", "priority": "p1", "category": "administration", "implementation_status": "implemented", "entities": [ { "name": "account-preference", "identity": "stable account-preference identity scoped by authenticated subject_id", "owner_scope": "account", "persistence": "durable" } ], "state_machine": { "kind": "entity-lifecycle", "states": [ "seeded", "updated" ], "transitions": [ { "from": "seeded", "to": "updated", "trigger": "authenticated owner saves allowlisted settings" } ] }, "server_authorities": [ "The server resolves the stable subject owner from the authenticated session.", "Every mutation and lookup is scoped by owner in the site SQLite database." ], "external_effect": "none", "journey_ids": [ "manage-profile-account" ], "invariant_ids": [ "account-isolation", "validation-before-mutation" ], "proofs": { "evidence": { "valid": [ "clone/tests/test_app.py" ], "foreign-owner": [ "clone/tests/test_app.py" ], "restart": [ "clone/tests/test_app.py" ] }, "planned": [ "invalid", "duplicate", "stale", "unauthorized-role", "migration", "concurrency" ], "not_applicable": [] } }, { "id": "sandbox-subscription", "label": "Transactional local-sandbox subscription and history", "priority": "p0", "category": "commerce", "implementation_status": "implemented", "entities": [ { "name": "subscription-receipt", "identity": "stable subscription-receipt identity scoped by authenticated subject_id", "owner_scope": "account", "persistence": "durable" } ], "state_machine": { "kind": "immutable-receipt", "states": [ "review", "declined", "retryable", "active" ], "transitions": [ { "from": "review", "to": "declined", "trigger": "sandbox decline is recorded without subscription mutation" }, { "from": "review", "to": "retryable", "trigger": "sandbox retry leaves subscription unchanged" }, { "from": "review", "to": "active", "trigger": "approval is consumed atomically with subscription and history" } ] }, "server_authorities": [ "The server resolves the stable subject owner from the authenticated session.", "Every mutation and lookup is scoped by owner in the site SQLite database." ], "external_effect": "none", "journey_ids": [ "register-mega-fan-local", "manage-profile-account" ], "invariant_ids": [ "local-sandbox-only", "account-isolation", "validation-before-mutation" ], "proofs": { "evidence": { "valid": [ "clone/tests/test_app.py" ], "invalid": [ "clone/tests/test_app.py" ], "duplicate": [ "clone/tests/test_app.py" ], "stale": [ "clone/tests/test_app.py" ], "foreign-owner": [ "clone/tests/test_app.py" ], "restart": [ "clone/tests/test_app.py" ] }, "planned": [ "unauthorized-role", "migration", "concurrency" ], "not_applicable": [] } } ], "r1_subject_binding": { "identity_kind": "stable authenticated account subject id", "identity_path": "resolve_session.account.subject_id", "model_path": "backend/model.json capabilities and entity owner_scope", "contract_component": "account-isolation invariant and subject-prefixed business owner keys", "source_evidence_component": "scope/invariants.json account-isolation plus clone/tests/test_app.py", "self_digest_disposition": "session_owner_digest is not used as business ownership because session rotation must preserve account state" } }