-
Notifications
You must be signed in to change notification settings - Fork 290
Merge spin locked app into spin app #3231
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
Open
seun-ja
wants to merge
5
commits into
spinframework:main
Choose a base branch
from
seun-ja:consider-merging-spin-locked-app-into-spin-app
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/// Type alias for a [`Result`]s with [`Error`]. | ||
pub type Result<T> = std::result::Result<T, Error>; | ||
|
||
/// Errors returned by methods in this crate. | ||
#[derive(Debug, thiserror::Error)] | ||
pub enum Error { | ||
/// An error propagated from the `spin_core` crate. | ||
#[error(transparent)] | ||
Core(anyhow::Error), | ||
/// An error from a `DynamicHostComponent`. | ||
#[error("host component error: {0:#}")] | ||
HostComponent(#[source] anyhow::Error), | ||
/// An error from a `Loader` implementation. | ||
#[error(transparent)] | ||
Loader(anyhow::Error), | ||
/// An error indicating missing or unexpected metadata. | ||
#[error("metadata error: {0}")] | ||
Metadata(String), | ||
/// An error indicating failed JSON (de)serialization. | ||
#[error("json error: {0}")] | ||
Json(#[from] serde_json::Error), | ||
/// A validation error that can be presented directly to the user. | ||
#[error(transparent)] | ||
Validation(anyhow::Error), | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Intentional that tests are being removed?
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.
It was moved into the
spin-factor-test
crate to avoid the cyclic dependency issue the compiler frowns at.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.
factors-test
seems like a rather strange place for it - I thought retaining components was a pure LockedApp operation whereasfactors-test
seems to be more about instantiation and runtime configuration. What was the cyclic dependency that you ran into?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.
The test inside the module
test_retain_components_filtering_for_only_component_works
callsbuild_locked_app
fromspin-factor-test
, which returnsLockedApp
.LockedApp
previously lived insidespin-locked_app
; hence, bothspin-app
andspin-factor-test
depend onspin-locked-app
, no conflict.With the merge,
LockedApp
lives insidespin-app
, that meansspin-factor-test
, which hostsbuild_locked_app
, would have to depend onspin-app
to importLockedApp
(which the function returns alongside other functions), whilespin-app
depends onspin-factor-test
forbuild_locked_app
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 seems like the tail wagging the dog.
build_locked_app
is a tiny ancillary function that basically wrapsspin_loader::from_file
. I don't think we should be locating tests based on where we happen to have existing helpers - I'd strongly prefer to keep the test with the thing it's testing and figure out how to support it in that location.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 see you've moved the
retain_components
test tospin_loader
, which still seems like you're letting the ancillarybuild_locked_app
control where you put the test. The test should go alongsideretain_components
and then you should figure out what supporting infrastructure it needs in that location. If that involves reworking or jettisoningbuild_locked_app
then so be it -build_locked_app
is not the important thing in the test and should not be driving the design.Looking at existing code, I'm a bit puzzled at why the compiler is getting mad now anyway. The
app
crate already has a dev-dependency onfactors-test
, andfactors-test
already has a dependency onapp
. Is it becausefactors-test
really only depended on theLockedApp
re-export and the compiler realised it wasn't a true circle?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 think because of the cyclic issue even though
spin-app
hasspin-factors-test
as adev-dependence
, the compiler keeps having issues knowing whichLockedApp
retain_components
returns.the crate `spin_app` is compiled multiple times, possibly with different configurations
Full error: