Skip to content

[Refactor ensureStateIsUpToDate] split into two modes for when to recompute state #1723

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

Merged
merged 2 commits into from
Jan 16, 2024

Conversation

savil
Copy link
Collaborator

@savil savil commented Jan 12, 2024

Summary

Refactor the implementation of ensureStateIsUpToDate as per the suggestion in this comment: #1692 (comment)

  1. Split lockfile.Save into lockfile.Save and lockfile.UpdateAndSaveStateHash
  2. For now, regardless of recomputeState (boolean variable), we always call recomputeState (the function). In the next PR, this will change.

NOTE:
In pluginManager.create, I only do lockfile.Save and not lockfile.UpdateAndSaveLocal (as before), because:
When I do devbox add php81Extensions.ds then the lockfile.Save in pluginManager.Create here is resulting in the local.lock being up-to-date so that the next devbox run is thinking everything is up to date and early returning in ensureStateIsUpToDate.

How was it tested?

devbox shell
devbox add hello
devbox rm hello

tests should pass.

Copy link
Collaborator Author

savil commented Jan 12, 2024

@savil savil force-pushed the savil/refactor-ensureStateUpToDate branch 4 times, most recently from 63e7860 to 3e1be89 Compare January 12, 2024 01:17
@savil savil force-pushed the savil/refactor-ensureStateUpToDate branch from 3e1be89 to 5cbd4a9 Compare January 12, 2024 04:42
@savil savil force-pushed the savil/refactor-ensureStateUpToDate branch from 5cbd4a9 to 6788172 Compare January 12, 2024 23:58
@savil savil requested review from mikeland73 and gcurtis January 13, 2024 00:59
@savil savil marked this pull request as ready for review January 13, 2024 00:59
@mikeland73
Copy link
Contributor

I'm not sure removing lock.Save() from plugin manager is great. It modifies the lock file so I would expect it to save it?

When I do devbox add php81Extensions.ds then the lockfile.Save in pluginManager.Create here is resulting in the local.lock being up-to-date so that the next devbox run is thinking everything is up to date and early returning in ensureStateIsUpToDate.

Why is the case?

If it only saves the lockfile but does not update the local cache state, would the local state not be out of date?

@savil savil merged commit e0cf344 into main Jan 16, 2024
@savil savil deleted the savil/refactor-ensureStateUpToDate branch January 16, 2024 23:05
mikeland73 added a commit that referenced this pull request Jan 18, 2024
mikeland73 added a commit that referenced this pull request Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants