Skip to content

1845 daps refactor repo server to use proto3#1846

Merged
JoshuaSBrown merged 10 commits into1843-DAPS-refactor-core-server-to-use-proto3from
1845-DAPS-refactor-repo-server-to-use-proto3
Feb 7, 2026
Merged

1845 daps refactor repo server to use proto3#1846
JoshuaSBrown merged 10 commits into1843-DAPS-refactor-core-server-to-use-proto3from
1845-DAPS-refactor-repo-server-to-use-proto3

Conversation

@JoshuaSBrown
Copy link
Collaborator

@JoshuaSBrown JoshuaSBrown commented Feb 5, 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

Refactor the repository server to use the new proto3 envelope and version constants for messaging and version reporting.

Enhancements:

  • Replace legacy SDMS proto includes and protocol ID-based message mapping with the new proto3 envelope-based message mapping in the repository server.
  • Update version and API reporting in server responses and CLI output to use the new release and protocol version constants.
  • Improve logging of incoming protobuf message types via a ProtoBufMap lookup and standardize NACK error codes to the new enum values.

@JoshuaSBrown JoshuaSBrown self-assigned this Feb 5, 2026
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.

Sorry @JoshuaSBrown, your pull request is larger than the review limit of 150000 diff characters

@JoshuaSBrown JoshuaSBrown changed the base branch from 1843-DAPS-refactor-core-server-to-use-proto3 to devel February 5, 2026 17:39
@JoshuaSBrown JoshuaSBrown changed the base branch from devel to 1843-DAPS-refactor-core-server-to-use-proto3 February 5, 2026 17:39
@JoshuaSBrown JoshuaSBrown added Component: Core Relates to core service Priority: Medium Above average priority Type: Refactor Imlplementation change, same functionality labels Feb 5, 2026
@JoshuaSBrown
Copy link
Collaborator Author

@sourcery-ai review

….com:ORNL/DataFed into 1845-DAPS-refactor-repo-server-to-use-proto3
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 5, 2026

Reviewer's Guide

Refactors the repo server to use the unified proto3 envelope/message definitions instead of protocol-ID–based SDMS_Anon/Auth protos, and updates error codes and version reporting to match the new proto3 constants and layout.

Sequence diagram for proto3 envelope-based request handling in RepoServer

sequenceDiagram
  actor Client
  participant RepoServer
  participant RequestWorker
  participant ProtoBufMap
  participant MsgMapper
  participant Handler as RequestHandler

  Client->>RepoServer: Send Envelope(message_type, payload)
  RepoServer->>RequestWorker: Deliver Envelope

  activate RequestWorker
  RequestWorker->>MsgMapper: getMessageType(envelope_field_name)
  MsgMapper-->>RequestWorker: msg_type (uint16)

  RequestWorker->>ProtoBufMap: toString(msg_type)
  ProtoBufMap-->>RequestWorker: msg_name
  Note right of RequestWorker: Log received message using msg_name

  alt handler_registered
    RequestWorker->>Handler: invoke handler(msg_request)
    Handler-->>RequestWorker: response Envelope
  else no_handler
    RequestWorker-->>RequestWorker: create NackReply
    Note right of RequestWorker: err_code BAD_REQUEST
  end

  RequestWorker-->>RepoServer: response Envelope
  RepoServer-->>Client: Send response
  deactivate RequestWorker
Loading

Updated class diagram for RequestWorker and proto3 message handling

classDiagram
  class RequestWorker {
    - static map~uint16_t, msg_fun_t~ m_msg_handlers
    - unique_ptr~MsgMapper~ m_msg_mapper
    - MessageFactory m_msg_factory
    - bool m_run
    + void wait()
    + void setupMsgHandlers()
    + void workerThread(LogContext log_context)
    + unique_ptr~IMessage~ procVersionRequest(unique_ptr~IMessage~ msg_request)
    + unique_ptr~IMessage~ procDataDeleteRequest(unique_ptr~IMessage~ msg_request)
    + unique_ptr~IMessage~ procDataGetSizeRequest(unique_ptr~IMessage~ msg_request)
    + unique_ptr~IMessage~ procPathCreateRequest(unique_ptr~IMessage~ msg_request)
    + unique_ptr~IMessage~ procPathDeleteRequest(unique_ptr~IMessage~ msg_request)
  }

  class MsgMapper {
    + uint16_t getMessageType(string msg_name)
  }

  class ProtoBufMap {
    + string toString(uint16_t msg_type)
  }

  class MessageFactory {
    + unique_ptr~IMessage~ createResponseEnvelope(IMessage request)
  }

  class IMessage {
    <<interface>>
  }

  class AckReply {
    + void set_err_code(int code)
    + void set_err_msg(string msg)
  }

  class NackReply {
    + void set_err_code(int code)
    + void set_err_msg(string msg)
  }

  class VersionReply {
    + void set_release_year(int year)
    + void set_release_month(int month)
    + void set_release_day(int day)
    + void set_release_hour(int hour)
    + void set_release_minute(int minute)
    + void set_api_major(int major)
    + void set_api_minor(int minor)
    + void set_api_patch(int patch)
    + void set_component_major(int major)
    + void set_component_minor(int minor)
    + void set_component_patch(int patch)
  }

  namespace SDMS_release {
    class release_constants {
      <<static>>
      + int YEAR
      + int MONTH
      + int DAY
      + int HOUR
      + int MINUTE
    }
  }

  namespace SDMS_protocol_version {
    class protocol_version_constants {
      <<static>>
      + int MAJOR
      + int MINOR
      + int PATCH
    }
  }

  namespace SDMS_repository_version {
    class repository_version_constants {
      <<static>>
      + int MAJOR
      + int MINOR
      + int PATCH
    }
  }

  RequestWorker --> MsgMapper : uses for msg_type lookup
  RequestWorker --> ProtoBufMap : uses for msg_type logging
  RequestWorker --> MessageFactory : creates response envelopes
  RequestWorker ..> IMessage : processes
  MessageFactory ..> IMessage
  AckReply ..|> IMessage
  NackReply ..|> IMessage
  VersionReply ..|> IMessage
  RequestWorker --> AckReply
  RequestWorker --> NackReply
  RequestWorker --> VersionReply
  RequestWorker --> release_constants : uses
  RequestWorker --> protocol_version_constants : uses
  RequestWorker --> repository_version_constants : uses
