Skip to content

fix: change nodeinfo version fallback behavior#365

Merged
dahlia merged 4 commits intofedify-dev:mainfrom
dodok8:dodok8-fix-issue-353
Aug 11, 2025
Merged

fix: change nodeinfo version fallback behavior#365
dahlia merged 4 commits intofedify-dev:mainfrom
dodok8:dodok8-fix-issue-353

Conversation

@dodok8
Copy link
Contributor

@dodok8 dodok8 commented Aug 11, 2025

Summary

Implementation of the immediate fix mentioned in #353, which supports non-Semver version strings.

Related Issue

Changes

  • Change fallback behavior of parseSoftware() to handle non-Semver number string.

Benefits

  • Since the version field of the nodeinfo specification doesn't have to be semver, it supports other formats.

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

Include any other information, context, or considerations.

@dodok8 dodok8 marked this pull request as ready for review August 11, 2025 10:58
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

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!

I've updated the parseSoftware function to improve its handling of version strings that do not strictly adhere to Semver. Previously, if a version string couldn't be parsed as Semver, it would default to 0.0.0. Now, the function attempts a more intelligent fallback, extracting major, minor, and patch components from non-Semver strings, which aligns better with the flexibility allowed by the NodeInfo specification. This change enhances the robustness and compatibility of the NodeInfo client.

Highlights

  • Enhanced Version Parsing: The parseSoftware function now includes a more intelligent fallback for non-Semver version strings. Instead of defaulting to 0.0.0 on parse failure, it attempts to extract major, minor, and patch numbers from dot-separated strings (e.g., "2.81" becomes 2.81.0).
  • Improved Compatibility: This change makes the parseSoftware function more resilient and compatible with NodeInfo implementations that use non-standard version formats, as the NodeInfo specification does not strictly require Semver.
  • New Test Cases: Added comprehensive test cases to client.test.ts to validate the new fallback behavior, covering various non-Semver formats like "2.81", "3", and "2.1.3.4".
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 or fill out our survey to provide feedback.

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 component/nodeinfo NodeInfo related priority/medium Medium priority issues runtime/deno Deno runtime related status/in progress In progress type/bug Something isn't working labels Aug 11, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

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 introduces a fallback mechanism to handle non-SemVer version strings in parseSoftware, which is a good improvement for robustness. The implementation is accompanied by relevant test cases. My review includes suggestions to refactor the new logic for conciseness and to improve the new tests by making them data-driven, which will enhance maintainability.

@dodok8
Copy link
Contributor Author

dodok8 commented Aug 11, 2025

Which part of changes.md should this change be added to, 1.9.0 or 1.8.5?

@github-actions
Copy link
Contributor

github-actions bot commented Aug 11, 2025

The docs for this pull request have been published:

https://09a677b1.fedify.pages.dev

Copy link
Contributor

@ThisIsMissEm ThisIsMissEm left a comment

Choose a reason for hiding this comment

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

Maybe it's better not to treat version as a parseable string? It's that or make nodeinfo enforce semver.

@dahlia
Copy link
Member

dahlia commented Aug 11, 2025

@ThisIsMissEm For the long term, we should change the type of the version field from SemVer to string, but as it's a breaking change, we need to improve our best effort parsing for now (see also #353 (comment)).

@dahlia
Copy link
Member

dahlia commented Aug 11, 2025

@dodok8 It should be 1.9.0.

@ThisIsMissEm
Copy link
Contributor

@ThisIsMissEm For the long term, we should change the type of the version field from SemVer to string, but as it's a breaking change, we need to improve our best effort parsing for now (see also #353 (comment)).

@dahlia okay, good to know. Perhaps we can create an issue for "change version from SemVer to string, and label it as "next version", that way we don't forget about it for 1.9.0

@dahlia
Copy link
Member

dahlia commented Aug 11, 2025

Filed an issue #366 for Fedify 2.0.

@github-actions
Copy link
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.365.1365+06363db2 JSR npm
@fedify/cli 1.9.0-pr.365.1365+06363db2 JSR
@fedify/amqp 1.9.0-pr.365.1365+06363db2 JSR npm
@fedify/elysia 1.9.0-pr.365.1365+06363db2 npm
@fedify/express 1.9.0-pr.365.1365+06363db2 JSR npm
@fedify/h3 1.9.0-pr.365.1365+06363db2 JSR npm
@fedify/nestjs 1.9.0-pr.365.1365+06363db2 npm
@fedify/next 1.9.0-pr.365.1365+06363db2 [npm][npm:@fedify/next]
@fedify/postgres 1.9.0-pr.365.1365+06363db2 JSR npm
@fedify/redis 1.9.0-pr.365.1365+06363db2 JSR npm
@fedify/sqlite 1.9.0-pr.365.1365+06363db2 JSR npm
@fedify/testing 1.9.0-pr.365.1365+06363db2 JSR npm

@dahlia dahlia merged commit 51a36a2 into fedify-dev:main Aug 11, 2025
10 checks passed
@dodok8 dodok8 deleted the dodok8-fix-issue-353 branch August 23, 2025 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/nodeinfo NodeInfo related priority/medium Medium priority issues runtime/deno Deno runtime related status/in progress In progress type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fedify nodeinfo reports snac's nodeinfo as invalid

3 participants