Skip to content

fix: version numbers from proto3 messages follow camel case.#1868

Merged
nedvedba merged 1 commit intodevelfrom
1867-DAPS-fix-datafed-ws-proto3-version-number
Feb 23, 2026
Merged

fix: version numbers from proto3 messages follow camel case.#1868
nedvedba merged 1 commit intodevelfrom
1867-DAPS-fix-datafed-ws-proto3-version-number

Conversation

@JoshuaSBrown
Copy link
Collaborator

@JoshuaSBrown JoshuaSBrown commented Feb 23, 2026

Ticket

Description

How Has This Been Tested?

Artifacts (if appropriate):

Tasks

  • - A description of the PR has been provided, and a diagram included if it is a new feature.
  • - Formatter has been run
  • - CHANGELOG comment has been added
  • - Labels have been assigned to the pr
  • - A reviwer has been added
  • - A user has been assigned to work on the pr
  • - If new feature a unit test has been added

Summary by Sourcery

Align web server version handling with updated proto3-generated field names for API and release version checks.

Bug Fixes:

  • Fix API version compatibility checks to use camelCase proto3 reply fields instead of legacy snake_case names.
  • Update release version comparison logic to use new proto3-generated field names and generic version constants.

@JoshuaSBrown JoshuaSBrown self-assigned this Feb 23, 2026
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 23, 2026

Reviewer's Guide

Aligns web server JavaScript with updated proto3/camelCase fields for version and release metadata, and initializes global API version variables from the new version constants.

Sequence diagram for API version and release comparison in startServer

sequenceDiagram
    participant WebServer
    participant CoreServer

    WebServer->>CoreServer: sendVersionCheckRequest()
    CoreServer-->>WebServer: reply(apiMajor, apiMinor, apiPatch, releaseYear, releaseMonth, releaseDay, releaseHour, releaseMinute)

    alt noReply
        WebServer->>WebServer: logger.error(ERROR_NO_REPLY)
    else incompatibleApiVersion
        WebServer->>WebServer: logger.error(incompatible api version reply.apiMajor.reply.apiMinor.reply.apiPatch)
    else compatibleApiVersion
        WebServer->>WebServer: buildWarningMessage(reply.releaseYear, reply.releaseMonth, reply.releaseDay, reply.releaseHour, reply.releaseMinute)
        WebServer->>WebServer: compareRelease(reply.releaseYear, reply.releaseMonth, reply.releaseDay, reply.releaseHour, reply.releaseMinute, g_ver_release_year, g_ver_release_month, g_ver_release_day, g_ver_release_hour, g_ver_release_minute)
        opt newerReleaseDetected
            WebServer->>WebServer: logger.warning(warning_msg)
        end
    end
Loading

Flow diagram for release version comparison logic

flowchart TD
    A[Start release comparison] --> B{reply.releaseYear > g_ver_release_year?}
    B -->|Yes| W[Log warning]
    B -->|No| C{reply.releaseYear == g_ver_release_year?}
    C -->|No| Z[No warning]
    C -->|Yes| D{reply.releaseMonth > g_ver_release_month?}
    D -->|Yes| W
    D -->|No| E{reply.releaseMonth == g_ver_release_month?}
    E -->|No| Z
    E -->|Yes| F{reply.releaseDay > g_ver_release_day?}
    F -->|Yes| W
    F -->|No| G{reply.releaseDay == g_ver_release_day?}
    G -->|No| Z
    G -->|Yes| H{reply.releaseHour > g_ver_release_hour?}
    H -->|Yes| W
    H -->|No| I{reply.releaseHour == g_ver_release_hour?}
    I -->|No| Z
    I -->|Yes| J{reply.releaseMinute > g_ver_release_minute?}
    J -->|Yes| W
    J -->|No| Z
    W --> K[End]
    Z --> K
Loading

File-Level Changes

