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

chore: check config policies on 'det notebook set priority' #10047

Merged
merged 3 commits into from
Oct 15, 2024

Conversation

stoksc
Copy link
Contributor

@stoksc stoksc commented Oct 11, 2024

Ticket

CM-562

Description

Add a constraint check to a stray priority change API.

Test Plan

TBD.

@stoksc stoksc requested a review from a team as a code owner October 11, 2024 21:13
@cla-bot cla-bot bot added the cla-signed label Oct 11, 2024
Copy link

netlify bot commented Oct 11, 2024

Deploy Preview for determined-ui canceled.

Name Link
🔨 Latest commit acd760b
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/670dae363a127d0008476406

Copy link

codecov bot commented Oct 11, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 54.41%. Comparing base (2ef2f12) to head (acd760b).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
master/internal/command/command.go 66.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10047      +/-   ##
==========================================
- Coverage   54.42%   54.41%   -0.01%     
==========================================
  Files        1262     1262              
  Lines      158880   158886       +6     
  Branches     3631     3632       +1     
==========================================
- Hits        86463    86455       -8     
- Misses      72283    72297      +14     
  Partials      134      134              
Flag Coverage Δ
backend 45.47% <66.66%> (-0.02%) ⬇️
harness 72.74% <ø> (ø)
web 53.95% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
master/internal/command/command.go 66.79% <66.66%> (-0.01%) ⬇️

... and 7 files with indirect coverage changes

@@ -278,6 +279,16 @@ func (c *Command) garbageCollect() {
}

func (c *Command) setNTSCPriority(priority int, forward bool) error {
if smallerHigher, err := c.rm.SmallerValueIsHigherPriority(); err == nil {
ok, err := configpolicy.PriorityAllowed(int(c.Metadata.WorkspaceID), model.NTSCType, priority, smallerHigher)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need to be calling

Suggested change
ok, err := configpolicy.PriorityAllowed(int(c.Metadata.WorkspaceID), model.NTSCType, priority, smallerHigher)
ok, err := configpolicy.PriorityUpdateAllowed(int(c.Metadata.WorkspaceID), model.NTSCType, priority, smallerHigher)

That function is implemented in the only commit on main that this branch doesn't have lol 😆. PriorityAllowed checks against constraints but we also want to check that this field isn't set in an invariant config, which is done in findAllowedPriority, a helper in PriorityUpdateAllowed!

Copy link
Contributor

Choose a reason for hiding this comment

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

I changed the name of the function (by request) in a recent PR. Sorry to change the code out from under you.

Copy link
Contributor

@amandavialva01 amandavialva01 Oct 14, 2024

Choose a reason for hiding this comment

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

Makes sense, this veriy likely would have had merge conflicts and would have been discovered when rebasing either way

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've changed it. I didn't have any conflicts from git (merge button is still green), it was a semantic conflict. So thanks for the catch.

Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome! Change LGTM, approved!

Copy link
Contributor

@amandavialva01 amandavialva01 left a comment

Choose a reason for hiding this comment

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

This looks great! I think we need to rebase this branch onto main and change the helper being used so that we check for invariant configs as well!

@stoksc stoksc force-pushed the check-contraints-set-nb-prio branch from 454e573 to acd760b Compare October 14, 2024 23:50
Copy link
Contributor

@amandavialva01 amandavialva01 left a comment

Choose a reason for hiding this comment

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

LGTM, awesome work!

@stoksc stoksc merged commit 5a39ecb into main Oct 15, 2024
81 of 94 checks passed
@stoksc stoksc deleted the check-contraints-set-nb-prio branch October 15, 2024 13:39
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