Skip to content

Add elasticgraph-proto_ingestion schema artifacts#1080

Open
jwils wants to merge 1 commit into
mainfrom
joshuaw/protobuf-schema-generation
Open

Add elasticgraph-proto_ingestion schema artifacts#1080
jwils wants to merge 1 commit into
mainfrom
joshuaw/protobuf-schema-generation

Conversation

@jwils

@jwils jwils commented Mar 22, 2026

Copy link
Copy Markdown
Collaborator

Why

What

  • add a new elasticgraph-proto_ingestion extension gem that generates schema.proto and proto_field_numbers.yaml
  • keep schema.proto on public GraphQL field names while storing private name_in_index overrides in the sidecar mapping file
  • emit the generated schema.proto artifact preamble with protobuf // comments so it remains valid proto syntax
  • preserve field numbers across public renames via field.renamed_from and update repo wiring/docs/tests

Referencing external proto enum types (proto_external_types) is split out into the stacked follow-up PR #1286.

Notes for review

  • elasticgraph-proto_ingestion is fully independent of elasticgraph-json_ingestion — no runtime or development dependency. Its specs activate only the proto extension; the rename-preservation specs use a minimal FieldRenameSupport spec extension that records renamed_from metadata on the schema-definition state, since proto generation duck-types against that state rather than depending on a specific ingestion extension. When no extension provides rename metadata, rename migration is skipped (covered by a dedicated spec).
  • Known open design question, flagged for discussion: enum value numbers are currently assigned positionally (1..n), so removing or inserting an enum value renumbers subsequent values. Message field numbers are pinned via proto_field_numbers.yaml; enum value numbers are not yet. If we want wire-format stability for enums before first release, the sidecar mechanism could be extended to them.

Verification

  • script/quick_build (the one spec failure on this machine — cli_new_spec under bundler 4 — reproduces identically on main and is environmental)
  • script/type_check, script/lint, script/spellcheck
  • script/run_gem_specs elasticgraph-proto_ingestion (100% line + branch coverage)
  • remaining run_misc_checks steps that CI previously never reached: config artifacts, dependency diagrams, CI yaml, licenses, README snippets, rake site:validate

References

@jwils jwils force-pushed the joshuaw/protobuf-schema-generation branch from 2e0e4a1 to 53ea492 Compare March 22, 2026 22:54
@jwils jwils force-pushed the joshauw/pluggable-ingestion-serializers branch from a3cfa5c to 9e6f39a Compare March 22, 2026 22:57
@jwils jwils force-pushed the joshuaw/protobuf-schema-generation branch 3 times, most recently from 4325d51 to fd8dd47 Compare March 23, 2026 04:10
@jwils jwils force-pushed the joshauw/pluggable-ingestion-serializers branch from 9e6f39a to c408a50 Compare March 23, 2026 04:10
@jwils jwils force-pushed the joshuaw/protobuf-schema-generation branch from fd8dd47 to bdce7fb Compare March 26, 2026 14:32
@jwils jwils force-pushed the joshauw/pluggable-ingestion-serializers branch from c408a50 to 5717334 Compare March 26, 2026 14:32
@jwils jwils force-pushed the joshauw/pluggable-ingestion-serializers branch 12 times, most recently from 0607029 to 40815e1 Compare April 4, 2026 21:53
@jwils jwils force-pushed the joshuaw/protobuf-schema-generation branch 6 times, most recently from 6591c29 to 751db75 Compare April 5, 2026 15:31
@jwils jwils force-pushed the joshauw/pluggable-ingestion-serializers branch 4 times, most recently from b2e8d34 to 6969f84 Compare May 6, 2026 15:42
@jwils jwils force-pushed the joshuaw/protobuf-schema-generation branch from 5a5bb53 to c5cd7b8 Compare June 11, 2026 15:28
@jwils jwils force-pushed the joshuaw/indexer-ingestion-adapters branch 5 times, most recently from 908b4c9 to 247ac28 Compare June 16, 2026 21:37
@jwils jwils force-pushed the joshuaw/protobuf-schema-generation branch from c5cd7b8 to 2f7471a Compare June 16, 2026 21:39
@jwils jwils changed the base branch from joshuaw/indexer-ingestion-adapters to main June 16, 2026 21:39
@jwils jwils force-pushed the joshuaw/protobuf-schema-generation branch 3 times, most recently from 070849e to ce625bc Compare June 16, 2026 23:27
@jwils jwils force-pushed the joshuaw/protobuf-schema-generation branch 2 times, most recently from e9902f1 to f069179 Compare June 29, 2026 19:47
@jwils jwils marked this pull request as ready for review June 29, 2026 20:20
@jwils jwils force-pushed the joshuaw/protobuf-schema-generation branch 2 times, most recently from 5efeb79 to 7d428d5 Compare July 1, 2026 20:55
Comment thread elasticgraph-protobuf/elasticgraph-protobuf.gemspec Outdated
@jwils jwils force-pushed the joshuaw/protobuf-schema-generation branch from 7d428d5 to 9acfed5 Compare July 4, 2026 01:38
@jwils jwils changed the title Add elasticgraph-protobuf schema artifacts Add elasticgraph-proto_ingestion schema artifacts Jul 4, 2026
Adds `elasticgraph-proto_ingestion`, a self-contained schema-definition
extension that generates Protocol Buffers schema artifacts from an
ElasticGraph schema.

Running `schema_artifacts:dump` emits:

- `schema.proto` — the generated Protobuf schema for the indexed types
- `proto_field_numbers.yaml` — a sidecar that reserves field numbers so they
  stay stable as the schema evolves (including across field renames)

Capabilities:

- Maps built-in ElasticGraph scalars to proto types, with `proto_field` to
  configure custom scalars.
- Generates messages for object/interface/union types and enums (with a
  zero-valued `*_UNSPECIFIED` entry), escaping proto reserved words and
  wrapping nested lists so the output stays valid.
- `proto_enum_mappings` reuses enum values already maintained elsewhere.

The generator emits `proto3` by default and can emit `proto2` via
`syntax: :proto2` (which labels every field `optional`/`repeated`). Arbitrary
file-level headers (e.g. `option` declarations) can be injected verbatim via
`headers:`, so language-specific options can be set without baking any
particular convention into the gem.
@jwils jwils force-pushed the joshuaw/protobuf-schema-generation branch from 9acfed5 to 4fe8938 Compare July 4, 2026 12:59
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.

2 participants