Skip to content

Add pro_list_invites / pro_list_requests / pro_revoke_invite / pro_current_person Tauri commands (#239) - #1472

Merged
mstomar125 merged 1 commit into
NodeSpaceAI:mainfrom
mstomar125:feature/issue-239-membership-backend-core
Jul 2, 2026
Merged

mstomar125 merged 1 commit into
NodeSpaceAI:mainfrom
mstomar125:feature/issue-239-membership-backend-core

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

Core (desktop-app) half of NodeSpaceAI/nodespace-sync#239 (S2 of the collection-membership-UI epic #237). Pairs with the daemon-half PR on nodespace-sync (adds the four gRPC methods this consumes).

What

Refreshes the vendored Pro proto from the daemon source-of-truth and adds four Tauri commands, each a thin pass-through over the daemon gRPC client — mirroring the eight existing membership commands (resolve the ProClient or fail in community mode, then one RPC):

Command Returns Purpose
pro_list_invites(collection_id) Vec<InviteDto{id,code,email,permission,expires_at}> admin: list a collection's pending invites
pro_list_requests(collection_id) Vec<RequestDto{id,requested_by,created_at}> admin: list pending join requests
pro_revoke_invite(invite_id) () admin: cancel a pending invite or join request
pro_current_person() PersonDto{person_id,email} the caller's own bound PersonNode id + email

pro_current_person gives the UI the caller's identity so it can tell which roster row is "me" and gate admin controls on the caller's own per-collection role. An empty person_id (un-bound device) is treated as "role unknown".

The proto is refreshed wholesale from nodespace-sync/nodespaced-pro/proto/nodespace_pro.proto (the documented scripts/refresh-pro-proto.sh source-of-truth), so the vendored copy stays byte-identical to the daemon's wire contract.

Community build

All four resolve the ProClient or return an error in community mode (no ProClient in managed state) — identical to the existing membership commands. The community nodespaced binary has no knowledge of this proto package, so the community build is behaviorally unchanged.

Checks

  • cargo check — clean (proto regenerates via build.rs).
  • cargo clippy — clean.
  • cargo fmt -- --check — clean.

Rust-only change (Tauri command bindings + vendored proto); no frontend surface yet — the UI lands in S1/S3/S4/S5.

Part of NodeSpaceAI/nodespace-sync#239.

…rrent_person Tauri commands (#239)

Refresh the vendored Pro proto from the daemon source-of-truth (adds the
ListInvites / ListRequests / RevokeInvite / GetIdentity RPCs + Invite /
JoinRequest / GetIdentity messages) and add the matching Tauri commands:

- pro_list_invites → Vec<InviteDto{id,code,email,permission,expires_at}>
- pro_list_requests → Vec<RequestDto{id,requested_by,created_at}>
- pro_revoke_invite(invite_id) — cancel a pending invite or join request
- pro_current_person → PersonDto{person_id,email} — the caller's own bound
  PersonNode id (+ email) so the UI can identify its own roster row and gate
  admin controls on the caller's per-collection role. Empty person_id on an
  un-bound device is treated as "role unknown".

Each is a thin pass-through over the daemon gRPC client, mirroring the eight
existing membership commands, and registered in the invoke handler. They resolve
the ProClient or fail in community mode, so the community build is unaffected.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@mstomar125

Copy link
Copy Markdown
Contributor Author

APPROVE

S2 core-half — correct and wire-safe. Verified at head fd3592d6.

  • 🟢 Wire compat: independently confirmed byte-identical to sync#244. I fetched both protos at their heads (fd3592d6 / sync#244 f6d4b122) and diffed them — 236 lines each, zero differences. The new S2 surface matches exactly: ListInvites/ListRequests/RevokeInvite→MembershipAck/GetIdentity, and messages Invite(id=1,code=2,email=3,permission=4,expires_at=5), JoinRequest(id=1,requested_by=2,created_at=3), RevokeInviteRequest.invite_id=1, GetIdentityResponse(person_node_id=1,email=2). No field-number drift.
  • 🟢 Community no-op: all 4 commands resolve through the shared membership_client guard (pro_sync.rs:239) which returns Err when there's no ProClient, propagated via ? — no panic/unwrap/side-effect, identical to the existing 6 membership commands. Free-user build stays behaviorally unchanged (additive registration only).
  • 🟢 DTOs (pro_sync.rs:202-235) are snake_case + Serialize; nice that PersonDto.person_id (renamed from proto person_node_id) aligns with MemberDto.person_id so the frontend can match "me" in the roster by equality. Heads-up for Add membership service + store foundations for the Collaboration UI (#238) #1473: read person_id, not person_node_id.
  • 🟢 Registration: all 4 in lib.rs invoke_handler (:452-455).

🟢 Non-blocking (pre-existing): the module doc (pro_sync.rs:3-6) says commands "return early with Ok" in community mode, but the membership family returns Err — drift from M5 #147, not this PR.

🔶 Cross-layer: this consumes sync#244's daemon RPCs (still open) — keep the daemon landing ahead of / with this so the commands resolve at runtime. LGTM.

@mstomar125
mstomar125 merged commit fc64601 into NodeSpaceAI:main Jul 2, 2026
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.

1 participant