Skip to content

Commit 7ecdc94

Browse files
committed
docs(knowledge): state why the ACL ceiling exists rather than where the number came from
The comment justified 5,000 tokens by appeal to a reference implementation. The real reason is that the ceiling is a bug detector: with group tokens a legitimate document names tens of principals, so thousands means a connector expanded a group to its members — the exact failure group tokens prevent, and one that bloats the GIN index for every other document in the workspace.
1 parent 8932ca2 commit 7ecdc94

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

apps/sim/lib/knowledge/access/tokens.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@ export const WORKSPACE_ACL: readonly string[] = Object.freeze([WORKSPACE_ACCESS_
1919
export const EMPTY_ACL: readonly string[] = Object.freeze([])
2020

2121
/**
22-
* The most tokens one document's ACL may carry.
22+
* The most tokens one document's ACL may carry — a bug detector, not a tuned
23+
* capacity.
2324
*
24-
* Every read compares the document's ACL against the caller's token set as one
25-
* array overlap, so an ACL is only as cheap as it is short; a runaway one — a
26-
* page restricted to a five-thousand-person space, a group expanded per member
27-
* — degrades the GIN index for every other document in the workspace. Onyx
28-
* declares the same 5,000 ceiling and, by its own comment, never enforces it.
29-
* Ours is enforced, and a document that exceeds it fails closed rather than
30-
* being stored with an ACL that would have to be truncated to fit.
25+
* With group tokens a legitimate document names at most tens of principals. An
26+
* ACL in the thousands means a connector expanded a group to its members, which
27+
* is the exact failure group tokens exist to prevent, and which costs every
28+
* other document in the workspace: the GIN index holds one entry per array
29+
* element per row, and every read overlaps the caller's set against it. The
30+
* number is a generous ceiling above anything real; a document past it fails
31+
* closed rather than being stored with an ACL truncated to fit.
3132
*/
3233
export const MAX_ACL_TOKENS = 5000
3334

0 commit comments

Comments
 (0)