Skip to content

Three deprecated symbols are missing the deprecated option, so the deprecation never reaches generated SDKs #74

Description

@deepspace28

Three symbols are documented as deprecated in their comments but carry no deprecated option, so the deprecation never reaches generated SDKs. The repo already applies the option correctly in two other places, so this reads as an oversight rather than a decision.

Filing as an issue rather than a PR because CONTRIBUTING lists adding or modifying options as a non-accepted contribution — these are yours to own. Happy to send the patch if you would rather have it that way, but I did not want to open a PR against your stated policy.

Missing

Location Comment
proto/xai/api/v1/chat.proto:63optional int32 n = 8; "PLEASE NOTE: This field is deprecated and will be removed in the future."
proto/xai/api/v1/usage.proto:35int32 num_sources_used = 8; "[DEPRECATED - live search feature has been deprecated so this field is redundant]"
proto/xai/api/v1/documents.proto:64enum RankingMetric "Deprecated: Metric now comes from what is set in the collection creation."

Already correct, for contrast

  • proto/xai/api/v1/chat.proto:596ROLE_FUNCTION = 4 [deprecated = true];
  • proto/xai/api/v1/documents.proto:92optional RankingMetric ranking_metric = 4 [deprecated = true];

Note the third row is the enum type RankingMetric. Its only consumer is ranking_metric, which is already deprecated, so marking the enum has no live callers.

Why it matters

buf.gen.yaml generates Python and TypeScript SDKs from these definitions, and the option is what surfaces the deprecation to end users — @deprecated JSDoc in bufbuild/es output (IDE strikethrough), and the deprecation marker in the Python/pyi output. Without it, someone writing against n or num_sources_used gets no signal from their editor, and the comment is only visible to people reading the .proto directly.

Measured with buf generate using buf.build/bufbuild/es:v2.8.0, counting @deprecated in the generated TypeScript before and after adding the three options:

Generated file before after
chat_pb.ts 1 2
usage_pb.ts 0 1
documents_pb.ts 1 3

(documents_pb.ts gains two because the enum's generated schema constant is annotated alongside the enum.)

Suggested change

// chat.proto
optional int32 n = 8 [deprecated = true];

// usage.proto
int32 num_sources_used = 8 [deprecated = true];

// documents.proto
enum RankingMetric {
  option deprecated = true;
  ...
}

Verified locally against 723dd2a with buf 1.72.0 — buf build, buf lint (your MINIMAL set) and buf breaking --against .git#ref=HEAD all pass. Adding the option changes no field numbers, types or wire format, so it is backward compatible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions