Repository navigation
fix(server): AND the GPU product pin into the form's node terms - #58
Open
aceforeverd wants to merge 1 commit into
Open
aceforeverd wants to merge 1 commit into
aceforeverd wants to merge 1 commit into
Conversation
nodeSelectorTerms are ORed, and a term's matchExpressions ANDed. Picking GPU products used to replace the form's required terms with the product term, and a variant's derived pin was replaced by any terms the form set, so a preset's or an edited term was lost either way. Both now add the product expression to each of the form's terms, replacing an In on the same key, and set the product term alone only when the form has none.
huskcass
reviewed
Nov 10, 2026
huskcass
left a comment
Collaborator
There was a problem hiding this comment.
No blockers. Tests pass against the pinned catalog (go test ./...), and the go and gate checks are green; e2e and publish were still pending.
Medium
- Silent dropped pins. In
AndTerms, a pin entry that isn't a map is skipped and a form term that isn't a map is kept without the pin, so a malformed term yields an unpinned deploy with no error. Both inputs come from our own code and a decoded form, so these are unrealistic cases. Cut theokbranches and themap[string]anyarm ofasTree(keep one decoded type), or return an error instead of passing through. - Behavior change when no products are picked. If the form already has an
Inon the product label key, for example a different product than the variant requires, the derived pin now overwrites it throughputExpr. Before, the form's terms won outright. Leave the form's ownInfor that key alone in this path, and replace only in the picked-products path where the replace is the intent. - The pin now lives in the form layer in the derived case, so
LayerOfreports it as the user's and an upgrade carries it forward even if the variant stops requiring it. This is acceptable for a stopgap that #56 replaces; worth a note in the PR.
Low
compose.gowrites intoin.Overridesin place. Copy it, or note the mutation.- The server and compose paths each repeat the get-list-AndTerms-set sequence; one small helper would cover both.
Solid
Fixes the real OR/AND bug, AndTerms doesn't mutate its inputs, the tests cover each case, and there is no API change.
Verdict: OK to merge; the Medium items are simplifications and one behavior question.
— Review Golden
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In
nodeSelectorTerms, the terms are ORed and a term'smatchExpressionsare ANDed.POST /api/planspinned GPU products by writing over the form's required node terms, so any term the form set was lost:gpuProducts)An
Inexpression on the product label key is replaced rather than added. That keeps an upgrade from stacking the old products' expression beside the new one.Example: a preset's term plus a picked product gives one term with both expressions, so the pod needs both:
Two separate terms would mean either one, and then the preset's rule would never constrain anything.
This is a fix to the current API only. The plan is for the web to build the whole form layer and for a
/api/v2/composeto replace this, at which point swissd stops writing into the form layer (#56).No API change. A console that sets no required terms gets the same plan as before.
Testing
TestAndTerms: each term gets the pin; anInon the same key is replaced and aNotInkept; the input is not changed.TestComposeGPUNodeSelectorTerms: the derived pin is added to the form's terms, and the catalog's own terms still stand.TestGPUProductsAreANDedIntoTheFormsTerms: aPOST /api/planswith a form term and a picked product gives one term with both expressions.go test ./...andgo vet ./...pass, andgofmt -lis empty.Refs #56.