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 v1-v2 release conversion #29

Merged
merged 1 commit into from
Sep 23, 2024
Merged

Add v1-v2 release conversion #29

merged 1 commit into from
Sep 23, 2024

Conversation

theory
Copy link
Member

@theory theory commented Sep 18, 2024

Dupe the pattern from the meta package by adding v1 and v2 sub-packages that know how to parse into the canonical form. Make meta::v1 public to the crate so that release::v1 can use it to migrate everything but the release metadata, then add v1_to_v2_release to handle that bit.

The v2 release object takes the form of a JWS-JS data structure, but since we're not signing anything yet, and this is just to get things to load properly, for now just generate random values for the JWS header and signature.

While at it, change the uri property to start with dist instead of /dist, because the latter implies relative to the root of a domain, and mirrors may not serve from a domain root.

@theory theory requested a review from vrmiguel September 18, 2024 16:40
@theory theory self-assigned this Sep 18, 2024
Copy link

codecov bot commented Sep 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (88b2183) to head (b239fe4).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #29   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            8        10    +2     
  Lines         1034      1083   +49     
=========================================
+ Hits          1034      1083   +49     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@theory theory linked an issue Sep 18, 2024 that may be closed by this pull request
for (name, patches, expect) in [
(
"license",
vec![json!({"license": "MIT"})],
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
vec![json!({"license": "MIT"})],
&[json!({"license": "MIT"})],

Doing this I believe you could skip the .as_slice() below

Copy link
Member Author

Choose a reason for hiding this comment

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

Sadly that doesn't work because the third item in the list has two items in the vector, not one, so it complains with

mismatched types
expected reference `&[serde_json::Value; 1]`
   found reference `&[serde_json::Value; 2]`

Dupe the pattern from the `meta` package by adding `v1` and `v2`
sub-packages that know how to parse into the canonical form. Make
`meta::v1` public to the crate so that `release::v1` can use it to
migrate everything but the release metadata, then add `v1_to_v2_release`
to handle that bit.

The v2 `release` object takes the form of a JWS-JS data structure, but
since we're not signing anything yet, and this is just to get things to
load properly, for now just generate random values for the JWS header
and signature.

Enable the v1 corpus tests and add a test for merging v1 release
metadata.

While at it, change the `uri` property to start with `dist` instead of
`/dist`, because the latter implies relative to the root of a domain,
and mirrors may not serve from a domain root.
Base automatically changed from release-struct to main September 23, 2024 22:19
@theory theory merged commit b239fe4 into main Sep 23, 2024
138 checks passed
@theory theory deleted the port-v1-release branch September 23, 2024 22:29
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.

Support Release metadata in pgxn_spec
2 participants