Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(halo): member roles #6656

Merged
merged 16 commits into from
May 14, 2024
Merged

feat(halo): member roles #6656

merged 16 commits into from
May 14, 2024

Conversation

yarolegovich
Copy link
Member

@yarolegovich yarolegovich commented May 13, 2024

Details

Changes:

  • Credential may contain parentCredentialIds that are signed.
  • SpaceMember.Role.MEMBER -> SpaceMember.Role.EDITOR.
  • dxos.halo.credentials.Revocation credential removed, SpaceMember.Role.REMOVED added instead.
  • An explicit SpaceMember.Role.OWNER added.
  • If parentCredentialIds array is empty it's deleted from the object for compatibility with old Credentials.
  • When generating a SpaceMember credential we set parentCredentialIds to ids of all the "leaf" SpaceMember credentials we knew about at the moment. Leaf credentials are those to which no parentCredentialIds are pointing.
  • MemberStateMachine inserts SpaceMember credentials into a CredentialGraph.
  • If a Credential was appended to the graph (the new credential has all the previously-leaf credentials in its parent references) we simply apply an update on top of the previous state.
  • Otherwise, we traverse the graph root-to-leaf handling concurrent branches using graph-structure- or domain-logic-specific rules to compute the new state.

Minor changes:

  • If log context is a function we evaluate it only if we're going to actually log the statement. Avoids doing unnecessary work for debug logs which do object transformations.
  • range supports a generator second argument.

TODO (in another PR):

  • Client API for role management.
  • Disconnect from peers who were removed.
  • Leave the swarm is you were removed.
  • Check a member has sufficient rights for creating an invitation.

re #6386

@yarolegovich yarolegovich changed the title Yarolegovich/roles feat(halo): member roles May 14, 2024
Copy link

cloudflare-pages bot commented May 14, 2024

Deploying docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 734e1eb
Status:🚫  Build failed.

View logs

@yarolegovich yarolegovich marked this pull request as ready for review May 14, 2024 10:20
Copy link

codecov bot commented May 14, 2024

Codecov Report

Attention: Patch coverage is 86.50519% with 39 lines in your changes are missing coverage. Please review.

Project coverage is 67.78%. Comparing base (247377c) to head (81fb707).

Files Patch % Lines
...ore/halo/credentials/src/graph/credential-graph.ts 84.95% 10 Missing and 21 partials ⚠️
...dentials/src/state-machine/member-state-machine.ts 88.67% 2 Missing and 4 partials ⚠️
packages/common/util/src/range.ts 80.00% 0 Missing and 1 partial ⚠️
...ent-services/src/packlets/spaces/spaces-service.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6656      +/-   ##
==========================================
- Coverage   68.28%   67.78%   -0.51%     
==========================================
  Files         793      740      -53     
  Lines       23200    22740     -460     
  Branches     3789     3708      -81     
==========================================
- Hits        15843    15415     -428     
+ Misses       5450     5431      -19     
+ Partials     1907     1894      -13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yarolegovich yarolegovich merged commit 6eeff4a into main May 14, 2024
6 checks passed
@yarolegovich yarolegovich deleted the yarolegovich/roles branch May 14, 2024 13:52
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.

None yet

2 participants