-
Notifications
You must be signed in to change notification settings - Fork 7
fix invalid union types and add automated checks to CI #132
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
Changes from all commits
7aac018
e134b26
24605ff
a55df04
da481e0
9bd413b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| --- | ||
| "@hypercerts-org/lexicon": minor | ||
| --- | ||
|
|
||
| Convert app.certified.defs#did to object type | ||
|
|
||
| The did definition in app.certified.defs has been converted from a primitive | ||
| string type to an object type to comply with the ATProto specification | ||
| requirement that all union variants must be object or record types. | ||
|
|
||
| This change was necessary because app.certified.badge.award uses this | ||
| definition in a union for the subject property. | ||
|
|
||
| Breaking changes: | ||
|
|
||
| - `app.certified.defs#did`: Now an object with `did` string property (maxLength 256) | ||
| - Code using this type must now access the `.did` property instead of using the value directly | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| --- | ||
| "@hypercerts-org/lexicon": minor | ||
| --- | ||
|
|
||
| Convert union string definitions to object types in activity lexicon | ||
|
|
||
| The contributorIdentity, contributorRole, and workScopeString definitions | ||
| in org.hypercerts.claim.activity have been converted from primitive string | ||
| types to object types to comply with the ATProto specification requirement | ||
| that all union variants must be object or record types. | ||
|
|
||
| Additionally, maximum length constraints have been reduced to more reasonable | ||
| values: | ||
|
|
||
| - `contributorIdentity.identity`: maxLength 1000, maxGraphemes 100 (previously no limits) | ||
| - `contributorRole.role`: maxLength 1000, maxGraphemes 100 (previously maxLength 10000, maxGraphemes 1000) | ||
| - `workScopeString.scope`: maxLength 1000, maxGraphemes 100 (previously maxLength 10000, maxGraphemes 1000) | ||
|
|
||
| Breaking changes: | ||
|
|
||
| - `contributorIdentity`: Now an object with `identity` string property | ||
| - `contributorRole`: Now an object with `role` string property | ||
| - `workScopeString`: Now an object with `scope` string property | ||
| - Reduced maximum lengths may affect existing records with longer values | ||
|
|
||
| This requires updating code that uses these union types to access the nested | ||
| property instead of using the value directly. | ||
|
aspiers marked this conversation as resolved.
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,9 +4,17 @@ | |
| "description": "Common type definitions used across certified protocols.", | ||
| "defs": { | ||
| "did": { | ||
| "type": "string", | ||
| "format": "did", | ||
| "description": "A Decentralized Identifier (DID) string." | ||
| "type": "object", | ||
| "description": "A Decentralized Identifier (DID) string.", | ||
| "required": ["did"], | ||
| "properties": { | ||
| "did": { | ||
| "type": "string", | ||
| "format": "did", | ||
| "description": "The DID string value.", | ||
| "maxLength": 256 | ||
| } | ||
|
Comment on lines
6
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check for .changeset directory and look for relevant changesets
echo "=== Checking .changeset directory ==="
if [ -d .changeset ]; then
echo ".changeset directory found"
echo ""
echo "=== Contents of .changeset directory ==="
ls -la .changeset
echo ""
echo "=== Searching for changeset files mentioning DID or defs ==="
find .changeset -type f \( -name "*.md" -o -name "*.json" \) -exec grep -l "did\|defs\|DID" {} \; 2>/dev/null | head -20
echo ""
echo "=== Content of changeset files ==="
find .changeset -type f \( -name "*.md" \) ! -name "README*" -exec echo "File: {}" \; -exec cat {} \; 2>/dev/null
else
echo "No .changeset directory found"
fiRepository: hypercerts-org/hypercerts-lexicon Length of output: 24894 🏁 Script executed: #!/bin/bash
# Examine the defs.json file to understand the DID definition context
echo "=== Reading lexicons/app/certified/defs.json ==="
cat lexicons/app/certified/defs.json | head -100
echo ""
echo "=== Checking initial-version-post-repo-migration.md for DID details ==="
grep -A 5 -B 5 "did" .changeset/initial-version-post-repo-migration.mdRepository: hypercerts-org/hypercerts-lexicon Length of output: 1143 Expand the changeset to fully document the DID definition change. The DID definition in
Example format: 🤖 Prompt for AI Agents |
||
| } | ||
|
Comment on lines
+7
to
+17
|
||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -116,20 +116,43 @@ | |||||||||
| } | ||||||||||
| }, | ||||||||||
| "contributorIdentity": { | ||||||||||
| "type": "string", | ||||||||||
| "description": "Contributor information as a string (DID or identifier)." | ||||||||||
| "type": "object", | ||||||||||
| "description": "Contributor information as a string (DID or identifier).", | ||||||||||
| "required": ["identity"], | ||||||||||
| "properties": { | ||||||||||
| "identity": { | ||||||||||
| "type": "string", | ||||||||||
| "description": "The contributor identity string (DID or identifier).", | ||||||||||
| "maxLength": 1000, | ||||||||||
| "maxGraphemes": 100 | ||||||||||
| } | ||||||||||
| } | ||||||||||
| }, | ||||||||||
| "contributorRole": { | ||||||||||
| "type": "string", | ||||||||||
| "type": "object", | ||||||||||
| "description": "Contribution details as a string.", | ||||||||||
| "maxLength": 10000, | ||||||||||
| "maxGraphemes": 1000 | ||||||||||
| "required": ["role"], | ||||||||||
| "properties": { | ||||||||||
| "role": { | ||||||||||
| "type": "string", | ||||||||||
| "description": "The contribution role or details.", | ||||||||||
| "maxLength": 1000, | ||||||||||
|
||||||||||
| "maxLength": 1000, | |
| "maxLength": 10000, |
Copilot
AI
Jan 26, 2026
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.
The maxLength and maxGraphemes constraints for the role property have been significantly reduced from the original values. The original contributorRole string type had maxLength: 10000 and maxGraphemes: 1000, but the new nested role property only has maxLength: 1000 and maxGraphemes: 100 (a 10x reduction). This represents an additional breaking change beyond just the structural conversion from string to object. Consider whether these tighter constraints are intentional, or if they should match the original values to minimize breaking changes.
| "maxLength": 1000, | |
| "maxGraphemes": 100 | |
| "maxLength": 10000, | |
| "maxGraphemes": 1000 |
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.
Use a major bump for this breaking change.
Changing
app.certified.defs#didfrom a string to an object is a breaking change for consumers, so the changeset should use amajorbump.🔧 Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents