Skip to content

Add protobuf ingestion adapter and indexing parity - #1450

Open
jwils wants to merge 4 commits into
joshuaw/proto-record-conversionfrom
joshuaw/proto-ingestion-adapter
Open

jwils wants to merge 4 commits into
joshuaw/proto-record-conversionfrom
joshuaw/proto-ingestion-adapter

Conversation

@jwils

@jwils jwils commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Why

The indexer has a format-neutral IngestionAdapter seam and shared for_each_ingestion_format test suite (#1412), but the :proto format is still pending because elasticgraph-proto_ingestion does not yet validate native protobuf records or register a "proto" ingestion adapter.

What

Add ProtoIngestion::RecordValidator and ProtoIngestion::IngestionAdapter, wire ProtoIngestion::IndexerExtension to register "proto", and enable :proto across the shared indexer test suite.

How

ProtoIngestion::RecordValidator validates ElasticGraph constraints that protobuf wire decoding cannot express: unknown enum integer values, JsonSafeLong range, finite Float values, calendar Date strings, DateTime Timestamp bounds, LocalTime, TimeZone, and Untyped JSON payloads. Retained wire-contract checks (JsonSafeLong and enum membership) stay unsampled when skip_record_validation: true.

ProtoIngestion::IngestionAdapter validates incoming Event[Google::Protobuf::Message] records, unwraps top-level union/interface messages to their concrete subtype, verifies required rollover timestamps, and pairs events with ProtoIngestion::RecordPreparer without JSON schema version checks.

Risk

Activates "proto" ingestion when protobuf runtime metadata is present in the schema artifacts. Existing JSON ingestion paths are unchanged.

Testing

No manual testing. The schema evolution acceptance specs now run their old-event ingestion examples for both formats; the dump checks that guard JSON schema versions stay JSON-only. Ignoring old events for a deleted indexed type remains pending for :proto, since the current envelope reserves that type's alternative and the event decodes without a record.

Bigger picture

Completes the 3-PR protobuf indexing parity stack (#1441, #1442, #1450), running the shared elasticgraph-indexer unit, integration, and acceptance specs against both :json and :proto.

@jwils
jwils marked this pull request as draft November 2, 2026 00:56
@jwils
jwils added this pull request to stack #1443 November 2, 2026 00:56
@jwils
jwils force-pushed the joshuaw/proto-ingestion-adapter branch from 1cc170f to 9ec7bb3 Compare November 4, 2026 23:50
@jwils
jwils force-pushed the joshuaw/proto-ingestion-adapter branch from 9ec7bb3 to 0cdff9d Compare November 5, 2026 20:08
@jwils
jwils force-pushed the joshuaw/proto-ingestion-adapter branch from 0cdff9d to bc946a1 Compare November 9, 2026 15:58
@jwils
jwils force-pushed the joshuaw/proto-ingestion-adapter branch from bc946a1 to 8099960 Compare November 9, 2026 16:10
jwils added a commit that referenced this pull request Nov 9, 2026
## Why

The shared indexer specs need real protobuf publishers before they can
exercise protobuf ingestion. Their protobuf round trip is still a
placeholder.

## What

Add a test publisher that compiles `schema.proto`, encodes event
batches, and decodes native protobuf records. Extract the shared
`protoc` locator from the existing schema test helper.

## How

The publisher walks protobuf descriptors and uses the generated runtime
metadata for scalar and enum overrides. Each instance owns its
descriptor pool, so tests can encode with an older publisher and decode
with the current schema.

Focused specs cover proto2 and proto3, field presence, nested lists and
abstract types, exact 64-bit integers, timestamps, and disk-backed
artifacts. The publisher stays independent of the production record
preparer.

## Risk

Adds test support and declares runtime dependencies on
`elasticgraph-indexer` and `google-protobuf`. Protobuf ingestion remains
inactive; existing indexing examples stay pending.

## Testing

No manual testing.

## Bigger picture

This prepares the shared indexer parity suite for real protobuf
publishing. Record preparation (#1442) and adapter integration plus
parity-test activation (#1450) follow in this stack.
@jwils
jwils force-pushed the joshuaw/proto-ingestion-adapter branch from 8099960 to 05b08cc Compare November 9, 2026 16:29
@jwils
jwils force-pushed the joshuaw/proto-ingestion-adapter branch 2 times, most recently from e30d8f0 to 81cf6c4 Compare November 21, 2026 23:57
- Extract ElasticGraph::ProtoIngestion::Descriptors to deduplicate descriptor walking across RecordPreparer, RecordValidator, and IngestionAdapter
- Fix IngestionAdapter to check Google::Protobuf::MessageExts, handle repeated id_source paths on rollover targets, and guard against raise
- Validate DateTime fields overridden to protobuf string in RecordValidator
- Cover Duration, string DateTime, and repeated derived id_source rollover checks in indexing_parity_spec
- Fix RBS signatures and YARD return types

Co-authored-by: Josh Wilson <joshuaw@squareup.com>
Signed-off-by: Josh Wilson <joshuaw@squareup.com>
`record_preparer_spec` covers record preparation directly, so these examples now assert only on adapter and validator behavior.

Co-authored-by: Josh Wilson <joshuaw@squareup.com>
Signed-off-by: Josh Wilson <joshuaw@squareup.com>
…or both formats

Split the indexing parity spec into an integration parity spec and an
`IngestionAdapter` spec that drives the indexer, defines each schema once,
uses one example per case, and covers NaN floats and out-of-range
`DateTime` string components. Add an `IndexerExtension` spec.

In the schema evolution specs, move the JSON-only dump checks into their
own examples so that the old-event ingestion examples run for protobuf
too. Only the deleted indexed type example remains pending for protobuf.
Replace the `respond_to?` publisher capture with a hook each ingestion
format implements.

Co-authored-by: Josh Wilson <joshuaw@squareup.com>
Signed-off-by: Josh Wilson <joshuaw@squareup.com>
@jwils
jwils force-pushed the joshuaw/proto-ingestion-adapter branch from 81cf6c4 to 79f2aca Compare November 22, 2026 00:16
@jwils
jwils marked this pull request as ready for review November 22, 2026 18:04

This branch has not been deployed

No deployments
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.

1 participant