Skip to content

feat: generate the entire Expected Relations section - #163

Open
ivanauth wants to merge 1 commit into
authzed:mainfrom
ivanauth:ivancherapau/oss-959-add-generate-all-to-populate-the-entire-expected-relations
Open

ivanauth wants to merge 1 commit into
authzed:mainfrom
ivanauth:ivancherapau/oss-959-add-generate-all-to-populate-the-entire-expected-relations

Conversation

@ivanauth

@ivanauth ivanauth commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Problem

Expected Relations only populates subjects for keys you have already written by
hand. Re-Generate against an empty document does nothing, so building the file
means hand-writing every object:id#relation key first — and keys for newly
added relations or permissions go missing silently.

Change

Re-Generate and Compute and Diff now enumerate every applicable relation and
permission key for the objects in the test relationships, seed them with empty
values, and hand that to the existing populate path. An empty document now
produces the complete section.

@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

@ivanauth is attempting to deploy a commit to the authzed Team on Vercel.

A member of the Team first needs to authorize it.

@ivanauth
ivanauth force-pushed the ivancherapau/oss-959-add-generate-all-to-populate-the-entire-expected-relations branch from 7185a1d to 9aa2fbb Compare August 5, 2026 21:27
Re-Generate and Compute and Diff now enumerate every applicable relation
and permission key for the objects appearing on either side of the test
relationships, seed them with empty values, and let the existing SpiceDB
WASM populate path fill in the expected subjects. An empty Expected
Relations document now produces the complete section.

Enumeration parses the schema fresh rather than reading the debounced
local parse service, so it stays consistent with the text at click time.
Merging only ever adds absent keys, leaving hand-written entries intact.
A document that is not a plain YAML map aborts with a toast before any
write, and the original contents are snapshotted before validation so
Compute and Diff reverts to the right thing.

Verified by hand against a running playground: caveats need no special
handling, wildcards are excluded as keys but preserved as subjects,
subject-only objects are enumerated, and self-referential relations
dedupe correctly.

The unit project needed spicedb-parser-js inlined: it pulls in parsimmon,
a CJS module whose named exports Node's ESM loader cannot see.
@ivanauth
ivanauth force-pushed the ivancherapau/oss-959-add-generate-all-to-populate-the-entire-expected-relations branch from 9aa2fbb to 45ee8ee Compare August 5, 2026 22:20

This branch has not been deployed

No deployments
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