Proposal: pin `getProjectName` precedence behavior with tests
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 68/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- docker-compose, typescript
調査の方向性
src/spec-node/dockerCompose.ts の getProjectName から始め、次に cli.up.test.ts にある既存の compose-with-name の describe ブロックと、関連する dockerComposeUtils.test.ts のカバレッジを読みます。まず関連する統合テストを実行します。完了の条件は、確立された優先順位を変更せずに、直接テストで COMPOSE_PROJECT_NAME、.env の検索、単純なベース名へのフォールバック、toProjectName の文字サニタイズをカバーすることです。
索引モデルが issue の本文から書いたものです。
説明
Hi — I've been reading getProjectName in src/spec-node/dockerCompose.ts carefully while contributing to the Zed editor's dev container support (zed-industries/zed), which recently switched from shelling out to @devcontainers/cli to a native Rust implementation. (I'm an outside contributor doing small things there; the Zed team does the heavy lifting.)
The port mirrors this function's precedence ladder quite closely: COMPOSE_PROJECT_NAME env → workspace .env file → explicit top-level name: on the merged compose config → ${workspaceFolderBasename}_devcontainer when the first compose file's directory is <workspace>/.devcontainer → otherwise plain basename of that directory, all passed through toProjectName's lowercase-and-strip-[^-_a-z0-9] sanitization — because divergence produces duplicate compose projects for the same folder when both tools touch it. The fix for this just landed in Zed PR #54302 (tracking issue #54255).
The precedence is crisp in the code but mostly implied, rather than asserted by tests. The existing integration coverage in cli.up.test.ts pins three of the five rungs: explicit name: in a fragment, name: with ${env} substitution (including the CUSTOM_NAME=devcontainer edge case that forces the raw-fragment rescan), and the _devcontainer suffix when the compose file sits under .devcontainer/. The remaining rungs — COMPOSE_PROJECT_NAME from the environment, the .env file lookup, and the "plain basename, no suffix" fallback for compose files outside .devcontainer/ — don't appear to have direct tests. Same fortoProjectName's character class as a contract.
One related observation: the spec on containers.dev is silent on compose project-name derivation — the Docker Compose section covers dockerComposeFile, service, and runServices, but nothing about how the project name is chosen, COMPOSE_PROJECT_NAME, or multi-tool interop around it. So getProjectName in this repo is the de facto contract that any other implementation has to match if the two are ever going to coexist on the same folder. That makes pinning it with tests a little more load-bearing than it might look from inside the CLI's own use.
The question: would you be open, in principle, to pinning this behavior with tests? I'd be happy to contribute them. Either:
-
Unit tests alongside
dockerComposeUtils.test.ts— possibly needs a small
refactor to pull the env/.env/config-name reasoning out of the
cliHost-dependent shell ofgetProjectName, or -
Integration tests with new fixtures for the three missing rungs, matching
the style of the existingcompose-with-name*describe blocks in
cli.up.test.ts.
Or both, or a different shape — I'd rather ask than cold-drop a PR with the wrong approach. The motivation is durability: a CI-enforced invariant here is a nicer long-term mitigation than a doc comment in the Rust port saying "mirrors the reference CLI as of commit X".
No rush, and no problem if the answer is "not a priority / won't review" — in that case I'll close this and I figure Zed can keep on mirroring.
- 主要言語
- TypeScript
- スター
- 3k
- フォーク
- 463
- 平均マージ
- 13時間 28分
- マージ済み PR(30日)
- 2
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
devcontainers/cli のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
devcontainers/cli#1203 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 68/100
devcontainers/cli#1178 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
devcontainers/cli#1317 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
devcontainers/cli#1308 ·
メンテナーはふだん 1 日以内に返信
-
build rejects valid tag@digest image references during registry inspection対応中かも @v-Kaniska244 が 7 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 78/100
devcontainers/cli#1307 · コメント 2 件 · リアクション 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
devcontainers/cli の issue をすべて見る
似ている issue
-
enhancement providers-api ui-dashboard
難易度 2/5 1〜3時間 初心者へのやさしさ 61/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
external-issue to-triage
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
メンテナーはふだん 1 日以内に返信
-
needs triage
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
homarr-labs/homarr#6976 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信