fix: address PR #813 latest review (ACL-aware doc-type discovery, robustness)
- get_indexed_doc_types: add optional accessible_owners param and reuse
build_ownership_filter so cross-user doc-type discovery matches the real
search scope (was self-only / ACL-blind); docstring documents the self-only
default. Covered by test_get_indexed_doc_types_is_acl_aware.
- access_filter: build_ownership_filter now omits the owner_id branch entirely
for an empty owner set instead of relying on undocumented MatchAny(any=[])
semantics; updated the empty-list unit test accordingly.
- access_filter: make the uid_owner/owner share-owner extraction explicit
("absent, not empty") to avoid skipping on a falsy-but-present field.
- access_filter: add an operator note that pre-owner_id points need a re-index
to surface to share recipients (ACL search is a no-op for legacy data).
- verification/webdav: lock the file_accessible_by_id(scope="") contract with a
targeted multi-user test (owner + recipient True, non-recipient False).
- viz_routes: comment that verify-on-read eviction runs inline by design (no
lifespan task group available on the Starlette route).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
531228d407
commit
423d0a1758
@@ -174,13 +174,15 @@ class TestBuildOwnershipFilter:
|
||||
# legacy match path, so it must NOT widen to other owners.
|
||||
assert user_branch.match.value == "alice"
|
||||
|
||||
def test_explicit_empty_list_still_keeps_legacy_branch(self) -> None:
|
||||
# Edge case: caller passed an explicit empty list. We shouldn't
|
||||
# silently re-default to [user_id] in the owner branch, but the
|
||||
# legacy branch is still the safety net so the user can find their
|
||||
# own content from before the migration.
|
||||
def test_explicit_empty_list_omits_owner_branch_keeps_legacy(self) -> None:
|
||||
# Edge case: caller passed an explicit empty list. The owner_id branch
|
||||
# is omitted entirely (rather than relying on MatchAny(any=[]) matching
|
||||
# nothing); the legacy user_id branch remains as the safety net so the
|
||||
# user still finds their own content from before the migration.
|
||||
flt = build_ownership_filter("alice", [])
|
||||
|
||||
owner_branch, user_branch = flt.should
|
||||
assert owner_branch.match.any == []
|
||||
assert flt.should is not None
|
||||
assert len(flt.should) == 1
|
||||
(user_branch,) = flt.should
|
||||
assert user_branch.key == "user_id"
|
||||
assert user_branch.match.value == "alice"
|
||||
|
||||
Reference in New Issue
Block a user