Skip to content

Remove the management namespace - #183

Merged
marcelveldt merged 19 commits into
Sendspin:mainfrom
balloobbot:remove-management
Sep 2, 2026
Merged

marcelveldt merged 19 commits into
Sendspin:mainfrom
balloobbot:remove-management

Conversation

@balloobbot

Copy link
Copy Markdown
Contributor

Fixes #182.

Removes the entire management/* namespace and replaces it with a fixed pairing-record model.

Changes

  • management.md deleted: all management/* commands, management/result, storage accounting, record_mode, and the used flag are gone.
  • pairing.md: new Pairing Records section. A record is the long-term PSK bound to a server_id; re-pairing replaces a server's own record. Clients MUST store at least 5 records. A pairing that completes at capacity MUST succeed by evicting an existing record; the choice is implementation-defined (for example, least recently used), except the record backing a currently-open connection MUST NOT be evicted. Evicted servers recover through the existing Sentinel fallback. Method enable/disable, secret rotation, the unpaired_access toggle, and pairing-window opening are local manufacturer-defined actions now.
  • messaging.md: activities is now ('playback' | 'pairing')[]; the long-term-PSK allowed sets are [], ['playback'], ['pairing']. server/unpair loses its shared-record carve-out. The management/ prefix and the management cases in the unauthorized and concurrent_attempt goodbye reasons are removed.
  • connection.md: connection priority is now 'playback' > 'pairing'. The shared-PSK storage model is removed; every record stores server_id and gets the post-match check. psk_id uniqueness is enforced at generation time. Eviction is added to the Sentinel-fallback causes.
  • README.md regenerated; build-readme.py --check passes.

Follow-up

The implementations (aiosendspin, sendspin-cpp) and the conformance suite still carry management support and need matching removals once this lands.

@maximmaxim345 maximmaxim345 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Previously runtime changes to the pairing config went through management, which needed the admitted connection, so the server that changed the state was also the one that knew the fresh state, and every change had a defined result.

Now local actions can change it at any time, but client/hello is only sent on a new connection and the client has no way to announce a change: a server that got pairing_required never learns that unpaired access was enabled later.
I think we should solve this at least somehow. For connected servers the simplest solution is to require the client to send a client/goodbye with restart after such a change, but I'm not sure if that is the best solution. If a server was previously disconnected through pairing_required, it has no connection left to receive a goodbye...

Also, @arturpragacz should also carefully review this PR before this is merged.

Comment thread pairing.md Resolved
Comment thread connection.md Resolved
Comment thread messaging.md Resolved
Comment thread pairing.md Resolved
Comment thread pairing.md Resolved
Comment thread pairing.md Resolved
Comment thread pairing.md Resolved
Comment thread pairing.md Resolved
Comment thread pairing.md Resolved
Comment thread messaging.md Resolved

@arturpragacz arturpragacz 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.

This should be addressed first: #182 (comment)

balloob added a commit that referenced this pull request Sep 1, 2026
Removes the already-paired entry into code-based pairing: a code-based
pairing now runs over a Sentinel-keyed connection only, and the
long-term PSK no longer admits the `'pairing'` activity.

A server has no need to run a pairing round over an existing credential:
to establish a fresh one it unpairs (`server/unpair`) and pairs again.
The Pairing PSK flow is unaffected - it still enters from any open
connection by re-handshaking to the pairing PSK first, since that is an
operator-token-driven fresh pairing.

Device-presence verification rode exclusively on this entry and is
removed with it. If demand appears, it can come back as its own feature.

Split out of #183 (see [the pairing.md
discussion](#183 (comment)))
so it can be discussed on its own. Overlaps textually with #183;
whichever merges second needs a rebase.

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
balloob and others added 17 commits September 1, 2026 17:50
Manufacturers will not accept remote server control over client records and pairing configuration. Replace the management commands with a fixed record model: clients store at least 5 pairing records and evict an implementation-chosen record (never one backing an open connection) when a pairing completes at capacity. An evicted server recovers through the Sentinel fallback.

Shared-PSK records, record_mode, storage accounting, and the used flag are removed with the namespace. Secret rotation, method enable/disable, the unpaired_access toggle, and pairing-window opening are local manufacturer-defined actions now.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Without remote configuration, a method shipped disabled with no pairing code provisioned can never be enabled. Static pairing code is for devices without an out-channel.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The manufacturer-defined action already defines the full behavior.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Both rules are stated at their point of use: supported_pair_methods omission in messaging.md, candidate-set exclusion in connection.md.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Every PSK is generated locally from a CSPRNG, so cross-category uniqueness holds by construction.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Uniqueness holds by construction (all PSKs are CSPRNG-drawn or the Sentinel constant), and category-scoped matching already makes a cross-category psk_id a lookup miss.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The pairing PSK cannot be set to a chosen value, so a removed record's PSK can never become the pairing PSK.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
supported_pair_methods already says what the client currently offers; how a client manages its own pairing configuration over time is not the spec's concern.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
How a client manages its own pairing secrets over time is not the spec's concern. The stability semantics and the per-device factory-provisioning requirement stay.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Remove restatements and stranded remnants: the static-keys-plus-PSK note left over from the deleted shared-PSK model, the stale Sentinel gloss, the record-removal inventory sentence, the duplicate category-mismatch and server-timeout statements, and the token-decoding dispatch sentence. Give the code-based starting-state bullets a lead-in. Fix the worked unauthorized example to a combination a server can actually send.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
With management removed, pairing methods cannot be disabled and the
pairing PSK is always among the handshake candidates, so a client that
offers no pairing method cannot exist: locked_down was unreachable.
Remove the Locked-Down Clients section and the goodbye reason.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Make record persistence and replacement an explicit MUST (covers a reinstalled server pairing fresh while the client still holds its old record)
- Protect records backing provisional connections from eviction and cap open paired connections below record capacity, so an evictable record always exists
- Restore the specific-version rejection rule in pairing-token decoding
- Remove the already-paired pairing entry: code-based pairing runs over Sentinel-keyed connections only, the long-term PSK no longer admits ['pairing'], and device-presence verification goes with it
- Stop implying the credential-mismatch rule points at an exhaustive record inventory

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Its removal moves to a separate PR so it can be discussed on its own.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A client that stops admitting unpaired access closes any connection relying on it with client/goodbye reason pairing_required.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The keep-the-entry revert predates Sendspin#192; replaying it over a main that
merged Sendspin#192 resurrected the removed text.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
balloob and others added 2 commits September 1, 2026 16:43
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@marcelveldt marcelveldt added this to the 1.0.0 milestone Sep 2, 2026
@marcelveldt
marcelveldt merged commit a5add82 into Sendspin:main Sep 2, 2026
1 check passed
@arturpragacz

Copy link
Copy Markdown
Contributor

Just for the future record: I personally am not in favour of this change.

maximmaxim345 added a commit that referenced this pull request Sep 2, 2026
Fixes #184. Fixes #186.

Two changes to pairing.md's Methods section:

- Clients may implement at most one pairing-code method: static or
dynamic, not both (Pairing PSK stays mandatory). No wire change -
`supported_pair_methods` already carries whatever the client offers;
this constrains what may appear there.
- The steering paragraph (SHOULD implement `dynamic_pairing_code` given
an out-channel, SHOULD offer `qr_code` given a display) is dropped.
Method choice is the client's decision; the method list already
describes the trade-offs (out-channel requirement, static-code MITM
caveat).

Note: overlaps textually with #183, which edits the same paragraph -
whichever lands second needs a trivial rebase.

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Maxim Raznatovski <nda.mr43@gmail.com>
balloob added a commit that referenced this pull request Sep 7, 2026
Reworks how code-based pairing attempts are gated, from the [#183
lockout
discussion](#183 (comment)).

Dynamic pairing code: the persisted failure counter and its escalation
to gesture-gating are gone. A failed attempt is one where the client
started emitting the code and the attempt ended without a successful
`server_kc` verification. After 20 consecutive failed attempts the
client MUST hold attempts back until a deliberate, manufacturer-defined
operator action; which action is the manufacturer's choice, with
guidance tracked in #205. The count is global across servers and
addresses and resets on success or on that action. How a client paces
attempts before the limit is its own choice, and it MAY be stricter,
including a gesture from the first attempt. Since any deliberate action
qualifies, no device is locked out, and since a client with no limit is
not conformant, manufacturers have a spec section to point a test lab at
(ETSI EN 303 645 provision 5.1-5, EN 18031-1 AUM-6).

Static pairing code: the window admits up to 5 attempts instead of one,
all on the connection that carries the first, so a typo no longer costs
a walk to the device. It closes on a completed pairing, the fifth failed
attempt, drop of that connection, operator cancellation, or lifetime
expiry, and the lifetime pauses while an attempt is in progress. The
pairing window is now a static-code-only concept and its section moves
under the Static Pairing Code Flow.

`client/pair-pending` now covers both cases, a gesture awaited or a
dynamic attempt held back, and gains an optional `message`: a plain-text
sentence for the operator of at most 200 characters, preferably in one
of the server's `languages`, shown as device text with no markup
interpreted. The server SHOULD surface the pending state and the message
to the operator and apply its own timeout.

An abandoned attempt does not count against a window and counts as a
failed dynamic attempt only if the code was already being emitted.

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Maxim Raznatovski <nda.mr43@gmail.com>
maximmaxim345 added a commit that referenced this pull request Sep 7, 2026
#183 made advertising the Pairing PSK method mandatory, but its
descriptor retained the `?` optional marker. Remove that marker to align
the schema with the existing requirement.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
maximmaxim345 added a commit to Sendspin/aiosendspin that referenced this pull request Oct 2, 2026
# What does this implement/fix?

<!-- Quick description and explanation of changes. -->

The client SDK no longer implements the management activity and record
mode, which the spec removed in Sendspin/spec#183. Server-side
management stays for now and is still deprecated.

Removed from the client side:
- `aiosendspin.client.management`, including `ManagementEffect`
- `ClientPairingConfig.record_mode_psk_id`
- `ClientPairingStore.set_record_mode_psk_id`, `can_store_record`,
`storage_accounting` and `can_remove_record`
- `StorageExhaustedError` and `StorageReport`

`ClientPairingRecord.server_id` is now required, and the client always
checks it after a long-term PSK match.
A client now closes with `unauthorized` when a server declares the
`management` activity, so servers should only enable management on
legacy devices.

Pairing store files from older versions still load: `record_mode_psk_id`
is ignored and shared records without a `server_id` are dropped.

**Related issue or spec PR (if applicable):**

- Sendspin/spec#183

## Types of changes

<!--
Tick exactly one box. CI (.github/workflows/pr-labels.yaml) applies the
matching label, and the release notes use it to sort this change.
-->

- [ ] 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`
- [x] 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 added a commit to Sendspin/aiosendspin that referenced this pull request Oct 12, 2026
# What does this implement/fix?

<!-- Quick description and explanation of changes. -->

The server offered the deprecated `management` activity to every paired
client, including clients on the current protocol, which don't know it
since the spec removed it.

Management is now only offered to paired clients on the pre-spec-#177
wire (`uses_pre_spec_177_wire`), which covers every client that
implemented it. For other clients, `enable_management` now raises a
`RuntimeError`.

**Related issue or spec PR (if applicable):**

- Sendspin/spec#183
- #397

## Types of changes

<!--
Tick exactly one box. CI (.github/workflows/pr-labels.yaml) applies the
matching label, and the release notes use it to sort this change.
-->

- [x] 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`
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.

Remove the management namespace from the spec

6 participants