shuttle icon indicating copy to clipboard operation
shuttle copied to clipboard

Add better error handling for shuttle-service version checking + compare version requirement rather than full version #283

Open kaleidawave opened this issue 1 year ago • 8 comments

Adds better error handling for when checking shuttle-service version to close #283. Removes potential for indexes to panic and adds detailed information for incorrect results.

I haven't tested this update yet. I also didn't quite know how to add testing for this feature sooo 😆

kaleidawave avatar Jul 27 '22 15:07 kaleidawave

Hmm I guess I am not handling a Value::InlineTable...

I think I instead need to be looking at parsing a manifest and using the dependency method on that instead of ad hoc dependency parsing as there is a lot of places the version could be in.

Will have a look later

kaleidawave avatar Aug 01 '22 09:08 kaleidawave

Awesome looks like it is passing all the tests and can be merged! :)

I decided to use the existing toml_edit crate in the end as the cargo crate is quite integrated and getting dependency information requires linking with the filesystem and stuff that seemed unnecessary complicated.

kaleidawave avatar Aug 02 '22 13:08 kaleidawave

Awesome, yes those changes are good. Have un-nested some of the functions and expanded out the tests a lot more. Now to see if they still pass 😬

kaleidawave avatar Aug 03 '22 11:08 kaleidawave

Awesome have responded. Yes this is quite critical, don't want to start rejecting all builds because of a error with the version logic 😆. So should rigorous with the tests here

kaleidawave avatar Aug 09 '22 12:08 kaleidawave

@kaleidawave we have some tests failing to compile :smile:

chesedo avatar Aug 11 '22 10:08 chesedo

Ooof that was a silly error on my part. Is fixed now :)

kaleidawave avatar Aug 16 '22 11:08 kaleidawave

@kaleidawave it seems there is a few extra failing tests in cargo-shuttle/src/lib.rs :smile:

chesedo avatar Aug 18 '22 06:08 chesedo

Ooof another silly error. Also after some local testing I realise Version is a fully qualified version and that cargo dependencies specify a requirement instead (VersionReq). So I think I will also add a fix that allows shuttle-service = to be *, 0.5, 0.5.* and so on to be compatible with the ones Cargo supports.

But VersionReq doesn't have order defined... When I have a bit more time next week I will do some reading on semver and write some custom matching logic

kaleidawave avatar Aug 18 '22 18:08 kaleidawave

Most of this has been made out of date by #377. Closing for now, but we can open it again for the better error messages

chesedo avatar Oct 17 '22 16:10 chesedo