Xuanwo opened a new pull request, #8730:
URL: https://github.com/apache/opendal/pull/8730
# Which issue does this PR close?
Closes #8729.
# Rationale for this change
`ImmutableIndexLayer` answers every `list` call from its in-memory index,
but `capability()` inherited the inner service's `list_with_*` flags unchanged
(except enabling `list_with_recursive`). When the wrapped backend advertises
`list_with_start_after` — the memory service does — the layered operator
advertised it too while `list()` ignored `args.start_after()` entirely.
`op.lister_with("/").start_after("a")` therefore passed the capability check
and silently returned `["a", "b"]` instead of `["b"]`.
The same applied to `list_with_limit`, `list_with_versions`, and
`list_with_deleted`: the index stores paths only and cannot honor them, yet the
flags were inherited verbatim, so `versions(true)`/`deleted(true)` passed the
check and returned unversioned entries instead of `Unsupported`.
# What changes are included in this PR?
- `ImmutableIndexService::list` now emits index entries in lexicographical
order and drops emitted entries at or before `start_after`, for both recursive
(`children_flat`) and hierarchy (`children_hierarchy`) listings. Filtering
applies to the emitted names, which matches the memory service's semantics when
the marker falls inside a folded directory (`start_after = "a/d/x"` excludes
`a/d/` entirely).
- `capability()` now reports only the list options the index implements:
`list`, `list_with_recursive`, `list_with_start_after`; `list_with_limit`,
`list_with_versions`, and `list_with_deleted` are no longer inherited from the
inner service. `limit` is a per-request size hint that the index does not
consume since it materializes the whole listing.
- `list` rejects `versions(true)`/`deleted(true)` with
`ErrorKind::Unsupported` using the same message contract as
`CorrectnessCheckLayer`, because that layer sits below user layers and cannot
gate the outermost advertised capability.
- Unit tests: a `start_after` case table covering recursive and hierarchy
listings, nested directories, exact-match vs between-keys markers, and root
listings; a capability test proving the `list_with_*` flags are no longer
inherited and that `versions`/`deleted` fail fast; a sorted-order test; and a
test wrapping `services::Memory` reproducing the reported `start_after` case.
# Are there any user-facing changes?
Yes. `lister_with`/`list_with` with `start_after` now actually filters on
backends that advertise `list_with_start_after`, and
`versions(true)`/`deleted(true)` now return `ErrorKind::Unsupported` instead of
silently returning current entries. List results are now emitted in sorted
order.
# Breaking changes
# AI Usage Statement
- Harness: pi coding agent inside T3 Code (delegated subagent)
- Model: devin/swe-2
- Effort: max
- Role: The agent investigated the bug, implemented the fix and tests, and
drafted this PR. `versions(true)`/`deleted(true)` changing from silently
returning current entries to `Unsupported` is a deliberate contract correction
noted above.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]