-
Notifications
You must be signed in to change notification settings - Fork 257
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 spin doctor
spurious "missing Wasm file" if app is in another directory
#1514
Fix spin doctor
spurious "missing Wasm file" if app is in another directory
#1514
Conversation
a6b578d
to
e181c58
Compare
This doesn't seem too bad to me, but another option to consider: impl PatientWasm {
// ...
pub fn local_abs_path(&self) -> Option<PathBuf> {
match self.source() {
WasmSource::Local(path) => Some(self.app_dir.join(path)),
_ => None,
}
}
}
|
e181c58
to
9d13971
Compare
Thanks @lann - I adopted that and it made for a cleaner diff I think. But it did make some of the "when do I use what" a bit fuzzier, so I ended up doing some renames anyway... Anyway ready for review now. |
crates/doctor/src/wasm.rs
Outdated
pub fn source(&self) -> WasmSource { | ||
match &self.0.source { | ||
pub fn rel_source(&self) -> WasmSource { | ||
match &self.component.source { | ||
RawModuleSource::FileReference(path) => WasmSource::Local(path), | ||
_ => WasmSource::Other, | ||
} | ||
} |
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.
Maybe change this to source_path(&self) -> Option<&Path>
and drop WasmSource
entirely? I think that will be clear enough and we'll need to document these before stabilizing this interface anyway.
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.
or maybe local_source_path
and local_source_abs_path
or something
9d13971
to
c18e66d
Compare
Does this play well with the changes from #1503? |
@rylev Ugh, good catch. Probably not. It looks like those paths are resolved at the apping stage rather than the raw load stage, and the Wasm doctor wisely relies only on the raw manifest (because the apping stage requires a high degree of validity). I guess I can bodge around it or rework the loader pipeline to more finely reflect load stages. The latter is my long term goal but I might try the former for now. sigh |
c18e66d
to
1d09e13
Compare
Signed-off-by: itowlson <ivan.towlson@fermyon.com>
1d09e13
to
f50721e
Compare
I ran into this because I was playing with
spin doctor
usingspin doctor -f ~/testing/kvmadness
and it reported that my Wasm file was missing. It looks like it currently probes for the file relative to the current directory rather than the app directory.This fixes that, but it feels a bit verbose, like I am passing more stuff around more places than should be necessary. @lann I'd be grateful for any insight on how you envisaged things like this being structured. I saw that the
WasmDiagnostic
trait passes thePatientApp
that includes the manifest file path, and originally used that to construct the absolute Wasm path indiagnose_wasm
.But it felt like that would end up getting repeated in multiple diagnostics so I moved it into the
PatientWasm
type. Anyway I don't want to end up spoiling the design on my first outing grin