Skip to content

fix: validate web feature entries#2520

Open
nanookclaw wants to merge 1 commit into
GoogleChrome:mainfrom
nanookclaw:fix/validate-web-features-schema
Open

fix: validate web feature entries#2520
nanookclaw wants to merge 1 commit into
GoogleChrome:mainfrom
nanookclaw:fix/validate-web-features-schema

Conversation

@nanookclaw
Copy link
Copy Markdown

Summary

Fixes #510.

This adds a validation step inside V3Parser.Parse before the existing post-processing logic runs. The validator checks the raw features object from data.json so malformed entries fail closed instead of being silently skipped or ingested with empty display data.

The checks now reject missing/empty feature maps, empty feature IDs, malformed feature values, unknown or missing kind discriminators, and kind: "feature" entries whose name is missing or blank. I left release-version handling in the existing workflow layer: parseByVersion already gates parser selection from the GitHub release tag, and the current upstream data.json does not include a top-level version field.

The post-processing switch now returns an error for bad discriminator data as a second guard, and feature processing rejects empty names before constructing the stored feature value.

Verification

  • make jsonschema to generate ignored local schema code needed for tests
  • GOTOOLCHAIN=go1.26.0 go test -count=1 ./pkg/data
  • git diff --check

@google-cla
Copy link
Copy Markdown

google-cla Bot commented Jun 5, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Guard against future web feature schema changes

1 participant