Skip to content

Register nested sourced_from path segments on the root index#1242

Merged
myronmarston merged 3 commits into
block:mainfrom
ellisandrews-toast:populate-sourced-from-nested-paths
Jun 10, 2026
Merged

Register nested sourced_from path segments on the root index#1242
myronmarston merged 3 commits into
block:mainfrom
ellisandrews-toast:populate-sourced-from-nested-paths

Conversation

@ellisandrews-toast

@ellisandrews-toast ellisandrews-toast commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

What

Populates IndexDefinition#sourced_from_nested_paths_by_relationship (stubbed to {} until now). When a parent_relationship chain resolves, its path segments are converted into ListPathSegment/ObjectPathSegments and registered on the root indexed type's Index, keyed by the leaf relationship name.

Scope

Path registration is the only effect of a resolved chain in this PR — no nested update target is produced yet (that comes later in the PR stack). Every parent_relationship chain is still resolved so its configuration errors surface, but a path is registered only for relationships that actually back a sourced_from field.

Validation

Index#register_sourced_from_nested_paths raises a clear SchemaError if two chains terminating at the same index share a relationship name — the runtime tracks sourced data by relationship name (__versions/__sources), so a collision can't be represented and we fail fast at schema-definition time rather than silently clobbering.

Notes

  • These tests assert on the in-memory runtime-metadata objects (the schema-definition logic that produces the path segments). Serialization of those segments (to_dumpable_hash/from_hash) is already round-trip-covered in elasticgraph-schema_artifacts's schema_spec.rb, so it isn't re-tested here.
  • No test schema exercises a nested chain yet, so there's no runtime_metadata.yaml churn. A later PR will add a nested sourced_from schema to config/schema/ and assert on the dumped YAML end-to-end.

@ellisandrews-toast ellisandrews-toast force-pushed the populate-sourced-from-nested-paths branch from 28a337f to 51f0170 Compare June 8, 2026 21:34
@myronmarston myronmarston merged commit c716a4d into block:main Jun 10, 2026
19 checks passed
@ellisandrews-toast ellisandrews-toast deleted the populate-sourced-from-nested-paths branch June 10, 2026 14:15
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