Skip to content

Unify the deletion of single revisions in decomposedfs #3734

Open

Description

@pbleser-oc

Follow-up of #1419. To be done once the reva changes of #1419 are merged.

reva now has two implementations of "delete one revision" in decomposedfs:

  • Decomposedfs.deleteRevisionFile (pkg/storage/pkg/decomposedfs/revisions.go), used by DeleteRevision and the DeleteRevision event
  • revisioncleanup.PurgeRevisionUnchecked (pkg/storage/pkg/decomposedfs/revisioncleanup/cleanup.go), used by the revision cleanup of 🧹 Clean-Up File Versions #1419

Both take the version from the revision key, call Node.DeleteRevisionUnchecked and delete the blob, but only PurgeRevisionUnchecked validates the key first (node.ValidateRevisionKey).
deleteRevisionFile only splits the key on .REV.: a key like <nodeid>.REV. turns into an empty version, and Node.DeleteRevisionUnchecked(ctx, "") reverts the node to its latest revision, or purges the node if it has none, instead of deleting a revision.

That path is not reachable today (Decomposedfs.DeleteRevision is not wired to an API, and the event always builds a non-empty version), but it would become a bug as soon as it is.

Proposal:

  • make deleteRevisionFile delegate to revisioncleanup.PurgeRevisionUnchecked, so that every path validates the key; malformed keys then get a BadRequest instead of a NotFound
  • adapt the doc of PurgeRevisionUnchecked, which says deleteRevisionFile was deliberately left as it is
  • add a test: deleting the revision <nodeid>.REV. fails and leaves the node and its revisions untouched
  • to discuss with @butonic as the author of the DeleteRevision event in opencloud-eu/reva@ae1b358 (and feat: add delete revision functionality reva#821): whether Node.DeleteRevisionUnchecked should also reject versions with path separators ("" has to stay valid there, as the event uses it to revert stuck nodes), and whether the legacy copy in pkg/storage/utils/decomposedfs (ocis/s3ng drivers) should get the same change

Activity

  1. added theissue type on Oct 15, 2026
  2. moved this from Qualification to No status in OpenCloud Team Boardon Oct 28, 2026
  3. pbleser-oc commented on Nov 25, 2026

    @pbleser-oc
    MemberAuthor

    @butonic, two questions on this before I start, as you wrote the DeleteRevision event (opencloud-eu/reva#821):

    1. Using one for the other. Decomposedfs.deleteRevisionFile and revisioncleanup.PurgeRevisionUnchecked both delete one revision and its blob. Only PurgeRevisionUnchecked checks the key with node.ValidateRevisionKey first. deleteRevisionFile only checks node.IsValidID, which lets <nodeid>.REV. through, and the empty version after it makes Node.DeleteRevisionUnchecked revert the node or purge it. Nothing calls Decomposedfs.DeleteRevision today, and the event always builds a non-empty version, so nothing can hit it yet. I'd let deleteRevisionFile call PurgeRevisionUnchecked, so that every path checks the key, with a test for <nodeid>.REV.. A malformed key would then give a BadRequest instead of a NotFound. Is that fine with you?
    2. Node.DeleteRevisionUnchecked itself. Should it also reject versions with path separators, so that a caller can't get around the check? "" would stay valid there, as the event uses it to revert stuck nodes. Or would you rather keep that method as it is and leave the checks to its callers?

    The legacy copy in pkg/storage/utils/decomposedfs stays as it is, as that package is frozen.

    AI assistance: Claude Code (claude-opus-5-5) checked the code on reva main and drafted this comment; I reviewed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions