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

o/assertstate, o/snapstate: always validate existence of snap-resource-pair for asserted components #14749

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

andrewphelpsj
Copy link
Member

Currently we don't enforce validating the existence of a snap-resource-pair when sideloading an asserted component. This change makes it so validate-component will now always be run when installing a component with a revision from the store. The task now handles components that are from the store differently than components that are being installing from a local file.

Copy link

codecov bot commented Nov 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.04%. Comparing base (96ea7b0) to head (34f5445).
Report is 89 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #14749      +/-   ##
==========================================
+ Coverage   78.95%   79.04%   +0.09%     
==========================================
  Files        1084     1087       +3     
  Lines      146638   147725    +1087     
==========================================
+ Hits       115773   116767     +994     
- Misses      23667    23730      +63     
- Partials     7198     7228      +30     
Flag Coverage Δ
unittests 79.04% <100.00%> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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


🚨 Try these New Features:

Copy link
Member

@alfonsosanchezbeato alfonsosanchezbeato 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, I have a question though

@@ -347,6 +347,9 @@ func doInstallComponent(st *state.State, snapst *SnapState, compSetup ComponentS
if fromStore {
prepare = st.NewTask("download-component", fmt.Sprintf(i18n.G("Download component %q%s"), compSetup.ComponentName(), revisionStr))
} else {
// if we're not downloading the component, then we can clear out any
// download info that might exist from the calling code
compSetup.DownloadInfo = nil

Choose a reason for hiding this comment

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

Is this really necessary? It should be actually nil for local files already, if that is not the case sounds a bit like a bug somewhere.

Copy link
Member Author

@andrewphelpsj andrewphelpsj Nov 20, 2024

Choose a reason for hiding this comment

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

Consider the case where we refresh a snap and the component revisions don't change. In that case, we will still have a DownloadInfo on the ComponentSetup, since we did check with the store for potential updates. It is up to doInstallComponent to decide that we don't need to re-download it.

Since it is valid for doInstallComponent to decide to not download a component, despite the caller providing a DownloadInfo, I think that this is needed.

Copy link
Member Author

Choose a reason for hiding this comment

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

0a42660 adds a commit that shows the need for this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

but in that case we still want to get a potentially updated pair from the store no? so it's not clear we want this behavior change

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah you're totally right.

@pedronis pedronis added this to the 2.67 milestone Nov 21, 2024
Copy link
Collaborator

@pedronis pedronis 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 but one comment

@@ -347,6 +347,9 @@ func doInstallComponent(st *state.State, snapst *SnapState, compSetup ComponentS
if fromStore {
prepare = st.NewTask("download-component", fmt.Sprintf(i18n.G("Download component %q%s"), compSetup.ComponentName(), revisionStr))
} else {
// if we're not downloading the component, then we can clear out any
// download info that might exist from the calling code
compSetup.DownloadInfo = nil
Copy link
Collaborator

Choose a reason for hiding this comment

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

but in that case we still want to get a potentially updated pair from the store no? so it's not clear we want this behavior change

@pedronis pedronis removed this from the 2.67 milestone Nov 22, 2024
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.

3 participants