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

fix(validate/webidl): upgrade reffy #155

Merged
merged 2 commits into from Apr 11, 2024
Merged

fix(validate/webidl): upgrade reffy #155

merged 2 commits into from Apr 11, 2024

Conversation

dontcallmedom
Copy link
Member

No description provided.

@sidvishnoi
Copy link
Member

Well that's a jump. The API is same, right?

dontcallmedom added a commit to w3c/webrtc-pc that referenced this pull request Mar 1, 2023
@dontcallmedom
Copy link
Member Author

hmm... I recall we did some breaking changes in the CLI, so this probably needs more careful checking; @tidoust would probably know best, but is away this week

@sidvishnoi
Copy link
Member

I'll see if we can use package.json (and dependabot) for this. Via optional dependencies perhaps.
Adding a CI for spec-prod itself is also on my TODO list.

@sidvishnoi sidvishnoi changed the title Upgrade reffy version used in WebIDL validation fix(validate/webidl): upgrade reffy Mar 1, 2023
@tidoust
Copy link
Member

tidoust commented Mar 6, 2023

Breaking changes are documented in major release commits. Also see the -v5.0.0 commit which did not follow the same commit message convention.

One breaking change affects spec-prod: v6.0.0 separated the raw IDL and the parsed IDL in the result structure, which means that the following line needs to be updated to const idl = results[0]?.idl:

const idl = results[0]?.idl?.idl;

Other breaking changes should not affect Web IDL extraction.

@sidvishnoi
Copy link
Member

Would someone be willing to update reffy further and handle the breaking changes?

dontcallmedom and others added 2 commits April 11, 2024 15:02
The only breaking change that affects Web IDL validation is the separation
between the `idl` and `idlparsed` modules in v6.0.0, which made the extracted
IDL available under a different path in the result.

A couple of minor improvements have been made to IDL extraction but no other
substantive change that would require updating the code.
Copy link
Member

@sidvishnoi sidvishnoi left a comment

Choose a reason for hiding this comment

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

Thanks @tidoust! I was expecting more breaking changes 😄

@sidvishnoi
Copy link
Member

I'll add a test infra for this project sometime! Until then, 🤞🏽

@tidoust
Copy link
Member

tidoust commented Apr 11, 2024

@sidvishnoi, I rebased the PR and force-pushed an update that bumps Reffy to its latest major version, and makes the change I raised earlier.

As far as I can tell, that should be all that's needed (IDL extraction has not changed significantly in the past few years). Now, I have not checked the resulting code. If there's a simple way to test this before merging, that could prove useful...

@sidvishnoi
Copy link
Member

Simplest way to test would be to create a fork of a repo, and use w3c/spec-prod@dontcallmedom-patch-1 in workflow.

@sidvishnoi
Copy link
Member

I tested locally by curl -o test.html a spec, and running tsx src/validate-webidl.ts

diff --git a/src/validate-webidl.ts b/src/validate-webidl.ts
index 40d3c67..1946c41 100644
--- a/src/validate-webidl.ts
+++ b/src/validate-webidl.ts
@@ -4,17 +4,15 @@ import { BuildResult } from "./build.js";
 type Input = Pick<BuildResult, "dest" | "file">;
 
 if (module === require.main) {
-	if (yesOrNo(env("INPUTS_VALIDATE_WEBIDL")) === false) {
-		exit("Skipped", 0);
-	}
-
-	const input: Input = JSON.parse(env("OUTPUTS_BUILD"));
-	main(input).catch(err => exit(err.message || "Failed", err.code));
+	main({
+		dest: process.cwd(),
+		file: "test.html",
+	}).catch(err => exit(err.message || "Failed", err.code));
 }
 
 export default async function main({ dest, file }: Input) {
 	console.log(`Validating Web IDL defined in ${file}...`);
-	await install("reffy@4");
+	await install("reffy@15");
 	const { crawlSpecs } = require("reffy");
 
 	const fileurl = new URL(file, `file://${dest}/`).href;
@@ -24,7 +22,7 @@ export default async function main({ dest, file }: Input) {
 	);
 	await rm(".cache", { recursive: true, force: true });
 
-	const idl = results[0]?.idl?.idl;
+	const idl = results[0]?.idl;
 	if (!idl) {
 		exit("No Web IDL found in spec, skipped validation", 0);
 	}

@sidvishnoi sidvishnoi merged commit c6d5322 into main Apr 11, 2024
1 check passed
@sidvishnoi sidvishnoi deleted the dontcallmedom-patch-1 branch April 11, 2024 13:27
@qingxinwu qingxinwu mentioned this pull request Apr 11, 2024
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.

None yet

3 participants