Skip to content

Conversation

@w1am
Copy link
Contributor

@w1am w1am commented Nov 27, 2025

User description

  • Use unique field number for custom options

PR Type

Enhancement


Description

  • Changed custom option field number from 50000 to 2113

  • Ensures unique field numbering for protobuf extensions

  • Aligns with protobuf best practices for custom options


Diagram Walkthrough

flowchart LR
  A["EnumValueOptions Extension"] -- "error field" --> B["Field Number: 50000"]
  B -- "updated to" --> C["Field Number: 2113"]
Loading

File Walkthrough

Relevant files
Configuration changes
rpc.proto
Update ErrorMetadata extension field number                           

src/main/proto/kurrentdb/protocol/v2/rpc.proto

  • Updated ErrorMetadata extension field number from 50000 to 2113
  • Ensures unique field numbering for protobuf custom options
  • Maintains extension functionality with corrected field identifier
+1/-1     

@qodo-code-review
Copy link

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status:
No logging context: The change only updates a protobuf field number and does not add or modify any audit
logging for critical actions, which may be outside the scope of this PR.

Referred Code
// Extend EnumValueOptions to include error information for enum values
extend google.protobuf.EnumValueOptions {
  // Provides additional information about error conditions for automated
  // code generation and documentation.
  optional ErrorMetadata error = 2113;

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
No error handling: The diff changes only a protobuf option field number and introduces no runtime error
handling or edge-case logic, which may be handled elsewhere.

Referred Code
// Extend EnumValueOptions to include error information for enum values
extend google.protobuf.EnumValueOptions {
  // Provides additional information about error conditions for automated
  // code generation and documentation.
  optional ErrorMetadata error = 2113;

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status:
User-facing detail risk: The change references error metadata in protobuf options but does not indicate how
user-facing errors are rendered, which is outside this diff.

Referred Code
// Extend EnumValueOptions to include error information for enum values
extend google.protobuf.EnumValueOptions {
  // Provides additional information about error conditions for automated
  // code generation and documentation.
  optional ErrorMetadata error = 2113;

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status:
Logging not shown: No logging is added or modified in this change; compliance cannot be assessed from this
diff alone.

Referred Code
// Extend EnumValueOptions to include error information for enum values
extend google.protobuf.EnumValueOptions {
  // Provides additional information about error conditions for automated
  // code generation and documentation.
  optional ErrorMetadata error = 2113;

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status:
No input validation: The protobuf option field renumbering does not involve input handling or validation, so
security validation cannot be determined from this change.

Referred Code
// Extend EnumValueOptions to include error information for enum values
extend google.protobuf.EnumValueOptions {
  // Provides additional information about error conditions for automated
  // code generation and documentation.
  optional ErrorMetadata error = 2113;

Learn more about managing compliance generic rules or creating your own custom rules

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-code-review
Copy link

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Use conventional custom option field number

Revert the field number for the custom option error to a value within the
recommended range (50000-536,870,911) to avoid potential conflicts with standard
protobuf options.

src/main/proto/kurrentdb/protocol/v2/rpc.proto [76]

-optional ErrorMetadata error = 2113;
+optional ErrorMetadata error = 50000;
  • Apply / Chat
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies that the new field number 2113 violates protobuf's best practice for custom options, which can cause future compatibility issues.

Medium
  • More

@w1am w1am merged commit 739b61a into trunk Nov 27, 2025
38 of 42 checks passed
@w1am w1am deleted the w1am/use-unique-custom-option branch November 27, 2025 17:09
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

@w1am 👉 Created pull request targeting release/v1.1: #356

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants