-
Notifications
You must be signed in to change notification settings - Fork 7
feat: add CEL expression support for structured work scopes #141
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
Merged
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
06fb6b5
feat: add CEL expression support for structured work scopes
holkexyz d6d2222
fix: handle object-type main defs in SCHEMAS.md generator
holkexyz d50f503
refactor: rename type to kind in workScopeTag
holkexyz 6407495
docs: update ERD to reflect type → kind rename in workScopeTag
holkexyz a4e3dc2
refactor: move schemas to ontology namespace and replace labels with …
holkexyz 0266b98
fix: regenerate SCHEMAS.md to fix stale field name (type→kind) and na…
aspiers e8fe2b9
refactor: rename ontology to workscope and improve tag schema
holkexyz e4b0064
docs: improve aliases description to distinguish from sameAs
holkexyz 5cc9a85
chore: update changeset to reflect workscope namespace
holkexyz 075a6e5
refactor: remove strongRef from workScope union
holkexyz 7418834
fix: sync ERD.puml workscope namespace/fields and fix README NSID pla…
aspiers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@hypercerts-org/lexicon": minor | ||
| --- | ||
|
|
||
| Add CEL expression support for structured work scopes (`org.hypercerts.workscope.cel`, `org.hypercerts.workscope.tag`) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| { | ||
| "lexicon": 1, | ||
| "id": "org.hypercerts.workscope.cel", | ||
| "defs": { | ||
| "main": { | ||
| "type": "object", | ||
| "description": "A structured, machine-evaluable work scope definition using CEL (Common Expression Language). Tags referenced in the expression correspond to org.hypercerts.workscope.tag keys. See https://github.com/google/cel-spec. Note: this is intentionally type 'object' (not 'record') so it can be directly embedded inline in union types (e.g., activity.workScope) without requiring a separate collection or strongRef indirection.", | ||
| "required": ["expression", "usedTags", "version", "createdAt"], | ||
| "properties": { | ||
| "expression": { | ||
| "type": "string", | ||
| "maxLength": 10000, | ||
| "maxGraphemes": 5000, | ||
| "description": "A CEL expression encoding the work scope conditions. Example: scope.hasAll(['mangrove_restoration', 'environmental_education']) && location.country == 'KE'" | ||
| }, | ||
| "usedTags": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "ref", | ||
| "ref": "com.atproto.repo.strongRef" | ||
| }, | ||
| "maxLength": 100, | ||
| "description": "Strong references to org.hypercerts.workscope.tag records used in the expression. Enables fast indexing by AT-URI and provides referential integrity to the underlying tag records." | ||
| }, | ||
| "version": { | ||
| "type": "string", | ||
| "maxLength": 16, | ||
| "knownValues": ["v1"], | ||
| "description": "CEL context schema version." | ||
| }, | ||
| "createdAt": { | ||
| "type": "string", | ||
| "format": "datetime", | ||
| "description": "Client-declared timestamp when this expression was originally created." | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| { | ||
| "lexicon": 1, | ||
| "id": "org.hypercerts.workscope.tag", | ||
| "defs": { | ||
| "main": { | ||
| "type": "record", | ||
| "description": "A reusable scope atom for work scope logic expressions. Scopes can represent topics, languages, domains, deliverables, methods, regions, tags, or other categorical labels. Tags are composed into structured expressions via CEL (Common Expression Language) on activity records.", | ||
| "key": "tid", | ||
| "record": { | ||
| "type": "object", | ||
| "required": ["key", "name", "createdAt"], | ||
| "properties": { | ||
| "key": { | ||
| "type": "string", | ||
| "description": "Lowercase, underscore-separated machine-readable key for this scope (e.g., 'mangrove_restoration', 'biodiversity_monitoring'). Used as the canonical identifier in CEL expressions.", | ||
| "maxLength": 120 | ||
| }, | ||
| "name": { | ||
| "type": "string", | ||
| "description": "Human-readable name for this scope.", | ||
| "maxLength": 200 | ||
| }, | ||
| "category": { | ||
| "type": "string", | ||
| "description": "Category type of this scope.", | ||
| "knownValues": ["topic", "language", "domain", "method"], | ||
| "maxLength": 50 | ||
| }, | ||
| "description": { | ||
| "type": "string", | ||
| "description": "Optional longer description of this scope.", | ||
| "maxLength": 10000, | ||
| "maxGraphemes": 1000 | ||
| }, | ||
| "parent": { | ||
| "type": "ref", | ||
| "ref": "com.atproto.repo.strongRef", | ||
| "description": "Optional strong reference to a parent work scope tag record for taxonomy/hierarchy support. The record referenced must conform with the lexicon org.hypercerts.workscope.tag." | ||
| }, | ||
| "status": { | ||
| "type": "string", | ||
| "description": "Lifecycle status of this tag. Communities propose tags, curators accept them, deprecated tags point to replacements via supersededBy.", | ||
| "knownValues": ["proposed", "accepted", "deprecated"], | ||
| "maxLength": 20 | ||
| }, | ||
| "supersededBy": { | ||
| "type": "ref", | ||
| "ref": "com.atproto.repo.strongRef", | ||
| "description": "When status is 'deprecated', points to the replacement work scope tag record. The record referenced must conform with the lexicon org.hypercerts.workscope.tag." | ||
| }, | ||
| "aliases": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string", | ||
| "maxLength": 200 | ||
| }, | ||
| "maxLength": 50, | ||
| "description": "Alternative human-readable names for this scope (e.g., translations, abbreviations, or common synonyms). Unlike sameAs, these are plain-text labels, not links to external ontologies." | ||
| }, | ||
| "sameAs": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string", | ||
| "format": "uri", | ||
| "maxLength": 2048 | ||
| }, | ||
| "maxLength": 20, | ||
| "description": "URIs to semantically equivalent concepts in external ontologies or taxonomies (e.g., Wikidata QIDs, ENVO terms, SDG targets). Used for interoperability, not as documentation." | ||
| }, | ||
| "referenceDocument": { | ||
| "type": "union", | ||
| "refs": [ | ||
| "org.hypercerts.defs#uri", | ||
| "org.hypercerts.defs#smallBlob" | ||
| ], | ||
| "description": "Link to a governance or reference document where this work scope tag is defined and further explained." | ||
| }, | ||
| "createdAt": { | ||
| "type": "string", | ||
| "format": "datetime", | ||
| "description": "Client-declared timestamp when this record was originally created." | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.