Skip to content

chore: run all lexicons against the ATProto lexicon style guide#103

Open
s-adamantine wants to merge 2 commits intodevelopfrom
style-fix
Open

chore: run all lexicons against the ATProto lexicon style guide#103
s-adamantine wants to merge 2 commits intodevelopfrom
style-fix

Conversation

@s-adamantine
Copy link
Contributor

@s-adamantine s-adamantine commented Jan 21, 2026

Fixes #66

Summary:
Ran an AI against the ATProto Lexicon Style Guide.

Changes:

  • Change enum to knownValues in badge/response.json for schema evolution
  • Add maxLength constraints to string fields without format:
    • badge/definition.json: badgeType (100), title (256), description (1000)
    • badge/award.json: note (500)
    • badge/response.json: weight (50)
    • rights.json: rightsDescription (5000/1000 graphemes)
    • funding/receipt.json: to, amount, currency, paymentRail, paymentNetwork, transactionId
  • Change maxGraphemes to maxLength for URI in defs.json

Summary by CodeRabbit

  • Chores

    • Enforced max-length/size constraints across multiple schema fields (badges, awards, rights, funding receipts, URIs) to tighten validation and data consistency.
    • Replaced enum usage with knownValues in badge responses.
  • Documentation

    • Reformatted schema docs and added explicit constraint notes for clearer developer-facing guidance and readability.

✏️ Tip: You can customize this high-level summary in your review settings.

- Change enum to knownValues in badge/response.json for schema evolution
- Add maxLength constraints to string fields without format:
  - badge/definition.json: badgeType (100), title (256), description (1000)
  - badge/award.json: note (500)
  - badge/response.json: weight (50)
  - rights.json: rightsDescription (5000/1000 graphemes)
  - funding/receipt.json: to, amount, currency, paymentRail, paymentNetwork, transactionId
- Change maxGraphemes to maxLength for URI in defs.json
@changeset-bot
Copy link

changeset-bot bot commented Jan 21, 2026

🦋 Changeset detected

Latest commit: 063bc1b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@hypercerts-org/lexicon Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Jan 21, 2026

📝 Walkthrough

Walkthrough

This PR tightens JSON Schema validations across lexicons: adds maxLength/maxGraphemes/maxSize constraints to various fields, replaces an enum with knownValues in badge responses, updates the URI constraint, and refreshes SCHEMAS.md and changelog entry to reflect these changes.

Changes

Cohort / File(s) Summary
Badge Schema Constraints
lexicons/app/certified/badge/definition.json, lexicons/app/certified/badge/award.json, lexicons/app/certified/badge/response.json
Added maxLength: badgeType (100), title (256), description (1000); added maxSize: icon (1048576); added maxLength: award.note (500); added maxLength: response.weight (50); changed response enum → knownValues.
Rights & Funding Schema Constraints
lexicons/org/hypercerts/claim/rights.json, lexicons/org/hypercerts/funding/receipt.json
Added rightsDescription constraints: maxLength (5000), maxGraphemes (1000); added funding receipt maxLength constraints: to (256), amount (50), currency (10), paymentRail (50), paymentNetwork (50), transactionId (256).
URI Definition Update
lexicons/org/hypercerts/defs.json
Replaced uri maxGraphemes: 1024 with maxLength: 2048.
Documentation & Changelog
.changeset/style-guide-compliance-fixes.md, SCHEMAS.md
Added changelog entry and updated SCHEMAS.md tables/constraints to document the new validation metadata and formatting adjustments.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • aspiers

Poem

🐇 I tidy schemas with a twitch and hop,

