Skip to content

Knowledge is shared through collections with end users, groups, agents and the whole org - #77

Merged
zlareb1 merged 42 commits into
mainfrom
acl-watermark
Oct 20, 2026
Merged

zlareb1 merged 42 commits into
mainfrom
acl-watermark

Conversation

@zlareb1

@zlareb1 zlareb1 commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • New Feature

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

Knowledge can be shared through collections: nested namespaces that only grants open, shared with a service's end users, SCIM groups, agents or the whole org. A service signs a short-lived token per end user, each user saves into their own collection (namespace: "@me"), and a revoked grant or removed group member is enforced on every replica within about a second.

Why

A chat service in front of Loom today keeps one namespace per tenant and passes user_id in the request body. Three things don't work with that:

  • Documents have no owner. Anyone who can read the tenant's namespace reads every document in it, so one user's private file turns up in another user's search.
  • Saved messages are marked rows in loom.conversations. They sit with recorded turns, only the first 2,048 characters are embedded, and the user isn't in either sort key, so one user's saved search scans everyone's.
  • Grants only name Loom accounts and service accounts, and each namespace's grants stand alone. A chat service needs to share a file, a folder or an agent with users and groups, and expects files in a folder to follow the folder's sharing.

One user's search, measured on ClickHouse 26.9 with the tables' own DDL (3,072-dim vectors; p50 of 5, rows from system.query_log):

Users in tenant Saved search before after Document search before after
1 40 rows, 7 ms 128 rows, 8 ms 48 rows, 8 ms 128 rows, 8 ms
100 4,000 rows, 13 ms 3,314 rows, 9 ms 4,059 rows, 15 ms 4,973 rows, 12 ms
5,000 200,000 rows, 33 ms 3,274 rows, 11 ms 121,660 rows, 50 ms 8,352 rows, 16 ms

"After" reads the user's personal collection for saved items, and their own collection plus three shared ones for documents. It stays flat as the tenant grows.

What changes

The full model is in docs/architecture/sharing.md.

Collections. A collection is a namespace named col-…; col-me-… is a user's personal one. The prefix is reserved, so the gate recognises a collection by name without a read. check_authorized sends every collection to server/auth/sharing.py first: the best role any of the request's principals holds on it or an ancestor (up to 8 levels) decides. Token claims, the org admin role and the code-namespace rules don't open a collection, though an org admin can still request its erasure without reading it. A platform admin passes on every collection, for operator erasure and export. A scoped or delegated token gets no more than its own claim allows, and nothing outside its ns_write set beyond viewer.

New ops (experimental): collection.create, collection.move (parent: "" detaches), collection.list and collection.delete, which purges what the collection held before it leaves the tree. Moves are serialised per org, and cycles and depth over 8 are refused. namespace.register, namespace.join and namespace.delete refuse col- names.

Principals. Grant subjects can now be user:<id>, group:<id>, agent:<id> and everyone. Groups, agents and everyone can only be granted collections. Groups come from SCIM /scim/v2/Groups, pushed with an org admin's token; a member is a user id, and deleting a group revokes its grants. An agent's files go in a collection granted to agent:<id>, and knowledge.search with namespaces: [...] reads exactly the collections it names, so one agent's search never reaches another agent's files.

End-user tokens. A service registers itself in LOOM_JWT_END_USER_ISSUERS_JSON with the orgs it may sign for (names or prefix*, never *, and no two issuers for one org) and its keys, inline or from a JWKS URL. Per request it signs an RS256 token with sub: user:<id>, one listed org, a jti, an optional agent: agent:<id>, and a lifetime of at most LOOM_JWT_END_USER_MAX_TTL_SECONDS (300). Loom verifies it into a viewer of the org with no claim, with reads pinned to that user. A claim that would widen it (namespaces, ns_write, ns_roles, roles, sa, read_scope, read_user_id, creator, parents) is refused. Until an issuer's JWKS has been fetched once, its tokens get a 503, and the fetch is retried every 2 s. An end-user token works on the op endpoint and knowledge.download. Of the ops no namespace gates, it may call only collection.create, collection.list, namespace.list_mine and grants.pending_for_me; MCP, /v1/me/* and the admin routes refuse it, and /oauth/revoke revokes nothing for one, because the issuer picks the jti. End users are revoked per org, with loom revoke-token --subject <org>/user:<id>.