Loading

File-Level Changes

Change Details Files
Switch message handling from protocol-ID plus SDMS_Anon/Auth message types to unified proto3 envelope-based message types.
  • Replace multiple SDMS*.pb.h includes with common/envelope.pb.h and remove SDMS::Anon/Auth namespace usage.
  • Change the SET_MSG_HANDLER macro to register handlers solely by message type name using the message mapper’s getMessageType(#msg).
  • Update setupMsgHandlers to register anonymous and authenticated message handlers without protocol IDs, relying on envelope field numbers.
  • Add ProtoBufMap usage in the worker thread to log human-readable message type names for incoming messages.
repository/server/RequestWorker.cpp
repository/server/RepoServer.cpp
Align error codes and version handling with the new proto3 constants and version namespaces.
  • Change NackReply error codes from legacy ID_* constants to the new proto3 enum values (e.g., INTERNAL_ERROR, BAD_REQUEST).
  • Update Version request handling to use SDMS::release and SDMS::protocol::version constants instead of Version::DATAFED_* macros.
  • Update repo server version check logic and CLI --version output to use release:: and protocol::version:: constants instead of Version.pb macros.
repository/server/RequestWorker.cpp
repository/server/RepoServer.cpp
repository/server/main.cpp
Clean up now-unused proto includes and prepare config header for proto3 usage.
  • Remove obsolete SDMS*.pb.h and Version.pb.h includes from server files now that envelope.pb.h is used.
  • Add include to Config.hpp, likely for future ownership semantics with proto3-related objects.
  • Leave generated Version.hpp.in unchanged, indicating version numbers are taken from new common headers instead of this file.
repository/server/RequestWorker.cpp
repository/server/RepoServer.cpp
repository/server/main.cpp
repository/server/Config.hpp
repository/server/Version.hpp.in

Possibly linked issues

  • #: PR refactors repository server to use Proto3 envelope and constants, implementing the requested Proto3 compatibility refactor.
  • #: PR updates repo server to proto3 envelope and version constants, directly implementing the proto3 refactor requested in issue.

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

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 left some high level feedback:

  • The new comment on setupMsgHandlers still refers to mapping by envelope field number, but the code now uses m_msg_mapper->getMessageType(#msg) with no protocol ID; consider updating the description to reflect that message types are resolved by name under a single protocol to avoid future confusion.
  • With the removal of protocol-specific IDs in SET_MSG_HANDLER, all handlers are now registered in a single namespace; if anonymous and authenticated messages can share names, you may want to document or enforce that these names remain unique to prevent subtle handler collisions.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new comment on setupMsgHandlers still refers to mapping by envelope field number, but the code now uses m_msg_mapper->getMessageType(#msg) with no protocol ID; consider updating the description to reflect that message types are resolved by name under a single protocol to avoid future confusion.
- With the removal of protocol-specific IDs in SET_MSG_HANDLER, all handlers are now registered in a single namespace; if anonymous and authenticated messages can share names, you may want to document or enforce that these names remain unique to prevent subtle handler collisions.

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.

…nvelope (#1849)

* [DAPS-1848] - refactor: update authz files to use proto3. (#1851)
* [DAPS-1850] - refactor web server proto3 (#1852)
@JoshuaSBrown JoshuaSBrown merged commit 4f04fed into 1843-DAPS-refactor-core-server-to-use-proto3 Feb 7, 2026
5 of 7 checks passed
JoshuaSBrown added a commit that referenced this pull request Feb 7, 2026
* [DAPS-1845] - refactor repo server to use proto3 (#1846)
* [DAPS-1847] - refactor: python package to be compatible with proto3 envelope (#1849)
* [DAPS-1848] - refactor: update authz files to use proto3. (#1851)
* [DAPS-1850] - refactor web server proto3 (#1852)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: Core Relates to core service Priority: Medium Above average priority Type: Refactor Imlplementation change, same functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant