Skip to content

Explicit include/exclude in the Expand exclusion tree (#31)#61

Merged
iarunsaragadam merged 1 commit into
mainfrom
feat/exclusion-encoding
Jun 18, 2026
Merged

Explicit include/exclude in the Expand exclusion tree (#31)#61
iarunsaragadam merged 1 commit into
mainfrom
feat/exclusion-encoding

Conversation

@iarunsaragadam

Copy link
Copy Markdown
Contributor

Closes #31 — replaces the fragile positional encoding of EXCLUSION nodes in the Expand UsersetTree (where children[0]=include, children[1]=exclude, documented only by a comment) with explicit fields.

  • New UsersetTree.include = 7 / exclude = 8. An EXCLUSION node now carries its operands explicitly (effective set = include − exclude) and leaves children empty; UNION/INTERSECTION still use children.
  • The Go authz.Tree was already explicit (Exclude *ExcludeTree{Include, Exclude}); only treeToProto and the e2e test carried the positional convention — both updated, positional code removed.
  • Tests: exclusion → include/exclude (no children); union still uses children; proto round-trip preserves structure; e2e checks the include leg carries the wildcard, exclude does not.

Additive proto · go test -race ./... ✓ (incl. real Postgres) · lint 0 ✓.

Closes #31

The UsersetTree EXCLUSION node encoded its operands by child position
(children[0]=include, children[1]=exclude), a fragile convention
documented only by a comment with no structural guarantee of order or
arity.

Add explicit include (field 7) and exclude (field 8) fields to
UsersetTree. EXCLUSION nodes now populate these and leave children empty;
UNION/INTERSECTION keep using children. The proto conversion and the
Expand e2e test are updated to the explicit encoding, and a connect-level
round-trip test pins that exclusion uses include/exclude (never children)
while union still uses children. Documents the encoding in the
authorization model.

Closes #31
@iarunsaragadam iarunsaragadam merged commit e809b78 into main Jun 18, 2026
10 of 11 checks 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.

Harden EXCLUSION userset-tree encoding (explicit include/exclude, not child position)

1 participant