Skip to content

fix(api): Modality zero-value and type-preserving observability attributes#25

Merged
connorcarpenter15 merged 2 commits into
ai-dynamo:mainfrom
tanmayv25:tanmayv-cleanup
Jul 17, 2026
Merged

fix(api): Modality zero-value and type-preserving observability attributes#25
connorcarpenter15 merged 2 commits into
ai-dynamo:mainfrom
tanmayv25:tanmayv-cleanup

Conversation

@tanmayv25

@tanmayv25 tanmayv25 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Two follow-ups from the schema extensibility/stability review, plus doc clarifications. Tightly scoped and mirrored in docs/api.md.

The generic tensor-type work that was originally on this branch has been dropped — a dtype-aware tensor (ergonomic-vs-raw, layout, dense/sparse) should be designed as one coherent piece when a real non-fp32 or tensor-inference consumer actually exists, not assembled speculatively now.

Changes

1. Fix the Modality zero-value foot-gun

MODALITY_UNSPECIFIED = 0 previously documented "treated as image," which permanently erased the old-client-vs-forgot-to-set distinction. Now UNSPECIFIED simply means the sender left it unset; no engine behavior is prescribed in the enum comment. Comment-only, non-breaking.

2. Type-preserving observability attributes

LoadInfo.attributes and RuntimeEvent.attributes change from map<string,string> to google.protobuf.Struct, so numeric / boolean / list telemetry keeps its JSON type on the wire instead of being flattened to strings. This also unifies them with the existing Struct bags (EngineError.details, KvSessionRef.attributes_struct). Implements #24.

3. Documentation

  • Enum-growth client rule: an unknown enum value MUST be treated as UNSPECIFIED/zero, never an error.
  • Note that durations/timestamps use explicit integer units (_ms / _unix_nanos) by design.

Compatibility & verification

  • Scope: 3 files (input.proto, observability.proto, docs/api.md).
  • protoc compile: OK
  • buf lint (STANDARD): PASS
  • buf breaking vs main: only the map→Struct change on the two attributes fields — intentionally wire-breaking, safe pre-adoption at schema revision 1.
  • markdownlint docs/api.md: 0 errors

Closes #24

🤖 Generated with Claude Code

…utes

Follow-ups from the extensibility review:

- Add tensor.proto with a DataType enum and a single row-major Tensor type
  (dense or sparse, any dtype). Replace DenseFloatTensor and SparseFloatTensor
  with Tensor across embedding, classification, and scoring outputs; collapse
  the EmbeddingOutput oneof to one field.
- Modality: drop the "0 = image" default so UNSPECIFIED just means unset.
- LoadInfo/RuntimeEvent attributes: map<string,string> -> google.protobuf.Struct
  so numeric, boolean, and list telemetry keeps its type on the wire.
- docs: document the enum-growth client rule and the explicit-integer-units
  choice for durations/timestamps; mirror all of the above in api.md.

Pre-adoption at schema revision 1, so the tensor-type and map->Struct changes
are intentionally wire-breaking.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@connorcarpenter15 connorcarpenter15 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM overall, but not sure we need a separate tensor.proto file yet. Can it be merged with inputs.proto?

@tanmayv25

Copy link
Copy Markdown
Contributor Author

I don't think inputs.proto is the right place as it is used by EmbeddingOutput.

Follow-ups from the extensibility review (tensor-type changes dropped;
that belongs in a dedicated design when a real consumer exists):

- Modality: drop the "0 = image" default so UNSPECIFIED just means unset.
- LoadInfo/RuntimeEvent attributes: map<string,string> -> google.protobuf.Struct
  so numeric, boolean, and list telemetry keeps its type on the wire instead of
  being flattened to strings.
- docs: document the enum-growth client rule and the explicit-integer-units
  choice for durations/timestamps; mirror the above in api.md.

The map->Struct change is intentionally wire-breaking; safe pre-adoption at
schema revision 1.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tanmayv25 tanmayv25 changed the title feat(api): unify tensor type, fix Modality zero-value, type observability attributes fix(api): Modality zero-value and type-preserving observability attributes Jul 17, 2026
@connorcarpenter15
connorcarpenter15 merged commit 1b28e6d into ai-dynamo:main Jul 17, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

observability: replace lossy map<string,string> attributes with google.protobuf.Struct

2 participants