Skip to content

Commit 3f004ad

Browse files
authored
fix: Resolve moved features and refactor evolution handling (#1772)
* fix: Return correct feature evolution data for moved and split features The primary changes are: - The `GetMovedWebFeatureDetailsByOriginalFeatureKey` function has been fixed. It was previously returning the internal database ID of the new feature; it now correctly returns the human-readable feature key, as intended. - The main feature query has been updated to join against a new `SplitWebFeatures` table. The `GET /v1/features` and `GET /v1/features/{feature_id}` endpoints now include an `evolution` object in the response. This object contains `split_off_info` which lists any features that have been split off from the primary feature. To support this, the following changes were also made: - The `openapi.yaml` specification has been updated to include the new `evolution` fields in the `Feature` schema. - The fake data generation process in `util/cmd/load_fake_data` has been significantly enhanced to create more realistic test data for feature evolution, including scenarios for moved, fully split, and partially split features. - End-to-end tests and snapshots have been updated to reflect the new data structures and the changes in the underlying test data.start There needs to be some frontend changes. But that will come in a future PR. * fix snapshots * Remove split out info from Regular Feature model Currently, v3 cannot let us know if a feature has been partially split out. This commit removes the split out info from the Regular Feature model. See comment: web-platform-dx/web-features#3000 (comment) This allows us to simplify this. We can revisit in v4. * update snapshots
1 parent 0908131 commit 3f004ad

File tree

48 files changed

+679
-584
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+679
-584
lines changed

backend/pkg/httpserver/get_feature_test.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ func TestGetFeature(t *testing.T) {
6666
),
6767
},
6868
DeveloperSignals: nil,
69-
Evolution: nil,
7069
BrowserImplementations: &map[string]backend.BrowserImplementation{
7170
"chrome": {
7271
Status: valuePtr(backend.Available),
@@ -176,15 +175,6 @@ func TestGetFeature(t *testing.T) {
176175
DeveloperSignals: &backend.FeatureDeveloperSignals{
177176
PositiveCount: 10,
178177
},
179-
Evolution: &backend.FeatureEvolutionInfo{
180-
SplitOffInfo: &backend.FeatureEvolutionSplit{
181-
Features: []backend.FeatureSplitInfo{
182-
{
183-
Id: "other",
184-
},
185-
},
186-
},
187-
},
188178
BrowserImplementations: &map[string]backend.BrowserImplementation{
189179
"chrome": {
190180
Status: valuePtr(backend.Available),
@@ -216,7 +206,6 @@ func TestGetFeature(t *testing.T) {
216206
`"browser_implementations":` +
217207
`{"chrome":{"date":"1999-01-01","status":"available","version":"100"}},` +
218208
`"developer_signals":{"positive_count":10},` +
219-
`"evolution":{"split_off_info":{"features":[{"id":"other"}]}},` +
220209
`"feature_id":"feature1","name":"feature 1"}`,
221210
),
222211
CacheCfg: getDefaultCacheConfig(),
@@ -238,7 +227,6 @@ func TestGetFeature(t *testing.T) {
238227
}
239228
},
240229
"developer_signals":{"positive_count":10},
241-
"evolution":{"split_off_info":{"features":[{"id":"other"}]}},
242230
"feature_id":"feature1",
243231
"name":"feature 1"
244232
}`,
@@ -257,7 +245,6 @@ func TestGetFeature(t *testing.T) {
257245
`"browser_implementations":` +
258246
`{"chrome":{"date":"1999-01-01","status":"available","version":"100"}},` +
259247
`"developer_signals":{"positive_count":10},` +
260-
`"evolution":{"split_off_info":{"features":[{"id":"other"}]}},` +
261248
`"feature_id":"feature1","name":"feature 1"}`,
262249
),
263250
Err: nil,
@@ -280,7 +267,6 @@ func TestGetFeature(t *testing.T) {
280267
}
281268
},
282269
"developer_signals":{"positive_count":10},
283-
"evolution":{"split_off_info":{"features":[{"id":"other"}]}},
284270
"feature_id":"feature1",
285271
"name":"feature 1"
286272
}`,

backend/pkg/httpserver/get_features_test.go

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ func TestListFeatures(t *testing.T) {
8585
},
8686
},
8787
DeveloperSignals: nil,
88-
Evolution: nil,
8988
},
9089
},
9190
},
@@ -256,15 +255,6 @@ func TestListFeatures(t *testing.T) {
256255
DeveloperSignals: &backend.FeatureDeveloperSignals{
257256
PositiveCount: 24,
258257
},
259-
Evolution: &backend.FeatureEvolutionInfo{
260-
SplitOffInfo: &backend.FeatureEvolutionSplit{
261-
Features: []backend.FeatureSplitInfo{
262-
{
263-
Id: "test-other",
264-
},
265-
},
266-
},
267-
},
268258
},
269259
},
270260
},
@@ -287,7 +277,6 @@ func TestListFeatures(t *testing.T) {
287277
`"browser_implementations":` +
288278
`{"chrome":{"date":"1999-01-01","status":"available","version":"101"}},` +
289279
`"developer_signals":{"positive_count":24},` +
290-
`"evolution":{"split_off_info":{"features":[{"id":"test-other"}]}},` +
291280
`"feature_id":"feature1","name":"feature 1"}],` +
292281
`"metadata":{"next_page_token":"next-page-token","total":100}}`,
293282
),
@@ -314,13 +303,6 @@ func TestListFeatures(t *testing.T) {
314303
"developer_signals":{
315304
"positive_count":24
316305
},
317-
"evolution":{
318-
"split_off_info":{
319-
"features":[
320-
{"id":"test-other"}
321-
]
322-
}
323-
},
324306
"feature_id":"feature1",
325307
"name":"feature 1"
326308
}
@@ -351,7 +333,6 @@ func TestListFeatures(t *testing.T) {
351333
`"browser_implementations":` +
352334
`{"chrome":{"date":"1999-01-01","status":"available","version":"101"}},` +
353335
`"developer_signals":{"positive_count":24},` +
354-
`"evolution":{"split_off_info":{"features":[{"id":"test-other"}]}},` +
355336
`"feature_id":"feature1","name":"feature 1"}],` +
356337
`"metadata":{"next_page_token":"next-page-token","total":100}}`,
357338
),
@@ -379,13 +360,6 @@ func TestListFeatures(t *testing.T) {
379360
"developer_signals":{
380361
"positive_count":24
381362
},
382-
"evolution":{
383-
"split_off_info":{
384-
"features":[
385-
{"id":"test-other"}
386-
]
387-
}
388-
},
389363
"feature_id":"feature1",
390364
"name":"feature 1"
391365
}
-1.45 KB
Loading
32 Bytes
Loading
7 Bytes
Loading

