Proposal: pin `getProjectName` precedence behavior with tests
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 68/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- docker-compose, typescript
Línea de trabajo
Empieza por getProjectName en src/spec-node/dockerCompose.ts y después lee los bloques describe existentes de compose-with-name en cli.up.test.ts y la cobertura relacionada de dockerComposeUtils.test.ts. Ejecuta primero las pruebas de integración pertinentes. Se considera terminado cuando las pruebas directas cubran COMPOSE_PROJECT_NAME, la búsqueda de .env, el fallback al nombre base simple y la sanitización de caracteres de toProjectName sin cambiar la precedencia establecida.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 3k
- Forks
- 463
- Merge medio
- 13 h 28 min
- PR fusionados (30 d)
- 2
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de devcontainers/cli
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
devcontainers/cli#1203 ·
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 68/100
devcontainers/cli#1178 · 1 comentario ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
devcontainers/cli#1308 ·
-
build rejects valid tag@digest image references during registry inspectionPosiblemente ocupada @v-Kaniska244 la tomó hace 6 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 78/100
devcontainers/cli#1307 · 2 comentarios · 1 reacción · 1 asignado ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
devcontainers/cli#1305 ·
Todos los issues de devcontainers/cli
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
automated issue report
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
-
documentation
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
github/copilot-sdk#2804 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
drizzle-team/drizzle-orm#6418 ·
Los mantenedores suelen responder en 4 días
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
diegosouzapw/OmniRoute#15307 · 1 comentario ·
Los mantenedores suelen responder en 2 días