Skip to content

feat(OCISDEV-945): DeleteStorageSpace: return typed result carrying SpaceName and FinalMembers - #622

Merged
f-firas merged 2 commits into
mainfrom
OCISDEV-945
Jun 12, 2026
Merged

f-firas merged 2 commits into
mainfrom
OCISDEV-945

Conversation

@f-firas

@f-firas f-firas commented Jun 8, 2026

Copy link
Copy Markdown

No description provided.

@kw-security

kw-security commented Jun 8, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@f-firas

f-firas commented Jun 8, 2026

Copy link
Copy Markdown
Author

Summary

The DeleteStorageSpace flow previously relied on a couple of awkward patterns to ferry data from the storage driver up to the events interceptor — before every delete, storageprovider.DeleteStorageSpace issued a ListStorageSpaces call to discover the space's name and grants, then stuffed those into DeleteStorageSpaceResponse.Opaque["spacename"] and Opaque["grants"] for the events interceptor to read back. It worked, but it cost an extra round-trip on every delete and was stringly-typed all the way through. This PR replaces them with a typed return value.

storage.FS.DeleteStorageSpace now returns a *storage.DeleteStorageSpaceResult alongside the error. The struct carries the two pieces of information the events interceptor needs:

type DeleteStorageSpaceResult struct {
    SpaceName    string
    FinalMembers map[string]provider.ResourcePermissions
}

Drivers that have rich data (decomposedfs, and posix via embedding) populate the result before the destructive purge runs, drivers that don't return nil and the conversion layer falls back gracefully when building the event. Either way, the published SpaceDeleted payload stays structurally identical to before.

Acceptance criteria

  • ListStorageSpaces pre-fetch in storageprovider.DeleteStorageSpace() removed
  • DeleteStorageSpaceResponse.Opaque["spacename"] and Opaque["grants"] smuggling removed
  • SpaceDeleted event covered by a test
  • Test asserts SpaceName, FinalMembers, ID, and Executant
  • SpaceDisabled is unchanged

Test plan

  • go build ./... and go vet ./... pass
  • Existing decomposedfs DeleteStorageSpace tests still pass; updated for the new return signature
  • New eventsmiddleware/conversion_test.go TestSpaceDeleted covers the typed/empty/nil result scenarios
  • Verified end-to-end against ocis: purging a project space produces a SpaceDeleted event whose payload (SpaceName, FinalMembers keys, per-member permission flags, ID, Executant) matches the pre-PR baseline
    byte-for-byte

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

Let's simplify the readFinalMembers description

@f-firas
f-firas requested a review from 2403905 June 9, 2026 13:31
2403905
2403905 previously approved these changes Jun 12, 2026
@f-firas
f-firas merged commit 63930c8 into main Jun 12, 2026
14 checks passed
@f-firas
f-firas deleted the OCISDEV-945 branch June 12, 2026 15:33
dragonchaser pushed a commit to opencloud-eu/reva that referenced this pull request Nov 11, 2026
DeleteStorageSpace now returns a DeleteStorageSpaceResult. When purging,
decomposedfs captures the space name and the active members before it
deletes anything, and the events middleware builds SpaceDeleted from
that instead of the response opaque. Disabling returns an empty result.

Differences to upstream:
- the storageprovider still lists the space first, so non-members keep
  getting a not found, and it still fills the response opaque. Drivers
  without a result fall back to that opaque for SpaceDeleted.
- decomposedfs does not emit SpaceMembershipExpired while collecting the
  final members. In our tree the share manager emits that event, and the
  purge removes expired grants together with the space anyway. Expired
  grants are just left out.
- a failure to list the grants now aborts the purge instead of only
  being logged, we need them for the event.

backport of owncloud#622

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
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.

4 participants