Skip to content

Add protobuf publishing test support - #1441

Merged
jwils merged 2 commits into
mainfrom
joshuaw/proto-indexing-parity
Nov 9, 2026
Merged

jwils merged 2 commits into
mainfrom
joshuaw/proto-indexing-parity

Conversation

@jwils

@jwils jwils commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

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-indexing-parity branch from 40f7957 to d471d9f Compare October 29, 2026 15:35
@jwils jwils changed the title Enable protobuf indexer parity tests Add protobuf publishing test support Oct 29, 2026
@jwils
jwils added this pull request to stack #1443 October 29, 2026 15:53
@jwils
jwils force-pushed the joshuaw/proto-indexing-parity branch from ad917c8 to fad65f3 Compare November 2, 2026 00:07
@CLAassistant

CLAassistant commented Nov 4, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Compile generated schemas and publish real protobuf event batches so
future indexing specs can exercise the wire format. Keep the publisher
independent of the production adapter and support historical schema
snapshots with separate descriptor pools. Cache compiled descriptors by
schema source so each unique schema runs `protoc` only once.

Declare `elasticgraph-indexer` and `google-protobuf` as runtime
dependencies of `elasticgraph-proto_ingestion`, since the ingestion
adapter needs both in production.
@jwils
jwils force-pushed the joshuaw/proto-indexing-parity branch from 82f96ee to b0e3f84 Compare November 5, 2026 20:08
@jwils
jwils merged commit f1503c8 into main Nov 9, 2026
25 checks passed
@jwils
jwils deleted the joshuaw/proto-indexing-parity branch November 9, 2026 16:29
jwils added a commit that referenced this pull request Nov 29, 2026
## Why

The indexer needs datastore hashes, but protobuf publishers produce
native messages. Converting them into public record hashes first adds a
full traversal and extra allocations.

## What

Prepare native protobuf messages directly into datastore records in one
pass using the generated protobuf runtime metadata and `google-protobuf`
descriptors.

## How

`ProtoIngestion::RecordPreparer` caches field plans built from protobuf
descriptors. Sparse runtime metadata supplies field-name overrides, enum
names, and scalar types. Renamed built-in scalars retain their indexing
preparers, and enum symbols and numbers map consistently across Ruby
runtimes.

The preparer applies shared scalar rules, unwraps abstract `oneof`
records, prepares message scalars such as `google.protobuf.Timestamp`
from their canonical protobuf JSON form through the scalar's indexing
preparer, and parses and canonicalizes `Untyped` leaves. The shared
indexing pipeline adds `__counts` afterward.

Preserves field presence, explicit defaults, exact 64-bit integers,
nested lists, and concrete types in a single pass.

## Risk

Adds `ProtoIngestion::RecordPreparer` and
`RuntimeMetadata::Schema.from_schema_artifacts`, which become active
when #1450 registers the protobuf ingestion adapter. Runtime
dependencies are `elasticgraph-indexer` and `google-protobuf`.

## Testing

No manual testing. Covered by integration specs in
`record_preparer_spec.rb` and unit specs in
`runtime_metadata/schema_spec.rb`.

## Bigger picture

Builds on #1441's protobuf publishing test support. Native record
validation, adapter registration, and activation of the shared indexing
parity suite follow in #1450.

---------

Signed-off-by: Josh Wilson <joshuaw@squareup.com>
Co-authored-by: Neon <f833053fa3445a7878359a1bd17c4f6b4ed1ceb3e7414f306f4929b1f9032d02@buzz>
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.

3 participants