Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: set preset parameters in the API rather than the frontend#17403

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
SasSwart merged 7 commits intomainfrom16930
Apr 16, 2025

Conversation

SasSwart
Copy link
Contributor

@SasSwartSasSwart commentedApr 15, 2025
edited
Loading

Follow-up from aprevious Pull Request required some additional testing of Presets from the API perspective.

In the process of adding the new tests, I updated the API to enforce preset parameter values based on the selected preset instead of trusting whichever frontend makes the request. This avoids errors scenarios in prebuilds where a prebuild might expect a certain preset but find a different set of actual parameter values.

@@ -960,6 +961,12 @@ func withInactiveVersion(params []database.TemplateVersionParameter) func(mTx *d
}
}

func withTemplateVersionPreset(presetID uuid.UUID) func(mTx *dbmock.MockStore) {
return func(mTx *dbmock.MockStore) {
mTx.EXPECT().GetPresetParametersByPresetID(gomock.Any(), presetID).Return(nil, nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand the value of returningnil, nil here; this won't execute your new codepath infindNewBuildParameterValue. Can you help me understand pls?

name: "Single Preset - No Preset Parameters But With Template Parameters",
presets: []*proto.Preset{emptyPreset},
templateVersionParameters: templateVersionParameters,
selectedPresetIndex: ptr.Ref(0),
Copy link
Contributor

Choose a reason for hiding this comment

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

What about instead just doing something like this?

Suggested change
selectedPresetIndex:ptr.Ref(0),
selectedPreset:&emptyPreset,

presets: []*proto.Preset{},
templateVersionParameters: []*proto.RichParameter{},
selectedPresetIndex: -1,
templateVersionParameters: templateVersionParameters,
Copy link
Contributor

Choose a reason for hiding this comment

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

Implementation doesn't seem to match the name

SasSwart reacted with thumbs up emoji
Copy link
Contributor

@dannykoppingdannykopping left a comment

Choose a reason for hiding this comment

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

Tests read much better now, thanks 👍


// Test Utility variables
templateVersionParameters := []*proto.RichParameter{
{Name: "param1", Type: "string", Required: false},
Copy link
Contributor

Choose a reason for hiding this comment

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

Only testing with unrequired params might introduce interesting blindspots, no?

@SasSwartSasSwart marked this pull request as ready for reviewApril 16, 2025 12:33
@dannykopping
Copy link
Contributor

Please update the referenced PR in the description

@SasSwartSasSwart merged commit64172d3 intomainApr 16, 2025
31 checks passed
@SasSwartSasSwart deleted the 16930 branchApril 16, 2025 13:54
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsApr 16, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@dannykoppingdannykoppingdannykopping approved these changes

@evgeniy-scherbinaevgeniy-scherbinaAwaiting requested review from evgeniy-scherbina

Assignees

@SasSwartSasSwart

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@SasSwart@dannykopping

[8]ページ先頭

©2009-2025 Movatter.jp