GoToSocial interaction controls vocabulary#622
Conversation
The preloaded `https://gotosocial.org/ns` JSON-LD context was outdated, containing only the deprecated property names (`always`, `approvalRequired`). Update it to match the current GoToSocial v0.21+ namespace, which includes: - New type terms: `LikeRequest`, `ReplyRequest`, `AnnounceRequest`, `LikeAuthorization`, `ReplyAuthorization`, `AnnounceAuthorization`, `QuoteRequest`, `QuoteAuthorization` - New property terms: `automaticApproval`, `manualApproval`, `interactingObject`, `interactionTarget`, `likeAuthorization`, `replyAuthorization`, `announceAuthorization`, `canQuote`, `quoteAuthorization` - Boolean properties: `hidesToPublicFromUnauthedWeb`, `hidesCcPublicFromUnauthedWeb` - Deprecated terms retained for backward compatibility Part of fedify-dev#453 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add type-safe vocabulary support for GoToSocial's interaction controls,
which allow post authors to specify who can like, reply to, or announce
their posts and to approve interactions.
New typeless embedded types (like Endpoints):
- InteractionPolicy: attached to posts via interactionPolicy, contains
canLike, canReply, and canAnnounce sub-policies
- InteractionRule: each sub-policy with automaticApproval and
manualApproval URI lists
New Activity subtypes for requesting interaction approval:
- LikeRequest, ReplyRequest, AnnounceRequest
New Object subtypes for proving approved interactions:
- LikeAuthorization, ReplyAuthorization, AnnounceAuthorization
(with interactingObject and interactionTarget properties)
New properties on Object:
- interactionPolicy, approvedBy, likeAuthorization,
replyAuthorization, announceAuthorization
All Object subtypes now include the GoToSocial namespace context
(https://gotosocial.org/ns) in their defaultContext so that inherited
GTS properties serialize correctly in compact JSON-LD.
Part of fedify-dev#453
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add changelog entries for the new vocabulary types and properties added for GoToSocial interaction controls (issue fedify-dev#453), under both the @fedify/vocab and @fedify/vocab-runtime package sections. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Change likeAuthorization, replyAuthorization, and announceAuthorization properties on Object from anyURI (scalar) to their corresponding Authorization types (non-scalar), enabling dereferencing accessors (e.g., Object.getLikeAuthorization()). Also fix the LikeAuthorization alias in the preloaded GTS context to map to the actual type URI (gts:LikeApproval), and update the context entry order to match the upstream GoToSocial namespace. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request integrates GoToSocial's interaction control mechanisms into the Fedify framework, providing developers with the tools to manage and enforce interaction policies on posts. The changes involve extending the vocabulary with new types and properties, updating the JSON-LD context for GoToSocial, and ensuring compatibility with the latest Deno environment. This enhancement allows for more granular control over post interactions within federated applications. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
@codex review |
There was a problem hiding this comment.
Code Review
This pull request adds vocabulary support for GoToSocial's interaction controls, which is a valuable addition for interoperability. The changes are extensive, including new vocabulary definitions in YAML, updating the preloaded JSON-LD context, and adjusting tests accordingly. The code is well-structured and follows the project's patterns.
However, I've identified a significant inconsistency regarding the type URIs for ReplyAuthorization and AnnounceAuthorization. The current implementation seems to contradict the official GoToSocial documentation, which could lead to federation issues. I have provided detailed comments and suggestions on the relevant files to align the implementation with the documentation and ensure correctness.
There was a problem hiding this comment.
Pull request overview
Adds GoToSocial “interaction controls” vocabulary support to @fedify/vocab and updates @fedify/vocab-runtime’s preloaded https://gotosocial.org/ns JSON-LD context to match current GoToSocial v0.21+ terms.
Changes:
- Introduces new GoToSocial interaction policy / approval vocab types (policy/rule value objects, request activities, authorization objects) and wires them into
Object. - Updates default JSON-LD contexts across generated vocab schemas/tests to include
https://gotosocial.org/ns. - Updates the preloaded GoToSocial JSON-LD context (and fixtures) plus bumps Deno toolchain versions/configs.
Reviewed changes
Copilot reviewed 71 out of 76 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/vocab/src/vocab.test.ts | Updates JSON-LD context expectations and adjusts auto toJsonLd assertions for non-entity types. |
| packages/vocab/src/snapshots/vocab.test.ts.snap | Updates snapshots to reflect new Object properties and new GoToSocial types. |
| packages/vocab/src/object.yaml | Adds interactionPolicy, approvedBy, and authorization-related properties to Object; adds GoToSocial context. |
| packages/vocab/src/interactionpolicy.yaml | Adds typeless InteractionPolicy value object schema. |
| packages/vocab/src/interactionrule.yaml | Adds typeless InteractionRule value object schema. |
| packages/vocab/src/likerequest.yaml | Adds LikeRequest activity type schema. |
| packages/vocab/src/replyrequest.yaml | Adds ReplyRequest activity type schema. |
| packages/vocab/src/announcerequest.yaml | Adds AnnounceRequest activity type schema. |
| packages/vocab/src/likeauthorization.yaml | Adds LikeAuthorization (GoToSocial LikeApproval) object schema. |
| packages/vocab/src/replyauthorization.yaml | Adds ReplyAuthorization object schema. |
| packages/vocab/src/announceauthorization.yaml | Adds AnnounceAuthorization object schema. |
| packages/vocab/src/activity.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/accept.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/add.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/announce.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/application.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/arrive.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/article.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/audio.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/block.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/chatmessage.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/collection.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/collectionpage.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/create.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/delete.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/dislike.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/document.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/emojireact.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/event.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/flag.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/follow.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/group.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/ignore.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/image.yaml | Expands Image defaultContext to include data-integrity + GoToSocial. |
| packages/vocab/src/intransitiveactivity.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/invite.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/join.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/leave.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/like.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/listen.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/move.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/note.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/offer.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/orderedcollection.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/orderedcollectionpage.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/organization.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/page.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/person.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/place.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/profile.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/question.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/read.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/reject.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/relationship.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/remove.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/service.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/tentativeaccept.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/tentativereject.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/tombstone.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/travel.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/undo.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/update.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/video.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab/src/view.yaml | Adds GoToSocial context to defaultContext. |
| packages/vocab-runtime/src/contexts.ts | Updates preloaded https://gotosocial.org/ns JSON-LD context with newer GoToSocial terms and proper xsd:boolean typings. |
| packages/fixture/src/fixtures/gotosocial.org/ns.json | Adds fixture JSON-LD context for https://gotosocial.org/ns matching the updated preloaded context. |
| packages/fedify/src/federation/handler.test.ts | Updates expected JSON-LD contexts in handler tests to include GoToSocial namespace. |
| packages/fedify/src/sig/proof.test.ts | Updates expected proof value for createProof() test vector. |
| mise.toml | Bumps Deno tool version to 2.7.5. |
| .github/actions/setup-deno/action.yaml | Keeps CI Deno version in sync with mise.toml (2.7.5). |
| examples/fresh/deno.json | Adds deno.temporal to TS lib list for the Fresh example. |
| deno.lock | Updates lockfile entries consistent with dependency/tooling changes. |
| CHANGES.md | Documents new GoToSocial context update and vocab additions in the changelog. |
|
Codex Review: Didn't find any major issues. 🎉 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 82 files with indirect coverage changes 🚀 New features to boost your workflow:
|
|
@jfietkau Could you look into this when you have some spare time? |
2chanhaeng
left a comment
There was a problem hiding this comment.
LGTM!
Btw, I have some questions and suggestions(not necessary).
| "deno.ns", | ||
| "deno.unstable" | ||
| "deno.unstable", | ||
| "deno.temporal" |
There was a problem hiding this comment.
As I know, Temporal became stable in Deno version 2.7. Is there a reason why it was added back?
There was a problem hiding this comment.
Oh, this is my mistake. I misread it. Sorry!
There was a problem hiding this comment.
It's because Deno separated their deno.temporal library since Deno 2.7.5.
sij411
left a comment
There was a problem hiding this comment.
Looks good, but one thing that concerns me is the increased volume of the contexts. We could use conditional context in codegen? (for non-GTS users)
|
@sij411 Hmm, I guess we might be able to implement conditional contexts, but it's probably rather overkill to determine if a peer is using GoToSocial or not… |
|
Yeah, I don't see any problems here at a glance. Will have to try it out to see if it does anything unexpected. It's true that the context could be slimmed down conditionally. However, doing that based on the remote server's software makes little sense to me either – especially since this vocabulary is already used by other implementations besides GoToSocial (currently WAFRN). Maybe that wasn't what was suggested. If anything, you could remove unused context definitions if none of the corresponding vocabulary is used in the current payload. It's up to you whether that benefit is worth the additional processing time. |
Summary
https://gotosocial.org/nsJSON-LD context in@fedify/vocab-runtimeto match the current GoToSocial v0.21+ namespace.New types
InteractionPolicyandInteractionRule— typeless embedded value objects (likeEndpoints) for expressing interaction sub-policiesLikeRequest,ReplyRequest,AnnounceRequest— Activity subtypes for requesting interaction approvalLikeAuthorization,ReplyAuthorization,AnnounceAuthorization— Object subtypes for proving approved interactions (withinteractingObjectandinteractionTargetproperties)New properties on
ObjectinteractionPolicy— the interaction policy for a postapprovedBy— URI referencing an authorization objectgetLikeAuthorization()/likeAuthorizationId,getReplyAuthorization()/replyAuthorizationId,getAnnounceAuthorization()/announceAuthorizationId— references to authorization objects proving approved interactionsCloses #453.
Test plan
mise run codegensucceedsmise run checkpassesmise run test:denopasses (all 28710 tests, 0 failures)mise run test:bunpasses