Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore: set wsbuilder to use preview parameters #18474

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 1 commit into from
Jun 23, 2025

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented Jun 20, 2025

Use richer previewtypes.Parameter for wsbuilder. This is a pre-requirement to adding dynamic parameter validation.

The richer type contains more information than the db parameter, so the conversion is lossless.

Note: This just pulls out some of the diff of the larger PR in the stack

@Emyrk Emyrk force-pushed the stevenmasley/parameters_to_preview branch 2 times, most recently from 6122995 to b5002b0 Compare June 20, 2025 16:09
Copy link
Member Author

Emyrk commented Jun 20, 2025

Base automatically changed from stevenmasley/dynamic_param_pkg to main June 20, 2025 18:00
@Emyrk Emyrk force-pushed the stevenmasley/parameters_to_preview branch from b5002b0 to 46d2751 Compare June 20, 2025 18:30
@Emyrk Emyrk force-pushed the stevenmasley/parameters_to_preview branch from 46d2751 to 635c56b Compare June 22, 2025 01:03
@Emyrk Emyrk changed the title chore: wsbuilder to use preview parameters chore: set wsbuilder to use preview parameters Jun 23, 2025
@Emyrk Emyrk requested a review from Copilot June 23, 2025 06:02
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the workspace builder to use the richer previewtypes.Parameter for dynamic parameter validation and adjusts related conversion and diagnostics logic.

  • Switched Builder to load and convert from previewtypes.Parameter instead of database.TemplateVersionParameter
  • Appended default‐value diagnostics in the static loader
  • Added preview→SDK conversion helpers in db2sdk

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
coderd/wsbuilder/wsbuilder.go Replaced DB parameter types with previewtypes.Parameter and updated conversion calls
coderd/dynamicparameters/static.go Injected default‐value diagnostics and removed inline diagnostics in conversion fn
coderd/database/db2sdk/db2sdk.go Added TemplateVersionParameterFromPreview and related option converter
Comments suppressed due to low confidence (2)

coderd/database/db2sdk/db2sdk.go:100

  • Add unit tests covering TemplateVersionParameterFromPreview, especially around different validation rules and option conversions.
func TemplateVersionParameterFromPreview(param previewtypes.Parameter) (codersdk.TemplateVersionParameter, error) {

coderd/dynamicparameters/static.go:145

  • The per-parameter conversion no longer appends validation diagnostics; consider restoring or centralizing that step to ensure non-default validations are captured.
	_, param.FormType, _ = provider.ValidateFormType(provider.OptionType(param.Type), len(param.Options), param.FormType)

@Emyrk Emyrk force-pushed the stevenmasley/parameters_to_preview branch from 635c56b to b7985e3 Compare June 23, 2025 06:07
Dynamic parameter validation relies on the preview parameter types.
These types have more information than the database. So converting
from `db -> preview` is lossless. The other way around is not
@Emyrk Emyrk merged commit 659b787 into main Jun 23, 2025
35 checks passed
@Emyrk Emyrk deleted the stevenmasley/parameters_to_preview branch June 23, 2025 16:31
@github-actions github-actions bot locked and limited conversation to collaborators Jun 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants