-
Notifications
You must be signed in to change notification settings - Fork 361
feat: allow underscore prefix for private identifiers #2733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: allow underscore prefix for private identifiers #2733
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2733 +/- ##
==========================================
+ Coverage 77.05% 77.71% +0.66%
==========================================
Files 464 472 +8
Lines 49188 49714 +526
==========================================
+ Hits 37896 38629 +733
+ Misses 8504 8231 -273
- Partials 2788 2854 +66 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
641584f to
835c8e9
Compare
docs/schema-language.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we writing this doc here? This will not get published anywhere. Maybe we should update https://authzed.com/docs/spicedb/concepts/schema instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, i removed docs from this pr and created a new docs pr.
Document the ability to use underscore prefixes for definitions, relations, and permissions to signal that they are private/internal. This is a naming convention that helps developers distinguish between public API and internal implementation details in their schemas. Related: authzed/spicedb#2733 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Document the ability to use underscore prefixes for definitions, relations, and permissions to signal that they are private/internal. This is a naming convention that helps developers distinguish between public API and internal implementation details in their schemas. Related: authzed/spicedb#2733 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Document the ability to use underscore prefixes for definitions, relations, and permissions to signal that they are private/internal. This is a naming convention that helps developers distinguish between public API and internal implementation details in their schemas. Related: authzed/spicedb#2733 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…n identifiers
Updates regex patterns across all API protos to allow identifiers to
begin with an underscore (`_`). This enables a convention for marking
identifiers as "private" or "internal".
Use cases:
- **Synthetic permissions**: Permissions that exist only to compose other permissions
- **Internal relations**: Relations not meant to be directly referenced by application code
- **Implementation details**: Parts of your schema that may change without affecting the public API
Example:
```zed
definition document {
relation viewer: user
relation _internal_viewer: user
// Private synthetic permission
permission _can_view = viewer + _internal_viewer
// Public permission
permission view = _can_view
}
```
Companion PR to authzed/spicedb#2733
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
I think if we introduce this, we should enforce that private identifiers cannot be accessed outside the scope of either the definition or the file (in composable schemas) and perhaps even enforce that they cannot be used in API calls |
The schema-language.md file won't be published from this repo. Documentation for underscore prefix identifiers should be added to https://github.com/authzed/docs instead.
b624462 to
48c6e78
Compare
|
@josephschorr good point - do you want me to try adding definition-scoped + API rejection by default? |
Summary
_) for definition, relation, and permission identifiersDescription
This PR implements the feature requested in issue #2066 by updating the identifier regex patterns from
[a-z]to[a-z_]to allow identifiers to begin with an underscore.This is useful for:
Changes
Example Usage
Note
End-user documentation for this feature should be added to authzed/docs at
pages/spicedb/concepts/schema.mdx.Fixes #2066