fix: change nodeinfo version fallback behavior#365
Conversation
There was a problem hiding this comment.
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
parseSoftwarefunction now includes a more intelligent fallback for non-Semver version strings. Instead of defaulting to0.0.0on parse failure, it attempts to extract major, minor, and patch numbers from dot-separated strings (e.g., "2.81" becomes2.81.0). - Improved Compatibility: This change makes the
parseSoftwarefunction 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.tsto 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
-
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. ↩
There was a problem hiding this comment.
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.
|
Which part of changes.md should this change be added to, 1.9.0 or 1.8.5? |
|
The docs for this pull request have been published: |
ThisIsMissEm
left a comment
There was a problem hiding this comment.
Maybe it's better not to treat version as a parseable string? It's that or make nodeinfo enforce semver.
|
@ThisIsMissEm For the long term, we should change the type of the |
|
@dodok8 It should be 1.9.0. |
@dahlia okay, good to know. Perhaps we can create an issue for "change |
|
Filed an issue #366 for Fedify 2.0. |
|
The latest push to this pull request has been published to JSR and npm as a pre-release:
|
Summary
Implementation of the immediate fix mentioned in #353, which supports non-Semver version strings.
Related Issue
Changes
parseSoftware()to handle non-Semver number string.Benefits
Checklist
deno task test-allon your machine?Additional Notes
Include any other information, context, or considerations.