Saved items. namespace: "@me" maps to the user's personal collection. Only that user (and a platform admin) can open it, and it takes no grants. A saved message is a document at chat/<conversation>/<message>, saved and found with the ordinary knowledge ops, chunked and embedded in full.

Provenance. Documents and chunks record the agent, the end user, the session and the content's class (migration 058). Knowledge writes accept agent, session_id and a source_class that can only be downgraded, and knowledge.search returns all three and filters on session and class. Access control never reads them.

Revocation within a second. Every grant, group or tree change adds a row to loom.acl_versions (migration 057). Each process polls the per-org sums every LOOM_ACL_WATERMARK_POLL_SECONDS (1 s) and drops only what that kind of change made stale. This replaces the same-host write-count file. If polling fails for LOOM_ACL_WATERMARK_MAX_STALE_SECONDS (10 s), a process stops serving cached grants. A write that may have landed even though its reply was lost still moves the watermark.

Search. knowledge.search reads every readable collection in one statement per leg, with BM25 statistics summed over the set, up to LOOM_KNOWLEDGE_SEARCH_MAX_NAMESPACES (10,000); the rest come back in namespaces_skipped. An end user's search that sets neither namespaces nor namespace_scope reads only its namespace.

Erasure. A user erasure now also covers what the user wrote as an end user:

  • it supersedes their documents and chunks, or deletes every version with purge: true;
  • it deletes the uploaded originals nobody else's live document shares, found through a new upload record (loom.blob_uploads);
  • it revokes and deletes their grants, removes them from groups and retires their personal collection;
  • it blanks their id where they created collections or granted access to others.

A user-scope erasure.export includes the user's own collection, and every section applies visibility before its LIMIT. erasure.request and erasure.export refuse a user_id of -, '' or *.

Alternatives considered (details in the architecture page): an owner column on documents, a separate saved-items table, row ACLs inside one namespace, an ACL key in the sort order, group membership in token claims, and inheritance resolved at write time. Each costs either pruning, consistency or a second store. A timestamp watermark was also ruled out, since a writer's clock skew or a merge keeping the larger version could hide a change; a sum of changes only grows.

Scope and risk

  • Touches the namespace gate, the grant cache, HTTP auth, knowledge search and writes, the erasure saga and SCIM.
  • Leaves alone every existing namespace (none uses col-), loom.conversations and run_id.
  • Isolation: a collection is decided before any rule that widens access. A tree, group or grant that can't be read refuses, or answers 503 when the server can't read it right now. An end-user token can't leave its org.
  • Load: one poll per process per second (10 ms for 10,000 orgs) and one insert per change. On a tenant with 48,000 collections and 84,000 grant rows, a grant change costs one grant-map read per subject that asks (12 ms), a group change 2 ms and a tree change 8 ms.
  • Not in this PR: limiting general federated issuers to orgs and roles, a SCIM token scoped below org admin, and ordering grant reads by subject. Each changes more than end users and needs its own change.

