Skip to content

README and docs treat Metric.unit as nullable; the field is non-nullable #63

@nficano

Description

@nficano

Metric.unit is declared val unit: String (non-nullable) at lib/src/main/kotlin/dev/arcp/messages/Telemetry.kt:56, and ARCPRuntime.handleMetric at lib/src/main/kotlin/dev/arcp/runtime/ARCPRuntime.kt:304 passes it directly to Currency(metric.unit), which requires a non-blank value. The README quickstart at README.md:176 and README.md:225, however, dereferences the field as ${m.unit ?: ""}, which only makes sense if the field were nullable. A reader following the README either pastes code that compiles with a "Elvis operator on non-nullable receiver" warning or assumes runtime metrics can omit the unit — neither of which matches the wire schema. The guides under docs/guides/job-events.md use the same idiom in the streamed snippets.

Fix prompt: Drop the ?: "" and print ${m.unit} directly in all README and docs snippets. While editing, audit other code samples that dereference Metric fields and verify each matches the actual declared nullability. If the intent is to allow the unit to be omitted on the wire, change Telemetry.kt to val unit: String? = null and propagate the change through ARCPRuntime.handleMetric and BudgetAmount/Currency callers — but that is a larger schema change and should be its own issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationseverity:lowLow severity issue

    Type

    No type
    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