e2e/tests/feature-page.spec.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ test.beforeEach(async ({page}) => {
2121
await setupFakeNow(page);
2222
});
2323

24+
const featureID = 'anchor-positioning';
25+
const featureName = 'Anchor Positioning';
26+
2427
test('matches the screenshot', async ({page}) => {
25-
await page.goto('http://localhost:5555/features/odit64');
28+
await page.goto(`http://localhost:5555/features/${featureID}`);
2629

2730
// Wait for the chart container to exist
2831
await page.waitForSelector('#feature-wpt-implementation-progress-0-complete');
@@ -35,7 +38,7 @@ test('matches the screenshot', async ({page}) => {
3538
});
3639

3740
test('chart width resizes with window', async ({page}) => {
38-
await page.goto('http://localhost:5555/features/odit64');
41+
await page.goto(`http://localhost:5555/features/${featureID}`);
3942
await page.waitForSelector('#feature-wpt-implementation-progress-0-complete');
4043
await page.waitForTimeout(1000);
4144
const narrowWidth = 1000;
@@ -71,7 +74,7 @@ test('chart width resizes with window', async ({page}) => {
7174
test('mobile chart displays on click and matches screenshot', async ({
7275
page,
7376
}) => {
74-
await page.goto('http://localhost:5555/features/odit64');
77+
await page.goto(`http://localhost:5555/features/${featureID}`);
7578
await page.waitForSelector('#feature-wpt-implementation-progress-0-complete');
7679
const mobileTab = page.locator(
7780
'sl-tab#feature-wpt-implementation-progress-tab-mobile',
@@ -84,7 +87,7 @@ test('mobile chart displays on click and matches screenshot', async ({
8487
});
8588

8689
test('date range changes are preserved in the URL', async ({page}) => {
87-
await page.goto('http://localhost:5555/features/odit64');
90+
await page.goto(`http://localhost:5555/features/${featureID}`);
8891
await page.waitForSelector('#feature-wpt-implementation-progress-0-complete');
8992

9093
// Get the current default startDate and endDate from the selectors
@@ -131,7 +134,7 @@ test('date range changes are preserved in the URL', async ({page}) => {
131134
// TODO: Check that the chart has the right start date.
132135

133136
// Click on the feature breadcrumb.
134-
const featureCrumb = page.locator('.crumbs >> a:has-text("odit64")');
137+
const featureCrumb = page.locator(`.crumbs >> a:has-text("${featureName}")`);
135138
await featureCrumb.click();
136139

137140
// Check that the URL no longer contains the startDate or endDate.
1.24 KB
Loading
3.65 KB
Loading
1.29 KB
Loading
-1.76 KB
Loading

0 commit comments

Comments
 (0)