Compatibility, rollout and rollback

  • Wire:

    • new ops collection.create, collection.move, collection.list, collection.delete;
    • end-user tokens and SCIM /scim/v2/Groups;
    • namespace: "@me";
    • knowledge.search takes namespaces, session_ids and source_classes, and returns ingested_at, agent, session_id and source_class;
    • knowledge writes take agent, session_id and source_class.

    Nothing is removed.

  • Settings: LOOM_JWT_END_USER_ISSUERS_JSON (empty means no end-user tokens), LOOM_JWT_END_USER_MAX_TTL_SECONDS (300), LOOM_JWT_END_USER_JWKS_REFRESH_SECONDS (300), LOOM_ACL_WATERMARK_POLL_SECONDS (1), LOOM_ACL_WATERMARK_MAX_STALE_SECONDS (10), LOOM_KNOWLEDGE_SEARCH_MAX_NAMESPACES (10000), LOOM_KNOWLEDGE_SEARCH_FANOUT_KINDS (memory,collection,personal). Knowledge search no longer reads LOOM_MEMORY_SEARCH_FANOUT_KINDS or LOOM_MEMORY_SEARCH_FANOUT_MAX_NAMESPACES: its own LOOM_KNOWLEDGE_SEARCH_FANOUT_KINDS and LOOM_KNOWLEDGE_SEARCH_MAX_NAMESPACES replace them, and the default cap for one search goes from 32 namespaces to 10,000. A deployment that tuned either memory setting to limit knowledge search sets the new ones.

  • Operator steps: migrations 057 and 058 run at boot. An existing namespace that starts with col- is closed to everyone but a platform admin, and the server logs the first 20 at boot.

  • Breaks:

    • A token whose subject looks like a grant principal (user:, group:, agent:, everyone, in any case, bare or after a /) no longer verifies. List them before upgrading with SELECT DISTINCT subject FROM loom.subject_last_seen WHERE match(lower(subject), '(^|/)((user:|group:|agent:)[^/]*|everyone)$') and re-mint them.
    • A trusted caller's X-Loom-On-Behalf-Of naming a grant principal (the same spellings) is refused with 403. The header names a Loom subject; an end user comes in through an end-user token.
    • erasure.request and erasure.export refuse a user_id of -, '' or *. No person has those ids, and - is on every row written without an end user.
  • Revocation window: a grant change used to reach another process on the same host at once, through the write-count file, and another host within the 10 s cache TTL. Now any process on any host sees it within a second (measured 1.02 s).

  • Rolling upgrade: N−1 never reads the new tables or columns, and grant changes cross between versions within the TTL. N−1 doesn't know the col- rule, refuses end-user tokens, drops the provenance columns when it rewrites a document, and resumes a user purge without purging. So, as with SCIM, create collections and register end-user issuers only once no N−1 replica is serving (rule 11 in docs/architecture/rolling-upgrades.md).

  • Rollback: leaves loom.acl_versions, loom.collections, loom.principal_groups, loom.blob_uploads, the new document and chunk columns and loom.erasure_requests.purge in place, unread.

