Skip to content

Follow the spec rules for server/activate - #193

Merged
maximmaxim345 merged 1 commit into
mainfrom
fix/activation-rules
Oct 22, 2026
Merged

maximmaxim345 merged 1 commit into
mainfrom
fix/activation-rules

Conversation

@maximmaxim345

Copy link
Copy Markdown
Member

What does this implement/fix?

The client closed the connection with unauthorized on several activations the spec allows: a first server/activate without active_roles, one after a re-handshake that leaves them out, and pairing PSK activations like [] to cancel a pairing attempt or playback with unpaired access.

The allowed activity sets now follow the spec table. active_roles persist across a re-handshake and are treated as empty once the connection can no longer play back. pairing_required is now also sent on pairing PSK sessions.

The management activity is removed from ServerActivate, and servers that send it are closed with unauthorized.

Related issue or spec PR (if applicable):

Types of changes

  • Bugfix (non-breaking change which fixes an issue): bugfix
  • New feature (non-breaking change which adds functionality): new-feature
  • Enhancement to an existing feature: enhancement
  • Breaking change (changes the public API or the protocol in a way that is not backwards compatible): breaking-change
  • Refactor (no behavior change): refactor
  • Documentation only: documentation
  • Maintenance / chore: maintenance
  • CI / workflow change: ci
  • Dependencies bump: dependencies

@maximmaxim345
maximmaxim345 requested a balanced review from Copilot October 22, 2026 15:59
@github-actions github-actions Bot added the breaking-change Changes the public API or the protocol in a way that is not backwards compatible label Oct 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Newly accepted combined pairing/playback activations still suspend playback-related protocol handling and discard authorized queued controller commands.

2 open issues
What changed in this PR

This PR aligns the SDK’s server/activate authorization and role persistence with the protocol specification, reducing incorrect connection closures.

Changes:

  • Updates allowed activities and pairing_required handling for pairing and Sentinel PSKs.
  • Preserves omitted active_roles across activations and re-handshakes, clearing effective roles when playback is no longer permitted.
  • Removes management from the public activation type and updates regression tests.
File Description
tests/​unit/​transport-rehandshake.test.ts Tests role persistence and pairing-PSK re-handshakes.
tests/​unit/​transport-activate.test.ts Tests omitted and persisted activation roles.
tests/​unit/​activate-authorization.test.ts Covers revised authorization rules and effective roles.
src/​types.ts Removes management from activation activities.
src/​core/​transport.ts Persists and forwards effective activation roles.
src/​core/​activate-authorization.ts Revises activity authorization and role resolution.

Review effort: Balanced

Comment thread src/core/activate-authorization.ts Resolved
Comment thread src/core/transport.ts Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

Static review found no unresolved blocking issues in the scoped changes; regression coverage is included, but tests were not executed.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

@maximmaxim345
maximmaxim345 merged commit 3f77b18 into main Oct 22, 2026
5 checks passed
@maximmaxim345
maximmaxim345 deleted the fix/activation-rules branch October 22, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change Changes the public API or the protocol in a way that is not backwards compatible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants