Skip to content

Commit 5db050e

Browse files
Rename document_type_stored_in → document_types_stored_in returning Set (#1159)
* Rename document_type_stored_in → document_types_stored_in returning Set Changes indexed_document_types_by_index_definition_name to accumulate all indexed document types per index into a Set (was: store only the first type seen via ||=). This is necessary for correctness with index inheritance, where multiple concrete types share the same index and all need to be visible to callers like non_subtypes_in_shared_index. Renames document_type_stored_in → document_types_stored_in to return the full Set. Updates the two callers: - graphql_adapter_builder: .first is safe — this branch is only reached for individually-indexed types, which always have exactly one type per index (no __typename in the document means no shared index). - search_response_adapter_builder: use __typename from the document to resolve the concrete type directly when present; shared-index types carry __typename so field paths in all_highlights resolve to the right type. Falls back to .first for individually-indexed types. Generated with Claude Code * Make indexed_document_types_by_index_definition_name public Required by non_subtypes_in_shared_index (on the index inheritance branch), which needs to enumerate all types sharing an index when deciding whether a __typename filter is needed on abstract type queries. Generated with Claude Code * Address PR review feedback on document_types_stored_in - Make indexed_document_types_by_index_definition_name private; public callers should use document_types_stored_in instead - Add unit test for multi-type index inheritance case - Add DistributionChannel type hierarchy to test schema to support acceptance test for __typename-aware all_highlights resolution - Add acceptance test proving all_highlights resolves against the concrete type for documents in a shared-index hierarchy - Update hidden_types_spec to account for new types - Add distribution_channels and physical_stores index definitions to config settings Generated with Claude Code * Improve comments on document_types_stored_in and indexed_document_types_by_index_definition_name Generated with Claude Code * Improve document_types_stored_in docs
1 parent baf5dd0 commit 5db050e

25 files changed

Lines changed: 5541 additions & 430 deletions

File tree

config/schema/artifacts/data_warehouse.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ tables:
3838
owner_ids ARRAY<STRING>,
3939
owner_id STRING
4040
)
41+
distribution_channels:
42+
table_schema: |-
43+
CREATE TABLE IF NOT EXISTS distribution_channels (
44+
id STRING,
45+
established_on DATE,
46+
active BOOLEAN,
47+
name STRING,
48+
__typename STRING
49+
)
4150
electrical_parts:
4251
table_schema: |-
4352
CREATE TABLE IF NOT EXISTS electrical_parts (
@@ -71,6 +80,13 @@ tables:
7180
name STRING,
7281
nationality STRING
7382
)
83+
physical_stores:
84+
table_schema: |-
85+
CREATE TABLE IF NOT EXISTS physical_stores (
86+
id STRING,
87+
established_on DATE,
88+
active BOOLEAN
89+
)
7490
sponsors:
7591
table_schema: |-
7692
CREATE TABLE IF NOT EXISTS sponsors (

config/schema/artifacts/datastore_config.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,6 +1618,35 @@ indices:
16181618
index.number_of_replicas: 1
16191619
index.number_of_shards: 1
16201620
index.max_result_window: 10000
1621+
distribution_channels:
1622+
aliases: {}
1623+
mappings:
1624+
dynamic: strict
1625+
properties:
1626+
id:
1627+
type: keyword
1628+
established_on:
1629+
type: date
1630+
format: strict_date
1631+
active:
1632+
type: boolean
1633+
name:
1634+
type: keyword
1635+
__typename:
1636+
type: keyword
1637+
__sources:
1638+
type: keyword
1639+
__versions:
1640+
type: object
1641+
dynamic: 'false'
1642+
_size:
1643+
enabled: true
1644+
settings:
1645+
index.mapping.ignore_malformed: false
1646+
index.mapping.coerce: false
1647+
index.number_of_replicas: 1
1648+
index.number_of_shards: 1
1649+
index.max_result_window: 10000
16211650
electrical_parts:
16221651
aliases: {}
16231652
mappings:
@@ -1733,6 +1762,31 @@ indices:
17331762
index.number_of_replicas: 1
17341763
index.number_of_shards: 1
17351764
index.max_result_window: 10000
1765+
physical_stores:
1766+
aliases: {}
1767+
mappings:
1768+
dynamic: strict
1769+
properties:
1770+
id:
1771+
type: keyword
1772+
established_on:
1773+
type: date
1774+
format: strict_date
1775+
active:
1776+
type: boolean
1777+
__sources:
1778+
type: keyword
1779+
__versions:
1780+
type: object
1781+
dynamic: 'false'
1782+
_size:
1783+
enabled: true
1784+
settings:
1785+
index.mapping.ignore_malformed: false
1786+
index.mapping.coerce: false
1787+
index.number_of_replicas: 1
1788+
index.number_of_shards: 1
1789+
index.max_result_window: 10000
17361790
sponsors:
17371791
aliases: {}
17381792
mappings:

config/schema/artifacts/json_schemas.yaml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@ json_schema_version: 1
2828
- ElectricalPart
2929
- Manufacturer
3030
- MechanicalPart
31+
- OnlineStore
3132
- Person
33+
- PhysicalStore
3234
- Sponsor
3335
- Team
36+
- ThirdPartyWholesale
3437
- Widget
3538
- WidgetWorkspace
3639
id:
@@ -445,6 +448,36 @@ json_schema_version: 1
445448
oneOf:
446449
- "$ref": "#/$defs/Person"
447450
- "$ref": "#/$defs/Company"
451+
OnlineStore:
452+
type: object
453+
properties:
454+
id:
455+
allOf:
456+
- "$ref": "#/$defs/ID"
457+
- maxLength: 8191
458+
established_on:
459+
anyOf:
460+
- "$ref": "#/$defs/Date"
461+
- type: 'null'
462+
active:
463+
anyOf:
464+
- "$ref": "#/$defs/Boolean"
465+
- type: 'null'
466+
name:
467+
anyOf:
468+
- allOf:
469+
- "$ref": "#/$defs/String"
470+
- maxLength: 8191
471+
- type: 'null'
472+
__typename:
473+
type: string
474+
const: OnlineStore
475+
default: OnlineStore
476+
required:
477+
- id
478+
- established_on
479+
- active
480+
- name
448481
Person:
449482
type: object
450483
properties:
@@ -472,6 +505,29 @@ json_schema_version: 1
472505
- id
473506
- name
474507
- nationality
508+
PhysicalStore:
509+
type: object
510+
properties:
511+
id:
512+
allOf:
513+
- "$ref": "#/$defs/ID"
514+
- maxLength: 8191
515+
established_on:
516+
anyOf:
517+
- "$ref": "#/$defs/Date"
518+
- type: 'null'
519+
active:
520+
anyOf:
521+
- "$ref": "#/$defs/Boolean"
522+
- type: 'null'
523+
__typename:
524+
type: string
525+
const: PhysicalStore
526+
default: PhysicalStore
527+
required:
528+
- id
529+
- established_on
530+
- active
475531
Player:
476532
type: object
477533
properties:
@@ -819,6 +875,24 @@ json_schema_version: 1
819875
- was_shortened
820876
- players_nested
821877
- players_object
878+
ThirdPartyWholesale:
879+
type: object
880+
properties:
881+
id:
882+
allOf:
883+
- "$ref": "#/$defs/ID"
884+
- maxLength: 8191
885+
active:
886+
anyOf:
887+
- "$ref": "#/$defs/Boolean"
888+
- type: 'null'
889+
__typename:
890+
type: string
891+
const: ThirdPartyWholesale
892+
default: ThirdPartyWholesale
893+
required:
894+
- id
895+
- active
822896
Untyped:
823897
type:
824898
- array

config/schema/artifacts/json_schemas_by_version/v1.yaml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@ json_schema_version: 1
2828
- ElectricalPart
2929
- Manufacturer
3030
- MechanicalPart
31+
- OnlineStore
3132
- Person
33+
- PhysicalStore
3234
- Sponsor
3335
- Team
36+
- ThirdPartyWholesale
3437
- Widget
3538
- WidgetWorkspace
3639
id:
@@ -565,6 +568,48 @@ json_schema_version: 1
565568
oneOf:
566569
- "$ref": "#/$defs/Person"
567570
- "$ref": "#/$defs/Company"
571+
OnlineStore:
572+
type: object
573+
properties:
574+
id:
575+
allOf:
576+
- "$ref": "#/$defs/ID"
577+
- maxLength: 8191
578+
ElasticGraph:
579+
type: ID!
580+
nameInIndex: id
581+
established_on:
582+
anyOf:
583+
- "$ref": "#/$defs/Date"
584+
- type: 'null'
585+
ElasticGraph:
586+
type: Date
587+
nameInIndex: established_on
588+
active:
589+
anyOf:
590+
- "$ref": "#/$defs/Boolean"
591+
- type: 'null'
592+
ElasticGraph:
593+
type: Boolean
594+
nameInIndex: active
595+
name:
596+
anyOf:
597+
- allOf:
598+
- "$ref": "#/$defs/String"
599+
- maxLength: 8191
600+
- type: 'null'
601+
ElasticGraph:
602+
type: String
603+
nameInIndex: name
604+
__typename:
605+
type: string
606+
const: OnlineStore
607+
default: OnlineStore
608+
required:
609+
- id
610+
- established_on
611+
- active
612+
- name
568613
Person:
569614
type: object
570615
properties:
@@ -601,6 +646,38 @@ json_schema_version: 1
601646
- id
602647
- name
603648
- nationality
649+
PhysicalStore:
650+
type: object
651+
properties:
652+
id:
653+
allOf:
654+
- "$ref": "#/$defs/ID"
655+
- maxLength: 8191
656+
ElasticGraph:
657+
type: ID!
658+
nameInIndex: id
659+
established_on:
660+
anyOf:
661+
- "$ref": "#/$defs/Date"
662+
- type: 'null'
663+
ElasticGraph:
664+
type: Date
665+
nameInIndex: established_on
666+
active:
667+
anyOf:
668+
- "$ref": "#/$defs/Boolean"
669+
- type: 'null'
670+
ElasticGraph:
671+
type: Boolean
672+
nameInIndex: active
673+
__typename:
674+
type: string
675+
const: PhysicalStore
676+
default: PhysicalStore
677+
required:
678+
- id
679+
- established_on
680+
- active
604681
Player:
605682
type: object
606683
properties:
@@ -1098,6 +1175,30 @@ json_schema_version: 1
10981175
- was_shortened
10991176
- players_nested
11001177
- players_object
1178+
ThirdPartyWholesale:
1179+
type: object
1180+
properties:
1181+
id:
1182+
allOf:
1183+
- "$ref": "#/$defs/ID"
1184+
- maxLength: 8191
1185+
ElasticGraph:
1186+
type: ID!
1187+
nameInIndex: id
1188+
active:
1189+
anyOf:
1190+
- "$ref": "#/$defs/Boolean"
1191+
- type: 'null'
1192+
ElasticGraph:
1193+
type: Boolean
1194+
nameInIndex: active
1195+
__typename:
1196+
type: string
1197+
const: ThirdPartyWholesale
1198+
default: ThirdPartyWholesale
1199+
required:
1200+
- id
1201+
- active
11011202
Untyped:
11021203
type:
11031204
- array

0 commit comments

Comments
 (0)