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 CDDL validation using cddlparser and pyodide #837

Merged
merged 2 commits into from
Dec 19, 2024
Merged

Add CDDL validation using cddlparser and pyodide #837

merged 2 commits into from
Dec 19, 2024

Conversation

tidoust
Copy link
Member

@tidoust tidoust commented Dec 19, 2024

There is no immediate parser in Node.js that could be used to validate CDDL extracts. Instead, the idea is to run the cddlparser Python package using a Python interpreter running in WebAssembly.

This provides a CDDL validation guarantee for Webref.

Some notes:

  • The version of cddlparser used by Strudy is specified in the requirements.txt file. Goal is for Dependabot to create a pull request automatically when a new version becomes available.
  • Loading could be optimized not to depend on micropip at all, but that requires hardcoding the Wheel URL of the cddlparser package somehow.
  • The line position in the anomalies report needs to be adjusted to account for the header that Reffy adds and that gets stripped during "expansion". That's hardcoded for now. I'd say that's good enough...
  • The CDDL parser stops as soon as it encounters an error, the list of anomalies only contains the first problem as a result.
  • The CDDL parser does not validate additional CDDL semantics for now.

There is no immediate parser in Node.js that could be used to validate CDDL
extracts. Instead, the idea is to run the cddlparser Python package using a
Python interpreter running in WebAssembly.

This provides a CDDL validation guarantee for Webref.

Some notes:
- The version of cddlparser used by Strudy is specified in the
`requirements.txt` file. Goal is for Dependabot to create a pull request
automatically when a new version becomes available.
- Loading could be optimized not to depend on `micropip` at all, but that
requires hardcoding the Wheel URL of the cddlparser package somehow.
- The line position in the anomalies report needs to be adjusted to account for
the header that Reffy adds and that gets stripped during "expansion". That's
hardcoded for now. I'd say that's good enough...
- The CDDL parser stops as soon as it encounters an error, the list of
anomalies only contains the first problem as a result.
- The CDDL parser does not validate additional CDDL semantics for now.
Recent crawl results should have a `cddl` property for each and every spec, but
previous crawl results and test data do not.
Copy link
Member

@dontcallmedom dontcallmedom left a comment

Choose a reason for hiding this comment

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

Amazing 😄

@tidoust tidoust merged commit ae96bd5 into main Dec 19, 2024
1 check passed
@tidoust tidoust deleted the cddl branch December 19, 2024 20:19
tidoust added a commit that referenced this pull request Dec 19, 2024
New features:
- Add CDDL validation using cddlparser and pyodide (#837)
- Add detection of IDL attributes for URL with wrong type (#836)
- Ignore text fragment directive in link comparison
- Run IDL analyses on curated branch, enable noEvent
- Web IDL study: detect event handlers with no matching event (#785)
- Adjust --update-mode options
- New `--cc` option to copy people in issues (#732)

Dependencies bumped:
- Bump mocha from 10.7.3 to 11.0.1
- Bump reffy from 17.2.2 to 18.1.1
- Bump @octokit/plugin-throttling from 9.3.1 to 9.3.2
- Bump @actions/core from 1.10.1 to 1.11.1
- Bump jsdom from 25.0.0 to 25.0.1
- Update jsdom version to avoid noisy deprecation notice
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.

2 participants