Skip to content

Build-time mirroring of compat data #15083

@foolip

Description

@foolip

We currently have a mirroring script (npm run mirror) which can be used to copy the data from one browser to another using the same engine, while updating version numbers. For example, Chrome 96 can be mirrored to Chrome Android 96, Opera 82, Opera Android 67, some future release of Samsung Internet, and Android WebView.

A downside is that data for many browsers often goes stale, and needs to be updated manually, as in #15055. And it's very difficult to see which data has been mirrored, and where there are differences.

This is a proposal to simplify maintenance of mirrored data in BCD. Strawman proposal using a simplified version of the structuredClone entry:

{
  "api": {
    "structuredClone": {
      "__compat": {
        "mdn_url": "https://developer.mozilla.org/docs/Web/API/structuredClone",
        "spec_url": "https://html.spec.whatwg.org/multipage/structured-data.html#dom-structuredclone",
        "support": {
          "chrome": {
            "version_added": "98"
          },
          "chrome_android": {
            "version_added": "mirror"
          },
          "edge": {
            "version_added": "mirror"
          },
          "firefox": {
            "version_added": "94"
          },
          "firefox_android": {
            "version_added": "mirror"
          },
          "ie": {
            "version_added": false
          },
          "opera": {
            "version_added": "mirror"
          },
          "opera_android": {
            "version_added": "mirror"
          },
          "safari": {
            "version_added": "15.4"
          },
          "safari_ios": {
            "version_added": "mirror"
          },
          "samsunginternet_android": {
            "version_added": "mirror"
          },
          "webview_android": {
            "version_added": "mirror"
          }
        },
        "status": {
          "experimental": false,
          "standard_track": true,
          "deprecated": false
        }
      }
    }
  }
}

The "mirror" values would be filled in at build time, and the data that BCD consumers see would be unchanged.

One implementation of this would mirror to false if the browser (such as Samsung Internet) doesn't have a release based on Chromium 98 yet, and would automatically get the right version if it's added to browsers/samsunginternet_android.json. An alternative to this would be to disallow mirroring to false values, and instead require replacing false with "mirror" after a release.

I imagine this being rolled out in the following way:

  • Add support for "mirror" in the build script
  • Mass replace versions where it mirrors to exactly the same (maybe only entries where everything can be mirrored, to avoid a mix)
  • Over time, review and replace "manual" values with "mirror" where it's actually bad data, starting with old and implausible off-by-one differences

cc @ddbeck @Elchi3 @queengooborg

Metadata

Metadata

Assignees

Labels

enhancementNice to have features.infraInfrastructure issues (npm, GitHub Actions, releases) of this projectscriptsIssues or pull requests regarding the scripts in scripts/.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions