Skip to content

Add compat sets to authoring format#4015

Open
ddbeck wants to merge 9 commits into
web-platform-dx:mainfrom
ddbeck:implement-compat-sets
Open

Add compat sets to authoring format#4015
ddbeck wants to merge 9 commits into
web-platform-dx:mainfrom
ddbeck:implement-compat-sets

Conversation

@ddbeck
Copy link
Copy Markdown
Collaborator

@ddbeck ddbeck commented May 6, 2026

See the previous PR #3902 for background. This PR subsumes the changes in that PR.

This implements part one of the so-called aspects proposal, which creates a ratcheting mechanism for compat key status calculation and validation. This is a precursor to feature merging.

@github-actions github-actions Bot added documentation Improvements or additions to documentation feature definition Creating or defining new features or groups of features. tools and infrastructure Project internal tooling, such as linters, GitHub Actions, or repo settings labels May 6, 2026
Comment thread docs/guidelines.md Outdated
Comment thread docs/CONTRIBUTING.md Outdated
| `group` | An optional group, or list of groups that this feature belongs to. See the definition of groups under [Create a new feature from scratch](#create-a-new-feature-from-scratch). | String, or array of strings | No |
| `caniuse` | The feature's ID on the [Can I Use](https://caniuse.com/) website. | String | No |
| `compat_features` | @mdn/browser-compat-data (BCD) entry keys (e.g., `css.properties.background-color`) that make up this feature. If `compat_features` is not set in `<feature-id>.yml`, the `dist` script will populate `compat_features` in `<feature-id>.yml.dist` with BCD entry keys tagged with `web-features:<feature-id>` in BCD, if any exist. | Array of strings | No |
| `compat_features` | @mdn/browser-compat-data (BCD) entry keys (e.g., `css.properties.background-color`) that make up this feature. This is typically an array of strings. Less commonly, an object consisting of three arrays of strings, `core`, `modifiers`, and `incidentals`. Different validation rules apply the three lists. When in doubt, use a plain array. If `compat_features` is not set in `<feature-id>.yml`, the `dist` script will populate `compat_features` in `<feature-id>.yml.dist` with BCD entry keys tagged with `web-features:<feature-id>` in BCD, if any exist. | Array of strings or object | No |
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Say here which set keys end up by default? Sounds like a plain array is a shorthand for something.

Comment thread docs/CONTRIBUTING.md Outdated
| `group` | An optional group, or list of groups that this feature belongs to. See the definition of groups under [Create a new feature from scratch](#create-a-new-feature-from-scratch). | String, or array of strings | No |
| `caniuse` | The feature's ID on the [Can I Use](https://caniuse.com/) website. | String | No |
| `compat_features` | @mdn/browser-compat-data (BCD) entry keys (e.g., `css.properties.background-color`) that make up this feature. If `compat_features` is not set in `<feature-id>.yml`, the `dist` script will populate `compat_features` in `<feature-id>.yml.dist` with BCD entry keys tagged with `web-features:<feature-id>` in BCD, if any exist. | Array of strings | No |
| `compat_features` | @mdn/browser-compat-data (BCD) entry keys (e.g., `css.properties.background-color`) that make up this feature. This is typically an array of strings. Less commonly, an object consisting of three arrays of strings, `core`, `modifiers`, and `incidentals`. Different validation rules apply the three lists. When in doubt, use a plain array. If `compat_features` is not set in `<feature-id>.yml`, the `dist` script will populate `compat_features` in `<feature-id>.yml.dist` with BCD entry keys tagged with `web-features:<feature-id>` in BCD, if any exist. | Array of strings or object | No |
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `compat_features` | @mdn/browser-compat-data (BCD) entry keys (e.g., `css.properties.background-color`) that make up this feature. This is typically an array of strings. Less commonly, an object consisting of three arrays of strings, `core`, `modifiers`, and `incidentals`. Different validation rules apply the three lists. When in doubt, use a plain array. If `compat_features` is not set in `<feature-id>.yml`, the `dist` script will populate `compat_features` in `<feature-id>.yml.dist` with BCD entry keys tagged with `web-features:<feature-id>` in BCD, if any exist. | Array of strings or object | No |
| `compat_features` | @mdn/browser-compat-data (BCD) entry keys (e.g., `css.properties.background-color`) that make up this feature. This is typically an array of strings. Less commonly, an object consisting of three arrays of strings, `core`, `modifier`, and `spare`. Different validation rules apply the three lists. When in doubt, use a plain array. If `compat_features` is not set in `<feature-id>.yml`, the `dist` script will populate `compat_features` in `<feature-id>.yml.dist` with BCD entry keys tagged with `web-features:<feature-id>` in BCD, if any exist. | Array of strings or object | No |

Philip suggested to me that having the sets being alphabetically sorted would be nice. I looked around for some alternatives and kind liked "spare" as having multiple meanings (e.g., unused as in a 'spare house key', superfluous as in a 'spare heir', and to refrain as in 'to spare from'). We could also have the number agreement: core, modifier, spare (no mixing plurals). I'm going to make a change on this.

Comment thread docs/guidelines.md
An alternative doesn't have to be a narrow drop-in replacement for the discouraged feature but it must handle some use case of the discouraged feature.
Guide developers to the most relevant features that would help them stop using the discouraged feature.

## Status overrides
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a big fan of the location of this guideline. It would make more sense to me if this section immediately followed the Associate BCD keys with your feature, under Set the status of a feature in CONTRIBUTING.md.

This feels more closely related than our writing style guide.

Perhaps we should also move the Groups and Discouraged sections to the CONTRIBUTING.md file.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@captainbrosset I tried doing as you suggested, but it ended up feeling pretty weird. CONTRIBUTING.md is a kind of tutorial on minting a feature. From here onward, most new feature minting should be flat compat_features, so it seemed kinda weird to introduce people to something that they should only do in exceptional circumstances.

Meanwhile, the Status overrides doc section is more of a policy: here's how to override a status and the situations when you might consider doing it. We could break up the guidelines.md file into something like style-guide.md and data-policies.md or something like that but I think it's out of scope for this PR.

That said, I did think it only fair to acknowledge the existence of overrides in CONTRIBUTING.md, so I added a cross reference with 364b592.

Comment thread docs/guidelines.md
The keys in `modifier` are validated to have the same status _level_ as the `core` keys (for example, if the `core` set of keys is newly available, then the keys in `modifier` must be too), but not necessarily the same Baseline dates or initial browser releases.
The keys in `spare` relate to the feature but do not affect the feature's status.

For example, this override sets the status on the basis of key `a` and `b`, validates that key `c` is at the same level as `core`, and ignores `x` for the purpose of calculating a status.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A real example would also be useful. This can be done in a separate PR though.
Without it, we're telling authors that there's another, weird, way to write features, but we're not really telling them why.

I see you wrote a "You can use an override method in the following situations" section, which is great. But I feel like a real example would go a long way.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to do this but quickly found that it's difficult to find a good example that is short and doesn't have some data oddities underneath. I'll come back to this in a follow up PR, probably when we do the conversion where I'll have to look at one in turn anyway.

ddbeck added 2 commits May 22, 2026 13:52
This reverts commit c1123ec.

This was a mistake. It won't survive long term because some of this data
is non-standard.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation feature definition Creating or defining new features or groups of features. tools and infrastructure Project internal tooling, such as linters, GitHub Actions, or repo settings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants