Skip to content

[HYPER-536] feat(lexicons): add app.certified.graph.entityFollow - #235

Closed
aspiers wants to merge 2 commits into
mainfrom
worktree-entity-follow
Closed

[HYPER-536] feat(lexicons): add app.certified.graph.entityFollow#235
aspiers wants to merge 2 commits into
mainfrom
worktree-entity-follow

Conversation

@aspiers

@aspiers aspiers commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds app.certified.graph.entityFollow — a follow record that targets a record rather than an account.

It is structurally identical to app.certified.graph.follow (same key: tid, same createdAt, optional via strongRef, and optional signatures fields). The only difference is subject:

graph.follow graph.entityFollow
subject string / format: did string / format: at-uri

This lets clients express "follow this activity/claim/collection" alongside the existing "follow this account" relationship, without overloading the meaning of graph.follow.

Notes for reviewers

subject is an unconstrained at-uri. An entity follow may therefore reference a record in any collection — including one governed by a lexicon outside this repository. Consumers should resolve the referenced record before assuming a particular shape, and treat the collection portion of the URI as untrusted input. Flagging this explicitly in case a narrower constraint is preferred.

Permission set growth. The new NSID is added to app.certified.authWrite, so apps already holding include:app.certified.authWrite gain create/update/delete on the new collection once the updated set is published. Per docs/design/permission-sets.md, this widening is silent on the OAuth path — no re-consent is triggered. That is the documented and intended behaviour of set growth, but it is a consent-surface change and worth a deliberate look.

ERD arrow is representative, not exhaustive. Since subject can point at any record, entityFollow::subject --> activity is drawn to keep the diagram readable rather than fanning an arrow out to every record type. A comment in ERD.puml says so.

Changes

File Change
lexicons/app/certified/graph/entityFollow.json New lexicon
lexicons/app/certified/authWrite.json Registered new NSID in the permission set
tests/validate-graph-entity-follow.test.ts New — 10 tests
ERD.puml New entityFollow node + arrow
README.md, SKILL.md ASCII map, table row, prose section with example
SCHEMAS.md Regenerated
.changeset/add-graph-entity-follow.md New — minor

New exports: GRAPH_ENTITY_FOLLOW_NSID, GRAPH_ENTITY_FOLLOW_LEXICON_JSON, GRAPH_ENTITY_FOLLOW_LEXICON_DOC, and the AppCertifiedGraphEntityFollow type namespace.

Testing

npm run check passes: 196/196 tests, up from 182 on main.

That is 10 new tests in validate-graph-entity-follow.test.ts, plus 4 doc-snippet tests auto-generated from the code blocks added to README.md / SKILL.md.

The test worth noting asserts that a bare DID is rejected as subject — confirming the at-uri format genuinely distinguishes this lexicon from graph.follow at validation time, rather than only documenting the intent. A companion test asserts an out-of-repo collection (app.bsky.feed.post) is accepted.

The git diff --exit-code SCHEMAS.md gate is also clean.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added support for certified entity-follow relationships targeting records via AT-URIs, not just accounts.
    • Enabled entity-follow records in certified write permissions.
  • Documentation
    • Updated the README, schema references, lexicon guide, and relationship diagrams with entity-follow usage, examples, and resolution guidance.
  • Tests
    • Added validation coverage for valid entity-follow records, optional references, external collections, and invalid inputs.

Add a follow record that targets a record rather than an account.

The new lexicon is structurally identical to app.certified.graph.follow
(same `key: tid`, same `createdAt`, optional `via` strongRef, and
optional `signatures` fields). The only difference is `subject`, which
is a string with `format: at-uri` referencing the record being
followed, instead of a string with `format: did` identifying an
account. This lets clients express "follow this activity/claim/
collection" alongside the existing "follow this account" relationship
without overloading the meaning of graph.follow.

Because `subject` is an unconstrained at-uri, an entity follow may
reference a record in any collection, including one governed by a
lexicon outside this repository. Consumers should resolve the
referenced record before assuming a particular shape.

Register the NSID in the app.certified.authWrite permission set. Note
this widens the effective grant of an already-consented set; see
docs/design/permission-sets.md for the set-growth semantics.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 22, 2026 15:45
@changeset-bot

changeset-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3835a1a

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 Minor

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@aspiers, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 50 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 61fd9ad3-5ca4-41d6-a7b0-64848769f57e

📥 Commits

Reviewing files that changed from the base of the PR and between bd9932a and 3835a1a.

📒 Files selected for processing (2)
  • .agents/skills/building-with-hypercerts-lexicons/SKILL.md
  • README.md
📝 Walkthrough

Walkthrough

Adds app.certified.graph.entityFollow, allowing certified follow records to target arbitrary record AT-URIs. The change updates authWrite permissions, schema and ERD documentation, usage guides, exported metadata declarations, and validation tests.

Changes

Entity Follow

Layer / File(s) Summary
Entity-follow schema and validation
lexicons/app/certified/graph/entityFollow.json, lexicons/app/certified/authWrite.json, SCHEMAS.md, tests/validate-graph-entity-follow.test.ts
Defines required subject and createdAt fields plus optional via and signatures, adds the collection to authWrite permissions, documents the schema, and tests valid and invalid records.
Relationship diagrams and usage documentation
ERD.puml, README.md, .agents/skills/building-with-hypercerts-lexicons/SKILL.md
Adds entity-follow relationships to diagrams and documents AT-URI targeting, examples, and record-resolution requirements.
Lexicon release metadata
.changeset/add-graph-entity-follow.md
Describes the new lexicon, permission update, exports, and public type namespace.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: copilot


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 README.md still claims every arrow is a strongRef/union ref, but graph.entityFollow and graph.follow use scalar DID/AT-URI subjects. Update the relationship-map legend to distinguish scalar DID/AT-URI subjects from strongRef/union references, then regenerate synced docs if needed.
✅ 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 clearly and concisely describes the main change: adding the app.certified.graph.entityFollow lexicon.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Lexicons Styleguide Compliance ✅ Passed New lexicon follows style guide: lowerCamelCase IDs/fields, main description present, ambiguous fields described, and no undocumented deviations in changed /lexicons files.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch worktree-entity-follow

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ERD.puml`:
- Around line 205-213: The non-facet optional signatures property is missing
from the entity-follow documentation. In ERD.puml lines 205-213, update
entityFollow to include signatures? and adjust the nearby omission rationale if
necessary; in .agents/skills/building-with-hypercerts-lexicons/SKILL.md lines
468-496, explicitly document the optional signatures property.

In `@README.md`:
- Line 49: Correct the relationship-map legends so scalar DID/AT-URI references
are distinguished from strongRef or union references: update the legend at
README.md line 49 and apply the equivalent correction at
.agents/skills/building-with-hypercerts-lexicons/SKILL.md line 333, preserving
the entityFollow.subject scalar at-uri representation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 50c58e0f-4be0-4a84-b5aa-4b29db9772fe

📥 Commits

Reviewing files that changed from the base of the PR and between 456c55c and bd9932a.

📒 Files selected for processing (8)
  • .agents/skills/building-with-hypercerts-lexicons/SKILL.md
  • .changeset/add-graph-entity-follow.md
  • ERD.puml
  • README.md
  • SCHEMAS.md
  • lexicons/app/certified/authWrite.json
  • lexicons/app/certified/graph/entityFollow.json
  • tests/validate-graph-entity-follow.test.ts

Comment thread ERD.puml
Comment thread README.md
The lexicon-map legend claimed every arrow is a `strongRef` or union
reference, but two arrows are scalar identifiers: `graph/follow` points
at an account via a `did` string, and the new `graph/entityFollow`
points at a record via an `at-uri` string.

Adding the entityFollow arrow turned a latent inaccuracy into a
pattern, so correct the claim in both README.md and SKILL.md rather
than describing only the new arrow.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 22, 2026 15:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Comment on lines +13 to +17
"subject": {
"type": "string",
"format": "at-uri",
"description": "AT-URI of the entity record being followed."
},

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The other way of doing this is an open union, as proposed by @Ashex in #236. That would allow follows to be not just weak refs but also strongRefs and anything else people want. That may or may not be practically useful - I'm not sure at this point, but I guess the point is that with an open union we don't have to know or care right now because it's always expandable later. The only minor downside is that it then needs to be wrapped in an object.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@Ashex I'm personally fine with either but think I marginally prefer #236. So this could be closed in favour of that if that's the general consensus.

@aspiers

aspiers commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #236.

@aspiers aspiers closed this Aug 3, 2026
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.

2 participants