Skip to content

Conversation

@mrclary
Copy link
Contributor

@mrclary mrclary commented Apr 2, 2025

In the course of testing #24072, @ccordoba12 discovered the possibility that a previously downloaded update artifact may not match the current update artifact on Github. This is the result of using the completed download artifact size as the verification tool. This works fine to verify the download immediately upon download completion or if the Github artifact does not change. However, it will be more robust to use the checksum of the artifact to both verify the completed download and to verify an existing local artifact against the current Github artifact.

  • The checksum digest for each asset is included in a single Spyder-checksums.txt asset. All 6.x release checksum assets are updated to reflect the new paradigm (unit tests will fail until this is completed).
  • The Spyder-checksums.txt asset is used to obtain the expected checksum for a downloaded asset. Fortunately, this does not need to be downloaded and read from file. A simple url request provides the contents of the file.
  • The checksum is then compared to the locally computed one if the download already exists or upon completion of the download.
  • The result of get_github_releases and get_asset_checksum are cached for unit tests. This removes the need to consider rate limit errors.

Notes:

  • The Spyder-checksums.txt file can be used to verify one or more local assets from the command line as follows.
    $ sha256sum --check Spyder-ckecksums.txt --ignore-missing
  • The updatemanager unit tests rely on specific releases for testing and url requests for Github releases return a finite number of releases. This means that at some time in the near future, either the releases referenced in the tests will need to be updated or the number of releases returned by the url request will need to be increased. This issue existed prior to this PR.

@mrclary mrclary self-assigned this Apr 2, 2025
@mrclary mrclary force-pushed the updater-download-verify branch from 1455137 to e1a25ff Compare April 3, 2025 23:21
@mrclary mrclary marked this pull request as ready for review April 4, 2025 04:44
@mrclary mrclary force-pushed the updater-download-verify branch from e1a25ff to 0fb3270 Compare April 4, 2025 16:14
@ccordoba12 ccordoba12 added this to the v6.1.0a2 milestone Apr 4, 2025
@mrclary mrclary force-pushed the updater-download-verify branch from 0fb3270 to 593e8f2 Compare April 5, 2025 04:09
Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

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

Just a few comments and suggestions for you @mrclary.

@ccordoba12 ccordoba12 changed the title PR: Use checksum to verify downloaded asset for updating Spyder PR: Use checksum to verify downloaded asset for updating Spyder (Update manager) Apr 5, 2025
mrclary and others added 7 commits April 5, 2025 13:30
…set size.

This can reduce url requests when checking for asset availability.
This also obviates writing asset size to file.
Verifying download now checks asset size against size info in Github release.
Download directory is cleared immediately prior to download.
…eliminates the need to consider rate limits on Github url requests.
Use recommended Github request header.
Cache get_asset_checksum, but only in unit tests.
Create single checksum file and include digest for zip and pkg assets.
Co-authored-by: Carlos Cordoba <ccordoba12@gmail.com>
@mrclary mrclary force-pushed the updater-download-verify branch from 8c3b17b to 261d411 Compare April 5, 2025 20:34
Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

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

@mrclary, I tested this manually and have a few more suggestions/comments for you.

Co-authored-by: Carlos Cordoba <ccordoba12@gmail.com>
@mrclary mrclary force-pushed the updater-download-verify branch from f3c36f8 to e692d11 Compare April 6, 2025 17:32
Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

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

Looks good to me now, thanks @mrclary!

@ccordoba12 ccordoba12 merged commit dc00617 into spyder-ide:master Apr 7, 2025
30 checks passed
@mrclary mrclary deleted the updater-download-verify branch April 7, 2025 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants