Skip to content

Commit 11b47c3

Browse files
DanielRyanSmithDanielRyanSmith
andauthored
Ingest mobile support data from BCD (#1395)
* ingest mobile support data from BCD * add missing types * add mobile browsers to bcd workflow job * save api changes for separate PR * remove mobile browsers from openapi (for now) * remove formatting changes * fix tests --------- Co-authored-by: DanielRyanSmith <[email protected]>
1 parent d706bfd commit 11b47c3

File tree

5 files changed

+77
-22
lines changed

5 files changed

+77
-22
lines changed

lib/gcpspanner/spanneradapters/bcdconsumertypes/types.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,13 @@ type BrowserRelease struct {
3333
type BrowserName string
3434

3535
const (
36-
Chrome BrowserName = "chrome"
37-
Edge BrowserName = "edge"
38-
Firefox BrowserName = "firefox"
39-
Safari BrowserName = "safari"
36+
Chrome BrowserName = "chrome"
37+
Edge BrowserName = "edge"
38+
Firefox BrowserName = "firefox"
39+
Safari BrowserName = "safari"
40+
ChromeAndroid BrowserName = "chrome_android"
41+
FirefoxAndroid BrowserName = "firefox_android"
42+
SafariIos BrowserName = "safari_ios"
4043
)
4144

4245
// ErrUnableToStoreBrowserRelease indicates that the storage layer was unable to save

lib/gcpspanner/spanneradapters/web_features_consumer.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,24 @@ func extractBrowserAvailability(
191191
BrowserVersion: *support.Safari,
192192
})
193193
}
194+
if support.ChromeAndroid != nil {
195+
fba = append(fba, gcpspanner.BrowserFeatureAvailability{
196+
BrowserName: "chrome_android",
197+
BrowserVersion: *support.ChromeAndroid,
198+
})
199+
}
200+
if support.FirefoxAndroid != nil {
201+
fba = append(fba, gcpspanner.BrowserFeatureAvailability{
202+
BrowserName: "firefox_android",
203+
BrowserVersion: *support.FirefoxAndroid,
204+
})
205+
}
206+
if support.SafariIos != nil {
207+
fba = append(fba, gcpspanner.BrowserFeatureAvailability{
208+
BrowserName: "safari_ios",
209+
BrowserVersion: *support.SafariIos,
210+
})
211+
}
194212

195213
return fba
196214
}

lib/gcpspanner/spanneradapters/web_features_consumer_test.go

Lines changed: 45 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,10 @@ func TestInsertWebFeatures(t *testing.T) {
480480
BrowserName: "safari",
481481
BrowserVersion: "103",
482482
},
483+
{
484+
BrowserName: "chrome_android",
485+
BrowserVersion: "104",
486+
},
483487
},
484488
"feature2": {
485489
{
@@ -490,15 +494,19 @@ func TestInsertWebFeatures(t *testing.T) {
490494
BrowserName: "safari",
491495
BrowserVersion: "203",
492496
},
497+
{
498+
BrowserName: "safari_ios",
499+
BrowserVersion: "106",
500+
},
493501
},
494502
},
495503
outputs: map[string][]error{
496-
"feature1": {nil, nil, nil, nil},
497-
"feature2": {nil, nil},
504+
"feature1": {nil, nil, nil, nil, nil},
505+
"feature2": {nil, nil, nil},
498506
},
499507
expectedCountPerFeature: map[string]int{
500-
"feature1": 4,
501-
"feature2": 2,
508+
"feature1": 5,
509+
"feature2": 3,
502510
},
503511
},
504512
mockUpsertFeatureSpecCfg: mockUpsertFeatureSpecConfig{
@@ -540,7 +548,7 @@ func TestInsertWebFeatures(t *testing.T) {
540548
ByCompatKey: nil,
541549
Support: web_platform_dx__web_features.StatusSupport{
542550
Chrome: valuePtr("100"),
543-
ChromeAndroid: nil,
551+
ChromeAndroid: valuePtr("104"),
544552
Edge: valuePtr("101"),
545553
Firefox: valuePtr("102"),
546554
FirefoxAndroid: nil,
@@ -577,7 +585,7 @@ func TestInsertWebFeatures(t *testing.T) {
577585
Firefox: valuePtr("202"),
578586
FirefoxAndroid: nil,
579587
Safari: valuePtr("203"),
580-
SafariIos: nil,
588+
SafariIos: valuePtr("106"),
581589
},
582590
Baseline: &web_platform_dx__web_features.BaselineUnion{
583591
Enum: valuePtr(web_platform_dx__web_features.Low),
@@ -904,13 +912,25 @@ func TestInsertWebFeatures(t *testing.T) {
904912
BrowserName: "safari",
905913
BrowserVersion: "103",
906914
},
915+
{
916+
BrowserName: "chrome_android",
917+
BrowserVersion: "104",
918+
},
919+
{
920+
BrowserName: "firefox_android",
921+
BrowserVersion: "105",
922+
},
923+
{
924+
BrowserName: "safari_ios",
925+
BrowserVersion: "106",
926+
},
907927
},
908928
},
909929
outputs: map[string][]error{
910-
"feature1": {nil, nil, nil, nil},
930+
"feature1": {nil, nil, nil, nil, nil, nil, nil},
911931
},
912932
expectedCountPerFeature: map[string]int{
913-
"feature1": 4,
933+
"feature1": 7,
914934
},
915935
},
916936
mockUpsertFeatureSpecCfg: mockUpsertFeatureSpecConfig{
@@ -943,12 +963,12 @@ func TestInsertWebFeatures(t *testing.T) {
943963
ByCompatKey: nil,
944964
Support: web_platform_dx__web_features.StatusSupport{
945965
Chrome: valuePtr("100"),
946-
ChromeAndroid: nil,
966+
ChromeAndroid: valuePtr("104"),
947967
Edge: valuePtr("101"),
948968
Firefox: valuePtr("102"),
949-
FirefoxAndroid: nil,
969+
FirefoxAndroid: valuePtr("105"),
950970
Safari: valuePtr("103"),
951-
SafariIos: nil,
971+
SafariIos: valuePtr("106"),
952972
},
953973
Baseline: &web_platform_dx__web_features.BaselineUnion{
954974
Enum: valuePtr(web_platform_dx__web_features.High),
@@ -1033,6 +1053,10 @@ func TestInsertWebFeatures(t *testing.T) {
10331053
BrowserName: "safari",
10341054
BrowserVersion: "103",
10351055
},
1056+
{
1057+
BrowserName: "chrome_android",
1058+
BrowserVersion: "104",
1059+
},
10361060
},
10371061
"feature2": {
10381062
{
@@ -1043,15 +1067,19 @@ func TestInsertWebFeatures(t *testing.T) {
10431067
BrowserName: "safari",
10441068
BrowserVersion: "203",
10451069
},
1070+
{
1071+
BrowserName: "safari_ios",
1072+
BrowserVersion: "106",
1073+
},
10461074
},
10471075
},
10481076
outputs: map[string][]error{
1049-
"feature1": {nil, nil, nil, nil},
1050-
"feature2": {nil, nil},
1077+
"feature1": {nil, nil, nil, nil, nil},
1078+
"feature2": {nil, nil, nil},
10511079
},
10521080
expectedCountPerFeature: map[string]int{
1053-
"feature1": 4,
1054-
"feature2": 2,
1081+
"feature1": 5,
1082+
"feature2": 3,
10551083
},
10561084
},
10571085
mockUpsertFeatureSpecCfg: mockUpsertFeatureSpecConfig{
@@ -1090,7 +1118,7 @@ func TestInsertWebFeatures(t *testing.T) {
10901118
ByCompatKey: nil,
10911119
Support: web_platform_dx__web_features.StatusSupport{
10921120
Chrome: valuePtr("100"),
1093-
ChromeAndroid: nil,
1121+
ChromeAndroid: valuePtr("104"),
10941122
Edge: valuePtr("101"),
10951123
Firefox: valuePtr("102"),
10961124
FirefoxAndroid: nil,
@@ -1127,7 +1155,7 @@ func TestInsertWebFeatures(t *testing.T) {
11271155
Firefox: valuePtr("202"),
11281156
FirefoxAndroid: nil,
11291157
Safari: valuePtr("203"),
1130-
SafariIos: nil,
1158+
SafariIos: valuePtr("106"),
11311159
},
11321160
Baseline: &web_platform_dx__web_features.BaselineUnion{
11331161
Enum: valuePtr(web_platform_dx__web_features.Low),

workflows/steps/services/bcd_consumer/cmd/job/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ func main() {
8383
string(bcdconsumertypes.Edge),
8484
string(bcdconsumertypes.Firefox),
8585
string(bcdconsumertypes.Safari),
86+
string(bcdconsumertypes.ChromeAndroid),
87+
string(bcdconsumertypes.FirefoxAndroid),
88+
string(bcdconsumertypes.SafariIos),
8689
},
8790
),
8891
}

workflows/steps/services/bcd_consumer/pkg/workflow/bcd_filter_data.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ func (f BCDDataFilter) checkBrowserFilters(filteredBrowsers []string) error {
5252
case bcdconsumertypes.Chrome,
5353
bcdconsumertypes.Edge,
5454
bcdconsumertypes.Firefox,
55-
bcdconsumertypes.Safari:
55+
bcdconsumertypes.Safari,
56+
bcdconsumertypes.ChromeAndroid,
57+
bcdconsumertypes.FirefoxAndroid,
58+
bcdconsumertypes.SafariIos:
5659
continue
5760
default:
5861
return errors.Join(ErrUnknownBrowserFilter)

0 commit comments

Comments
 (0)