{
  "date": "2026-10-04",
  "phase": "Android Media3 and Apple system-session native pending-episode scheduling; App batch integration",
  "tests": {
    "platform": {
      "passed": 273,
      "log": "work/offline-queue-platform-full.log"
    },
    "app": {
      "passed": 371,
      "typecheck": true,
      "log": "work/apple-queue-app-full.log",
      "scope": "Actual App SDK/React/modules with explicitly controlled HTTP/SecureStore/native adapters; no device claim"
    },
    "goRace": {
      "passed": 16,
      "skipped": 2,
      "log": "work/offline-queue-go-race.jsonl"
    },
    "goBuild": true,
    "androidMedia3": {
      "passed": 54,
      "failures": 0,
      "errors": 0,
      "skipped": 0,
      "log": "work/apple-queue-android-native.log",
      "scope": "Actual Media3 manager, SQLite index, DownloadHelper, cache and worker slots with native loopback metadata HTTP and controlled media transport; not Android device/background acceptance."
    },
    "appleSDK": {
      "passed": 227,
      "addedQueueChecks": 34,
      "log": "work/apple-queue-sdk.log",
      "scope": "Actual macOS Foundation/AVFoundation, durable native store and queue coordinator; real metadata URLSession callbacks with controlled URLProtocol and system media admission adapter. No full iOS build, system background execution or physical-device proof."
    }
  },
  "joint": {
    "date": "2026-10-04",
    "passed": true,
    "checks": [
      "Three-episode handoff is idempotent, expires within 30 minutes, leaks no login credential and causes zero reservations/video/debits.",
      "Credential-free native prepare restores only the original official owner/device; one actual episode charges once while later episodes remain uncharged.",
      "Native direct-to-relay fallback uses the same original permit/debit/expiry, and existing terminal cleanup releases all relay RAM.",
      "An unbound asset, input query or cancelled original order cannot use the handoff or charge later episodes.",
      "Current source withdrawal and installation revocation deny native preparation; shortened installation expiry invalidates the old handoff and expires the replacement.",
      "Handoff respects the current official session expiry; terminal/repeated/late release removes only the exact RAM handoff, keeping a replacement alive and all durable permits unchanged.",
      "Official Better Auth sign-out stops new native preparation; final base debit remains one and video relay RAM remains zero."
    ],
    "scope": "Public Go/API + official Better Auth email OTP/cookies + approved fixture App installation + isolated RAM PostgreSQL. Original MP4 fixture only; native scheduler/SMTP/physical devices are not exercised.",
    "baseDebits": 1,
    "initialAssets": 3,
    "remainingAssetsUncharged": 2,
    "finalMedia": {
      "cenc": false,
      "fixtureBytes": 280496,
      "mediaRequests": 0,
      "metadataRequests": 0,
      "offlineRelays": 0,
      "ramBytes": 0,
      "ramRelayOnly": true,
      "ramSegments": 0,
      "videoJobs": 0
    },
    "initialRelayCount": 0,
    "goExitCode": 0,
    "historicalPhase": "Backend handoff foundation on 2026-10-04; retained evidence, not a newly coupled native device run"
  },
  "review": {
    "kind": "Root source review and failure tests",
    "freshIndependentSubagentReview": false
  },
  "deploymentScope": "Static documentation only; no API/App/OTA/native binary/business deployment",
  "runtimeVersion": "11",
  "remaining": [
    "Physical Android devices, process-kill/OS limits and current HLS acceptance",
    "Full iOS SDK build and physical-device/background acceptance",
    "Real video sources and SMTP",
    "App qualification and credible invitation watch proof",
    "Complete design/catalog and production load acceptance",
    "Business deployment"
  ],
  "nativePatch": {
    "passed": true,
    "files": 26,
    "buildArtifacts": 0,
    "exactOriginalVersion": "6.19.2",
    "scope": "Saved patch applied cleanly to original npm package; all modified source files equal actual compiled/tested sources"
  },
  "builds": {
    "apk": "dramivio-runtime11-apple-queue-local-test.apk",
    "apiOrigin": "http://127.0.0.1:18091",
    "updatesOrigin": "http://127.0.0.1:8998/api/updates",
    "apkInspection": "/Users/alienmu/Documents/Codex/2026-10-02/bang/work/apple-queue-runtime11-build.log.apk-check.json",
    "bytes": 43323611,
    "runtimeVersion": "11",
    "scope": "Local ARM64 debug-signed release build; subsequent Android36 first-registration device check passes. Earlier three-episode playback evidence retained separately. No physical-device or production publication claim.",
    "inspection": {
      "apk": "/Users/alienmu/Documents/work/juku-mobile/android/app/build/outputs/apk/release/app-release.apk",
      "sizeBytes": 43323611,
      "classesPresent": {
        "JukuOfflineModule": true,
        "JukuOfflineStore": true,
        "JukuOfflineService": true,
        "ReactExoplayerView": true
      },
      "offlineServiceManifestPresent": true,
      "foregroundDataSyncPermissionPresent": true,
      "hermesBundlePresent": true,
      "localFixtureApiEmbedded": true,
      "pendingNativeCleanupEmbedded": true,
      "abis": [
        "arm64-v8a"
      ],
      "debugSigningCertificate": true,
      "jsFeaturesPresent": {
        "enqueueQueue": true,
        "nativeManaged": true
      },
      "installedOnDevice": false,
      "published": false,
      "scope": "Actual complete APK, DEX, manifest, Hermes assets and signature inspection. Local loopback test build using the existing debug signing config; not a device playback or production-release result.",
      "runtimeVersion": "11",
      "updatesOriginMatches": true
    }
  },
  "checks": [
    "Entire original batch is durably indexed stopped before acknowledgement; no metadata prepare/debit before a Media3 worker slot.",
    "Three pending episodes prepare only two; native completion frees a slot and starts the third without JavaScript scheduling.",
    "Wi-Fi waiting, user pause, foreign owner and over-capacity batch cause no waiting-item prepare or video access.",
    "Direct network failure materializes the existing same-license relay; its cache can play without network.",
    "HLS uses existing DownloadHelper and persists the selected stream keys for offline playback.",
    "Queue-control deadline stays distinct from fixed media license expiry; terminal batch replacement does not reprepare or extend ready files.",
    "Unknown metadata POST result publishes Media3 pause before releasing a worker, preventing a third prepare; original IDs remain for recovery.",
    "Repeated batch handoff preserves the user-paused episode; completed cache survives cold restart but disk owner metadata cannot restore authentication.",
    "Native completion exposes only permit/progress metadata; actual React cache hook and player restore it while offline without source/API work.",
    "App batch acknowledgement racing cancellation removes late indexed assets; legacy binaries retain their existing foreground scheduler.",
    "Apple pending original-order items reuse the existing native manifest; no system video task or prepare before one of two slots is available.",
    "Apple media transfer stays in existing URLSession and AVAssetDownloadURLSession sessions; no new JS timer/video engine/service.",
    "Apple native completion advances the original third episode; capture, grant and expiry are whitelisted and durable before media admission.",
    "Apple repeat handoff preserves an explicit pause; cold native owner metadata never restores authentication.",
    "Apple unknown POST response pauses waiting original items before another admission; user/account cancellation prevents late media resurrection.",
    "Apple retains a bounded mutating request callback after cancellation so a late relay grant can release only its exact RAM slot.",
    "Apple actual direct network failure requests the original relay command; permit/asset/order/expiry must be identical.",
    "Apple terminal queue waits for exact relay 204 before admitting the next episode; user pause/Wi-Fi/capacity do not request fallback.",
    "Apple metadata HTTP carries no login/source credentials, refuses redirects and bounds streamed JSON at128KiB.",
    "Apple queue admission checks existing episode/byte limits and128MiB filesystem reserve; actual metadata requests honor Wi-Fi-only policy.",
    "Apple repeated ready batch returns the registered playback alias; a missing file cannot be returned as ready."
  ],
  "timeZone": "UTC",
  "deviceAcceptance": {
    "passed": true,
    "checks": {
      "actual_runtime11_loopback_binary": true,
      "native_wifi_wait_no_debit": true,
      "background_three_original_assets_ready": true,
      "native_sqlite_three_media_files_complete": true,
      "original_order_charges_once_per_episode": true,
      "native_batch_only_one_handoff": true,
      "terminal_server_ram_and_jobs_zero": true,
      "cold_offline_playback_has_no_more_media_access": true,
      "offline_three_positions_saved": true,
      "reconnected_three_positions_uploaded_without_invitation_completion": true
    },
    "runtimeVersion": "11",
    "platform": "Android36 ARM64 emulator",
    "goExitCode": 0,
    "scope": "Earlier runtime11 local APK before the registration-viewer fix, actual RN/Media3/system HTTP/DNS, Go API, official Better Auth email OTP and isolated RAM PostgreSQL. Clear6s MP4 bytes, email delivery and explicit reviewed installation are fixtures. Home/background Wi-Fi return completed original3 items; offline cold start played all3 and saved positions; reconnect uploaded positions. Not physical-device, real source/SMTP/hardware attestation, process-kill background or HLS acceptance.",
    "baseDebits": 3,
    "mediaRequests": 3,
    "finalMedia": {
      "cenc": false,
      "fixtureBytes": 280496,
      "mediaRequests": 3,
      "metadataRequests": 0,
      "offlineRelays": 0,
      "ramBytes": 0,
      "ramRelayOnly": true,
      "ramSegments": 0,
      "videoJobs": 0
    },
    "registrationDevicePersisted": false,
    "historicalFinding": "First native email registration stored no original registration device; later verified referral summary recorded the signed viewer. Production registration-device forwarding needs diagnosis. Test App approval used explicit fixture authority and current observed viewer; no business permission was relaxed.",
    "findingResolution": {
      "status": "fixed_and_verified",
      "evidence": "dramivio-registration-viewer-validation.json",
      "latestAPKRegistrationDevicePersisted": true,
      "scope": "Subsequent corrected APK signup only. Original three-episode run is retained unchanged; not repeated on the rebuilt APK."
    }
  },
  "correctedBuildEvidence": "Previous runtime10 and first runtime11 artifacts inherited real API/OTA from .env, contrary to prior local-loopback label. Helper now injects loopback origins at prebuild and bundle build, forces bundle regeneration and inspects actual APK/API/OTA/runtime before reporting success. Final runtime11 artifact passes. Earlier runtime10 file retired from outputs.",
  "registrationViewer": {
    "passed": true,
    "checks": [
      "Obsolete saved viewer cannot bypass the actual Go handshake",
      "Official BA/Expo OTP requests carry the current server-signed viewer",
      "Actual first registration persists the original Go-verified device",
      "Framework registration date stays unchanged",
      "No invitation credit or production App approval created"
    ],
    "scope": "Actual client API + installed BA/Expo JS SDK, Go HTTP and isolated RAM PostgreSQL. Native platform/storage supplied adapters, mail explicitly captured; no current new-APK/device claim.",
    "appRegressionTests": 3,
    "firstRegistrationDevicePersisted": true,
    "authRequests": 2,
    "identityRequests": 4,
    "deviceAcceptance": {
      "passed": true,
      "date": "2026-10-04T22:49:13.763215+00:00",
      "platform": "Android36 ARM64 emulator",
      "runtimeVersion": "11",
      "apkBytes": 43323611,
      "checks": {
        "latest_loopback_apk": true,
        "first_registration_device_persisted": true,
        "original_registration_time_preserved": true,
        "device_record_matches_registration_device": true,
        "official_email_otp_send_and_verify": true,
        "no_invitation_credit_or_app_qualification_created": true
      },
      "scope": "Actual newly rebuilt RN APK, official Better Auth/Expo on Android36 emulator, Go HTTP and isolated RAM PostgreSQL. Native UI email signup; email is captured test delivery. No installation approval, video transfer or production service in this registration run.",
      "firstRegistrationDevicePersisted": true,
      "baseDebits": 0,
      "installationApprovals": 0,
      "invitationRewards": 0,
      "stateEvidence": "work/registration-viewer-device-state.json",
      "goExitCode": 0
    },
    "resolution": "Revalidate persisted viewer metadata through the existing shared Go handshake before official registration OTP requests; a failed handshake sends no OTP. Previously saved account/device history is not rewritten."
  },
  "currentCencRuntime11": {
    "passed": true,
    "date": "2026-10-04",
    "runtimeVersion": "11",
    "platform": "Android36 ARM64 emulator",
    "apkBytes": 43323611,
    "scope": "Latest local runtime11 APK with actual React Native, Media3, Go HTTP, official Better Auth email OTP, isolated RAM PostgreSQL, and controlled CENC media fixture. Wi-Fi-only was explicitly disabled for this run because the headless emulator did not report a usable Wi-Fi transport; this validates the non-Wi-Fi policy path.",
    "checks": {
      "latest_loopback_apk": true,
      "cenc_native_queue_three_assets_ready": true,
      "three_base_debits_only": true,
      "direct_media_no_relay_ram": true,
      "offline_cold_player_reopened_cached_cenc": true,
      "reconnected_positions_uploaded_without_invitation_completion": true,
      "registration_device_and_installation_owner_valid": true
    },
    "baseDebits": 3,
    "progress": [
      {
        "position": 6,
        "duration": 6,
        "completed": false
      },
      {
        "position": 6,
        "duration": 6,
        "completed": false
      },
      {
        "position": 6,
        "duration": 6,
        "completed": false
      }
    ],
    "media": {
      "cenc": true,
      "fixtureBytes": 286092,
      "mediaRequests": 7,
      "metadataRequests": 18,
      "offlineRelays": 0,
      "ramBytes": 0,
      "ramRelayOnly": true,
      "ramSegments": 0,
      "videoJobs": 0
    },
    "assets": [
      {
        "id": "2838a292-3cca-4ccf-90a8-8dd05a56fa5b",
        "order_id": "37da2bb8-1c30-489e-a22e-448c91cecf95",
        "permit_id": "6f480d6a-d770-47e7-9f25-e3981c1a0992",
        "state": "ready",
        "expires_at": "2026-10-05T23:15:36.801Z",
        "source_index": 1
      },
      {
        "id": "fb793d39-d0d7-4d5e-bafc-f94b8fe3c3b9",
        "order_id": "37da2bb8-1c30-489e-a22e-448c91cecf95",
        "permit_id": "255895f1-fb63-441d-8cab-bf3a5e7fc9f7",
        "state": "ready",
        "expires_at": "2026-10-05T23:15:36.851Z",
        "source_index": 2
      },
      {
        "id": "0e7b3e30-2075-417f-a1b7-add0aee9ef43",
        "order_id": "37da2bb8-1c30-489e-a22e-448c91cecf95",
        "permit_id": "095dd15b-1f38-4693-9ce5-e4eec7dedbdc",
        "state": "ready",
        "expires_at": "2026-10-05T23:15:37.173Z",
        "source_index": 3
      }
    ],
    "requests": {
      "POST /internal/consumer/import 200": 2,
      "POST /internal/consumer/config 200": 5,
      "POST /internal/consumer/session 200": 48,
      "GET /api/auth/get-session 200": 7,
      "POST /internal/consumer/query 200": 5,
      "POST /internal/consumer/legal 200": 1,
      "POST /api/auth/email-otp/send-verification-otp 200": 1,
      "POST /api/auth/sign-in/email-otp 200": 1,
      "POST /internal/consumer/following/list 200": 3,
      "POST /internal/consumer/playback/resume 200": 2,
      "POST /internal/consumer/offline/preview 200": 1,
      "POST /internal/consumer/offline/order 200": 1,
      "POST /internal/consumer/offline/queue 200": 1,
      "POST /internal/consumer/playback/state 200": 5,
      "POST /internal/consumer/offline/source 200": 3,
      "POST /internal/consumer/offline/prepare 200": 3,
      "POST /internal/consumer/offline/transfer 200": 16,
      "POST /internal/consumer/offline/progress 200": 3
    },
    "offlineScreenshot": "runtime8-android-preview/current-cenc-offline-ep1-playing.png",
    "invitationRewards": 0,
    "installationApprovals": 1,
    "registrationDevices": 1
  }
}
