You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Related issue: #579
Validation tasks: no passed case is reached; touches #197 (Playback), not run yet
Stacked on #3115; merge that first.
A delivery's max_channels applies to every audio codec. A client that decodes AAC only in stereo but plays E-AC-3 or AC-3 5.1 (a Roku without multichannel AAC) cannot say so: max_channels: 2 would also force its 5.1 tracks to stereo, and leaving it out lets the server plan 5.1 AAC the client cannot decode. The Roku works around this by guessing the track before the start and, when the server still returns 5.1 AAC, stopping and starting again.
This change adds an optional per-codec ceiling. max_channels_by_codec: {"aac": 2} keeps every AAC conversion in stereo and never copies multichannel AAC to that delivery, while other codecs follow max_channels alone. /api/v2 advertises it as codec_channel_ceilings_v1, so a client knows the server honors it.
Approach
DeliveryCapabilityV3.MaxChannelsByCodec: keys normalized like codec names (E-AC-3 spellings become eac3; spellings of one codec keep the lowest positive ceiling, which also beats an unset one), at most 32 entries (stated in the OpenAPI schema), values up to 64; zero or less means no ceiling.
deliveryChannelCeilingV3 takes the lower of max_channels and the codec's entry. The copy checks, the finished-plan check (on the effective recipe's codec), and aacOutputChannelsV3 all use it.
/api/v1 drops the field before validation, as it does the buffering-quality fields, so the frozen surface neither rejects nor acts on it.
Contracts: OpenAPI, the v3 JSON schemas, generated web types, and playback fixtures (the new feature string) are regenerated. The two fix(sections): cap profile section item limits at 500 #3050 breaking-change approvals no longer match any change against main and are removed, as the contract check asks.
The start's audio choice from #3115 plans each candidate, so a per-codec ceiling also counts there: with {"aac": 2}, a multichannel AAC track no longer counts as playable without conversion.
Validation
TestStartRequestV3NormalizesCodecChannelCeilings covers the spelling merge. TestPlanPlaybackV3CodecChannelCeiling: with {"aac": 2}, TrueHD 7.1 and AAC 5.1 convert to stereo AAC; E-AC-3 5.1 plays as is. Planner-backed rows in TestPreferUnconvertedAudioTrackV3FollowsThePlanner cover the ceiling in the start's choice. TestV1StartIgnoresBufferingQualityFields now sends an out-of-range ceiling to /api/v1, which still plays.
Roku Ultra on an isolated sandbox: a DTS-HD MA 7.1 file plays stereo AAC on the first start, with no restart; a TrueHD 7.1 file with an AC-3 5.1 track still copies AC-3 5.1.
make verify-apiv2-contract reports two additive request properties. go build, gofmt, go vet, make lint-changed, make test-go (two jellycompat DV-strip tests fail locally on main too and pass in CI), and the playback-fixture, OpenAPI, API v2 fixture, web-type, and route-inventory checks pass.
Clients that never send the field are unaffected. A client that sends it to an older server gets the field ignored, so it should send it only when the server lists codec_channel_ceilings_v1.
Checklist
I read and can explain the complete diff.
This pull request addresses one concern.
AI Disclosure
Harness: Claude Code in T3 Code
Tool(s): Claude Code subagents (code exploration and an independent diff review)
Model(s): claude-opus-5-5
Involvement: Fully AI-generated, human verified
Review: an independent review found that /api/v1 validated the new field and that duplicate codec spellings resolved by map order; CodeRabbit found that an unset spelling could override a ceiling. All are fixed with tests.
A delivery's max_channels applies to every codec, so a client that decodes
AAC only in stereo but plays E-AC-3 5.1 had to cap both. The new optional
max_channels_by_codec caps one codec on top of max_channels: {"aac": 2}
keeps AAC conversions in stereo and still copies E-AC-3 5.1. /api/v2
advertises codec_channel_ceilings_v1.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The playback API and planner add optional per-codec audio channel ceilings. The planner applies these ceilings during audio selection and plan validation. The /api/v1 paths remove the new field before validation. The breaking-approvals list is also emptied.
The protocol advertises codec_channel_ceilings_v1 and validates the per-codec map. API schemas, documentation, and response fixtures describe or include the field and feature.
Apply codec ceilings during planning internal/playback/plan_v3.go, internal/playback/protocol_v3_test.go, internal/playback/audio_select_v3_test.go
Planning checks codec-specific limits alongside the delivery-wide limit. Tests cover AAC, TrueHD, and E-AC-3 planning outcomes and audio-track selection.
Preserve the frozen v1 request surface internal/api/handlers/playback_v3.go, internal/api/handlers/playback_connection_test.go
The v1 start and replan paths clear MaxChannelsByCodec before validation. The compatibility test includes the field in a v1 request.
Breaking API approvals
Layer / File(s)
Summary
Update breaking-approval list contracts/api/v2/breaking-approvals.json
The approvals array no longer lists the two profile-section override operations.
sequenceDiagram
participant Client
participant PlaybackAPI
participant DeliveryValidation
participant PlaybackPlanner
Client->>PlaybackAPI: submit delivery capability with codec ceilings
PlaybackAPI->>DeliveryValidation: validate and normalize capability
DeliveryValidation->>PlaybackPlanner: pass normalized capability
PlaybackPlanner->>PlaybackAPI: return plan using codec-specific limits
PlaybackAPI->>Client: return playback decision
Loading
Suggested reviewers:rhainland
Merge Risk: Moderate · up to 79377
A codec limit can be lost, and clients can submit schema-valid requests that the server rejects. Fix those mismatches before merging; also cover the separate v1 replan compatibility path.
Security architecture risk: Low · up to 79377
The new settings can tighten, but cannot raise, an existing channel ceiling. Playback ownership checks and recovery controls remain in place, and the older API discards the field. No new access or privilege expansion was identified. End-to-end resource containment and mixed-version recovery behavior were not fully verified.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
inferred — The demonstrated control scope is the authenticated user/profile's playback attempt. Codec ceilings can change its audio route and consume shared conversion resources, but restrictive max_channels values already exposed conversion planning before this PR. The inspection did not establish global quota guarantees or an increase in independently attackable resource scope.
Trust Boundaries and Controls
observed — Replan capability replacement occurs after authenticated user/profile checks, durable attempt ownership and API-surface checks, playback-attempt identity checks, and live-session validation. The new map does not replace those controls.
Resilience and Maintainability Implications
observed — The map uses the existing per-attempt persistence and replan lifecycle: capacity and session locks, request-digest leases, revision checks, and transport/session rollback on failed replacement commits. The inspected failure path also releases incomplete leases using a cancellation-independent context. These controls remain compensating transitions, not evidence that live transport and durable storage are one atomic transaction.
Pre-merge checks: 4 · 1
Failed checks: 1 inconclusive
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 6 files. (10 skipped:…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title "feat(playback): accept per-codec audio channel ceilings" names the main change: an optional per-codec channel ceiling (max_channels_by_codec) for playback delivery. The changeset adds this …
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description is specific and on-topic. It explains the problem (a delivery-wide max_channels cannot differ by codec), the new optional max_channels_by_codec field, the /api/v2 codec_channel_ceiling…
Full details: Title check
Explanation
The title "feat(playback): accept per-codec audio channel ceilings" names the main change: an optional per-codec channel ceiling (max_channels_by_codec) for playback delivery. The changeset adds this field to the protocol, planner, schemas, and tests, so the title matches the primary change. It uses a conventional-commit prefix and is 55 characters long.
Full details: Description check
Explanation
The description is specific and on-topic. It explains the problem (a delivery-wide max_channels cannot differ by codec), the new optional max_channels_by_codec field, the /api/v2 codec_channel_ceilings_v1 feature flag, the /api/v1 handling, the contract and fixture updates, the validation performed, and the risks. It matches the changeset summaries, which cover the protocol struct, planner logic, schemas, fixtures, and tests.
Full details: Docstring Coverage
Explanation
Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 6 files. (10 skipped: 9 unsupported, 1 too large.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches: 💡 1
📝 Generate docstrings: 💡
Commit to this branch
Create a new PR
🧪 Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
silo-triageBot
added
api-v2
API v2 / Huma migration program (epic #135); long-running, stacked by phase
enhancement
New feature or request
go
Pull requests that update go code
impact: playback
Can't play, stalls, or wrong media
priority: P2
Limited scope, workaround exists, or polish
stacked
Base is another open PR; merge in stack order named in the body
labels
Oct 27, 2026
The over-64 max_channels_by_codec case exists only for /api/v1 start. The replan route independently calls withoutNativeDeliveryFieldsV3 before validation, but no replan test sends this field. Add {"aac": 99} to an existing /api/v1 replan request and retain the successful-status assertion. This protects the replan call site without duplicating the start assertion.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: af157630-e62e-4d00-9819-b9dd0f84a6d3
Commits
Reviewing files that changed from the base of the PR and between 953e3e1 and 793777c.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
When two spellings of one codec meet in max_channels_by_codec, a positive
ceiling now wins over zero or less (unset), and the lowest positive one
over the rest. The OpenAPI schema states the 32-entry limit.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ersion (#3115)
* feat(playback): start on a track the client plays without conversion
When a v3 start names no audio track and the preference-based default
would need an audio conversion for this request, play another main track
in the same language that the request can take unconverted. A saved
series track still plays as saved.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* fix(playback): refine Auto audio on the route and version that play
The start's audio refinement now judges each track after the escalation
the start applies to a progressive remux with no route, and refines the
preference again when a buffered start moves to a lower version, instead
of carrying a track chosen on the requested file over by position.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* feat(playback): accept per-codec audio channel ceilings (#3116)
* feat(playback): accept per-codec audio channel ceilings
A delivery's max_channels applies to every codec, so a client that decodes
AAC only in stereo but plays E-AC-3 5.1 had to cap both. The new optional
max_channels_by_codec caps one codec on top of max_channels: {"aac": 2}
keeps AAC conversions in stereo and still copies E-AC-3 5.1. /api/v2
advertises codec_channel_ceilings_v1.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* fix(playback): keep a codec ceiling over an unset spelling
When two spellings of one codec meet in max_channels_by_codec, a positive
ceiling now wins over zero or less (unset), and the lowest positive one
over the rest. The OpenAPI schema states the 32-entry limit.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---------
Co-authored-by: Claude Opus 5.5 <[email protected]>
---------
Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
api-v2API v2 / Huma migration program (epic #135); long-running, stacked by phaseenhancementNew feature or requestgoPull requests that update go codeimpact: playbackCan't play, stalls, or wrong mediapriority: P2Limited scope, workaround exists, or polishsize/L200–499 added + deleted lines (all files); change volume, not priority.stackedBase is another open PR; merge in stack order named in the body
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Related issue: #579
Validation tasks: no passed case is reached; touches #197 (Playback), not run yet
Stacked on #3115; merge that first.
A delivery's
max_channelsapplies to every audio codec. A client that decodes AAC only in stereo but plays E-AC-3 or AC-3 5.1 (a Roku without multichannel AAC) cannot say so:max_channels: 2would also force its 5.1 tracks to stereo, and leaving it out lets the server plan 5.1 AAC the client cannot decode. The Roku works around this by guessing the track before the start and, when the server still returns 5.1 AAC, stopping and starting again.This change adds an optional per-codec ceiling.
max_channels_by_codec: {"aac": 2}keeps every AAC conversion in stereo and never copies multichannel AAC to that delivery, while other codecs followmax_channelsalone./api/v2advertises it ascodec_channel_ceilings_v1, so a client knows the server honors it.Approach
DeliveryCapabilityV3.MaxChannelsByCodec: keys normalized like codec names (E-AC-3 spellings becomeeac3; spellings of one codec keep the lowest positive ceiling, which also beats an unset one), at most 32 entries (stated in the OpenAPI schema), values up to 64; zero or less means no ceiling.deliveryChannelCeilingV3takes the lower ofmax_channelsand the codec's entry. The copy checks, the finished-plan check (on the effective recipe's codec), andaacOutputChannelsV3all use it./api/v1drops the field before validation, as it does the buffering-quality fields, so the frozen surface neither rejects nor acts on it.mainand are removed, as the contract check asks.The start's audio choice from #3115 plans each candidate, so a per-codec ceiling also counts there: with
{"aac": 2}, a multichannel AAC track no longer counts as playable without conversion.Validation
TestStartRequestV3NormalizesCodecChannelCeilingscovers the spelling merge.TestPlanPlaybackV3CodecChannelCeiling: with{"aac": 2}, TrueHD 7.1 and AAC 5.1 convert to stereo AAC; E-AC-3 5.1 plays as is. Planner-backed rows inTestPreferUnconvertedAudioTrackV3FollowsThePlannercover the ceiling in the start's choice.TestV1StartIgnoresBufferingQualityFieldsnow sends an out-of-range ceiling to/api/v1, which still plays.make verify-apiv2-contractreports two additive request properties.go build,gofmt,go vet,make lint-changed,make test-go(twojellycompatDV-strip tests fail locally onmaintoo and pass in CI), and the playback-fixture, OpenAPI, API v2 fixture, web-type, and route-inventory checks pass.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-3116/
Risks
codec_channel_ceilings_v1.Checklist
AI Disclosure
/api/v1validated the new field and that duplicate codec spellings resolved by map order; CodeRabbit found that an unset spelling could override a ceiling. All are fixed with tests.🤖 Generated with Claude Code