Skip to content

feat(acl): additive atomic whole-library ACL batch API and shared rule-cache reuse - #52

Merged
opendev9 merged 13 commits into
devfrom
feat/library-acl-batch-20261023
Oct 23, 2026
Merged

opendev9 merged 13 commits into
devfrom
feat/library-acl-batch-20261023

Conversation

@servicememeai

Copy link
Copy Markdown

Motivation

Etech permission publication currently sends per-rule GET→PUT→GET plus per-directory existence checks. This causes redundant remote calls, small transactions and cache invalidations. Do not disturb existing Etech installations that still use directory-rules/.

Additive API (old API unchanged)

/api/v2.1/cloudfile/authorization/v1/library-acl-batch/

  • GET ?repo_id: complete provider ACL rules + deterministic fingerprint (including revisions).
  • POST {repo_id,paths}: one read-only resource preview + complete snapshot + missing_paths, replacing N per-directory GETs.
  • PUT {repo_id,expected_fingerprint,managed,desired}: one per-library transfer fence and Branch(master) lock, a current provider snapshot, optimistic fingerprint check, difference-only INSERT/UPDATE/DELETE and one transaction / one post-commit cache generation invalidation.
  • managed explicitly declares Etech publisher's old+new natural keys: only these keys can be removed or changed; rules outside them and other providers are preserved. Fail-closed on invalid inputs, 409 stale snapshot, 403 unauthorized, 503 SQL/storage errors. Limit 4096 keys/rows.
  • Existing directory-rules endpoint remains available for non-upgraded Etech. There is no table migration or new redis namespace/cache.

Read/write behavior

Both can_read and can_write still use one existing Authority per call and the same existing Redis library ACL snapshot (default TTL 180s). Request-local ancestor-path buckets reduce O(rules × directory children) scans; no new persistent cache. Native C/Go final publication fences and SQL lock semantics remain intact.

Validation

New Django/DRF tests: batch authentication, request validation, preview results, fingerprint, 409 conflict; optional disposable MariaDB test verifies atomic diff, preservation of unmanaged/provider rows and exactly one cache invalidation; quick CI runs dependency-light contract tests, no full builds.
Real Hub/EAP interoperability, MariaDB locking/rollback and native C/Go should be verified before merge/deployment. Deploy Hub before upgraded EAP. Related Server fixes #27 and #28 need independent acceptance.
No DEV/PROD was contacted or modified.

@opendev9
opendev9 merged commit a260257 into dev Oct 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants