Skip to content

feat: make dynamic parameters opt-in by default for new templates #19006

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jaaydenh
Copy link
Contributor

No description provided.

@jaaydenh jaaydenh self-assigned this Jul 22, 2025
@jaaydenh
Copy link
Contributor Author

@CodeRabbit review

Copy link

coderabbitai bot commented Jul 22, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

coderabbitai bot commented Jul 22, 2025

📝 Walkthrough

Walkthrough

The changes update the default value of the UseClassicParameterFlow flag for templates from true to false across backend logic, API handlers, and test data. Frontend updates introduce a new deprecation warning component for the classic parameter flow, integrate permission checks for updating templates, and propagate these permissions through relevant components. Several documentation links are updated, and associated tests and stories are adjusted accordingly.

Changes

File(s) Change Summary
coderd/database/dbgen/dbgen.go, coderd/templates.go Changed default value of UseClassicParameterFlow from true to false in backend template logic and API handler.
coderd/insights_test.go, coderd/templates_test.go Updated tests to expect or set UseClassicParameterFlow: true only when required; default expectation is now false.
site/src/testHelpers/entities.ts Changed mock data: use_classic_parameter_flow and template_use_classic_parameter_flow from true to false.
site/src/modules/workspaces/ClassicParameterFlowDeprecationWarning/ClassicParameterFlowDeprecationWarning.tsx Added new React component to display a deprecation warning for classic parameter flow.
site/src/modules/workspaces/ClassicParameterFlowDeprecationWarning/ClassicParameterFlowDeprecationWarning.test.tsx Added tests for the new deprecation warning component.
site/src/pages/CreateWorkspacePage/CreateWorkspacePage.tsx Added React Query hook to fetch template update permissions; passed permissions to child component.
site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx Added new prop templatePermissions and rendered the deprecation warning component.
site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.stories.tsx Added templatePermissions prop to Storybook default args.
site/src/pages/CreateWorkspacePage/CreateWorkspacePageViewExperimental.tsx, site/src/pages/WorkspaceSettingsPage/WorkspaceParametersPage/WorkspaceParametersPageExperimental.tsx, site/src/pages/WorkspaceSettingsPage/WorkspaceParametersPage/WorkspaceParametersPageViewExperimental.tsx Updated documentation links to new dynamic parameters path.
site/src/pages/TemplateSettingsPage/TemplateGeneralSettingsPage/TemplateSettingsForm.tsx Updated label and helper text for dynamic parameters checkbox; updated documentation link.
site/src/pages/WorkspaceSettingsPage/WorkspaceParametersPage/WorkspaceParametersPage.tsx Added React Query hook for template update permissions; passed permissions through component hierarchy.
site/src/pages/WorkspaceSettingsPage/WorkspaceParametersPage/WorkspaceParametersForm.tsx Added templatePermissions prop and rendered deprecation warning component.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CreateWorkspacePage
    participant TemplatePermissionsQuery
    participant CreateWorkspacePageView
    participant ClassicParameterFlowDeprecationWarning

    User->>CreateWorkspacePage: Load page
    CreateWorkspacePage->>TemplatePermissionsQuery: Fetch canUpdateTemplate
    TemplatePermissionsQuery-->>CreateWorkspacePage: Return permission data
    CreateWorkspacePage->>CreateWorkspacePageView: Render with templatePermissions
    CreateWorkspacePageView->>ClassicParameterFlowDeprecationWarning: Render warning if enabled and canUpdateTemplate
Loading
sequenceDiagram
    participant User
    participant WorkspaceParametersPage
    participant TemplatePermissionsQuery
    participant WorkspaceParametersPageView
    participant WorkspaceParametersForm
    participant ClassicParameterFlowDeprecationWarning

    User->>WorkspaceParametersPage: Load page
    WorkspaceParametersPage->>TemplatePermissionsQuery: Fetch canUpdateTemplate
    TemplatePermissionsQuery-->>WorkspaceParametersPage: Return permission data
    WorkspaceParametersPage->>WorkspaceParametersPageView: Render with templatePermissions
    WorkspaceParametersPageView->>WorkspaceParametersForm: Pass templatePermissions
    WorkspaceParametersForm->>ClassicParameterFlowDeprecationWarning: Render warning if enabled and canUpdateTemplate
