Skip to content

fix: resolve compose project names consistently - #13468

Merged
ssongliu merged 1 commit into
dev-v2from
fix/compose-project-name-resolution
Aug 4, 2026
Merged

fix: resolve compose project names consistently#13468
ssongliu merged 1 commit into
dev-v2from
fix/compose-project-name-resolution

Conversation

@ssongliu

@ssongliu ssongliu commented Aug 4, 2026

Copy link
Copy Markdown
Member

Refs #13460

Copilot AI lite review requested due to automatic review settings August 4, 2026 08:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 addresses issue #13460 by ensuring Docker Compose “project name” resolution is consistent when creating/operating compose projects (especially when the compose file is selected from a path whose parent directory name isn’t a valid Compose project name).

Changes:

  • Frontend: adds an optional “Name” input when the compose source is “path”, and updates validation to allow empty-but-validated names in that mode.
  • Agent/backend: resolves a canonical compose project name (prefer compose-defined name, else normalized parent dir, else user fallback) and consistently passes it to compose commands via --project-name.
  • Updates shared validation patterns and i18n messages for the new compose-name resolution/validation behavior.

Reviewed changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
frontend/src/views/container/compose/index.vue Adds optional name input for path-based compose creation and conditional validation rules.
frontend/src/lang/modules/zh.ts Adds helper text translation for compose name priority.
frontend/src/lang/modules/zh-Hant.ts Adds helper text translation for compose name priority.
frontend/src/lang/modules/tr.ts Adds helper text translation for compose name priority.
frontend/src/lang/modules/ru.ts Adds helper text translation for compose name priority.
frontend/src/lang/modules/pt-br.ts Adds helper text translation for compose name priority.
frontend/src/lang/modules/ms.ts Adds helper text translation for compose name priority.
frontend/src/lang/modules/lo.ts Adds helper text translation for compose name priority.
frontend/src/lang/modules/ko.ts Adds helper text translation for compose name priority.
frontend/src/lang/modules/ja.ts Adds helper text translation for compose name priority.
frontend/src/lang/modules/fa.ts Adds helper text translation for compose name priority.
frontend/src/lang/modules/es-es.ts Adds helper text translation for compose name priority.
frontend/src/lang/modules/en.ts Adds helper text translation for compose name priority.
frontend/src/global/form-rules.ts Aligns compose-name length validation with intended 1–256 character constraint.
agent/utils/re/re.go Adds a reusable backend regex constant for Compose project name validation.
agent/utils/compose/compose.go Threads optional --project-name through compose operations (up/down/config/image discovery).
agent/i18n/lang/zh.yaml Adds new error messages related to compose project-name parsing/derivation/validation.
agent/i18n/lang/zh-Hant.yaml Adds new error messages related to compose project-name parsing/derivation/validation.
agent/i18n/lang/tr.yaml Adds new error messages related to compose project-name parsing/derivation/validation.
agent/i18n/lang/ru.yaml Adds new error messages related to compose project-name parsing/derivation/validation.
agent/i18n/lang/pt-BR.yaml Adds new error messages related to compose project-name parsing/derivation/validation.
agent/i18n/lang/ms.yaml Adds new error messages related to compose project-name parsing/derivation/validation.
agent/i18n/lang/lo.yaml Adds new error messages related to compose project-name parsing/derivation/validation.
agent/i18n/lang/ko.yaml Adds new error messages related to compose project-name parsing/derivation/validation.
agent/i18n/lang/ja.yaml Adds new error messages related to compose project-name parsing/derivation/validation.
agent/i18n/lang/fa.yaml Adds new error messages related to compose project-name parsing/derivation/validation.
agent/i18n/lang/es-ES.yaml Adds new error messages related to compose project-name parsing/derivation/validation.
agent/i18n/lang/en.yaml Adds new error messages related to compose project-name parsing/derivation/validation.
agent/app/service/runtime_utils.go Extends compose command builder to optionally include --project-name.
agent/app/service/container_compose.go Implements compose project-name resolution and propagates it through create/test/update/operations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread agent/app/service/container_compose.go
Comment thread frontend/src/views/container/compose/index.vue
Copilot AI review requested due to automatic review settings August 4, 2026 08:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 32 out of 32 changed files in this pull request and generated no new comments.

Suppressed comments (2)

frontend/src/views/container/compose/index.vue:614

  • optionalComposeNameRule duplicates the Compose-name regex and error message that already exist in Rules.composeName, which makes it easy for validations to drift over time. Prefer reusing the shared rule’s validator and only special-case the empty-string behavior for from === 'path'.
    agent/app/service/container_compose.go:320
  • parentName is derived from the compose file’s parent directory and returned as the project name, but it isn’t validated against the Compose name constraints (notably the 1–256 length limit). If the directory name normalizes to a value that’s too long, subsequent docker compose --project-name ... calls can fail. Validate parentName with re.ComposeNamePattern (and fall back to the user-provided name / error) before using it.
	if dirName == "" {
		// Keep compatibility with callers that used name as both the directory and

Copilot AI review requested due to automatic review settings August 4, 2026 08:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 32 out of 32 changed files in this pull request and generated no new comments.

Suppressed comments (2)

agent/app/service/container_compose.go:346

  • resolveComposeProjectName returns parentName without validating it against the same Compose name constraints used elsewhere. Since parentName is derived from a directory name, it can still end up too long (or otherwise invalid) for ComposeNamePattern, which would later break --project-name operations and reintroduce name/record inconsistencies. Validate parentName before returning it and fall back to the user-provided name (or error) when it’s invalid.
		if parentName != "" {
			return parentName, nil
		}

agent/app/service/container_compose.go:390

  • The error message in runComposeConfig hardcodes "docker-compose" even when the configured command is docker compose, which can mislead users when troubleshooting. Consider using a command-agnostic message (or include the configured command).
		return nil, fmt.Errorf("docker-compose config failed, std: %s, err: %v", mergeComposeOutput(stdout, stderr), err)
	}

@ssongliu
ssongliu force-pushed the fix/compose-project-name-resolution branch from 643b856 to faf3b47 Compare August 4, 2026 09:16
@ssongliu
ssongliu merged commit 1eb4296 into dev-v2 Aug 4, 2026
3 checks passed
@ssongliu
ssongliu deleted the fix/compose-project-name-resolution branch August 4, 2026 09:17
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.

2 participants