Sorts the two latitudes in the KQL layer so MinLat <= MaxLat. Only bleve
strictly requires it (it errors on an inverted box; OpenSearch tolerates it),
but doing it centrally keeps behaviour consistent across backends and the AST
easy to reason about. Longitude order is preserved so an antimeridian-crossing
box (minLon > maxLon) still works, which both backends handle identically.
Replaces the ad-hoc key+"_geopoint" concatenation with a proper lookup
(query.ResolveGeoField) derived from the TypeGeopoint field overrides, so it
works for any geopoint field, not just location. Geo predicates on non-geopoint
fields now error instead of querying a nonexistent field.
Adds geo_distance/geo_bounding_box query builders plus a geo_shape polygon
query (relation intersects, the modern replacement for the deprecated
geo_polygon, still valid against geo_point). Wires the geo AST nodes through
the KQL transpiler onto the <field>_geopoint sibling.
Extends the KQL grammar with geo function values on any field, e.g.
location:geo.distance(lat, lon, 5km). Parses into GeoDistance/GeoBoundingBox/
GeoPolygon AST nodes; radius units (km/m/mi) are normalised to meters.
A text restriction on a numeric field reached the engines as is. bleve found nothing for size:>100 or size:50..500, OpenSearch failed the search with a number format exception. size=50 only matched on OpenSearch.
Both engines now read the value of such a restriction as a number and match it as a whole, with : and with =. Anything that is no number matches nothing, and so does text on a date field. size:>100 is not KQL, the range form is size>100; old iOS clients still send the colon form.
The field type comes from one table of all fields, built from the walk the mapping validation uses. It replaces the separate walk for numeric fields, which left out the parts of a location: location.altitude>1000 now matches, the parts are indexed as numbers next to the geopoint.
The parity suite covers >=, <=, combined ranges, number equality, the colon forms and the location parts.
The proxy redirected requests forwarded as plain HTTP to https:// plus
the Host header of the request. The client controls that header, so the
redirect could send users to any other site (open redirect).
The redirect now uses the host of OC_URL, the URL where OpenCloud is
reachable for users, and keeps the path and query of the request as the
client escaped them. If OC_URL can't be parsed or has no host, requests
are passed on without a redirect, and the proxy logs why at startup.
Assisted-by: Claude Code:claude-opus-5-5
HttpLogger assigned each header instead of appending it, so the request
log only showed the last header of each request and response, usually
Date. Format all headers, with all their values and the indentation of
the rest of the log. Mask Authorization and Cookie: the logs are public
in the CI.
Fixes#4104
Assisted-by: Claude Code:claude-opus-5-5
Follows opencloud-eu/reva#895, which makes the revision cleanup go by
the time a revision was created, recorded by the server, instead of the
modification time of its content, which clients choose with X-OC-Mtime.
"auto" keeps the oldest revision of each slot (#3735).
- The storage-users README explains the new age of a revision.
- The acceptance scenario outline that checked the age as the time the
content was written is replaced by two scenarios: versions whose
content is dated 60 and 50 days ago are kept by "30d", and a version
with content dated 10 years ahead doesn't push out the newest one
under "1".
Assisted-by: Claude Code:claude-opus-5-5
The revisions cleanup command, its help and the README said that, with
a cache local to each process, the server would keep listing the
revisions the command deleted until their cache entries expire or it
restarts. It doesn't: the server lists the revisions of a file from
disk. What it doesn't learn about is that they were deleted, so a list
of versions that is already open, e.g. in the Versions panel, keeps
showing them, and downloading or restoring one of them fails.
The command still refuses to run with such a cache, unless
--allow-local-cache is given: a shared cache is the right setup for a
command that changes the storage next to the server.
Assisted-by: Claude Code:claude-opus-5-5
A dry run reads the metadata of every file it looks at. With a file
metadata cache shared with the server, e.g. 'nats-js-kv', it filled
that cache with entries for all of them, for a run that changes
nothing.
A dry run now always keeps its file metadata cache in its own memory,
whatever is configured. It doesn't need the shared cache: it deletes
nothing the server would have to see, and a cache of its own starts
empty, so it reads the metadata from disk. A real run still uses the
configured cache, which must be shared.
Assisted-by: Claude Code:claude-opus-5-5
The revision cleanup doesn't apply the strategy to the revision a
restore created of the content it replaced, not even an age limit,
as long as the file has the restored content. Say so next to the
strategies, as it is an exception admins wouldn't expect.
Assisted-by: Claude Code:claude-opus-5-5
The revisions cleanup command runs in a process of its own. With a file
metadata cache that each process keeps in its own memory ('memory', the
default, or 'ocmem'), the server doesn't learn about the revisions the
command deletes: a list of versions that is already open, e.g. in the
Versions panel, keeps showing them, and downloading or restoring one of
them fails. A new list is right, as the server lists them from disk.
The command now refuses to run with such a cache. The error says how to
share the cache (STORAGE_USERS_FILEMETADATA_CACHE_STORE=nats-js-kv, not
OC_CACHE_STORE, which sets the cache store of all services) and that
--allow-local-cache runs it anyway. A dry run deletes nothing and runs
with any cache.
The acceptance tests pass --allow-local-cache: their server runs with the
default cache, and they check the versions through the API, which lists
them from disk.
Assisted-by: Claude Code:claude-opus-5-5
A new cliCommands feature, cleanupFileVersions.feature, tests the
"storage-users revisions cleanup" command against a running server,
checking the remaining versions through the WebDAV versions API:
- keeping the newest version of every file in all spaces
- a dry run, which deletes nothing
- only a folder within the personal space (--space with --path)
- only a project space (--space)
- the JSON output (--json)
- no strategy while the configured one is disabled: exit code 1
- a timeout: exit code 2, nothing deleted
- a strategy without spaces after its commas ("auto,1"), as the CLI
wrapper splits commands on spaces
- a folder by its path on disk (--fs-path), posix only
- the configured strategy (STORAGE_USERS_REVISIONS_CLEANUP_STRATEGY),
which cleans up a file whenever it gets a new version: without
background workers, and with them, the default
- the configured strategy for uploads with TUS, as the web UI and the
clients upload
- the age of a version, which is the time its content was written:
uploads with an older modification time (X-OC-Mtime) make versions
that "30d" deletes right away, while "1,30d" keeps the newest one
- restoring a version with the strategy "0": the content from before
the restore is kept, so that the restore can be undone
A second feature, collaborativePosix/cleanupFileVersions.feature, tests
the versions that changes on the POSIX filesystem create, with
STORAGE_USERS_POSIX_ENABLE_FS_REVISIONS: the configured strategy cleans
up a file whenever a change on disk creates a version, with and without
background workers, and the command deletes such versions. The
collaborativePosix suite doesn't run in the CI for now
(https://github.com/opencloud-eu/opencloud/issues/2036), so these
scenarios are ready for when it does again; they pass locally. The
suite gets the FilesVersionsContext, whose steps its existing version
scenarios already use.
New steps: in CliContext, running the command for all spaces, a space,
a path within a space, a path on the POSIX filesystem, or with flags
only; checking the exact exit code; and checking the objects of a JSON
output, which "the command output should contain" can't match as it
contains quotes. In FilesVersionsContext, a number of versions that is
checked until it matches, for the cleanup that runs in the background
after postprocessing. In WebDav, the Given form of an upload with
content and a modification time.
Assisted-by: Claude Code:claude-opus-5-5
'opencloud storage-users revisions cleanup' deletes old revisions,
according to a cleanup strategy, of:
- the files of spaces (--space, repeatable),
- or of a file or folder within a space (--space with --path),
- or of all spaces (--all),
- or of a file or folder given by its path on disk (--fs-path, posix
only).
The id of a file or folder is rejected as the id of a space, as the
command would otherwise clean up its whole space. So is an id without a
space id, e.g. 'storage$'.
The storage-users service only cleans up the revisions of a file when it
gets a new one. The command also covers the files that are not changed
anymore, and applies a different strategy once.
The strategy and the settings of the background workers default to the
configured ones (STORAGE_USERS_REVISIONS_CLEANUP_*), and can be
overridden with --strategy, --async, --workers and --queue-size. Only
--queue-full defaults to 'block' without a timeout, whatever is
configured: the command finds files faster than the workers clean them
up, so dropping the files that find the queue full, or giving up after
the timeout meant for uploads, would skip most of them.
--queue-full-timeout sets one for the run.
The command uses the storage driver directly, in its own process, like
'uploads sessions': posix neither scans nor watches the file system, and
no driver joins the postprocessing consumer group of the service.
For posix, the driver needs NATS for its event stream. The command waits
for it 10 seconds at most, instead of the 15 minutes the stream retries
for, and ctrl-c also stops that wait: with the single binary, NATS only
runs within the server (opencloud-eu/opencloud#3805). The driver gets
the logger of the command: posix passes it on to the NATS connections
of its id cache, whose handlers would panic on a lost connection
without one. Ctrl-C also stops waiting for the driver, e.g. for the id
cache, which retries for up to 15 minutes as well.
Unless it is a dry run, which changes nothing on disk, the command
warns when the storage belongs to another user than the one it runs as,
e.g. root: the lock files it creates belong to that user, and the
server may not be able to lock these files anymore.
Output: a line for every file whose revisions were deleted, that failed
or that was skipped, with its path within its space, and a summary;
--verbose adds every file and every revision with the decision and its
reason; --json prints the same as JSON objects, one per line, with a
final summary object. --dry-run deletes nothing.
--timeout stops the cleanup gracefully, as does ctrl-c, and a second
ctrl-c ends the command right away, which can leave the blob of a
deleted revision behind; the help says so. Whether the timeout or ctrl-c
stopped the cleanup is told by the contexts of the command, not by the
error: the storage can return context errors of its own. --shuffle walks
the spaces and folders in a random order, so that repeated runs that
are stopped by the timeout, e.g. from a cron job, eventually reach all
files. The help explains that a file waiting for a lock can't be
interrupted, and that a dry run changes nothing on disk, but decides on
a snapshot, as it doesn't keep the files locked while it decides.
The common flags have short forms: -a (--all), -p (--fs-path),
-s (--strategy), -n (--dry-run), -v (--verbose), -j (--json) and
-t (--timeout).
Exit codes:
- 0 when done,
- 1 if the cleanup or any file failed, or if it was interrupted,
- 2 if the timeout stopped the cleanup before all files were cleaned
up.
The storage-users README documents the command, along with the cleanup
strategies and how they relate to the configured cleanup.
Assisted-by: Claude Code:claude-opus-5-5
Wire reva's revision cleanup options into the 'decomposed', 'decomposeds3'
and 'posix' drivers, in the storage provider and in the data provider.
The options are a single 'revisions_cleanup' section of the storage-users
configuration, next to 'filemetadata_cache' and 'id_cache', as only one
driver is used at a time. Its environment variables:
- STORAGE_USERS_REVISIONS_CLEANUP_STRATEGY: which old revisions to
delete whenever a file gets a new revision, e.g. 'auto', '30d' or
'7d, auto, 90d'
- STORAGE_USERS_REVISIONS_CLEANUP_ASYNC: run the cleanup in background
workers
- STORAGE_USERS_REVISIONS_CLEANUP_ASYNC_WORKERS: number of background
workers
- STORAGE_USERS_REVISIONS_CLEANUP_ASYNC_QUEUE_SIZE: number of files that
can wait
- STORAGE_USERS_REVISIONS_CLEANUP_ASYNC_QUEUE_FULL: 'drop' or 'block'
- STORAGE_USERS_REVISIONS_CLEANUP_ASYNC_QUEUE_FULL_TIMEOUT: how long
'block' waits for room at most, 0 for as long as it takes
The strategy defaults to 'disabled', which keeps all revisions as before.
The other defaults are reva's: background workers, with the number of
workers and the queue size determined automatically, dropping the
cleanup of a file when the queue is full (it is cleaned up with its
next revision), and a timeout of 5s for 'block'.
Other commands that create a driver, 'posixfs scan' and 'uploads
sessions', clean up revisions without background workers: they could
exit before the workers are done, and stop the cleanup of a file
midway.
Assisted-by: Claude Code:claude-opus-5-5
We bump reva to 2b2b8732790b, the merge of
https://github.com/opencloud-eu/reva/pull/1053 on reva main. The
gateway now issues a view only token only to users who may stat a
file but not download it. Users who may download the file open it in
view mode with their own access token, so the collaboration service
no longer treats their session as a secure view, and files of
received federated shares can be opened in view mode again.
It also brings in https://github.com/opencloud-eu/reva/pull/1037
(only the WebDAV permissions are taken from OCM permission change
notifications) and the test change of
https://github.com/opencloud-eu/reva/pull/1050.
Assisted-by: Claude Code:claude-opus-5-5