Skip to content

Conversation

arnaucasau
Copy link
Collaborator

@arnaucasau arnaucasau commented Dec 19, 2023

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

@arnaucasau arnaucasau changed the title [WIP] Handle Qiskit release notes structure correctly Handle Qiskit release notes structure correctly Dec 20, 2023
@arnaucasau arnaucasau marked this pull request as ready for review December 20, 2023 15:50
Copy link
Collaborator

@Eric-Arellano Eric-Arellano left a 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.

Comment on lines 233 to 236
if (!(await pathExists(versionPath))) {
// We don't have any release note file for that version
continue;
}
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator

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?

Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

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

Looking good!

Comment on lines 233 to 236
if (!(await pathExists(versionPath))) {
// We don't have any release note file for that version
continue;
}
Copy link
Collaborator

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?

Copy link
Collaborator

@Eric-Arellano Eric-Arellano left a 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!

Comment on lines 233 to 236
if (!(await pathExists(versionPath))) {
// We don't have any release note file for that version
continue;
}
Copy link
Collaborator

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].*\//, ""));
Copy link
Collaborator

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?

Copy link
Collaborator Author

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

arnaucasau and others added 2 commits December 28, 2023 19:17
Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
github-merge-queue bot pushed a commit that referenced this pull request Dec 29, 2023
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>
@arnaucasau arnaucasau added this pull request to the merge queue Dec 29, 2023
Merged via the queue into Qiskit:main with commit deb9898 Dec 29, 2023
@arnaucasau arnaucasau deleted the qiskit-release-notes branch December 29, 2023 16:07
frankharkins pushed a commit to frankharkins/documentation that referenced this pull request Jul 22, 2024
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.
frankharkins pushed a commit to frankharkins/documentation that referenced this pull request Jul 22, 2024
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>
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.

Handle Qiskit release notes structure correctly to split out the notes by version
2 participants