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(agent/agentcontainers): treat customizations as array#18357

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
DanielleMaywood merged 3 commits intomainfromdm-sub-agent-display-apps-fix
Jun 13, 2025

Conversation

DanielleMaywood
Copy link
Contributor

This PR fixes a mistake from the previous PR
#18342. Merged configuration results in the customization being an array not an object.

This PR also movesdisplayApps from being an array to being an object, like the terraform provider has.

{        "name": "Sample Dev Container",        "image": "mcr.microsoft.com/devcontainers/base:ubuntu",        "customizations": {                "coder": {                        "displayApps": {                                "vscode": true,                                "vscode_insiders": false,                                "web_terminal": true                        }                }        }}

This PR fixes a mistake from the previous PR#18342. Merged configuration resultsin the customization being an array not an object.This PR also moves `displayApps` from being an array to being an object,like the terraform provider has.
Copy link
Contributor

@CopilotCopilotAI 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 fixes the configuration merging behavior for agent customizations by treating customizations as arrays and updating the DisplayApps type from an array to a map. Key changes include:

  • Changing CoderCustomization from a pointer to a slice in the configuration.
  • Updating DisplayApps from an array to a map in both the configuration and tests.
  • Refactoring related merging logic in the API to accommodate the new configuration structure.

Reviewed Changes

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

FileDescription
agent/agentcontainers/devcontainercli_test.goUpdated test expectations to reflect changes from a single customization to a slice.
agent/agentcontainers/devcontainercli.goUpdated type definitions for CoderCustomization and DisplayApps to match desired schema.
agent/agentcontainers/api_test.goModified test cases to use a slice for customization and updated DisplayApps assertions.
agent/agentcontainers/api.goRefactored merging logic for DisplayApps using a map and then converting to a slice.
Comments suppressed due to low confidence (1)

agent/agentcontainers/api.go:1109

  • Document the merging behavior here since later customizations override earlier ones when populating the 'displayAppsMap', so future maintainers are aware of this design choice.
for _, customization := range coderCustomization {

Comment on lines +1116 to +1119
displayApps:=make([]codersdk.DisplayApp,0,len(displayAppsMap))
forapp,enabled:=rangedisplayAppsMap {
ifenabled {
displayApps=append(displayApps,app)
Copy link
Preview

CopilotAIJun 13, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider renaming the 'displayApps' slice (e.g. to 'enabledDisplayApps') to avoid possible confusion with other similarly named variables and improve code clarity.

Suggested change
displayApps:=make([]codersdk.DisplayApp,0,len(displayAppsMap))
forapp,enabled:=rangedisplayAppsMap {
ifenabled {
displayApps=append(displayApps,app)
enabledDisplayApps:=make([]codersdk.DisplayApp,0,len(displayAppsMap))
forapp,enabled:=rangedisplayAppsMap {
ifenabled {
enabledDisplayApps=append(enabledDisplayApps,app)

Copilot uses AI. Check for mistakes.

@DanielleMaywoodDanielleMaywood marked this pull request as ready for reviewJune 13, 2025 10:44
@@ -1099,14 +1099,24 @@ func (api *API) injectSubAgentIntoContainerLocked(ctx context.Context, dc coders
directory=DevcontainerDefaultContainerWorkspaceFolder
}

vardisplayApps []codersdk.DisplayApp
displayAppsMap:=make(map[codersdk.DisplayApp]bool)
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Good point, I'll add the same defaults here then.

@DanielleMaywoodDanielleMaywood merged commit0ef6226 intomainJun 13, 2025
34 checks passed
@DanielleMaywoodDanielleMaywood deleted the dm-sub-agent-display-apps-fix branchJune 13, 2025 13:48
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsJun 13, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

Copilot code reviewCopilotCopilot left review comments

@mafredrimafredrimafredri approved these changes

Assignees

@DanielleMaywoodDanielleMaywood

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@DanielleMaywood@mafredri

[8]ページ先頭

©2009-2025 Movatter.jp