Skip to content

feat(admin): show local or remote stream location - #1330

Merged
Quick104 merged 14 commits into
Silo-Server:mainfrom
neurekadev:feat/1328-admin-stream-location
Sep 23, 2026
Merged

Quick104 merged 14 commits into
Silo-Server:mainfrom
neurekadev:feat/1328-admin-stream-location

Conversation

@neurekadev

@neurekadev neurekadev commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Important

Part 3 of 3 — review and merge in order. #1322 Remote per-stream bitrate → #1327 Local per-stream bitrate → #1330 Activity Local/Remote label.

This PR depends on #1327 and #1322 and should merge after both. Its upstream Files changed view includes the two predecessor PRs because GitHub compares fork-head PRs with main. Review the activity-only diff for the smaller change in this layer.

Problem

Related issue: #1328

Admin Activity currently shows the access-network route but not whether the server classified each playback stream as local or remote. Administrators need that classification to verify which bitrate policy applies.

Approach

Depends on #1327 and #1322. This branch includes both preceding PRs in its diff against upstream main until they land; the activity-specific change adds a shared local/remote classifier, persists the bitrate-policy classification chosen at native playback start or Jellyfin PlaybackInfo, exposes stream_location and its capability flag in the v2 admin contract, and displays a Local or Remote badge for each stream. Provider ingress and unknown addresses classify as remote, matching bitrate enforcement. Later media requests and policy edits do not change the stored classification or interrupt playback.

Validation

  • Passed: focused Go stream-location, session-start, and bitrate-policy tests; TypeScript and Vite builds; 40 Admin Activity presentation/UI tests; Go formatting of changed committed files; and git diff --check.
  • The API fixture, generated OpenAPI/web types, capability response, and contract digest were updated. Linux CI is validating the migration, API contract and fixtures, full Go checks, and web gates; broader Go checks cannot compile on this Windows checkout because of existing native dependencies.
  • No PostgreSQL-backed integration test was run locally.
  • Review follow-up dda71aaf: the v1 bridge's /api/v1/admin/sessions/capabilities no longer advertises stream_location, which v1 rows never return. The flag stays on the v2 capabilities endpoint. The handler capability test, focused Go and web tests, and changed-line lint pass.

Risks

A migration adds the stored policy location to live session observations. No playback route changes. Legacy sessions without captured policy location fall back to the existing network metadata, treating unknown addresses as remote. The API adds a required response field and a capability flag; clients that ignore unknown fields remain compatible.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.

AI Disclosure

  • Harness: Codex desktop
  • Tool(s): OpenAI Codex; GitHub CLI
  • Model(s): GPT-5
  • Involvement: AI-assisted
  • Review follow-up: Claude Opus 5.5 (claude-opus-5-5) in Claude Code wrote commit dda71aaf during maintainer review.
  • Adversarial review: Reviewed the classifier, native and Jellyfin-compatible policy capture, durable session sync and restart, API projection/capability, and Activity rendering. Greptile found a path-change attribution bug and a missing capability signal; both were fixed with regression coverage. The predecessor PRs' total-bitrate bypass was fixed and carried forward. No independent human review has been performed.

Summary by CodeRabbit

  • New Features

    • Added separate local and remote per-stream bitrate limits for access groups and user overrides.
    • Playback now enforces applicable bitrate limits, selecting direct play or compliant transcoding; unavailable compliant routes are rejected.
    • New playback capability indicators identify supported bitrate policies.
    • Admin playback sessions display whether streams are local or remote.
    • Access Group and user policy screens show, edit, and inherit bitrate limits.
  • Documentation

    • Updated API and playback documentation with bitrate policy behavior and configuration details.

@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: d6fa07b1-636f-4701-8078-f697979ecce3

📥 Commits

Reviewing files that changed from the base of the PR and between b8e7f95 and e22aa86.

📒 Files selected for processing (33)
  • cmd/silo/session_sync.go
  • contracts/api/v2/fixtures/admin_playback_sessions.json
  • contracts/api/v2/fixtures/get_system_info_ok.json
  • contracts/api/v2/openapi.json
  • docs/admin-api.md
  • internal/api/handlers/playback.go
  • internal/api/handlers/playback_sessions.go
  • internal/api/handlers/playback_sessions_test.go
  • internal/api/handlers/playback_v3.go
  • internal/apiv2/admin_sessions.go
  • internal/apiv2/admin_sessions_postgres_test.go
  • internal/apiv2/admin_sessions_test.go
  • internal/jellycompat/handlers_playback.go
  • internal/jellycompat/playback_contract_test.go
  • internal/jellycompat/playback_sessions.go
  • internal/jellycompat/streams.go
  • internal/jellycompat/streams_test.go
  • internal/playback/recipecard.go
  • internal/playback/recipecard_test.go
  • internal/playback/session.go
  • internal/playback/session_test.go
  • internal/playback/transcode_manager.go
  • internal/streamlocation/location.go
  • internal/streamlocation/location_test.go
  • internal/streamtoken/token.go
  • internal/worker/reconciler.go
  • internal/worker/reconciler_postgres_test.go
  • internal/worker/reconciler_test.go
  • migrations/sql/20260922232000_add_stream_policy_location.sql
  • web/src/api/types.ts
  • web/src/api/v2/schema.ts
  • web/src/components/PlaybackRouteBadges.tsx
  • web/src/pages/AdminActivity.test.tsx
 ____________________________________________
< Rabbit in the repo, here to fix that bug 🎶 >
 --------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

The current head appears safe to merge; no blocking or actionable new issue was identified.

Reviews (3) · Last reviewed commit: "test(playback): cover unknown audio-only..."

Comment thread internal/apiv2/admin_sessions.go Resolved
Comment thread internal/apiv2/admin_sessions.go Resolved
@neurekadev

Copy link
Copy Markdown
Contributor Author

@greptile review

@neurekadev

Copy link
Copy Markdown
Contributor Author

@greptileai please re-review the latest commit so this PR has a current-head review after the shared audio-only bitrate regression test was added.

Declare the nonnegative limit in response schemas and reject fractional group-editor input without changing the saved value. Update the OpenAPI artifact and add focused UI coverage.
Choose a direct-playable version within the server cap for unqualified static requests, including session reuse. Keep explicit source selection and its over-limit rejection unchanged.

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the activity layer of the stack (086d21e2..755136ae) at 755136ae, tracing native start, Jellyfin PlaybackInfo, session sync, and recipe-card reconstruction. One P2 finding is inline. I'm pushing the fix to this branch and will follow up with a summary.

AI-assisted review: Claude Opus 5.5 (claude-opus-5-5) in Claude Code, run for @Quick104.

The v1 bridge shares AdminPlaybackSessionFeatures with v2, so
/api/v1/admin/sessions/capabilities advertised stream_location even
though v1 rows never serialize it. Advertise the field only from the
v2 capabilities endpoint, which already sets it directly.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@Quick104

Copy link
Copy Markdown
Contributor

Review summary: activity layer (086d21e2..755136ae). Fix pushed as dda71aaf.

Fixed

  • P2: /api/v1/admin/sessions/capabilities advertised stream_location, but v1 rows never return it. dda71aaf removes the flag from the shared v1 response, keeps it on v2, and adds a regression assertion.

Checked; no change needed

  • Native start captures the location from the same request context as the bitrate cap, and replans reuse the stored per-attempt cap, so the label and enforcement agree.
  • Jellyfin PlaybackInfo stores the location on the negotiated source. ensureUpstreamPlayback applies it before the first sync, and upstreamRecipeCard carries it through reconstruction. persistTranscodeRecipe doesn't copy the field, but that card only rebuilds ffmpeg, not the playback session.
  • FromMetadata/FromContext classify exactly as the old IsRemote did, because Path.IsDefault() is Provider == "".

Validation

  • CI passed on dda71aaf: Go lint, Go test, Go contract checks, Web, and both Web test shards.
  • Local: focused Go tests for streamlocation, playback, worker, apiv2, api/handlers, and jellycompat. Admin Activity, route badge, and v2 session web tests passed. make lint-changed reported 0 issues.
  • CI's make test-go runs without SILO_TEST_DATABASE_URL, so the Postgres tests for this layer are skipped there. I ran them locally on pgvector/pgvector:pg18 after applying all migrations. TestReconcileNodeSessionsAfterAccountDeletion, TestAdminSessionPagesBeyondBridgeLimitPostgres, and TestPostgresPlanStore passed. 20260922232000 rolls down and back up cleanly, and its CHECK constraint rejects values other than '', local, and remote.

Remaining condition

Mergeability: 8/10 (conditional) at dda71aaf. The layer fits the stated goal: it records the classification at the point where policy is chosen, keeps v1 frozen, and exposes a v2 capability flag. The only blocker is the stack order.

AI-assisted review: Claude Opus 5.5 (claude-opus-5-5) in Claude Code, run for @Quick104.

Resolve the contract_digest conflict in get_system_info_ok.json by
regenerating the v2 fixtures after Silo-Server#1322 and Silo-Server#1327 merged.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@Quick104
Quick104 merged commit 087ad02 into Silo-Server:main Sep 23, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants