Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow use of ranges (≤) before the Baseline low date #1208

Merged

Conversation

foolip
Copy link
Collaborator

@foolip foolip commented Jun 7, 2024

The use_ranges_before_baseline_low_date field controls when generating
the status, but it could also be done in overrides.

Closes #1018.

@github-actions github-actions bot added the feature definition Creating or defining new features or groups of features. label Jun 7, 2024
@foolip foolip force-pushed the use_ranges_before_baseline_low_date branch from 7846d59 to c0afc72 Compare June 7, 2024 10:39
@foolip
Copy link
Collaborator Author

foolip commented Jun 7, 2024

I have tried sprinkling this onto the HTML element draft features and really like what it's doing. For example:

--- a/features/draft/html-elements/h1.yml.dist
+++ b/features/draft/html-elements/h1.yml.dist
@@ -11,5 +11,5 @@ status:
     edge: "12"
     firefox: "1"
     firefox_android: "4"
-    safari: "4"
-    safari_ios: "3.2"
+    safari: ≤4
+    safari_ios: ≤3.2

Not having to spend any time updating BCD to show that <h1> was actually supported in Safari 1 will be great.

index.ts Outdated
if (data.status?.support) {
const versions: string[] = Object.values(data.status.support);
if (versions.some((v) => v.startsWith('≤'))) {
if (data.status.baseline_low_date !== earliestBaselineLowDate) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should I change this to allow for ranges when the Baseline low date is before 2016? I'm on the fence.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I like this being a more specific thing to start, then expanded to later uses later (as needed).

@foolip foolip requested a review from ddbeck June 7, 2024 10:51
@@ -5,3 +5,4 @@ group: forms
caniuse: input-search
# TODO: investigate minor differences in the early support of the feature
# between https://caniuse.com/input-search and our generated status.
use_ranges_before_baseline_low_date: true
Copy link
Collaborator

Choose a reason for hiding this comment

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

It only just occurred to me: should we consider indicating internal-only fields? For example, prefixing with an underscore? Doesn't have to happen in this PR, but it'd be nice to get your thoughts on it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think that would provide a useful clue to someone reading the source and wondering if they can use the data through a published package. However, it wouldn't make it any easier for us to filter out such keys, because in order to catch typos we have to enumerate all allowed keys.

Comment on lines -9 to +15
chrome: "5"
chrome: ≤5
chrome_android: "18"
edge: "12"
firefox: "4"
firefox: ≤4
firefox_android: "4"
safari: "5"
safari_ios: "4.2"
safari: ≤5
safari_ios: 4.2
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm taking this to mean "Edge 12 is the very latest release to introduce support for this feature but other browsers may have come earlier than we report."

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, which is different from "it may have come earlier or later than we report" which would be a natural outcome of "we're not sure we trust this data and haven't reviewed it carefully." But, when throwing together a bunch of things, the most recent version is the one we use, so there's good reason to expect that the error will usually be mostly in the direction of claiming features are newer than they are.

index.ts Outdated
@@ -20,16 +20,20 @@ const nameMaxLength = 80;
// The longest description allowed, to avoid them growing into documentation.
const descriptionMaxLength = 300;

// The earliest possible Baseline low date, the release date of Edge 12.
const earliestBaselineLowDate = '2015-07-29';
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't know if this is better exactly, but it feels more "correct":

Suggested change
const earliestBaselineLowDate = '2015-07-29';
// needs import { browser } from "compute-baseline/browser-compat-data";
const earliestBaselineLowDate = browser("edge").version("12").date.toString();

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If taking one step I'd be tempted to take the next one, and compute from the core browser set what the earliest possible Baseline low date is.

But I think it would be just as good to just say that ranges are allowed for any pre-2016 data except the keystone release for each feature. Once it's 2026 this will be quite easy to justify too :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK, if this will eventually become a date, let's leave it as a date.

index.ts Outdated
if (data.status?.support) {
const versions: string[] = Object.values(data.status.support);
if (versions.some((v) => v.startsWith('≤'))) {
if (data.status.baseline_low_date !== earliestBaselineLowDate) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like this being a more specific thing to start, then expanded to later uses later (as needed).

// Ensure that version ranges are only used for prehistoric features.
if (data.status?.support) {
const versions: string[] = Object.values(data.status.support);
if (versions.some((v) => v.startsWith('≤'))) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't love adding uncertainty to potentially already-certain ranges in BCD, but I expect a future resolution to #1211 to fix this at a later date, so it's fine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I get the discomfort. Should we instead have a single possible combination of ranged browser versions as described in #1018 (comment)?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's leave this for now too. I think bubbling up BCD's uncertainty will mess with a bunch of values anyway (especially dates), so let's sort that out first.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Alright, let me make some cosmetic changes around the Edge 12 date and land this.

@foolip foolip force-pushed the use_ranges_before_baseline_low_date branch 2 times, most recently from 3335b72 to c58ed0f Compare June 10, 2024 14:39
@foolip foolip mentioned this pull request Jun 13, 2024
5 tasks
@ddbeck
Copy link
Collaborator

ddbeck commented Jun 25, 2024

@foolip I think this is ready to go, pending a main merge or rebase.

@foolip foolip force-pushed the use_ranges_before_baseline_low_date branch 2 times, most recently from 347d270 to dcc0587 Compare June 27, 2024 08:16
The `use_ranges_before_baseline_low_date` field controls when generating
the status, but it could also be done in overrides.

Closes web-platform-dx#1018.
@foolip foolip force-pushed the use_ranges_before_baseline_low_date branch from dcc0587 to c09ce0b Compare June 27, 2024 08:20
@foolip foolip merged commit 9c7f22d into web-platform-dx:main Jun 27, 2024
3 checks passed
@foolip foolip deleted the use_ranges_before_baseline_low_date branch June 27, 2024 08:27
@foolip
Copy link
Collaborator Author

foolip commented Jun 27, 2024

This got in the way of grouping comments, see https://github.com/web-platform-dx/web-features/pull/1231/files#r1656826439. I'm considering if we should revert this as it's less important than #1231.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature definition Creating or defining new features or groups of features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow ranged dates and versions for non-threshold support information
3 participants