Skip to content

type: change ResourceDescriptor and Link interfaces - #403

Closed
dodok8 wants to merge 4 commits into
fedify-dev:mainfrom
dodok8:dodok8-fix-issue-402
Closed

type: change ResourceDescriptor and Link interfaces#403
dodok8 wants to merge 4 commits into
fedify-dev:mainfrom
dodok8:dodok8-fix-issue-402

Conversation

@dodok8

@dodok8 dodok8 commented Sep 1, 2025

Copy link
Copy Markdown
Member

Summary

Change ResourceDescriptor and Link interfaces to support OStatus 1.0 Draft 2

Related Issue

Changes

  • Add OStatusSubscribeLink
  • Change href field in Link Optional
  • Change links field of ResourceDescriptor to Array<Link | OStatusSubscribeLink>

Benefits

Describe the advantages or improvements brought by these changes.
Explain how these changes affect the project, users, or performance.

Checklist

  • Did you add a changelog entry to the CHANGES.md?
  • Did you write some relevant docs about this change (if it's a new feature)?
  • Did you write a regression test to reproduce the bug (if it's a bug fix)?
  • Did you write some tests for this change (if it's a new feature)?
  • Did you run deno task test-all on your machine?

Additional Notes

It's a breaking change about ctx.lookupWebFinger().

@gemini-code-assist gemini-code-assist Bot 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.

Summary of Changes

Hello @dodok8, 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 updates core data structures to improve compatibility with the OStatus 1.0 Draft 2 specification. It primarily involves refining how links are represented within resource descriptors, enabling support for specific OStatus subscription mechanisms and increasing the flexibility of link definitions.

Highlights

  • New Interface for OStatus Subscription: Introduced the OStatusSubscribeLink interface to specifically handle subscription links as defined in OStatus 1.0 Draft 2, including a template property for URI construction.
  • Optional Link Href: The href property in the Link interface has been made optional, allowing for more flexible link definitions where a direct URI might not always be present.
  • Expanded Resource Descriptor Links: The links property within the ResourceDescriptor interface now supports an array that can contain both standard Link objects and the newly added OStatusSubscribeLink objects, enhancing compatibility with OStatus specifications.
Using Gemini Code Assist

The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions github-actions Bot added activitypub/interop Interoperability issues component/webfinger WebFinger related status/in progress In progress type/enhancement labels Sep 1, 2025

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request updates the WebFinger JRD interfaces to support OStatus 1.0 Draft 2. The changes include making the href property on Link optional, adding a new OStatusSubscribeLink interface for subscription links, and updating the ResourceDescriptor to allow an array of either link type. My review has identified a few areas for improvement. Firstly, making href optional is a breaking change that should be clearly documented in the PR description and changelog. Secondly, the new OStatusSubscribeLink interface could be more complete by including optional properties from the standard Link interface. Finally, the union type for links is not a true discriminated union, which has implications for type-safety and API ergonomics that should be considered and documented. I've left specific comments with suggestions on these points.

Comment thread packages/fedify/src/webfinger/jrd.ts
Comment thread packages/fedify/src/webfinger/jrd.ts
Comment thread packages/fedify/src/webfinger/jrd.ts
@dodok8
dodok8 marked this pull request as draft September 1, 2025 14:05
@dodok8
dodok8 marked this pull request as ready for review September 2, 2025 06:26
@dodok8
dodok8 force-pushed the dodok8-fix-issue-402 branch from 9d754ef to 06adbe6 Compare September 2, 2025 06:49
@dodok8
dodok8 marked this pull request as draft September 2, 2025 07:04
@dodok8
dodok8 force-pushed the dodok8-fix-issue-402 branch from 06adbe6 to d4aadc2 Compare September 2, 2025 09:05
@github-actions

github-actions Bot commented Sep 2, 2025

Copy link
Copy Markdown
Contributor

The docs for this pull request have been published:

https://97e1ab00.fedify.pages.dev

@dodok8
dodok8 marked this pull request as ready for review September 2, 2025 09:30
@dodok8
dodok8 force-pushed the dodok8-fix-issue-402 branch from 1f37da4 to 713ff70 Compare September 2, 2025 09:31
Comment on lines +61 to +73
/**
* References a link. See also
* [OStatus 1.0 Draft 2](https://www.w3.org/community/ostatus/wiki/images/9/93/OStatus_1.0_Draft_2.pdf)
*/
export interface OStatusSubscribeLink {
rel: "http://ostatus.org/schema/1.0/subscribe";
/**
* A URI template (RFC 6570) that can be used to construct URIs by
* substituting variables. Used primarily for subscription endpoints
* where parameters like account URIs need to be dynamically inserted.
*/
template: string;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Instead of declaring a separate OStatusSubscribeLink type, how about adding a template field to the existing Link type? I think the template field might be useful even when the rel field is not "http://ostatus.org/schema/1.0/subscribe".

@dodok8 dodok8 Sep 2, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This way seems right; however, this PR and branch are mainly about separating types, so I'll close this PR and make a new PR after adding the template field and fixing the following problems.

@github-actions

github-actions Bot commented Sep 2, 2025

Copy link
Copy Markdown
Contributor

The latest push to this pull request has been published to JSR and npm as a pre-release:

Package Version JSR npm
@fedify/fedify 1.9.0-pr.403.1509+713ff700 JSR npm
@fedify/cli 1.9.0-pr.403.1509+713ff700 JSR
@fedify/amqp 1.9.0-pr.403.1509+713ff700 JSR npm
@fedify/cfworkers 1.9.0-pr.403.1509+713ff700 JSR npm
@fedify/denokv 1.9.0-pr.403.1509+713ff700 JSR
@fedify/elysia 1.9.0-pr.403.1509+713ff700 npm
@fedify/express 1.9.0-pr.403.1509+713ff700 JSR npm
@fedify/h3 1.9.0-pr.403.1509+713ff700 JSR npm
@fedify/hono 1.9.0-pr.403.1509+713ff700 JSR npm
@fedify/nestjs 1.9.0-pr.403.1509+713ff700 npm
@fedify/next 1.9.0-pr.403.1509+713ff700 npm
@fedify/postgres 1.9.0-pr.403.1509+713ff700 JSR npm
@fedify/redis 1.9.0-pr.403.1509+713ff700 JSR npm
@fedify/sqlite 1.9.0-pr.403.1509+713ff700 JSR npm
@fedify/sveltekit 1.9.0-pr.403.1509+713ff700 JSR npm
@fedify/testing 1.9.0-pr.403.1509+713ff700 JSR npm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

activitypub/interop Interoperability issues component/webfinger WebFinger related status/in progress In progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

type: extend Link type and ResourceDescriptor

2 participants