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

fix: affected_packages's optimization flow #9950

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

dimitropoulos
Copy link
Contributor

Description

This PR addresses the affected_packages API and its handling of the optimization for lockfiles. It should not change the current behaviors without this optimization.

Testing Instructions

In Progress...

Copy link

vercel bot commented Feb 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-basic-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 5:51pm
examples-designsystem-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 5:51pm
examples-gatsby-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 5:51pm
examples-kitchensink-blog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 5:51pm
examples-native-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 5:51pm
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 5:51pm
examples-svelte-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 5:51pm
examples-tailwind-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 5:51pm
examples-vite-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 5:51pm

@@ -70,23 +69,21 @@ impl<'a> ScopeChangeDetector<'a> {
&lockfile_path,
) {
debug!("lockfile did not change");
return None;
Copy link
Contributor Author

@dimitropoulos dimitropoulos Feb 13, 2025

Choose a reason for hiding this comment

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

this appears to have been sorta incorrect because the None state was intended to mean "there was a change but we don't know what it was" which maps, today, to LockfileContents::Unknown. But, as you can see here, it's being used in the codepath where LockfileContents::Unchanged is correct. Ultimately, it shouldn't be a behavioral change, though, because the codepaths have the same end behavior.

Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't "there was a change but we don't know what it was" Some(None)? And None is "no change"

/// This describes the state of a change to a lockfile.
pub enum LockfileContents {
/// We know the lockfile did not change
Unchanged,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

although at first I thought this might not be needed because we have the list of files and can simply see that the lockfile wasn't in there, it's used in change_detector with get_lockfile_contents.

@@ -57,6 +57,7 @@ export class Workspace {
*/
affectedPackages(
files: Array<string>,
changedLockfile?: string | undefined | null
comparison?: string | undefined | null,
Copy link
Member

Choose a reason for hiding this comment

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

Not blocking, but I feel like from or base is less confusing name.
Defer to Git wizard @NicholasLYang, if you're finding affected packages between HEAD and another commit, is there a standard name for what to call that other commit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@NicholasLYang I agree with @chris-olszewski - happy to refer to you on this and in my next PR on the api side, I'll be sure to rename it there too, to match.

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably base is best

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants