Skip to content

feat!: endpoint groups and attributes - #86

Open
b5 wants to merge 9 commits into
mainfrom
b5/endpoint-groups-and-attributes
Open

feat!: endpoint groups and attributes#86
b5 wants to merge 9 commits into
mainfrom
b5/endpoint-groups-and-attributes

Conversation

@b5

@b5 b5 commented May 17, 2026

Copy link
Copy Markdown
Member

Description

Add cloud-side metadata for client endpoints beyond the existing name: a single group and an arbitrary key-value attributes map. Both are settable at build time via ClientBuilder::group / attributes and updatable post-construction via Client::set_group / set_attributes, mirroring the name API. Attributes use full-replace semantics on each call. Adds matching SetGroup / SetAttributes RPC messages to the protocol, plus an endpoint_meta example that exercises both paths.

Group names follow the same 2–128 byte UTF-8 rules as endpoint names. Attribute keys share those rules; values may be empty and are capped at 128 bytes; the map is capped at 128 entries.

Breaking Changes

  • Make protocol and error enums non_exhaustive

Notes & open questions

This unfortunately requires a v2 as we forgot to mark the protocol enums as non_exhaustive, need to ensure though the protocol stays compatible

@github-actions

github-actions Bot commented May 17, 2026

Copy link
Copy Markdown

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh-services/pr/86/docs/iroh_services/

Last updated: 2026-08-10T13:07:32Z

Add cloud-side metadata for client endpoints beyond the existing name:
a single `group` and an arbitrary key-value `attributes` map. Both are
settable at build time via `ClientBuilder::group` / `attributes` and
updatable post-construction via `Client::set_group` / `set_attributes`,
mirroring the name API. Attributes use full-replace semantics on each
call. Adds matching `SetGroup` / `SetAttributes` RPC messages to the
protocol, plus an `endpoint_meta` example that exercises both paths.

Group names follow the same 2–128 byte UTF-8 rules as endpoint names.
Attribute keys share those rules; values may be empty and are capped at
128 bytes; the map is capped at 128 entries.
@b5
b5 force-pushed the b5/endpoint-groups-and-attributes branch from aa6d719 to 097602e Compare June 5, 2026 13:31
@dignifiedquire dignifiedquire self-assigned this Jun 29, 2026
@dignifiedquire
dignifiedquire force-pushed the b5/endpoint-groups-and-attributes branch 5 times, most recently from c6021b0 to f074627 Compare June 29, 2026 13:08
@dignifiedquire
dignifiedquire marked this pull request as ready for review June 29, 2026 15:07
@dignifiedquire dignifiedquire changed the title feat: endpoint groups and attributes feat!: endpoint groups and attributes Jun 29, 2026
Add set_attribute(key, value) which merges a single entry into the
endpoint's attributes (rather than replacing the whole map) and sends the
full SetAttributes. Attributes remain a BTreeMap.
@dignifiedquire
dignifiedquire force-pushed the b5/endpoint-groups-and-attributes branch from f074627 to 8581e5a Compare June 29, 2026 15:13
@b5
b5 requested a review from divagant-martian June 30, 2026 13:36

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

One relevant bug and many minor comments.

How does versioning work here? because this updated the underlying protocol without a new ALPN. Are we relying on how unlikely it is that a client with updated protocol dials an oudated "server" with one of the new calls and the connection is killed because of that? I can try to understand this but it would be good to have an explicit policy here because as it is, this is making alpn negotiation rather meaningless

Comment thread src/client.rs Outdated
Comment thread src/client.rs Outdated
Comment thread src/client.rs Outdated
Comment thread src/client.rs Outdated
Comment thread src/client.rs
Comment thread src/client.rs Outdated
Comment thread src/client.rs Outdated
Comment thread src/client.rs Outdated
Comment thread src/client.rs
Comment thread src/client.rs Outdated
- set_attribute validates the *merged* set in the actor: a valid single entry
  can still push a full set over the max-entry limit, so the single-entry check
  was insufficient. Surfaces InvalidAttributes(TooManyEntries) locally.
- Read initial name/group/attributes from the actor's own state instead of
  passing them to run() again; add ReadGroup + Client::group() to mirror name.
- Docs: single-sentence style, state the 2-128 byte rules directly, drop the
  misleading insertion-order / group-uniqueness / same-as-names claims, and
  clarify that builder validation errors return immediately while startup-send
  failures are logged (use set_* for explicit handling).
- Log the group (not just its length) in the set-group debug line.
…ot characters

Reword the versioning doc and cleanups without em dashes, en dashes, ellipses,
or arrows. Fix the ValidateNameError messages to say bytes, matching the actual
byte-length (name.len()) check and the doc wording.
@dignifiedquire

Copy link
Copy Markdown
Contributor

How does versioning work here? because this updated the underlying protocol without a new ALPN. Are we relying on how unlikely it is that a client with updated protocol dials an oudated "server" with one of the new calls and the connection is killed because of that? I can try to understand this but it would be good to have an explicit policy here because as it is, this is making alpn negotiation rather meaningless

Added a policy statement matching what we have done in the past. TLDR we only extend the protocol, so we need to make sure old clients can talk to new servers, but as we first deploy the server side updates, we are safe on that side

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

LGTM, it's a bit sad that set_attribute can't have the same "explicit error handling" guarantee the others have but I don't really see a workaround. Otherwise the bug is fixed and docs and code style were improved

@ramfox ramfox modified the milestones: Sprint 0, Sprint N Jul 7, 2026
@ramfox ramfox removed this from the Sprint N milestone Jul 22, 2026
@okdistribute

okdistribute commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

@dignifiedquire will this need to be v2 of iroh-services? Also does it need to be published before the server?

@Frando

Frando commented Aug 10, 2026

Copy link
Copy Markdown
Member

will this need to be v2 of iroh-services? Also does it need to be published before the server?

Yes, this is semver-breaking, unfortunately. Reason is that the protocol module is public, and this adds variants to protocol::IrohServicesProtocol, which so far was not marked non_exhaustive. It is now, so we can add further variants without needing to do major releases again. But this PR here needs to be released as 2.0.0 then.

Also does it need to be published before the server?

No, the other way around: We first need to deploy svc with support for the new methods, by using a git dependency onto this branch of iroh-services in svc. And only once svc is deployed to prod with this, we can release iroh-services 2.0.0 with this PR merged. Otherwise, people doing cargo add iroh-services will get errors because svc does not support the new methods yet.

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.

6 participants