Tests

  • tests/integration/test_cross_principal_leakage.py, with auth on and off. It runs every read op against a shared parent, its child, a personal collection and @me, as six attackers: a stranger, a revoked user, a removed group member, the same user id in another org, an org admin and another namespace's writer. Nothing leaks, and the owner, a direct grantee and a group member still read the canary.
  • tests/integration/test_knowledge_sharing.py, with auth on and off. It covers:
    • inheritance and revocation;
    • groups, agents and everyone;
    • every request field that might widen access;
    • downloads and provenance filters;
    • long saved messages;
    • collection.delete purging, and user erasure and purge, including an original whose document version was merged away.
  • tests/integration/test_grant_watermark_two_processes.py: a revoke, a member removal and a detach made in one process are enforced by another within the poll interval plus 2 s (3 s at the default).
  • Both sharing suites ran against a 3-worker server, as CI runs them.
  • The SCIM provider and deprovisioning suites pass.
  • Unit tests cover:
    • every way an end-user token is refused, and the issuer setting's rules;
    • JWKS fetch and refresh;
    • the org-scoped revocation key and the CLI;
    • SCIM Groups, including names in any case and refused PatchOps;
    • lost-reply handling on every write that narrows access;
    • the erasure steps and census.
  • Lint, typecheck, make schema-dump on a fresh ClickHouse, the analyzer corpus, the unit suite with coverage floors, and make test-mixed-version all pass.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Claude Code. I checked the gate order on every path, the isolation matrix with auth on and off, the watermark with and without its write, the erasure census and the rolling-upgrade behaviour.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • make format-check, make lint, make typecheck and make test-unit pass; the integration suite passes if server behaviour changed.
  • Generated files are regenerated in this PR, not by hand: the SDK op tables, docs/reference/configuration.md and the docs/reference/ tables (python scripts/codegen/docs_reference.py), the reach manifest, schemas/schema.sql (make schema-dump) and the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py).
  • A new migration is additive and numbered after the latest on main; no merged migration is edited.
  • A behaviour change to any file a plugin ships (hooks/, lib/, bin/, skills/, .mcp.json, the Codex plugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.
  • The frontend builds (npm --prefix frontend run build) and its tests pass, if frontend/ changed.
  • Docs under docs/ describe the system as it now is, and this description names any operator steps and wire changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers; the history goes in this description (tests/unit/test_public_copy.py).
  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.

zlareb1 and others added 2 commits October 19, 2026 20:19
Each grant change inserts a per-org row into loom.acl_versions, and every process polls the rows' count and sum per org every acl_watermark_poll_seconds (1 s), dropping the org's cached grants when they move. This replaces the same-host write-count file and bounds cross-replica staleness by the poll interval instead of the 10 s TTL, which stays as the backstop. A process whose last good poll is older than acl_watermark_max_stale_seconds serves no cached grant.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…roups and agents

A collection is a namespace named col-... that only grants open, inheriting its parent's grants. A per-org gateway token acts for one end user per request (user:<id>, optional agent:<id>); grants may name user:, group: and agent: principals, and groups are pushed over SCIM /Groups. knowledge.search reads every readable collection in one statement per leg, saved items live in each user's personal collection (@me), documents record who wrote them, and a user's erasure removes their documents, grants, memberships and personal collection. Grant, group and tree changes now await their watermark row, and a poll reads one total before any org's pair.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
@zlareb1 zlareb1 changed the title A revoked grant is enforced on every replica within a second Knowledge is shared through collections with a service's end users, groups and agents Oct 19, 2026
zlareb1 and others added 15 commits October 19, 2026 22:26
…ectory self-service

Fixes the second review. A personal collection admits only the user its name is derived from, takes no grant and sits in no tree, and @me needs no setup. Principal ids are lowercase. Trusted callers cannot assert a grant principal; end users may call only the collection ops and their own standing among org-level ops. Scoped and delegated tokens are capped on a collection. collection.delete replaces opening namespace.delete to narrowed tokens; collection.create checks names with read-your-write and finishes a create cut short for its creator only. Org-wide views hide collections by prefix. SCIM groups take a claim per group, page in SQL, answer 503 when tokens cannot be checked and revoke a deleted group's grants. Erasure rewrites outrank the row they replace. Search hits carry ingested_at; caches are bounded; the boot log names existing col- namespaces.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…its own kinds, erasure and SCIM fixes

The ACL watermark sums per-org change rows, so concurrent writers never collide on a version. Knowledge search reads its own fan-out kinds setting; memory search sweeps memory namespaces only. Erasure rewrites take a version above the stored one, and SCIM group deletes revoke the group's grants first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…nts each kind of change apart

A metadata edit or delete now carries agent, user_id, actor and source_class forward, so a user erasure reaches an edited document. The ACL watermark counts grant, group and tree changes apart, so grant churn no longer reloads an org's tree or groups. A user-scope export returns every chunk the user wrote; erasure's group and tree rewrites and bulk revokes hold the claims their online writers hold, and bulk revokes are audited.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…register, gateway tokens act as no one

erasure.request and erasure.export refuse a user_id scope of '-', '' or '*', which would reach every non-gateway writer's rows. A personal collection's directory row is written on its first write. A gateway token is refused on every route that names no end user, and grants.create refuses a group that does not exist. loom mint-token --gateway refuses claim flags; sharing.role reads through sharing.roles.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
… replace, group grants under the group's claim

collection.delete retires the tree row before the directory row, so a retry closes a delete cut short. Tree and group rows are versioned above the row they replace whatever the writer's clock says. grants.create holds a group's claim from its existence check to the write. A user-scope export shows an org admin only the collections it may read. collection.list answers a platform admin; watermark inserts are never deduplicated; private-first search is one helper for memory and knowledge. The sharing integration suites wait one watermark poll after each change of access.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
… directory's claims, MCP answers a gateway token with 403

knowledge.update_metadata with reindex keeps the stored authorship. Erasure's directory rewrites hold each row's account claim before the tree's. SCIM group lists clamp startIndex and take eq in any case. A gateway token's refusal is counted on HTTP and answered 403 on MCP. namespace.browse never lists a collection.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…sure rewrites prove they landed

A user purge first supersedes the versions that user's writes replaced, so another writer's older version never reads as live again. The blob step compares sha256 as a string and is covered by an integration test. Erasure rewrites re-count and fail when rows still match. The gate refuses @me on every transport. The grant cache's two caches share one single-flight loader. Tests cover the erasure identity steps' claims.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…etry from either step, scoped tokens list collections

A write that leaves a live document's text as it was keeps the stored authorship. collection.delete writes the directory row, then retires the tree on every call. A read on a stale watermark is not kept over the entry the fallback needs. collection.list and collection.create admit a scoped token. A user erasure never purges, so its steps lose their purge branches. The context helper keeps its name from main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
… erased user leaves no id on grants they issued

revoke_subject versions each revoke above its grant and reads again until none is live, failing with 503 otherwise. A user erasure blanks the user as the issuer of grants others hold. namespace.delete refuses a personal collection. forget_owner claims collections whose create stopped before the directory row and counts both rewrites.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…rg admin follows its collection erasures

The collection gate and the readable set re-raise BackendUnavailableError, so an outage is never a 403 or an empty collection.list. An org admin sees the status and listing of a collection's erasure. A user erasure scrubs the user:<id> subject off the request ledger and deletes the user's subject_last_seen row. The two-process watermark test covers a collection detach; the BM25 stats read is measured.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…y server answers 503 for a collection

revoke_subject and forget_granter re-read each grant under its claim, so a revoke landing meanwhile is kept, and move the watermark once. The collection gate re-raises timeouts and pool exhaustion as well as outages. collection.delete closes a collection whose create stopped before its directory row. loom mint-token --gateway refuses --user-token. test_grants waits one watermark poll after its revoke, the bound on a multi-process server.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…er writer's text

A write without fresh bytes no longer carries an end user's uploaded original to someone else's new text, and a user erasure finds the originals of every version the user wrote. revoke_subject lists once more before it reports a grant still live. Docs say a change binds the process that made it at once and every other process within one poll.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…wide grants, document provenance

An end user signs in with a short-lived token its service signs under a key registered for it alone (jwt_end_user_issuers_json), naming the user and the agent; it replaces the static gateway token and its headers. A grant to everyone reaches every member of the org. knowledge.search takes an explicit list of namespaces, each gated. collection.delete erases what the collection held; a user erasure purges on request, the ledger keeping the flag for a resume. Documents and chunks record the agent, the session and the class of their content, which knowledge writes declare and search returns and filters on. A same-text write with a new original makes its uploader the author; an erased user's revoked grant rows are deleted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>

# Conflicts:
#	docs/reference/configuration.md
zlareb1 and others added 11 commits October 20, 2026 07:53
…ession on knowledge writes

collection.delete runs a purging erasure of the collection, so its documents, chunks, originals and memory leave the disk. Knowledge writes carry a session, so a token pinned to one session must name it, as memory.set does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…WKS URL

Each end-user issuer names the orgs its tokens may name (names or prefix
patterns, never every org, and no two issuers for one org) and where its
keys come from: inline PEMs or an https JWKS fetched at boot and on a
cadence, answered 503 until the first fetch lands. Its tokens carry a jti
and live at most 5 minutes, and an end user's knowledge.search reads its
namespace alone unless it asks for more.

namespace.delete refuses a collection, which goes with what it holds
through collection.delete; a request reads its principals' grant maps side
by side; a user-scope export includes the user's personal collection.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>

# Conflicts:
#	docs/reference/operations.md
#	sdk/typescript/src/generated/ops.ts
…issuer is never a trusted one

Until every end-user issuer's first JWKS fetch lands, the refresh loop retries
every 2 s instead of the refresh period; issuers are fetched side by side.
The settings refuse an end-user issuer that is also Loom's or a trusted
federated issuer (the token's iss picks the path), replacing the kid check.
A request reads its grant maps at most 8 at a time.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…/revoke, and erasure finds every original a user uploaded

- A token with an ns_write claim holds viewer at most on a collection outside
  it, as on any namespace.
- /oauth/revoke revokes nothing for an end-user token: its jti is its
  issuer's choice and the revocation list spans the deployment.
- Each end user's upload is recorded in loom.blob_uploads (migration 047), so
  a user erasure deletes originals whose naming document version was replaced
  and merged away; the census counts the user's rows.
- erasure.export leaves out what its caller may not see inside each read,
  before its LIMIT.
- A key is never both an end-user and a federated key, compared by key
  material; a fetched JWKS key that is a federated one is dropped; the 2 s
  JWKS retry fetches only the issuers not loaded yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…eaves the other issuers on their period

- End-user tokens are checked against <org>/user:<id>, so one tenant's
  subject revocation never cuts off the same id at another.
- The JWKS loop still fetches every issuer each period while one has never
  loaded, so an issuer that rotates keeps working.
- collection.create refuses a name outside the token's ns_write set.
- The export filter runs on clickhouse-local in its test; Shown.admits is gone.
- One settings helper tells federated keys apart for the validator and the
  JWKS fetch; the upload record takes its user from _authorship.
- The original sweep deletes the upload records of the originals it removes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…rries

A bare user:, group:, agent: or everyone subject matches no token (an end
user is revoked as <org>/user:<id>), so the CLI refuses it instead of
reporting a revocation that cuts off no one. The cutoff message and the
--subject help name the end-user form; security.md states the rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…s them, and records it under their org

An <org>/user:<id> subject is accepted only with a named org and a lowercase
id, the key a token's check builds; any other principal-shaped spelling is
refused, since it would revoke no one. The audit row of an end user's
revocation carries their org.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>

# Conflicts:
#	server/settings/__init__.py
…nd revoke agree

is_reserved_subject also judges the segment after a subject's last '/', the
shape of an end user's revocation key (<org>/user:<id>). Minting and
verification refuse such a subject as the revocation CLI does, so a Loom token
never shares an end user's key or escapes a subject revocation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
zlareb1 and others added 5 commits October 20, 2026 10:55
…names everyone

The mint/verify test verifies the same claims under an ordinary subject first,
so the subject alone is shown refused; X-Loom-On-Behalf-Of and grant subjects
refuse the slash form too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>

# Conflicts:
#	docs/features/memory/retention-and-erasure.md
#	server/erasure/store/census.py
#	tests/unit/test_schema_baseline.py
…ys which subjects have aliases

- mint-token prints a refusal and exits 2 for a subject spelled like a grant
  principal, before the keyring read; mint and verify share one message.
- has_aliases (server.core.principals) is the one rule alias lookup and the
  grant cache use, so everyone is never read as a person's spelling.
- The collection ops' wire fields carry descriptions; the trusted-caller and
  grant-principal docs name everyone and the slash form.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…paragraph is rewrapped

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…t cannot read; a bulk grant revoke announces a write whose reply was lost

- patch_operations (scim_routes) is the PatchOp reader both SCIM routes use:
  Operations and each operation's names match in any case (RFC 7643 §2.1), and
  a missing list or a non-object operation is a 400, not a 200 that changed
  nothing nor a 503 retried forever.
- revoke_subject and forget_granter move the watermark for every write they
  attempted, so a revoke that landed with its reply lost is still enforced.
- Four doc paragraphs rewrapped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
zlareb1 and others added 9 commits October 20, 2026 11:55
… reply is lost is audited

- POST, PUT and PATCH /Groups read their attribute names and each member's
  through scim_routes.lowered (RFC 7643 §2.1), so a PUT spelling Members keeps
  them instead of emptying the group; a name sent twice in two cases is a 400.
- revoke_subject audits every attempted revoke, the row may have landed.
- forget_granter counts with an int; the failed-revoke test fake takes the
  real signature.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>

# Conflicts:
#	docs/reference/operations.md
#	docs/reference/schema.md
#	schemas/schema.sql
#	sdk/typescript/src/generated/ops.ts
#	server/settings/_env.py
#	tests/analyzer/shapes.txt
#	tests/unit/test_erasure_verify.py
#	tests/unit/test_schema_baseline.py
…mark

Both write the tree through one helper that announces the change in a
finally: the row may have landed, and a retry finds nothing left to do, so a
detach or a delete is enforced on every replica within one poll either way.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…ly is lost

grant_cache.announced runs a change's writes and then moves the org's
watermark in a finally. Collection move and retire, the erasure's group
removal and owner rewrite, and the SCIM group write use it; the SCIM write
also audits in a finally. A retry of a write that landed finds nothing to do,
so without this the change waited for the cache TTL.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
… or failed

The step keeps the tree's claim with no collection listed, so a create racing
the erasure is rewritten under it, but moves the collections watermark only
when rows changed or the rewrite raised (a lost reply may hide one that
landed). collections.py uses grant_cache.announced in place.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…an owner

The cached collection tree holds parents only, so blanking a user as a
collection's creator changes nothing a reader serves; the step keeps its
claims (a create racing the erasure is rewritten under them). The sharing
page lists the step.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…ermark they move

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…and which delete

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>

# Conflicts:
#	docs/reference/operations.md
#	docs/reference/schema.md
#	schemas/schema.sql
#	sdk/typescript/src/generated/ops.ts
#	tests/integration/test_cross_principal_leakage.py
#	tests/unit/test_schema_baseline.py
@zlareb1 zlareb1 changed the title Knowledge is shared through collections with a service's end users, groups and agents Knowledge is shared through collections with end users, groups, agents and the whole org Oct 20, 2026
@zlareb1
zlareb1 merged commit f7f0610 into main Oct 20, 2026
21 of 22 checks passed
@zlareb1
zlareb1 deleted the acl-watermark branch October 20, 2026 14:50
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.

1 participant