Skip to content

Update stats script#4030

Open
ddbeck wants to merge 2 commits into
web-platform-dx:mainfrom
ddbeck:new-stats
Open

Update stats script#4030
ddbeck wants to merge 2 commits into
web-platform-dx:mainfrom
ddbeck:new-stats

Conversation

@ddbeck
Copy link
Copy Markdown
Collaborator

@ddbeck ddbeck commented May 11, 2026

Towards #3510, this PR updates ./scripts/stats.ts to return a JSON object with counts of:

  • The total features
  • The total groups
  • The total compat keys in our BCD dependency
  • The unmapped compat keys
  • The unmapped compat keys that are nomral (i.e., not nonstandard or deprecated in BCD)
  • The unmapped compat keys that are discourageable (i.e., nonstandard or deprecated in BCD)
  • The cumulative shipping days for each (i.e., for each requisite compat key, how many days has a browser shipped that feature in a stable release; see Generate new statistics #3510 (comment) for more details)
  • The total caniuse IDs in our caniuse-lite dependency (excluding some dupes of BCD)
  • The unmapped caniuseIds

The output looks like this:

{
  "featureCount": 1163,
  "groupCount": 103,
  "compatKeys": 17714,
  "unmappedCompatKeys": 2680,
  "unmappedCompatKeysNormal": 1691,
  "unmappedCompatKeysDiscourageable": 16023,
  "unmappedCompatKeysCumulativeShippingDays": 41875279,
  "unmappedCompatKeysCumulativeShippingDaysNormal": 11600644,
  "unmappedCompatKeysCumulativeShippingDaysDiscourageable": 30274635,
  "caniuseIds": 583,
  "unmappedCaniuseIds": 236
}

(Yes, some of those numbers are very large! This is expected.)

If you rerun it with --previous some-previous-run.json , it'll include a change key with the difference between the two runs.

Possible follow up work:

  • Create a stats.json release artifact for comparing stats over time
  • Create a regularly-posted comment thread similar to Feature statistics #788, possibly with graphs

@ddbeck ddbeck added the R26:coverage Close the coverage gap (roadmap 2026) label May 11, 2026
@github-actions github-actions Bot added the tools and infrastructure Project internal tooling, such as linters, GitHub Actions, or repo settings label May 11, 2026
Comment thread scripts/stats.ts
Comment on lines +75 to +77
const unmappedCompatKeysCumulativeShippingDaysDiscourageable = [
...featuresToDays.values(),
].reduce((prev, curr) => prev + curr, 0);
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.

This is wrong. It's summing all features, not just the discourageables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

R26:coverage Close the coverage gap (roadmap 2026) 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.

1 participant