Skip to content

Conversation

@rydrman
Copy link
Collaborator

@rydrman rydrman commented Nov 23, 2022

This changes the current inheritance mechanism from being calculated based on the specific Opt::inheritance field, instead expecting the package itself to identify downstream requests that need to be present.

@rydrman rydrman added agenda item Items to be brought up at the next dev meeting Rust API Pertaining to the public rust API of the library labels Nov 23, 2022
@rydrman rydrman added this to the V1 Spec milestone Nov 23, 2022
@rydrman rydrman requested review from dcookspi and jrray November 23, 2022 03:21
@rydrman rydrman self-assigned this Nov 23, 2022
@rydrman rydrman changed the title Remove use of v0::Opt from binary builder Remove v0::Opt from the Package/Recipe Traits Nov 23, 2022
@codecov
Copy link

codecov bot commented Nov 23, 2022

Codecov Report

Merging #563 (d07e319) into main (e175bbc) will increase coverage by 0.06%.
The diff coverage is 67.15%.

@@            Coverage Diff             @@
##             main     #563      +/-   ##
==========================================
+ Coverage   53.93%   53.99%   +0.06%     
==========================================
  Files         248      248              
  Lines       19102    19241     +139     
==========================================
+ Hits        10302    10389      +87     
- Misses       8800     8852      +52     
Impacted Files Coverage Δ
crates/progress_bar_derive_macro/src/lib.rs 0.00% <ø> (ø)
crates/spk-cli/common/src/flags.rs 22.22% <0.00%> (ø)
crates/spk-schema/src/install_spec.rs 100.00% <ø> (ø)
crates/spk-schema/src/recipe.rs 34.78% <0.00%> (ø)
crates/spk-solve/src/io.rs 46.49% <0.00%> (ø)
crates/spk-solve/src/solver.rs 85.46% <14.28%> (-0.85%) ⬇️
crates/spk-schema/src/package.rs 17.14% <30.00%> (+3.34%) ⬆️
crates/spk-schema/src/v0/spec.rs 77.27% <42.59%> (-7.15%) ⬇️
crates/spk-schema/src/spec.rs 76.59% <44.44%> (-2.82%) ⬇️
...ates/validation/src/validators/var_requirements.rs 78.94% <50.00%> (+1.16%) ⬆️
... and 8 more

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@rydrman
Copy link
Collaborator Author

rydrman commented Dec 17, 2022

I have found a way to maintain the old behavior and not need to error on missing requirements for either v1 or v0 (largely thanks to the fact that #594 negates the need to inject downstream build requirements)

I should be able to backport it to this branch in the future

@rydrman rydrman mentioned this pull request Dec 23, 2022
11 tasks
@rydrman rydrman force-pushed the 256-ident-types branch 2 times, most recently from 741933c to f4ee76d Compare January 4, 2023 23:57
Base automatically changed from 256-ident-types to master January 5, 2023 23:28
@jrray
Copy link
Collaborator

jrray commented Jan 31, 2023

This one needs a rebase.

@rydrman rydrman force-pushed the 296-embedded-stub-trait branch from 658caf7 to e59695f Compare February 1, 2023 00:47
@rydrman
Copy link
Collaborator Author

rydrman commented Feb 1, 2023

Thanks, rebased just now

@rydrman rydrman force-pushed the 296-embedded-stub-trait branch from e59695f to 4173e28 Compare February 23, 2023 04:19
@rydrman rydrman force-pushed the 296-embedded-stub-trait branch 2 times, most recently from f84f53e to 07942f4 Compare June 13, 2023 17:16
let renderer = Some(std::thread::spawn(move || {
if let Err(err) = bars.join() {
tracing::error!("Failed to render commit progress: {err}");
tracing::error!("Failed to render commit progress: {}", err);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this was causing errors for me in cargo 1.68 and seems harmless while we finish updating everything else internally

));
}
if self.pin || other.pin {
// we cannot consider an unpinned request to contain any
Copy link
Collaborator

Choose a reason for hiding this comment

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

pin == true is "unpinned"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ya this seems to just be a typo

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually, no - they are unpinned because the request is set as needing to be pinned still - but I'll clarify the comment

Comment on lines 369 to 376
if !value.is_empty() {
f.write_char('/')?;
value.fmt(f)?;
} else if *pin {
f.write_str("/<fromBuildEnv>")?;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should VarRequest::pin and VarRequest::value be combined into an enum (mutually exclusive)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

possibly, but I think that would greatly increase the size of this PR

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am going to give this a try, actually, as it might reduce some of the ambiguity you noted earlier. I'll give up if it get's too involved, though...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Okay, I added a separate commit that introduces an enum for this. I made the VarRequest generic over this type thinking that we could have an instance of it for packages that can only ever have a string value and no pin (since only recipes can pin during build) but it started getting too involved and I left it as-is which is still a bit of an improvement for rusty-ness

Comment on lines 61 to 96
return ours.contains(theirs);
}
(Request::Var(ours), Request::Var(theirs)) => {
return ours.contains(theirs);
Copy link
Collaborator

Choose a reason for hiding this comment

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

The return here means it will give up on the first thing it checks, compatible or incompatible. That doesn't seem right. Shouldn't this be looking to see if any element in self.iter() is compatible?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The requirements list is not supposed to allow multiple requests with the same name. I'll add a comment and also button up the FromIterator implementations that break this invariant.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Turns out we had some bugs-incognito here, but I've buttoned up the RequirementsList type and tried to make the interaction methods clearer.

Copy link
Collaborator

Choose a reason for hiding this comment

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

What I'm still confused about is if self is something like:

- var: a/1.0.0
- var: b/1.0.0
- var: c/1.0.0

and theirs is var: b/1.0.0, won't this return incompatible when comparing the first element a/1.0.0 <> b/1.0.0?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I see what you are saying now, ya it looks like there are some additional checks for the name here

@rydrman rydrman force-pushed the 296-embedded-stub-trait branch from 07942f4 to 541c7bd Compare June 14, 2023 16:00
@rydrman rydrman requested a review from jrray June 14, 2023 18:36
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum PinnableValue {
FromBuildEnv,
Pinned(String),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Pinned(String),
Pinned(Arc<str>),

Don't need mutability here.

I saw https://youtu.be/A4cKi7PTJSs last night and I think it could help this project conserve memory and maybe improve performance. I'm interested in trying out this kind of change in a few areas, like for PkgNameBuf. A combination of this change and some kind of string interning mechanism for common strings like package names.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Interesting video, definitely could be super beneficial to the name bufs - I'll take a stab at the change here

Copy link
Collaborator

Choose a reason for hiding this comment

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

FYI #766.

Copy link
Collaborator

Choose a reason for hiding this comment

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

A lot of missing coverage in this file.

Comment on lines 61 to 96
return ours.contains(theirs);
}
(Request::Var(ours), Request::Var(theirs)) => {
return ours.contains(theirs);
Copy link
Collaborator

Choose a reason for hiding this comment

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

What I'm still confused about is if self is something like:

- var: a/1.0.0
- var: b/1.0.0
- var: c/1.0.0

and theirs is var: b/1.0.0, won't this return incompatible when comparing the first element a/1.0.0 <> b/1.0.0?

Comment on lines +22 to +24
/// Requirements lists cannot contain multiple requests with the
/// same name, requiring instead that they be combined into a single
/// request as needed.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Anecdotally, we have some packages published that have multiple install requirements specified for the same package. This generates a warning when the solver walks over them. We've deprecated the packages to in theory make the solver not consider them, but the solver still has to read the packages to find out they are deprecated... which generates the warning.

rydrman added 7 commits June 28, 2023 18:25
This changes the current inheritance mechanism from being calculated
based on the specific v0::Opt::inheritance field, instead expecting the
package itself to identify downstream requests that need to be present.

Signed-off-by: Ryan Bottriell <rbottriell@ilm.com>
Signed-off-by: Ryan Bottriell <rbottriell@ilm.com>
Signed-off-by: Ryan Bottriell <rbottriell@ilm.com>
The VarRequest had a pin field used to denote when fromBuildEnv was
given and this field was mutually exclusive to a provided value. An enum
works better in this case. Ideally, the package would not allow this
field to be pinned, only the recipe. For now, I have not made that
change only this first one to introduce an enum.

Signed-off-by: Ryan Bottriell <rbottriell@ilm.com>
Signed-off-by: Ryan Bottriell <rbottriell@ilm.com>
Signed-off-by: Ryan Bottriell <rbottriell@ilm.com>
Signed-off-by: Ryan Bottriell <rbottriell@ilm.com>
@rydrman rydrman force-pushed the 296-embedded-stub-trait branch 2 times, most recently from fdc3eea to 7c08bd3 Compare June 29, 2023 02:15
Signed-off-by: Ryan Bottriell <rbottriell@ilm.com>
@rydrman rydrman force-pushed the 296-embedded-stub-trait branch from 7c08bd3 to d07e319 Compare June 29, 2023 02:43
@rydrman rydrman merged commit ea43485 into main Jun 29, 2023
@rydrman rydrman deleted the 296-embedded-stub-trait branch June 29, 2023 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agenda item Items to be brought up at the next dev meeting Rust API Pertaining to the public rust API of the library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants