Repository navigation
Follow-ups to RecordPreparer: faster Timestamps, shared generated names, imported message zero values - #1472
Merged
Conversation
Collaborator
Author
|
This change is part of the following stack: Change managed by git-spice. |
myronmarston
force-pushed
the
myron/proto-record-preparer-followups
branch
2 times, most recently
from
November 29, 2026 02:12
4d2b0ef to
cefc153
Compare
myronmarston
marked this pull request as ready for review
November 29, 2026 02:18
myronmarston
requested review from
BrianSigafoos-SQ,
bsorbo,
ellisandrews-toast,
jwils,
jwondrusch,
marcdaniels-toast and
rossroberts-toast
as code owners
November 29, 2026 02:18
jwils
force-pushed
the
joshuaw/proto-record-conversion
branch
from
November 29, 2026 14:53
71db773 to
e58a6b4
Compare
Follow-ups to the protobuf `RecordPreparer`. Each change below gives its own reason.
- Format `google.protobuf.Timestamp` values with `Time.at(seconds, nanos, :nsec)` when the scalar uses the `DateTime` indexing preparer. Re-parsing an ISO 8601 string in `IndexingPreparers::DateTime` costs about 1.5 µs of the 2.0 µs spent per `Timestamp` value.
- Encode other message scalars with `emit_defaults: true`. The canonical protobuf JSON form omits zero-valued fields, so a `geo_point` scalar with `lat: 0` was prepared as `{"lon" => 5.5}`.
- Key the enum lookup by symbol only. Decoded messages return known enum values as symbols on both MRI and JRuby. Only a JRuby `RepeatedField#push(0)` keeps a number, and only the spec did that.
- Add `ProtoConversions::ABSTRACT_TYPE_ONEOF_NAME`, `LIST_WRAPPER_VALUES_FIELD_NAME` and `enum_value_prefix`, and use them in the schema generator and in `RecordPreparer`. Before this, a change to the generator could break preparation with no shared code to show the link.
- Let `ProtoPublisher` search extra proto paths for the files that `schema.proto` imports.
- Add specs for these cases:
- Truncation of sub-millisecond digits, negative `seconds` before 1970, and a `Timestamp` scalar with another indexing preparer.
- An imported message scalar with a zero-valued field.
- Nested lists of objects and abstract types, a list of `DateTime` values, camelCase fields, and a field named `value`. No spec failed before when list recursion dropped the nested mapping below the first level, when presence methods used snake_case names, or when a field named `value` marked a type as abstract.
Generated with Claude Code
myronmarston
force-pushed
the
myron/proto-record-preparer-followups
branch
from
November 29, 2026 20:54
cefc153 to
194fd1e
Compare
jwils
approved these changes
Nov 30, 2026
Addresses review feedback from PR #1472. - Read the list wrapper's field with `LIST_WRAPPER_VALUES_FIELD_NAME` instead of the hardcoded `values` accessor. Generated with Claude Code
myronmarston
enabled auto-merge (squash)
November 30, 2026 18:08
jwils
added a commit
that referenced
this pull request
Nov 30, 2026
- Use `ProtoConversions::ABSTRACT_TYPE_ONEOF_NAME` and `ProtoConversions::LIST_WRAPPER_VALUES_FIELD_NAME` in `Descriptors`, `RecordValidator`, and `IngestionAdapter` instead of hardcoded `"value"` / `"values"` names - Drop the unused `path` parameter from `RecordValidator#error_for` and extract `DATE_REGEX` - Consolidate `IngestionAdapter` `@update_targets` and `@ingestible_types` into `@update_targets_by_type` and make the non-ingestible error message accurate for concrete and abstract types - Replace `schema.respond_to?(:json_schema_version)` in `schema_evolution_spec.rb` with a format check and generalize the shared example descriptions - Close mutation-testing gaps in `ingestion_adapter_spec.rb` (`Date` trailing characters, renamed scalar error name, `camelCase` field presence, concrete field named `value`), use `:STATE_UNSPECIFIED`, and qualify top-level constants with `::` Co-authored-by: Neo <f833053fa3445a7878359a1bd17c4f6b4ed1ceb3e7414f306f4929b1f9032d02@buzz> Signed-off-by: Josh Wilson <joshuaw@squareup.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-ups to
RecordPreparerfrom #1442, proposed as a stacked PR.TimestampwasIndexingPreparers::DateTimere-parsing an ISO 8601 string. The direct format gives the same output: it truncates to milliseconds and handles negativeseconds.geo_pointscalar withlat: 0was indexed as{"lon" => 5.5}.RepeatedField#push(0)keeps a number, and only the spec did that.RecordPreparernow use the same constants for the names that the generator emits.ProtoPublisherkeeps its own derivation, so it stays an independent check.Evidence
expected {"location" => {"lat" => 0.0, "lon" => 5.5}}, got {"location" => {"lon" => 5.5}}.After: it passes.
Timestampshortcut ignores the scalar's preparer.Float.google.protobufas an object type.valuemarks a type as abstract.Timestampvalue on MRI 4.0, preparation takes 2.0 µs on the JSON path and 0.4 µs on the direct format.Merge Danger
Door: two-way
Blast Radius:
elasticgraph-proto_ingestion. The only effect outside it is a new optionalproto_paths:argument onSpecSupport::ProtoPublisher.🤖 Generated with Claude Code