Repository navigation
feat: 4076: a revision cleanup strategy per type of space - #1042
Merged
pbleser-oc merged 5 commits intoNov 23, 2026
Merged
Conversation
The space types "personal" and "project" are spelled out in many places, as literals or as private constants of each package. The revision cleanup is about to choose a strategy by the type of a space, and opencloud needs the same names for its configuration, so storagespace exports them now. The existing private copies are left alone here, switching them over is a change of its own. Assisted-by: Claude Code:claude-opus-5-5
The revision cleanup has a single strategy for all spaces, while personal and project spaces often need different ones: few versions of personal files, more of the files a team works on together. The new options revisions_cleanup_strategy_personal and revisions_cleanup_strategy_project set the strategy of one type of space. Empty leaves that type to revisions_cleanup_strategy, "disabled" keeps all revisions of its spaces, and any other type of space gets revisions_cleanup_strategy. A Policy holds these strategies, and CleanerFor picks the one of a file: a forced strategy, e.g. given to a command for a single run, otherwise the strategy of the type of the file's space, otherwise the default. It reads the type of the space only when there are strategies per type. As it decides by the file, which knows its space root, more layers can be added later: the settings of a space itself, from an attribute of its root, and rules by the type or the size of the file. Nothing uses the Policy yet. Assisted-by: Claude Code:claude-opus-5-5
… space The revision cleanup Service, and an on-demand Run, now hold a Policy instead of a single Cleaner, and choose the strategy of each file from its space when they clean it up. So revisions_cleanup_strategy_personal and revisions_cleanup_strategy_project take effect, for uploads, restores and changes on disk as well as for the cleanup on demand. The Service is enabled as soon as any of the strategies is. Files in a space whose type has the strategy "disabled" are still queued, as the strategy is only chosen when a worker reads the file anyway, and are then skipped. A file whose strategy can't be chosen, as the type of its space can't be read, is not cleaned up: its Result has the error. The Result says which strategy applied, and which setting it came from, so that the output of a command can tell. The instances of a storage in a process must agree on all strategies now, not only the default one. The strategy given to an on-demand cleanup is forced on all spaces of the run, as it was before, when there was only one. Assisted-by: Claude Code:claude-opus-5-5
… a space type A Request can now give the strategy of the personal and of the project spaces for its run (StrategyPersonal, StrategyProject), in place of the configured ones, e.g. to try a stricter strategy for project spaces in a dry run. The other types keep their configured strategy. Strategy still forces one strategy on all spaces, and would override the ones per type, so a request that gives both is rejected. Assisted-by: Claude Code:claude-opus-5-5
With a strategy per type of space, an admin wants to see what each of them deletes. The counters of deleted revisions, deleted bytes and failed deletions now have a space_type label: personal, project, or other for any other type of space, and when the type can't be read, so that each counter has at most three series, whatever types of spaces exist. The counters are not in a release yet, so no existing series change. Assisted-by: Claude Code:claude-opus-5-5
aduffeck
approved these changes
Nov 23, 2026
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 59 |
| Duplication | 1 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
This was referenced Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of opencloud-eu/opencloud#4076: a revision cleanup strategy per type of space.
The revision cleanup (#895) has a single strategy for all spaces. With this PR, personal and project spaces can have strategies of their own:
revisions_cleanup_strategyrevisions_cleanup_strategy_personaldisabled: keep all their revisionsrevisions_cleanup_strategy_projectSpaces of any other type get the default.
How
revisioncleanup.Policyholds the strategies, andCleanerForpicks the one of a file, by layers, the most specific first: a forced strategy (an on-demand run'sRequest.Strategy), the strategy of the type of the file's space, the default. It decides by the file, so that the per-space strategies of Per-space revision cleanup strategies opencloud#3733 (an attribute on the space root), and possibly rules by file type or size, can be added as more layers later.Runhold aPolicyinstead of a singleCleaner. The space type is only read when there are strategies per type, and costs no extra read:ReadNodehas the space root's attributes cached already.disabledare still queued, and skipped by the worker, which reads the node anyway.Resultsays which strategy applied and where it came from (forced,space type,default), for the output of the command.Requestcan replace the strategy of a type for its run (StrategyPersonal,StrategyProject). Combined withStrategy, which forces one strategy on all spaces, it is rejected.space_typelabel:personal,project, orother. They are not in a release yet, so no existing series change.storagespace.TypePersonalandTypeProjectare exported, for this and for opencloud's configuration. The private copies of these names in other packages are left for a separate change.Commits
storagespace: export the space typesPolicyand the two optionsRunuse thePolicyspace_typelabel of the countersEach commit builds and passes the tests of
pkg/storagespace,pkg/storage/pkg/decomposedfs/...andpkg/storage/fs/posix/....The opencloud side (the environment variables
STORAGE_USERS_REVISIONS_CLEANUP_STRATEGY_PERSONAL/_PROJECT, the command's--strategy-personal/--strategy-project, acceptance tests) follows once this is merged and opencloud-eu/opencloud#3778 is in.AI assistance: Claude Code (claude-opus-5-5) wrote the code, the tests and this description, after the design was agreed with me.