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: improve errors for ReadAll and loadIndexfile #526

Merged
merged 1 commit into from
Jun 27, 2023

Conversation

sparr
Copy link
Contributor

@sparr sparr commented Jun 20, 2023

NewWithContext refers to both the oci-layout and index.json as "OCI Image Layout", this PR fixes the latter.

ReadAll is a deeper change that will improve error reporting for a lot of cases, at the cost of error volume. Some or all of that change could happen higher up to satisfy this particular issue. I think the expected/actual size output belongs here. There seem to be more than a few code paths in this and other repos that end up calling ReadAll multiple times without reporting which call produced an error so I think it's appropriate to also output the digest here, but that's less compelling.

The Verify comment clears up confusion I encountered while working on this issue. "verifies size" implies checking for both too big AND too small, but it only checks if the file is bigger (or reader is longer) than expected.

Fixes #432

Copy link
Member

@TerryHowe TerryHowe left a comment

Choose a reason for hiding this comment

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

/lgtm

@codecov-commenter
Copy link

codecov-commenter commented Jun 25, 2023

Codecov Report

Merging #526 (bb97f3e) into main (2e7b65f) will decrease coverage by 0.02%.
The diff coverage is 83.33%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##             main     #526      +/-   ##
==========================================
- Coverage   73.22%   73.21%   -0.02%     
==========================================
  Files          49       49              
  Lines        4602     4604       +2     
==========================================
+ Hits         3370     3371       +1     
- Misses        923      924       +1     
  Partials      309      309              
Impacted Files Coverage Δ
content/oci/readonlyoci.go 73.52% <0.00%> (ø)
content/oci/oci.go 75.28% <100.00%> (ø)
content/reader.go 89.39% <100.00%> (-1.24%) ⬇️

content/reader.go Outdated Show resolved Hide resolved
content/oci/oci.go Show resolved Hide resolved
@shizhMSFT
Copy link
Contributor

@sparr Could you address the comment and rebase the branch? We are ready to merge 🚀

@shizhMSFT shizhMSFT changed the title Improve errors for ReadAll and loadIndexfile fix(oci): improve errors for ReadAll and loadIndexfile Jun 25, 2023
@shizhMSFT shizhMSFT changed the title fix(oci): improve errors for ReadAll and loadIndexfile fix: improve errors for ReadAll and loadIndexfile Jun 25, 2023
@sparr sparr force-pushed the 432_loadIndexFile_error_clarity branch from 5ef63f4 to a18e874 Compare June 25, 2023 03:20
@Wwwsylvia
Copy link
Member

Wwwsylvia commented Jun 26, 2023

It looks like the branch is still out-of-date. @sparr Would you mind rebasing it?

Signed-off-by: Clarence "Sparr" Risher <clrnc@amazon.com>
@sparr sparr force-pushed the 432_loadIndexFile_error_clarity branch from a18e874 to bb97f3e Compare June 26, 2023 13:32
@sparr
Copy link
Contributor Author

sparr commented Jun 26, 2023

I'm also ok with contributors rebasing the PR.

Copy link
Member

@Wwwsylvia Wwwsylvia left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

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

LGTM

@Wwwsylvia Wwwsylvia merged commit 6b5bd4b into oras-project:main Jun 27, 2023
7 checks passed
@sparr sparr deleted the 432_loadIndexFile_error_clarity branch June 27, 2023 13:59
Wwwsylvia pushed a commit to Wwwsylvia/oras-go that referenced this pull request Jul 4, 2023
NewWithContext refers to both the `oci-layout` and `index.json` as "OCI
Image Layout", this PR fixes the latter.

ReadAll is a deeper change that will improve error reporting for a lot
of cases, at the cost of error volume. Some or all of that change could
happen higher up to satisfy this particular issue. I think the
expected/actual size output belongs here. There seem to be more than a
few code paths in this and other repos that end up calling ReadAll
multiple times without reporting which call produced an error so I think
it's appropriate to also output the digest here, but that's less
compelling.

The Verify comment clears up confusion I encountered while working on
this issue. "verifies size" implies checking for both too big AND too
small, but it only checks if the file is bigger (or reader is longer)
than expected.

Fixes oras-project#432

Signed-off-by: Clarence "Sparr" Risher <clrnc@amazon.com>
shizhMSFT pushed a commit that referenced this pull request Jul 4, 2023
NewWithContext refers to both the `oci-layout` and `index.json` as "OCI
Image Layout", this PR fixes the latter.

ReadAll is a deeper change that will improve error reporting for a lot
of cases, at the cost of error volume. Some or all of that change could
happen higher up to satisfy this particular issue. I think the
expected/actual size output belongs here. There seem to be more than a
few code paths in this and other repos that end up calling ReadAll
multiple times without reporting which call produced an error so I think
it's appropriate to also output the digest here, but that's less
compelling.

The Verify comment clears up confusion I encountered while working on
this issue. "verifies size" implies checking for both too big AND too
small, but it only checks if the file is bigger (or reader is longer)
than expected.

Fixes #432

Signed-off-by: Clarence "Sparr" Risher <clrnc@amazon.com>
@Wwwsylvia Wwwsylvia mentioned this pull request Jul 4, 2023
4 tasks
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.

oras copy error message is not clear enough
5 participants