Skip to content

Commit c38985d

Browse files
Add end-to-end acceptance tests for index inheritance (#1167)
* Add end-to-end acceptance tests for index inheritance Updates the NamedInventor interface to use a shared index (with Person and Company inheriting it), adds acceptance tests covering __typename filtering at multiple levels of an abstract type hierarchy, and updates schema artifacts, settings, and test factories accordingly. Generated with Claude Code * Fix comment in search_spec.rb Co-authored-by: Myron Marston <myron.marston@gmail.com> --------- Co-authored-by: Myron Marston <myron.marston@gmail.com>
1 parent eeae4eb commit c38985d

16 files changed

Lines changed: 269 additions & 1833 deletions

File tree

Rakefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ configure_local_rake_tasks = ->(tasks) do
7777
FactoryBot.build(:widget, components: widget_components, inventor: Faker::Base.sample(inventors))
7878
end)
7979

80+
batch.concat(Array.new(10) { FactoryBot.build(:online_store) })
81+
batch.concat(Array.new(10) { FactoryBot.build(:physical_store) })
82+
batch.concat(Array.new(5) { FactoryBot.build(:direct_wholesaler) })
83+
batch.concat(Array.new(5) { FactoryBot.build(:broker_wholesaler) })
84+
8085
batch.concat(sponsors = Array.new(10) { FactoryBot.build(:sponsor) })
8186
batch.concat(Array.new(10) { FactoryBot.build(:team, sponsors: sponsors.sample(rand(3))) })
8287
batch

config/schema/artifacts/data_warehouse.yaml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@ tables:
1414
shapes ARRAY<STRUCT<type STRING, coordinates ARRAY<FLOAT>>>,
1515
manufacturer_id STRING
1616
)
17-
companies:
18-
table_schema: |-
19-
CREATE TABLE IF NOT EXISTS companies (
20-
id STRING,
21-
name STRING,
22-
stock_ticker STRING
23-
)
2417
components:
2518
table_schema: |-
2619
CREATE TABLE IF NOT EXISTS components (
@@ -62,7 +55,7 @@ tables:
6255
id STRING,
6356
name STRING,
6457
created_at TIMESTAMP,
65-
ceo STRUCT<id STRING, name STRING, nationality STRING>
58+
ceo STRUCT<id STRING, name STRING, nationality STRING, __typename STRING>
6659
)
6760
mechanical_parts:
6861
table_schema: |-
@@ -73,12 +66,14 @@ tables:
7366
material STRING,
7467
manufacturer_id STRING
7568
)
76-
people:
69+
named_inventors:
7770
table_schema: |-
78-
CREATE TABLE IF NOT EXISTS people (
71+
CREATE TABLE IF NOT EXISTS named_inventors (
7972
id STRING,
8073
name STRING,
81-
nationality STRING
74+
nationality STRING,
75+
__typename STRING,
76+
stock_ticker STRING
8277
)
8378
physical_stores:
8479
table_schema: |-
@@ -158,8 +153,8 @@ tables:
158153
internal_details STRUCT<name STRING>,
159154
internal_highlightable_details STRUCT<name STRING>,
160155
the_opts STRUCT<size STRING, the_sighs STRING, color STRING, is_draft BOOLEAN>,
161-
inventor STRUCT<id STRING, name STRING, nationality STRING, stock_ticker STRING, __typename STRING>,
162-
named_inventor STRUCT<id STRING, name STRING, nationality STRING, stock_ticker STRING, __typename STRING>,
156+
inventor STRUCT<id STRING, name STRING, nationality STRING, __typename STRING, stock_ticker STRING>,
157+
named_inventor STRUCT<id STRING, name STRING, nationality STRING, __typename STRING, stock_ticker STRING>,
163158
weight_in_ng_str BIGINT,
164159
weight_in_ng BIGINT,
165160
tags ARRAY<STRING>,

config/schema/artifacts/datastore_config.yaml

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,30 +1531,6 @@ indices:
15311531
index.number_of_replicas: 1
15321532
index.number_of_shards: 1
15331533
index.max_result_window: 10000
1534-
companies:
1535-
aliases: {}
1536-
mappings:
1537-
dynamic: strict
1538-
properties:
1539-
id:
1540-
type: keyword
1541-
name:
1542-
type: keyword
1543-
stock_ticker:
1544-
type: keyword
1545-
__sources:
1546-
type: keyword
1547-
__versions:
1548-
type: object
1549-
dynamic: 'false'
1550-
_size:
1551-
enabled: true
1552-
settings:
1553-
index.mapping.ignore_malformed: false
1554-
index.mapping.coerce: false
1555-
index.number_of_replicas: 1
1556-
index.number_of_shards: 1
1557-
index.max_result_window: 10000
15581534
components:
15591535
aliases: {}
15601536
mappings:
@@ -1738,7 +1714,7 @@ indices:
17381714
index.number_of_replicas: 1
17391715
index.number_of_shards: 1
17401716
index.max_result_window: 10000
1741-
people:
1717+
named_inventors:
17421718
aliases: {}
17431719
mappings:
17441720
dynamic: strict
@@ -1749,6 +1725,10 @@ indices:
17491725
type: keyword
17501726
nationality:
17511727
type: keyword
1728+
stock_ticker:
1729+
type: keyword
1730+
__typename:
1731+
type: keyword
17521732
__sources:
17531733
type: keyword
17541734
__versions:

0 commit comments

Comments
 (0)