Skip to content

Pong.gauges value type is int64 but all documented gauge values are non-negative #10

Description

@bibonix

The gauges field in Pong (pong.proto:146) is declared as map<string, int64>. Every value the comment documents is non-negative: load (percent × 100, range 0–10000), clients (connected client count), version (a build counter that mirrors Welcome.minor, itself a uint32), brothers (peer set size), stalls (write-back-pressure count), and rtt (round-trip time in milliseconds). No gauge key is documented as carrying a signed value.

Using int64 admits negative values that have no defined protocol meaning. A receiver that encounters a negative load or rtt has no contract to consult: the field type accepts it, the comment says nothing about it. The version gauge is the sharpest inconsistency: it is said to match Welcome.minor, which is uint32. A gauges["version"] value of -1 satisfies the wire type but cannot equal any valid Welcome.minor.

Change map<string, int64> to map<string, uint64> at pong.proto:146. This rules out semantically impossible negative values and brings the type into line with the rest of the numeric fields in pong.proto, all of which use uint64.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions