Skip to content

drive-registry: surface Layer 0 errors from share, unshare and delete - #404

Open
ilchu wants to merge 2 commits into
ic/pallet-rustdoc-gatefrom
ic/drive-share-auth
Open

drive-registry: surface Layer 0 errors from share, unshare and delete#404
ilchu wants to merge 2 commits into
ic/pallet-rustdoc-gatefrom
ic/drive-share-auth

Conversation

@ilchu

@ilchu ilchu commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

share_drive carried an empty if drive.owner != who {} block whose comments described an owner bypass that was never written, and all three drive-registry calls that reach into Layer 0 flattened every failure into a generic error of their own. A caller could not tell "not an admin" from "bucket is full" or "the last admin cannot leave". The dead-variant check in #403 flagged the never-raised NotAuthorizedToShare this was meant to become.

The bypass is dropped rather than built. Bucket admins are the authority, and the drive owner is one unless they stepped down, so a Layer 1 override would only weaken Layer 0's rules. Share, unshare and delete now propagate the Layer 0 error unchanged, which makes MembershipUpdateFailed and BucketCleanupFailed dead, so they go too and the bindings are regenerated.

The permission test that only ever hit DriveNotFound is replaced by one that creates a drive and checks that a stranger's share and unshare both fail with NotBucketAdmin. The drive lifecycle e2e step expects the same.

@bkontur

bkontur commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

/aireview

github-actions[bot]

This comment was marked as outdated.

@bkontur

bkontur commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

/aireview

@github-actions github-actions Bot 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.

🤖 AI-generated review — advisory only, not a substitute for human review.

Summary

  • Propagates native Layer 0 errors directly from share_drive, unshare_drive, and delete_drive in pallet-drive-registry.
  • Removes redundant MembershipUpdateFailed and BucketCleanupFailed error variants along with an unused owner check.
  • Updates unit tests, subxt metadata bindings, and end-to-end test expectations.

share_drive carried an empty `if drive.owner != who {}` block that was
meant to become an owner bypass and never did, and all three calls
that reach into Layer 0 flattened every failure into a generic
drive-registry error. A caller could not tell "not an admin" from
"bucket full" or "last admin cannot leave".

The bypass is dropped rather than built: bucket admins are the
authority, and the drive owner is one unless they stepped down, so a
Layer 1 override would only weaken Layer 0's rules. The three calls
now propagate the Layer 0 error unchanged, which makes
MembershipUpdateFailed and BucketCleanupFailed dead, so they go too.

The permission test that only ever hit DriveNotFound is replaced by
one that creates a drive and checks that a stranger's share and
unshare both fail with NotBucketAdmin. The drive lifecycle e2e step
expects the same.
@ilchu
ilchu force-pushed the ic/drive-share-auth branch from 172abd6 to 7c61dca Compare September 10, 2026 12:47
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.

2 participants