maxLength set, knownValues swap — nonstop,
Icons bounded, rights trimmed neat and bright,
Receipts gain limits, URI grows in light,
A rabbit’s nibble made the lexicon right. 🥕✨


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error)
Check name Status Explanation Resolution
Lexicon Documentation Sync ❌ Error SCHEMAS.md is out of sync with lexicon files; three lexicons missing from documentation due to incomplete hardcoded lists in scripts/generate-schemas.js. Update scripts/generate-schemas.js to include app.certified.defs, com.atproto.repo.strongRef, and correct org.hypercerts.claim.contribution to contributor, then regenerate SCHEMAS.md.
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: running lexicons against the ATProto style guide and applying compliance fixes.
Linked Issues check ✅ Passed The PR successfully addresses issue #66 by running all lexicons against the ATProto Lexicon Style Guide and applying the recommended schema changes including enum→knownValues conversion and maxLength/maxGraphemes constraints.
Out of Scope Changes check ✅ Passed All changes are directly related to improving ATProto lexicon style guide compliance; no out-of-scope modifications were introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Lexicons Styleguide Compliance ✅ Passed All lexicon modifications comply with ATProto Lexicon Style Guide: enum→knownValues for forward compatibility, maxLength constraints on unformatted strings, maxGraphemes for internationalization, and proper blob size limits.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@s-adamantine s-adamantine changed the title chore: improve lexicon style guide compliance chore: run all lexicons against the ATProto lexicon style guide Jan 21, 2026
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@SCHEMAS.md`:
- Around line 177-191: Create a new ATProto lexicon v1 JSON file named
lexicons/org/hypercerts/claim/acknowledgement.json that defines the record
"org.hypercerts.acknowledgement" with the properties listed in SCHEMAS.md:
subjects (ref, required), context (ref, required), given (boolean, required),
comment (string, optional, maxLength 1000), and createdAt (string, required);
ensure the lexicon includes proper ids, defs, record key, and required array per
ATProto lexicon schema v1 and mirrors the table types and descriptions. Then
update README.md to list and briefly describe the new acknowledgement lexicon
alongside the existing claim-related records so it appears in the lexicon
index/documentation.

SCHEMAS.md Outdated
Comment on lines 177 to 191
### `org.hypercerts.acknowledgement`

**Description:** Acknowledgement of inclusion/association between subjects and a context.

**Key:** `tid`

#### Properties

| Property | Type | Required | Description | Comments |
| ----------- | --------- | -------- | ----------------------------------------------------------------------- | --------------- |
| `subjects` | `ref` | yes | The records being acknowledged (e.g., activities). | |
| `context` | `ref` | yes | The target context (e.g. a collection) for the acknowledgement/consent. | |
| `given` | `boolean` | yes | Indicates whether acknowledgement is granted (true) or denied (false). | |
| `comment` | `string` | no | Optional comment providing additional details or reasoning. | maxLength: 1000 |
| `createdAt` | `string` | yes | Client-declared timestamp when this record was originally created. | |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Search for acknowledgement lexicon JSON file
find . -type f -name "*acknowledgement*" | grep -E '\.(json|md)$'

Repository: hypercerts-org/hypercerts-lexicon

Length of output: 59


🏁 Script executed:

# Check README.md for acknowledgement documentation
rg -n "acknowledgement" README.md -i

Repository: hypercerts-org/hypercerts-lexicon

Length of output: 59


🏁 Script executed:

# List lexicons directory structure to understand organization
find ./lexicons -type f -name "*.json" | head -20

Repository: hypercerts-org/hypercerts-lexicon

Length of output: 740


🏁 Script executed:

# Check if SCHEMAS.md exists and contains acknowledgement section
grep -n "org.hypercerts.acknowledgement" SCHEMAS.md

Repository: hypercerts-org/hypercerts-lexicon

Length of output: 117


🏁 Script executed:

# Check README.md structure
head -50 README.md

Repository: hypercerts-org/hypercerts-lexicon

Length of output: 1155


🏁 Script executed:

# Verify README does not mention acknowledgement
grep -i "acknowledgement" README.md || echo "No acknowledgement found in README"

Repository: hypercerts-org/hypercerts-lexicon

Length of output: 111


Create the acknowledgement lexicon JSON file and document it in README.md

SCHEMAS.md documents org.hypercerts.acknowledgement (line 177), but the corresponding lexicon JSON file is missing. Create lexicons/org/hypercerts/claim/acknowledgement.json following ATProto lexicon schema v1, and update README.md to document the new lexicon alongside other claim-related records.

🧰 Tools
🪛 LanguageTool

[style] ~191-~191: This phrase is redundant. Consider writing “created”.
Context: ...declared timestamp when this record was originally created. | | --- ## Cert...

(ORIGINALLY_CREATED)

🤖 Prompt for AI Agents
In `@SCHEMAS.md` around lines 177 - 191, Create a new ATProto lexicon v1 JSON file
named lexicons/org/hypercerts/claim/acknowledgement.json that defines the record
"org.hypercerts.acknowledgement" with the properties listed in SCHEMAS.md:
subjects (ref, required), context (ref, required), given (boolean, required),
comment (string, optional, maxLength 1000), and createdAt (string, required);
ensure the lexicon includes proper ids, defs, record key, and required array per
ATProto lexicon schema v1 and mirrors the table types and descriptions. Then
update README.md to list and briefly describe the new acknowledgement lexicon
alongside the existing claim-related records so it appears in the lexicon
index/documentation.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
SCHEMAS.md (1)

186-194: Update SCHEMAS.md to document the URI maxLength constraint.

The defs.json file correctly contains maxLength: 2048 for the URI definition, but SCHEMAS.md does not reflect this constraint in the Comments column. The table shows only "Has 'uri' property (string, format uri)" without documenting the maxLength. Regenerate or update SCHEMAS.md to include this constraint and keep it in sync with the source lexicon.

@aspiers
Copy link
Contributor

aspiers commented Jan 25, 2026

@copilot This needs rebasing

Copy link
Contributor

Copilot AI commented Jan 25, 2026

@aspiers I've opened a new pull request, #130, to work on those changes. Once the pull request is ready, I'll request review from you.

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.

check lexicons against Lexicon Style Guide using AI

3 participants