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

Add an internal-only "annotations" field #24783

Open
ddbeck opened this issue Oct 22, 2024 · 3 comments
Open

Add an internal-only "annotations" field #24783

ddbeck opened this issue Oct 22, 2024 · 3 comments
Labels
enhancement Nice to have features. schema Isses or pull requests regarding the JSON schema files used in this project.

Comments

@ddbeck
Copy link
Collaborator

ddbeck commented Oct 22, 2024

What would you like to see added to BCD?

This is a proposal for a new, internal-only tagging field to help tools and contributors make sense of the data while reviewing and editing it.

I'm suggesting an annotations field that could be used in __compat and status objects and simple support statements. It would accept an array of (enumerated) strings. It would not be a free-form notes field. Instead, we'd have a file (or a lint script) declare which annotations are permitted and their meaning. At build time, these annotations would be stripped from the data.

Here are some use-cases:

Provenance

We could use this field to mark the origin of a piece of data. For example, when the collector runs and creates a new support statement, it could leave a breadcrumb that it produced that value (e.g., that it was not manually introduced).

{
  "version_added": "131",
  "annotations": [
    "provenance:collector"
  ]
}

Meanwhile, a human contributor could mark a new data point (such a behaviorial feature) as being hand-written:

{
  "version_added": "131",
  "annotations": [
    "provenance:authored"
  ]
}

In the course of other investigations, we might note when something was originally migrated from the wiki but was later confirmed:

{
  "version_added": "1",
  "annotations": [
    "provenance:wiki",
    "confirmed:collector"
  ]
}
{
  "version_added": "16",
  "annotations": [
    "provenance:authored",
    "confirmed:manual-test"
  ]
}

FIXME comments

Suppose we discovered some issue with data, but had not been able to resolve it yet. We could mark that data, setting ourselves up for a burndown of data that needs investigation. To ensure that the flags are useful, we could require an issue URL:

{
  "version_added": "4",
  "annotations": [
    "fixme:https://github.com/mdn/browser-compat-data/issue/00000"
  ]
}

How impactful do you think this enhancement will be?

I think it would help us mark up data to make it easier for our future selves to understand what we've done, without doing heavier and riskier alternatives, such as switching formats (e.g., JSONC, JSON5, YAML) and allowing traditional code comments.

Do you have anything more you want to share?

No response

@ddbeck ddbeck added the enhancement Nice to have features. label Oct 22, 2024
@ddbeck ddbeck changed the title Add an internal-only "provenance" field Add an internal-only "annotations" field Oct 22, 2024
@ddbeck
Copy link
Collaborator Author

ddbeck commented Oct 23, 2024

This would be an alternative to #9223.

@caugner caugner added the schema Isses or pull requests regarding the JSON schema files used in this project. label Nov 20, 2024
@ddbeck
Copy link
Collaborator Author

ddbeck commented Jan 21, 2025

On the BCD call today, we discussed this tangential to a data PR, where we had some uncertainty about the data. I mentioned this proposal as a way to mark data that's uncertain.

The discussion and reading over this revealed one issue: "annotations" is a bit long and doesn't obviously mark itself as an internal field. @caugner suggested something like "_notes" instead, both to be shorter and to indicate the internal-ness of the field. In the distant past, there have been suggestions to use $ as an internal marker, so something like $notes$ could do as well.

There were also questions about this being a schema change that might impact consumers. Since there's a separate build step in BCD, it's not clear to me that this is required, though we might need something like an internal schema, then a public schema that removes the internal-only fields. I don't think this would be terribly difficult, but it would be a new bit of indirection within the repo.

cc: @caugner, @Elchi3

@caugner
Copy link
Contributor

caugner commented Jan 23, 2025

Given that "annotations" is a bit long, and "notes" is already taken, how about repurposing the "tags" field:

  1. Move the web-features tags into a dedicated feature field,
  2. Start reusing the tags field for internal annotations, and
  3. Introduce a tags field on support statements.

As for prefixes, here are some potentially useful ones that come to mind:

Key Value Feature Support
provenance <'authored'|'wiki'> -
fixme <task or url to issue/comment>
confirmed <'collector'|'manual-test'> -
collector <'yes'|'no'> -
wpt-url <url to WPT query> -
webcompat-url <url to webcompat issue> -
same-as <other BCD key> -
inherits <'yes'> -
deprecation <reason> -

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Nice to have features. schema Isses or pull requests regarding the JSON schema files used in this project.
Projects
None yet
Development

No branches or pull requests

2 participants