-
Notifications
You must be signed in to change notification settings - Fork 128
Handle Qiskit release notes structure correctly #537
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for diving into this! I know it's pretty complex logic. You did a great job here abstracting it well and writing effective tests so we can be confident it works.
scripts/lib/releaseNotes.ts
Outdated
if (!(await pathExists(versionPath))) { | ||
// We don't have any release note file for that version | ||
continue; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, when would this happen? For example, if we're adding a brand new Qiskit version, then we should probably set up the new file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an edge case possible if, for some reason, we generate two versions at the same time. For example, if we add a version using the historical argument, the release notes will not be created, and when we add the current version, the file for the former won't exist.
This shouldn't happen often, but if someday we have to regenerate several versions, for some reason, the script will handle the case correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh - I think this probably speaks to my other comment about realizing I think we have a bug how --historical
stops us from generating release notes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I continue to be confused about this point.
we generate two versions at the same time.
That's not technically possible. The script only can generate one release at a time.
For example, if we add a version using the historical argument, the release notes will not be created, and when we add the current version, the file for the former won't exist.
I don't think I'm understanding. If the historical arg has 0.44 and 0.45, then we should expect both those release note files to exist. Now we generate current, which has 0.44, 0.45, and 0.46: it should generate all three of those files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not technically possible.
Yes, sorry, I meant in the same PR. In a situation where you skipped one version, and you want now to add the current and the previous you skipped as historical without having it generated as current before.
I don't think I'm understanding.
The problem that I wanted to describe can't happen anymore because now, the script generates release notes even when we use the historical argument. However, the problem is still there.
When you generate a version for the first time, the release notes for that new version are not present in the release notes folder. The script will read the release notes (html converted to md) in order to find old versions we modified, and we need to update from the files in the folder. To update the old versions, we need to read the current release notes for those versions. The catch is that the script will try to read the current version as well, but the file doesn't exist yet, so we need to prevent it from breaking.
We need to read the current release notes files because we don't want to overwrite everything we had. There are some parts like the front matter or text added manually (like the table in qiskit v0.44 or a custom description) that we want to preserve. Your comment made me realize that we don't need to go through each section because the release notes should contain all the versions by default, so we can just overwrite that part with the new content. In the last commit, I removed some unnecessary code. Thank you Eric.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good!
scripts/lib/releaseNotes.ts
Outdated
if (!(await pathExists(versionPath))) { | ||
// We don't have any release note file for that version | ||
continue; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh - I think this probably speaks to my other comment about realizing I think we have a bug how --historical
stops us from generating release notes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This overall looks great! I only have one doubt still. Thanks for working on this!
scripts/lib/releaseNotes.ts
Outdated
if (!(await pathExists(versionPath))) { | ||
// We don't have any release note file for that version | ||
continue; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I continue to be confused about this point.
we generate two versions at the same time.
That's not technically possible. The script only can generate one release at a time.
For example, if we add a version using the historical argument, the release notes will not be created, and when we add the current version, the file for the former won't exist.
I don't think I'm understanding. If the historical arg has 0.44 and 0.45, then we should expect both those release note files to exist. Now we generate current, which has 0.44, 0.45, and 0.46: it should generate all three of those files.
|
||
if (isReleaseNotes && releaseNotesTitle) { | ||
// Release notes links should point to the current version | ||
$img.attr("src", dest.replace(/[0-9].*\//, "")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. What was happening before this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before this change, if we used the historical argument, the release notes had all the links correct but the images. The images were pointing to the historical folder instead of the current version. For example, public/images/api/qiskit/0.44/circuit-1.png
instead of public/images/api/qiskit/circuit-1.png
Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
Part of #495. -- This PR adds two arguments to `npm run check:links`, `--current-apis` and `--qiskit-release-notes`. In a follow up, we'll add `--historical-apis`. By default, we don't do any of these checks since it's pretty rare for a PR author to be changing those files and we want `npm run check` to be as fast as possible locally. CI will still check the whole thing, though. This makes the script around 2x faster: ``` npm run check:links 4.04s user 0.32s system 156% cpu 2.797 total npm run check:links -- --current-apis --qiskit-release-notes 8.66s user 0.99s system 134% cpu 7.182 total ``` -- To fix the actual broken links, I manually fixed problems in release notes up to 0.44. We are unlikely to regenerate these release notes, so manual fixes should be fine. I did not fix 0.45, though, since we will continue to regenerate those release notes per #537. We will need to fix the underlying problem in the API docs, or in our API generation script.
Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
Part of Qiskit#495. -- This PR adds two arguments to `npm run check:links`, `--current-apis` and `--qiskit-release-notes`. In a follow up, we'll add `--historical-apis`. By default, we don't do any of these checks since it's pretty rare for a PR author to be changing those files and we want `npm run check` to be as fast as possible locally. CI will still check the whole thing, though. This makes the script around 2x faster: ``` npm run check:links 4.04s user 0.32s system 156% cpu 2.797 total npm run check:links -- --current-apis --qiskit-release-notes 8.66s user 0.99s system 134% cpu 7.182 total ``` -- To fix the actual broken links, I manually fixed problems in release notes up to 0.44. We are unlikely to regenerate these release notes, so manual fixes should be fine. I did not fix 0.45, though, since we will continue to regenerate those release notes per Qiskit#537. We will need to fix the underlying problem in the API docs, or in our API generation script.
This PR changes how we write the Qiskit `release-notes.html` to correctly split the notes by version, updating the previous files if we find any change. If we already have a file for the version we updated, the script adds the new entries without overwriting the file and sorts the entries by patch. If the patch we modified was already in the version file, it substitutes its section for the new one. Qiskit v0.45 has been regenerated using the new script to split correctly versions 0.45 and 0.25 to remove the last one from the file. Historical release notes files (< 0.45) will no longer be updated in the regeneration. For more information see: Qiskit/qiskit#11436 Command used: `npm run gen-api -- -p qiskit -v 0.45.0 -a https://github.com/Qiskit/qiskit/suites/17881600359/artifacts/1026798160` Closes Qiskit#359 --------- Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
This PR changes how we write the Qiskit
release-notes.html
to correctly split the notes by version, updating the previous files if we find any change. If we already have a file for the version we updated, the script adds the new entries without overwriting the file and sorts the entries by patch. If the patch we modified was already in the version file, it substitutes its section for the new one.Qiskit v0.45 has been regenerated using the new script to split correctly versions 0.45 and 0.25 to remove the last one from the file. Historical release notes files (< 0.45) will no longer be updated in the regeneration. For more information see: Qiskit/qiskit#11436
Command used:
npm run gen-api -- -p qiskit -v 0.45.0 -a https://github.com/Qiskit/qiskit/suites/17881600359/artifacts/1026798160
Closes #359