Change Details Files
Update use of version constants and reply fields to match new proto3/camelCase schema and expose API semver components.
  • Switch global release version variables to use RELEASE_* and MAJOR/MINOR/PATCH constants from the version module.
  • Introduce global API version variables (major/minor/patch) initialized from version.MAJOR/MINOR/PATCH.
  • Update all access to reply API version fields from snake_case (api_major/api_minor/api_patch) to camelCase (apiMajor/apiMinor/apiPatch).
  • Update all access to reply release timestamp fields from snake_case (release_year/month/day/hour/minute) to camelCase (releaseYear/releaseMonth/releaseDay/releaseHour/releaseMinute), including comparison logic and warning message formatting.
web/datafed-ws.js

Possibly linked issues

  • #[Bug] - DataFed Web server version numbers from Proto3 request: PR corrects proto3 camelCase version fields and API globals, fixing undefined.undefined.undefined version error in logs.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@JoshuaSBrown JoshuaSBrown added Type: Bug Something isn't working Priority: High Highest priority labels Feb 23, 2026
@nedvedba nedvedba merged commit eba87f5 into devel Feb 23, 2026
4 of 5 checks passed
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • The new g_ver_api_patch global is assigned but not used anywhere in this file; consider either removing it or incorporating it into the compatibility check/logging if patch-level comparison is intended.
  • The nested release date comparison logic (releaseYear/Month/Day/Hour/Minute) is quite deep; consider refactoring into a helper that converts the version fields to a comparable timestamp or numeric tuple to simplify readability and reduce branching.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `g_ver_api_patch` global is assigned but not used anywhere in this file; consider either removing it or incorporating it into the compatibility check/logging if patch-level comparison is intended.
- The nested release date comparison logic (`releaseYear`/`Month`/`Day`/`Hour`/`Minute`) is quite deep; consider refactoring into a helper that converts the version fields to a comparable timestamp or numeric tuple to simplify readability and reduce branching.

## Individual Comments

### Comment 1
<location path="web/datafed-ws.js" line_range="155-159" />
<code_context>
+g_ver_release_hour = version.RELEASE_HOUR;
+g_ver_release_minute = version.RELEASE_MINUTE;
+
+g_ver_api_major = version.MAJOR;
+g_ver_api_minor = version.MINOR;
+g_ver_api_patch = version.PATCH;

 g_version =
</code_context>
<issue_to_address>
**suggestion:** g_ver_api_patch is defined but not used in the compatibility logic, which suggests either dead state or incomplete use of patch versions.

Consider either using `g_ver_api_patch` in the compatibility logic (e.g., when major/minor are equal) or removing it to avoid a dead, misleading variable that never affects behavior.

```suggestion
g_ver_api_major = version.MAJOR;
g_ver_api_minor = version.MINOR;

g_version =
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +155 to 159
g_ver_api_major = version.MAJOR;
g_ver_api_minor = version.MINOR;
g_ver_api_patch = version.PATCH;

g_version =
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: g_ver_api_patch is defined but not used in the compatibility logic, which suggests either dead state or incomplete use of patch versions.

Consider either using g_ver_api_patch in the compatibility logic (e.g., when major/minor are equal) or removing it to avoid a dead, misleading variable that never affects behavior.

Suggested change
g_ver_api_major = version.MAJOR;
g_ver_api_minor = version.MINOR;
g_ver_api_patch = version.PATCH;
g_version =
g_ver_api_major = version.MAJOR;
g_ver_api_minor = version.MINOR;
g_version =

nedvedba added a commit that referenced this pull request Feb 23, 2026
* fix: prevent defaults being set to undefined, and interpret numbers a… (#1861)

* fix: prevent defaults being set to undefined, and interpret numbers and enums as strings.

* chore: Auto-format JavaScript files with Prettier

* fix: version numbers from proto3 messages follow camel case. (#1868)

---------

Co-authored-by: Joshua S Brown <joshbro42867@yahoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: High Highest priority Type: Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants