You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unify the deletion of single revisions in decomposedfs #3734
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
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?
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.
Activity
pbleser-oc commentedon Nov 25, 2026
@butonic, two questions on this before I start, as you wrote the
DeleteRevisionevent (opencloud-eu/reva#821):Decomposedfs.deleteRevisionFileandrevisioncleanup.PurgeRevisionUncheckedboth delete one revision and its blob. OnlyPurgeRevisionUncheckedchecks the key withnode.ValidateRevisionKeyfirst.deleteRevisionFileonly checksnode.IsValidID, which lets<nodeid>.REV.through, and the empty version after it makesNode.DeleteRevisionUncheckedrevert the node or purge it. Nothing callsDecomposedfs.DeleteRevisiontoday, and the event always builds a non-empty version, so nothing can hit it yet. I'd letdeleteRevisionFilecallPurgeRevisionUnchecked, so that every path checks the key, with a test for<nodeid>.REV.. A malformed key would then give aBadRequestinstead of aNotFound. Is that fine with you?Node.DeleteRevisionUncheckeditself. 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/decomposedfsstays 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.