Loading

Estimated code review effort

3 (~45 minutes)

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (1)
site/src/pages/CreateWorkspacePage/CreateWorkspacePageViewExperimental.tsx (1)

545-548: Same duplication as above

Refer to the previous comment – same literal, same recommendation.

🧹 Nitpick comments (6)
site/src/pages/WorkspaceSettingsPage/WorkspaceParametersPage/WorkspaceParametersPageViewExperimental.tsx (1)

213-214: Centralise docs URL to avoid future drift

The same /admin/templates/extending-templates/dynamic-parameters slug is now hard-coded here and in several other files. Expose it via a shared constant (e.g. DOCS_DYNAMIC_PARAMETERS) or extend the docs() helper to accept a well-named key.
This prevents silent divergence if the path changes again.

site/src/pages/CreateWorkspacePage/CreateWorkspacePageViewExperimental.tsx (1)

396-399: Duplicate literal docs path – extract to constant

Two identical string literals were introduced in this component (see also the Parameters section below). Moving the slug to a shared constant keeps the UI and docs in sync and avoids scattered hot-fixes next time the URL changes.

coderd/insights_test.go (1)

668-672: Consider adding a clarifying comment for consistency.

For better maintainability and consistency with the similar change at line 1564, consider adding a comment explaining why UseClassicParameterFlow: true is explicitly set here.

 			createdTemplate := dbgen.Template(t, db, database.Template{
 				ID:                      template.id,
 				ActiveVersionID:         version.ID,
 				OrganizationID:          firstUser.OrganizationID,
 				CreatedBy:               firstUser.UserID,
-				UseClassicParameterFlow: true,
+				UseClassicParameterFlow: true, // Required for testing legacy parameter flow behavior
 				GroupACL: database.TemplateACL{
site/src/pages/TemplateSettingsPage/TemplateGeneralSettingsPage/TemplateSettingsForm.tsx (1)

1-1: Note: MUI components present - consider migration.

This file uses deprecated MUI components (Checkbox, FormControlLabel, TextField, etc.). While not introduced by this PR, consider migrating these to newer component alternatives in future work.

site/src/testHelpers/entities.ts (1)

829-829: Avoid hard-coded duplicate default – reuse a shared constant

The literal false is now duplicated across mocks. Extracting a DEFAULT_USE_CLASSIC_PARAMETER_FLOW constant (or deriving the value from the template when constructing the workspace) will keep test helpers in sync the next time this default changes.

-	use_classic_parameter_flow: false,
+	use_classic_parameter_flow: DEFAULT_USE_CLASSIC_PARAMETER_FLOW,
site/src/modules/workspaces/ClassicParameterFlowDeprecationWarning/ClassicParameterFlowDeprecationWarning.tsx (1)

28-30: Improve the deprecation message clarity.

The phrase "dynamic improved functionality" is awkward and unclear. Consider rephrasing for better user experience.

 This template is using the classic parameter flow, which will be{" "}
 <strong>deprecated</strong> in a future release. Please migrate to
-dynamic improved functionality.
+the improved dynamic parameter flow.
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f41275e and a62ba63.

📒 Files selected for processing (16)
  • coderd/database/dbgen/dbgen.go (1 hunks)
  • coderd/insights_test.go (2 hunks)
  • coderd/templates.go (1 hunks)
  • coderd/templates_test.go (2 hunks)
  • site/src/modules/workspaces/ClassicParameterFlowDeprecationWarning/ClassicParameterFlowDeprecationWarning.test.tsx (1 hunks)
  • site/src/modules/workspaces/ClassicParameterFlowDeprecationWarning/ClassicParameterFlowDeprecationWarning.tsx (1 hunks)
  • site/src/pages/CreateWorkspacePage/CreateWorkspacePage.tsx (3 hunks)
  • site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.stories.tsx (1 hunks)
  • site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx (4 hunks)
  • site/src/pages/CreateWorkspacePage/CreateWorkspacePageViewExperimental.tsx (2 hunks)
  • site/src/pages/TemplateSettingsPage/TemplateGeneralSettingsPage/TemplateSettingsForm.tsx (1 hunks)
  • site/src/pages/WorkspaceSettingsPage/WorkspaceParametersPage/WorkspaceParametersForm.tsx (4 hunks)
  • site/src/pages/WorkspaceSettingsPage/WorkspaceParametersPage/WorkspaceParametersPage.tsx (5 hunks)
  • site/src/pages/WorkspaceSettingsPage/WorkspaceParametersPage/WorkspaceParametersPageExperimental.tsx (2 hunks)
  • site/src/pages/WorkspaceSettingsPage/WorkspaceParametersPage/WorkspaceParametersPageViewExperimental.tsx (1 hunks)
  • site/src/testHelpers/entities.ts (2 hunks)
🧠 Learnings (9)
site/src/pages/CreateWorkspacePage/CreateWorkspacePageViewExperimental.tsx (3)

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : MUI components are deprecated - migrate away from these when encountered

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : Use functional updates (setX(prev ⇒ …)) whenever next state depends on previous state.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : Leverage custom color tokens: content-primary, surface-secondary, etc.

site/src/pages/WorkspaceSettingsPage/WorkspaceParametersPage/WorkspaceParametersPageExperimental.tsx (2)

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : MUI components are deprecated - migrate away from these when encountered

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : Use functional updates (setX(prev ⇒ …)) whenever next state depends on previous state.

site/src/modules/workspaces/ClassicParameterFlowDeprecationWarning/ClassicParameterFlowDeprecationWarning.test.tsx (4)

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : MUI components are deprecated - migrate away from these when encountered

Learnt from: CR
PR: coder/coder#0
File: .cursorrules:0-0
Timestamp: 2025-07-21T14:32:43.035Z
Learning: Applies to site/src/**/*.test.{ts,tsx,js,jsx} : React components and pages are organized in the site/src/ directory, with Jest used for testing.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : Emotion CSS is deprecated. Use Tailwind CSS instead.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.{ts,tsx} : Components and custom Hooks must be pure and idempotent—same inputs → same output; move side-effects to event handlers or Effects.

site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx (9)

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : MUI components are deprecated - migrate away from these when encountered

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : Emotion CSS is deprecated. Use Tailwind CSS instead.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.{ts,tsx} : Never mutate props, state, or values returned by Hooks. Always create new objects or use the setter from useState.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : Use shadcn/ui components first - check site/src/components for existing implementations

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.{ts,tsx} : Components and custom Hooks must be pure and idempotent—same inputs → same output; move side-effects to event handlers or Effects.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.{ts,tsx} : Never pass Hooks around as values or mutate them dynamically. Keep Hook usage static and local to each component.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.{ts,tsx} : Don’t call Hooks (including useRef) inside loops, conditions, or map(). Extract a child component instead.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : Use functional updates (setX(prev ⇒ …)) whenever next state depends on previous state.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.{ts,tsx} : Only call Hooks from React functions. Regular JS functions, classes, event handlers, useMemo, etc. are off-limits.

site/src/pages/CreateWorkspacePage/CreateWorkspacePage.tsx (1)

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.{ts,tsx} : Never mutate props, state, or values returned by Hooks. Always create new objects or use the setter from useState.

site/src/modules/workspaces/ClassicParameterFlowDeprecationWarning/ClassicParameterFlowDeprecationWarning.tsx (6)

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : MUI components are deprecated - migrate away from these when encountered

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : Emotion CSS is deprecated. Use Tailwind CSS instead.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.{ts,tsx} : Components and custom Hooks must be pure and idempotent—same inputs → same output; move side-effects to event handlers or Effects.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.{ts,tsx} : Never mutate props, state, or values returned by Hooks. Always create new objects or use the setter from useState.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : Replace Emotion css prop with Tailwind classes

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.{ts,tsx} : Never pass Hooks around as values or mutate them dynamically. Keep Hook usage static and local to each component.

site/src/pages/WorkspaceSettingsPage/WorkspaceParametersPage/WorkspaceParametersForm.tsx (4)

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : MUI components are deprecated - migrate away from these when encountered

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : Emotion CSS is deprecated. Use Tailwind CSS instead.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.{ts,tsx} : Components and custom Hooks must be pure and idempotent—same inputs → same output; move side-effects to event handlers or Effects.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : Use shadcn/ui components first - check site/src/components for existing implementations

site/src/pages/WorkspaceSettingsPage/WorkspaceParametersPage/WorkspaceParametersPage.tsx (1)

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.{ts,tsx} : Never mutate props, state, or values returned by Hooks. Always create new objects or use the setter from useState.

coderd/templates_test.go (2)

Learnt from: CR
PR: coder/coder#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T14:32:56.474Z
Learning: Applies to **/*_test.go : Never use hardcoded names in concurrent Go tests

Learnt from: CR
PR: coder/coder#0
File: .cursorrules:0-0
Timestamp: 2025-07-21T14:32:43.035Z
Learning: Applies to **/*_test.go : All tests must use t.Parallel() to run concurrently, which improves test suite performance and helps identify race conditions.

🧰 Additional context used
🧠 Learnings (9)
site/src/pages/CreateWorkspacePage/CreateWorkspacePageViewExperimental.tsx (3)

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : MUI components are deprecated - migrate away from these when encountered

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : Use functional updates (setX(prev ⇒ …)) whenever next state depends on previous state.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : Leverage custom color tokens: content-primary, surface-secondary, etc.

site/src/pages/WorkspaceSettingsPage/WorkspaceParametersPage/WorkspaceParametersPageExperimental.tsx (2)

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : MUI components are deprecated - migrate away from these when encountered

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : Use functional updates (setX(prev ⇒ …)) whenever next state depends on previous state.

site/src/modules/workspaces/ClassicParameterFlowDeprecationWarning/ClassicParameterFlowDeprecationWarning.test.tsx (4)

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : MUI components are deprecated - migrate away from these when encountered

Learnt from: CR
PR: coder/coder#0
File: .cursorrules:0-0
Timestamp: 2025-07-21T14:32:43.035Z
Learning: Applies to site/src/**/*.test.{ts,tsx,js,jsx} : React components and pages are organized in the site/src/ directory, with Jest used for testing.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : Emotion CSS is deprecated. Use Tailwind CSS instead.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.{ts,tsx} : Components and custom Hooks must be pure and idempotent—same inputs → same output; move side-effects to event handlers or Effects.

site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx (9)

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : MUI components are deprecated - migrate away from these when encountered

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : Emotion CSS is deprecated. Use Tailwind CSS instead.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.{ts,tsx} : Never mutate props, state, or values returned by Hooks. Always create new objects or use the setter from useState.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : Use shadcn/ui components first - check site/src/components for existing implementations

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.{ts,tsx} : Components and custom Hooks must be pure and idempotent—same inputs → same output; move side-effects to event handlers or Effects.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.{ts,tsx} : Never pass Hooks around as values or mutate them dynamically. Keep Hook usage static and local to each component.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.{ts,tsx} : Don’t call Hooks (including useRef) inside loops, conditions, or map(). Extract a child component instead.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : Use functional updates (setX(prev ⇒ …)) whenever next state depends on previous state.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.{ts,tsx} : Only call Hooks from React functions. Regular JS functions, classes, event handlers, useMemo, etc. are off-limits.

site/src/pages/CreateWorkspacePage/CreateWorkspacePage.tsx (1)

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.{ts,tsx} : Never mutate props, state, or values returned by Hooks. Always create new objects or use the setter from useState.

site/src/modules/workspaces/ClassicParameterFlowDeprecationWarning/ClassicParameterFlowDeprecationWarning.tsx (6)

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : MUI components are deprecated - migrate away from these when encountered

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : Emotion CSS is deprecated. Use Tailwind CSS instead.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.{ts,tsx} : Components and custom Hooks must be pure and idempotent—same inputs → same output; move side-effects to event handlers or Effects.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.{ts,tsx} : Never mutate props, state, or values returned by Hooks. Always create new objects or use the setter from useState.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : Replace Emotion css prop with Tailwind classes

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.{ts,tsx} : Never pass Hooks around as values or mutate them dynamically. Keep Hook usage static and local to each component.

site/src/pages/WorkspaceSettingsPage/WorkspaceParametersPage/WorkspaceParametersForm.tsx (4)

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : MUI components are deprecated - migrate away from these when encountered

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : Emotion CSS is deprecated. Use Tailwind CSS instead.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.{ts,tsx} : Components and custom Hooks must be pure and idempotent—same inputs → same output; move side-effects to event handlers or Effects.

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.tsx : Use shadcn/ui components first - check site/src/components for existing implementations

site/src/pages/WorkspaceSettingsPage/WorkspaceParametersPage/WorkspaceParametersPage.tsx (1)

Learnt from: CR
PR: coder/coder#0
File: site/CLAUDE.md:0-0
Timestamp: 2025-07-21T14:33:50.919Z
Learning: Applies to site/src/**/*.{ts,tsx} : Never mutate props, state, or values returned by Hooks. Always create new objects or use the setter from useState.

coderd/templates_test.go (2)

Learnt from: CR
PR: coder/coder#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T14:32:56.474Z
Learning: Applies to **/*_test.go : Never use hardcoded names in concurrent Go tests

Learnt from: CR
PR: coder/coder#0
File: .cursorrules:0-0
Timestamp: 2025-07-21T14:32:43.035Z
Learning: Applies to **/*_test.go : All tests must use t.Parallel() to run concurrently, which improves test suite performance and helps identify race conditions.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: test-e2e
  • GitHub Check: test-go-race-pg
  • GitHub Check: build-dylib
  • GitHub Check: test-go-pg-17
  • GitHub Check: test-go-pg (windows-2022)
  • GitHub Check: test-go-pg (macos-latest)
  • GitHub Check: test-go-pg (ubuntu-latest)
  • GitHub Check: chromatic
  • GitHub Check: gen
🔇 Additional comments (33)
coderd/database/dbgen/dbgen.go (1)

150-151: Audit dbgen.Template calls for missing UseClassicParameterFlow
The previous script misparsed file paths (it included the code line in the filename). Please use the following to correctly extract file:line and then scan the next ~20 lines for UseClassicParameterFlow:

#!/usr/bin/env bash
# Find dbgen.Template invocations without UseClassicParameterFlow configured.
rg --type go -n 'dbgen\.Template' | while IFS=":" read -r file line _; do
  if ! sed -n "${line},$((line+20))p" "$file" | grep -q 'UseClassicParameterFlow'; then
    echo "$file:$line"
  fi
done | head

Rerun this and audit any test that now depends on the flipped default.

site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.stories.tsx (1)

33-34: Storybook arg looks good

Adding templatePermissions keeps the stories compiling with the new prop signature – no issues spotted.

coderd/insights_test.go (1)

1560-1564: Good practice with explanatory comment.

Excellent approach to explicitly set UseClassicParameterFlow: true with a clear comment explaining why this override is necessary for the test's parameter usage tracking functionality. This ensures the test remains functional despite the default value change.

coderd/templates_test.go (2)

80-80: LGTM: Test assertion correctly updated for new default.

The test assertion has been properly updated to expect false for UseClassicParameterFlow, which aligns with the PR objective of making dynamic parameters the default for new templates.


1554-1554: LGTM: Default expectation correctly updated.

The assertion correctly expects false as the default value for UseClassicParameterFlow, confirming that dynamic parameters are now enabled by default for new templates. The comment clearly documents this behavior change.

site/src/pages/WorkspaceSettingsPage/WorkspaceParametersPage/WorkspaceParametersPageExperimental.tsx (2)

229-229: LGTM: Documentation link updated to canonical path.

The documentation link has been cleanly updated from a fragment-based URL to a dedicated dynamic parameters path, improving maintainability and user experience.


264-266: LGTM: Consistent documentation link update.

The EmptyState documentation link has been updated to match the same canonical dynamic parameters path, maintaining consistency across the component.

site/src/pages/TemplateSettingsPage/TemplateGeneralSettingsPage/TemplateSettingsForm.tsx (3)

248-248: LGTM: UI label appropriately updated to reflect recommended option.

The addition of "(recommended)" to the dynamic parameters label clearly communicates the preferred choice to users, aligning with the PR's objective of making dynamic parameters the default.


252-256: LGTM: Helper text updated to reflect new default behavior.

The updated helper text effectively communicates:

  • Dynamic parameters as the default for new templates
  • Additional capabilities (form types, conditional parameters)
  • Future deprecation of classic flow

This provides clear guidance to users about the direction of the platform.


261-261: LGTM: Documentation link updated to canonical path.

The documentation link has been updated to the cleaner, dedicated dynamic parameters path, improving consistency across the application.

site/src/testHelpers/entities.ts (1)

1392-1392: LGTM – flag value updated to reflect new default
The workspace mock correctly mirrors the template’s default (false). ✅

site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx (4)

30-30: LGTM: Clean import of the new deprecation warning component.

The import is properly structured and follows the project's naming conventions.


70-70: LGTM: Proper TypeScript interface extension.

The new templatePermissions prop is correctly typed with the expected structure.


96-96: LGTM: Consistent prop destructuring.

The new prop is properly destructured in the component signature.


251-255: LGTM: Proper component integration with correct props.

The deprecation warning component is well-positioned between the header and main form, and receives the appropriate props from the template and permissions data.

site/src/pages/CreateWorkspacePage/CreateWorkspacePage.tsx (4)

72-85: LGTM: Well-structured authorization query for template permissions.

The query follows the established pattern for permission checks and correctly uses the template ID as the resource identifier. The enablement condition ensures the query only runs when template data is available.


107-107: LGTM: Proper integration of new query into loading state.

The loading state correctly includes the new permissions query alongside existing queries.


110-113: LGTM: Consistent error handling pattern.

The error handling follows the existing pattern of using nullish coalescing to check multiple query errors.


229-231: LGTM: Type-safe prop passing with proper assertion.

The template permissions data is correctly passed to the view component with appropriate type assertion, following the same pattern as other permission data.

site/src/modules/workspaces/ClassicParameterFlowDeprecationWarning/ClassicParameterFlowDeprecationWarning.test.tsx (3)

4-7: LGTM: Appropriate mocking of navigation dependencies.

The navigation modules are properly mocked with consistent return values for testing.


17-27: Good test coverage for enabled state.

The test properly verifies that the warning text and action link are rendered when the component is enabled.


29-38: LGTM: Proper test for disabled state.

The test correctly verifies that nothing is rendered when the component is disabled.

site/src/modules/workspaces/ClassicParameterFlowDeprecationWarning/ClassicParameterFlowDeprecationWarning.tsx (4)

6-10: LGTM: Well-defined TypeScript interface.

The props interface is clear and uses appropriate types for the component's requirements.


15-19: LGTM: Proper conditional rendering pattern.

The early return for disabled state is clean and follows React best practices.


21-23: LGTM: Clean link generation logic.

The template settings URL is constructed properly using the navigation utilities.


26-35: LGTM: Proper use of modern styling and component structure.

The component correctly uses Tailwind CSS classes (following the learning about avoiding Emotion) and maintains a clean Alert + Link structure.

site/src/pages/WorkspaceSettingsPage/WorkspaceParametersPage/WorkspaceParametersForm.tsx (4)

17-17: LGTM: Consistent import of deprecation warning component.

The import follows the same pattern used in other files.


37-37: LGTM: Proper optional prop typing.

The templatePermissions prop is correctly typed as optional with undefined, allowing for graceful handling when permissions aren't available.


51-51: LGTM: Consistent prop destructuring.

The templatePermissions prop is properly added to the destructuring pattern.


87-91: LGTM: Well-positioned deprecation warning with proper fallback.

The warning component is appropriately placed after the workspace disabled alert and uses nullish coalescing to provide a safe fallback when templatePermissions is undefined.

Also applies to: 92-96

site/src/pages/WorkspaceSettingsPage/WorkspaceParametersPage/WorkspaceParametersPage.tsx (3)

54-67: LGTM! Well-structured permission query implementation.

The template permissions query follows the established pattern used for workspace permissions and correctly implements conditional enabling. The authorization check structure is appropriate for template update permissions.


69-71: LGTM! Consistent type casting pattern.

The type assertion follows the same pattern used for the existing permissions variable and correctly handles the potential undefined state.


82-82: LGTM! Proper prop threading implementation.

The templatePermissions prop is correctly added to the type definitions, component signatures, and passed through the component hierarchy without any mutations. This follows React best practices and maintains type safety throughout.

Also applies to: 117-117, 130-130, 154-154

Comment on lines +200 to 202
// Default is false as dynamic parameters are now the preferred approach.
useClassicParameterFlow := ptr.NilToDefault(createTemplate.UseClassicParameterFlow, false)

Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Breaking-default flip – double-check upstream callers

Switching the default from truefalse silently changes behaviour for every client that omits use_classic_parameter_flow when calling the POST /organizations/:org/templates endpoint.
Please verify that:

  1. All first-party callers (UI, CLI, Terraform provider, integration tests, seed data, etc.) now explicitly set the flag to true when the classic flow is expected.
  2. Public API docs are updated so external consumers are aware of the new default.
  3. No inserts rely on the column’s DB-level default anymore (we pass the value explicitly here, but raw SQL elsewhere might not).

Quick scan helper:


🏁 Script executed:

#!/bin/bash
# Find CreateTemplateRequest literals that do NOT specify UseClassicParameterFlow
rg --type-go -n --pretty $'CreateTemplateRequest\\s*{[^}]*}' | \
  grep -v 'UseClassicParameterFlow'

Length of output: 532


🏁 Script executed:

#!/usr/bin/env bash
# Scan all .go files (excluding vendor/testdata) for CreateTemplateRequest literals missing the UseClassicParameterFlow field
python3 - << 'EOF'
import re, glob, os

for path in glob.glob('**/*.go', recursive=True):
    if any(excl in path for excl in ('vendor/', 'testdata/')):
        continue
    with open(path, 'r', encoding='utf-8') as f:
        src = f.read()
    for m in re.finditer(r'CreateTemplateRequest\s*\{', src):
        # Walk the braces to extract the full literal block
        idx = m.end()
        depth = 1
        while depth > 0 and idx < len(src):
            if src[idx] == '{':
                depth += 1
            elif src[idx] == '}':
                depth -= 1
            idx += 1
        block = src[m.start():idx]
        if 'UseClassicParameterFlow' not in block:
            lineno = src.count('\n', 0, m.start()) + 1
            print(f"{path}:{lineno}")
EOF

Length of output: 542


Explicitly set UseClassicParameterFlow on all CreateTemplateRequest call sites

We flipped the default from truefalse, so any caller that omits UseClassicParameterFlow will now use the new dynamic‐parameter flow. The following literals need to be updated to include UseClassicParameterFlow: ptr.Bool(true) where the classic flow is expected:

• cli/templatecreate.go:152
• cli/templatepush.go:183
• coderd/templates_test.go:99, 116, 132, 150, 183, 219, 242, 262, 312, 362, 393, 419, 435
• coderd/coderdtest/coderdtest.go:969
• codersdk/toolsdk/toolsdk.go:1284
• enterprise/coderd/users_test.go:282

Additionally:

  • Update the public API docs to reflect the new default (false) for use_classic_parameter_flow.
  • Audit any raw‐SQL inserts/migrations to ensure they no longer rely on the old DB default.
🤖 Prompt for AI Agents
In coderd/templates.go around lines 200 to 202, the default for
UseClassicParameterFlow was changed from true to false, affecting all
CreateTemplateRequest call sites. Update all listed call sites in
cli/templatecreate.go, cli/templatepush.go, coderd/templates_test.go,
coderd/coderdtest/coderdtest.go, codersdk/toolsdk/toolsdk.go, and
enterprise/coderd/users_test.go to explicitly set UseClassicParameterFlow:
ptr.Bool(true) where the classic flow is required. Also, update the public API
documentation to show the new default as false and audit any raw-SQL inserts or
migrations to ensure they do not depend on the old default value.

Comment on lines +10 to +15
const defaultProps = {
enabled: true,
organizationName: "test-org",
templateName: "test-template",
canUpdateTemplate: true,
};
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix prop naming inconsistency in test setup.

The default props define enabled: true but the test uses isEnabled={true}. This creates confusion about the actual prop interface.

 const defaultProps = {
-  enabled: true,
   organizationName: "test-org",
   templateName: "test-template",
-  canUpdateTemplate: true,
+  isEnabled: true,
 };

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In
site/src/modules/workspaces/ClassicParameterFlowDeprecationWarning/ClassicParameterFlowDeprecationWarning.test.tsx
between lines 10 and 15, the defaultProps object uses the prop name 'enabled'
while the test uses 'isEnabled'. To fix this inconsistency, rename the prop in
defaultProps from 'enabled' to 'isEnabled' so it matches the prop used in the
test, ensuring clarity and consistency in the prop interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant