Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion contracts/api/v2/breaking-approvals.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
{
"approvals": []
"approvals": [
{
"operation_id": "listAdminDiagnosticReports",
"change_id": "response-property-enum-value-added",
"fingerprint": "1f6542b1993f82beafdb63afe392fac5272a3643a0353f2b2ffdfb9e462f85d6",
"reason": "Adds the roku client-diagnostics platform. Only the web admin reads this field, and this change teaches it roku.",
"approved_in": "#3298"
},
{
"operation_id": "getAdminDiagnosticReport",
"change_id": "response-property-enum-value-added",
"fingerprint": "087b44f74b4203e933af56f91ed6edea9b99476f7479b359577e6363a379f3f0",
"reason": "Adds the roku client-diagnostics platform. Only the web admin reads this field, and this change teaches it roku.",
"approved_in": "#3298"
}
]
}
6 changes: 4 additions & 2 deletions contracts/api/v2/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -6045,7 +6045,8 @@
"android",
"android-tv",
"ios",
"tvos"
"tvos",
"roku"
],
"type": "string"
},
Expand Down Expand Up @@ -6155,7 +6156,8 @@
"android",
"android-tv",
"ios",
"tvos"
"tvos",
"roku"
],
"type": "string"
},
Expand Down
4 changes: 2 additions & 2 deletions docs/design/2026-07-19-client-diagnostics.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Today we are blind to client-side failures:
beyond STATS on the clients are a separate product decision; v1 admin
consumption is via API + web admin).
- macOS. The Apple repo has a macOS target, but v1 scopes to
`android`, `android-tv`, `ios`, `tvos`; the platform enum reserves `macos`
`android`, `android-tv`, `ios`, `tvos`, `roku`; the platform enum reserves `macos`
without accepting it.
- Third-party telemetry, metrics aggregation, or fleet analytics. This is a
support/debugging tool, not analytics.
Expand Down Expand Up @@ -239,7 +239,7 @@ additive fields.
"capture_session_id": "run_c7d…", // UUID per app run, also stamped on log lines
"app_version": "1.4.2",
"app_build": "20841",
"platform": "android-tv", // android | android-tv | ios | tvos (macos reserved)
"platform": "android-tv", // android | android-tv | ios | tvos | roku (macos reserved)
"os_version": "11 (API 30)",
"profile_id": "prof_…" // capturing profile, attribution only
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"schema_version": 1,
"report": {
"type": "manual",
"captured_at": "2026-07-19T23:50:00Z",
"capture_session_id": "run_roku_manual_008",
"app_version": "0.1.0",
"app_build": "0",
"platform": "roku",
"os_version": "15.3.4"
},
"destination": {
"server_instance_id": "srv_home_01"
},
"consent": {
"mode": "manual",
"notice_version": 1
},
"device_summary": {
"manufacturer": "TCL",
"model": "55R625",
"os": "15.3.4",
"form_factor": "tv"
},
"playback_session_ids": [],
"log_summary": {
"lines": 48,
"bytes_gz": 4200,
"dropped_lines": 0,
"categories": [
"browse",
"network"
],
"debug_logging": false
},
"archive": {
"entries": [
"manifest.json",
"device.json",
"logs.jsonl"
],
"bytes": 7000,
"uncompressed_bytes": 36000,
"sha256": "5555555555555555555555555555555555555555555555555555555555555555"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
"android",
"android-tv",
"ios",
"tvos"
"tvos",
"roku"
],
"maxLength": 32
},
Expand Down
2 changes: 1 addition & 1 deletion internal/apiv2/admin_diagnostics_reads.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type AdminDiagnosticSummary struct {
CapturedAt Instant `json:"captured_at"`
ReceivedAt Instant `json:"received_at"`
ReportType string `json:"report_type" enum:"crash,anr,native_crash,hang,abnormal_exit,manual"`
Platform string `json:"platform" enum:"android,android-tv,ios,tvos"`
Platform string `json:"platform" enum:"android,android-tv,ios,tvos,roku"`
AppVersion string `json:"app_version"`
AppBuild string `json:"app_build"`
CrashSummary *string `json:"crash_summary,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion internal/diagnostics/contract/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ var (
manifestArchiveRequiredFields = []string{"entries", "bytes", "uncompressed_bytes", "sha256"}

reportTypes = []string{"crash", "anr", "native_crash", "hang", "abnormal_exit", "manual"}
platforms = []string{"android", "android-tv", "ios", "tvos"}
platforms = []string{"android", "android-tv", "ios", "tvos", "roku"}
crashSources = []string{"ueh", "exit_info", "metrickit", "exit_sentinel"}
crashProvenances = []string{"pre_failure", "post_restart", "metric_reporting_period"}
consentModes = []string{"prompt", "always", "manual"}
Expand Down
42 changes: 42 additions & 0 deletions migrations/client_diagnostic_reports_roku_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package migrations

import (
"strings"
"testing"
)

// The platform constraint accepts roku after the migration, keeps every stored
// report, still rejects macos, and stays wide on rollback.
func TestClientDiagnosticReportsRokuPlatformPostgres(t *testing.T) {
tx, schema := adminMigrationFixture(t)
migrationExec(t, tx, `CREATE TABLE users (id integer PRIMARY KEY); INSERT INTO users VALUES (1);`)
data, err := FS.ReadFile("sql/20260720084550_client_diagnostic_reports.sql")
if err != nil {
t.Fatal(err)
}
up, _, _ := strings.Cut(string(data), "-- +goose Down")
migrationExec(t, tx, up)

insert := func(id, platform string) string {
return `INSERT INTO client_diagnostic_reports (id, short_id, user_id, state, captured_at, report_type, platform, app_version, manifest)
VALUES ('` + id + `', 'SILO-` + id[len(id)-12:] + `', 1, 'ready', now(), 'manual', '` + platform + `', '1.0.0', '{}')`
}
migrationExec(t, tx, insert("00000000-0000-0000-0000-000000000001", "android-tv"))
requireMigrationSQLState(t, tx, insert("00000000-0000-0000-0000-000000000002", "roku"), "23514")

const migration = "20261031021616_allow_roku_client_diagnostic_reports"
migrationExec(t, tx, adminMigrationSQL(t, migration, schema, false))
migrationExec(t, tx, insert("00000000-0000-0000-0000-000000000002", "roku"))
requireMigrationSQLState(t, tx, insert("00000000-0000-0000-0000-000000000003", "macos"), "23514")

var platforms string
if err := tx.QueryRow(t.Context(), `SELECT string_agg(platform, ',' ORDER BY id) FROM client_diagnostic_reports`).Scan(&platforms); err != nil {
t.Fatal(err)
}
if platforms != "android-tv,roku" {
t.Fatalf("platforms = %q, want android-tv,roku", platforms)
}

migrationExec(t, tx, adminMigrationSQL(t, migration, schema, true))
migrationExec(t, tx, insert("00000000-0000-0000-0000-000000000004", "roku"))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- +goose NO TRANSACTION

-- +goose Up
-- The Roku client uploads client diagnostics as the roku platform. macos
-- stays reserved and rejected.
ALTER TABLE public.client_diagnostic_reports
DROP CONSTRAINT client_diagnostic_reports_platform_check,
ADD CONSTRAINT client_diagnostic_reports_platform_check
CHECK (platform IN ('android', 'android-tv', 'ios', 'tvos', 'roku')) NOT VALID;
ALTER TABLE public.client_diagnostic_reports VALIDATE CONSTRAINT client_diagnostic_reports_platform_check;

-- +goose Down
-- The wider constraint is kept. An older binary never accepts a roku report,
-- and narrowing it again would fail while a stored roku report remains.
SELECT 1;
1 change: 1 addition & 0 deletions scripts/ci/db-contracts.txt
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,7 @@
# The access-token lifetime moves from the old 1h seed to 8h and keeps a value
# an administrator chose.
./migrations TestAccessTokenExpiryMigrationPostgres
./migrations TestClientDiagnosticReportsRokuPlatformPostgres

# A stored collection's Jellyfin BoxSet page skips members the viewer can't see
# without shortening the page or shifting later pages.
Expand Down
2 changes: 1 addition & 1 deletion web/src/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2888,7 +2888,7 @@ export type DiagnosticReportType =
| "hang"
| "abnormal_exit"
| "manual";
export type DiagnosticPlatform = "android" | "android-tv" | "ios" | "tvos";
export type DiagnosticPlatform = "android" | "android-tv" | "ios" | "tvos" | "roku";

export interface ClientDiagnosticManifest {
schema_version: number;
Expand Down
4 changes: 2 additions & 2 deletions web/src/api/v2/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14952,7 +14952,7 @@ export interface components {
/** @description Original validated client diagnostics manifest document, retaining its own schema_version and extension fields. */
manifest: unknown;
/** @enum {string} */
platform: "android" | "android-tv" | "ios" | "tvos";
platform: "android" | "android-tv" | "ios" | "tvos" | "roku";
playback_session_ids: string[];
profile_id?: string;
/**
Expand Down Expand Up @@ -14991,7 +14991,7 @@ export interface components {
*/
id: string;
/** @enum {string} */
platform: "android" | "android-tv" | "ios" | "tvos";
platform: "android" | "android-tv" | "ios" | "tvos" | "roku";
playback_session_ids: string[];
profile_id?: string;
/**
Expand Down
3 changes: 3 additions & 0 deletions web/src/pages/AdminDiagnostics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ export default function AdminDiagnostics() {
<SelectItem value="android-tv">Android TV</SelectItem>
<SelectItem value="ios">iOS</SelectItem>
<SelectItem value="tvos">tvOS</SelectItem>
<SelectItem value="roku">Roku</SelectItem>
</SelectContent>
</Select>
</FilterField>
Expand Down Expand Up @@ -738,6 +739,8 @@ function formatPlatform(value: string) {
return "iOS";
case "tvos":
return "tvOS";
case "roku":
return "Roku";
default:
return "Android";
}
Expand Down
Loading