Skip to content

Prepare native protobuf records for indexing - #1442

Draft
jwils wants to merge 3 commits into
mainfrom
joshuaw/proto-record-conversion
Draft

jwils wants to merge 3 commits into
mainfrom
joshuaw/proto-record-conversion

Conversation

@jwils

@jwils jwils commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

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, formats google.protobuf.Timestamp values directly from seconds and nanos, 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 across proto2 and proto3 in record_preparer_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.

@jwils
jwils added this pull request to stack #1443 October 29, 2026 15:53
@jwils jwils changed the title Convert protobuf records for indexing Prepare native protobuf records for indexing Oct 29, 2026
@jwils
jwils force-pushed the joshuaw/proto-record-conversion branch from 7ec74bf to 7fb2796 Compare November 2, 2026 00:07
@jwils
jwils force-pushed the joshuaw/proto-record-conversion branch 2 times, most recently from 2af56fe to 11abf6f Compare November 5, 2026 20:08
@jwils
jwils force-pushed the joshuaw/proto-record-conversion branch from 11abf6f to bda3128 Compare November 9, 2026 15:58
Base automatically changed from joshuaw/proto-indexing-parity to main November 9, 2026 16:29
jwils added 2 commits November 9, 2026 10:29
Keep scalar metadata when built-in names are customized. Accept numeric enum values from JRuby and avoid native message singleton mocks. Include a reproducible preparation benchmark.
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-record-conversion branch from 9d326d9 to bcddf29 Compare November 9, 2026 16:29

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