Skip to content

refactor: rename client_stream/* to client-stream/*, document prefix rule - #163

Merged
maximmaxim345 merged 4 commits into
mainfrom
refactor/stream-client-messages
Aug 24, 2026
Merged

maximmaxim345 merged 4 commits into
mainfrom
refactor/stream-client-messages

Conversation

@chrisuthe

@chrisuthe chrisuthe commented Aug 20, 2026 •

Copy link
Copy Markdown
Member

Fixes #150.

Revised after review: names are now client-stream/*, per the final discussion on #150. The issue body still shows the superseded stream/client-* form.

Change 1: client_stream/* → client-stream/*

client_stream/start → client-stream/start, client_stream/end → client-stream/end. The underscore goes; the messages keep their own prefix rather than joining stream/, because server→client and client→server binary channels are independent and have separate lifetimes. All 18 occurrences are in roles/source/v1.md; the two section headings move with their anchors and in-file links are updated (build-verified). No other file links to these sections.

⚠️ Breaking: these two message types change on the wire for clients implementing the source role. No other message type changes.

Change 2: the prefix rule

Added to the Communication section of messaging.md, directly after the type/payload paragraph:

Message type prefixes. The prefix before the / in a message type identifies a group of messages. client/ and server/ name the sender. stream/ groups the messages that control a binary channel from the server to the client, and client-stream/ those that control a binary channel from the client to the server; the two kinds of channel are independent and have separate lifetimes. group/, management/, pair/, and noise/ name a subject. A message outside the client/ and server/ groups can flow in either direction; each message's definition gives its direction.

The closing sentence is what places stream/request-format (client-sent, but controlling the server→client channel) correctly. Body text rather than a **Note:**, in keeping with #147.

Coordination

#161 (open) touches roles/source/v1.md on one of the same lines (the promoted format-announcement note). Whichever merges second needs a trivial rebase + README rebuild — happy to do that on this side.

Verification

  • Zero client_stream or stream/client- occurrences remain in any source file.
  • python3 tools/build-readme.py --check passes — the renamed headings' anchors and all links to them resolve.

…rule

Renames the only underscore message prefix: client_stream/start
becomes stream/client-start and client_stream/end becomes
stream/client-end. The stream/ prefix is a category, not a sender -
these messages control a binary channel exactly like stream/start,
stream/end, and stream/clear, so they keep the category prefix and
carry the direction in the name.

Also documents the message-type prefix rule in the Communication
section of messaging.md: client/ and server/ name the sender, stream/
groups the binary-channel control messages regardless of sender, the
other prefixes name a subject, and messages outside client/ and
server/ define their own direction.

BREAKING CHANGE: the two message types change on the wire for source
clients. No other message type changes.

Fixes #150

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

Can you adjust this PR to instead call it client-stream/start and client-stream/end? I think this got mixed up since the description of #163 still suggested stream/client-start.

See #150 (comment)

@chrisuthe chrisuthe changed the title refactor: rename client_stream/* to stream/client-*, document prefix rule refactor: rename client_stream/* to client-stream/*, document prefix rule Aug 21, 2026
Review on #163 (maximmaxim345) settled the names from the #150
discussion: client-stream/start and client-stream/end - the underscore
goes, but the messages keep their own prefix rather than joining
stream/. Server-to-client and client-to-server binary channels are
independent and have separate lifetimes, so folding both under one
prefix would blur that.

The prefix rule in messaging.md is rewritten accordingly: stream/
groups the messages controlling a server-to-client channel,
client-stream/ those controlling a client-to-server channel.
Resolves the roles/source/v1.md conflict with #161: keep the promoted
(non-Note) format-announcement sentence from main and apply the
client-stream/start rename to it. README.md regenerated.

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

Thanks @chrisuthe !

@maximmaxim345
maximmaxim345 merged commit 092ffb1 into main Aug 24, 2026
1 check passed
@maximmaxim345
maximmaxim345 deleted the refactor/stream-client-messages branch August 24, 2026 08:00
chrisuthe added a commit to Sendspin/aiosendspin that referenced this pull request Sep 16, 2026
# What does this implement/fix?

Implements spec [#163](Sendspin/spec#163).
`client_stream/start` and`client_stream/end` become
`client-stream/start` and `client-stream/end` on the wire.

The discriminator accepts both spellings for the same message, driven by
one map of superseded names in `models/types.py`, so a later rename
joins it rather than growing a second mechanism. A source still on the
old spelling is served and flagged, exactly as the legacy `client/state`
field and the pre-rename artwork dimension keys already are — which
means a server running `allow_noncompliant_clients=False` will drop it,
that being what opting into strict mode has always meant. The name a
message arrived under survives on the parsed message, so nothing has to
be recorded alongside it.

NOTE:

- **The Python identifiers are deliberately unchanged**, unlike the
sibling rename in #351. There, a word changed (`static` → `output`).
Here only the separator moved, and a hyphen is not a Python identifier
character — `on_client_stream_start` already spells
`client-stream/start` as closely as a method name can.
`Role.on_client_stream_start` is an ABC hook with a no-op default, so
renaming it would silently stop delivering the callback to any embedder
who did not follow, and buy nothing.

- The client emits the new spelling, so it requires a server that
understands it. That is the same trade as the other renames in this
series.

**Related issue (if applicable):**

- n/a

## Types of changes

- [x] Refactor (no behaviour change) — `refactor`

## Checklist

- [x] The code change is tested and works locally.
- [x] `pre-commit run --all-files` passes.
- [x] `pytest` passes, and tests have been added/updated under `tests/`
where applicable.
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.

Rename client_stream/* to client/stream-* and document the message-type naming convention

2 participants