Hatch: the uv-installer check reads the pyproject.toml environments that hatch.toml replaces, and refuses a pip project
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 82/100
Línea de trabajo
Empieza en crates/socket-patch-core/src/utils/hatch.rs y lee merged_key, require_pip_installer_documents y los tres llamadores mencionados en el issue. Añade una prueba unitaria para el caso de envs reemplazado y asegúrate de que los dos casos de cierre por defecto sigan cubiertos. Ejecuta las pruebas de la biblioteca socket-patch-core. El trabajo estará terminado cuando los entornos de pyproject.toml reemplazados ya no provoquen un rechazo falso de uv, pero la configuración activa de uv sí lo siga provocando.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
[agent] Filed by the architecture refactor routine (lead L06, run on main at 9a2a946).
Kind: bug, a drifted copy of one rule. Low harm: the wrong answer is a refusal.
Problem
Hatch reads its settings from pyproject.toml ([tool.hatch]) and hatch.toml, and a top-level key in hatch.toml replaces the [tool.hatch] key of the same name. So when hatch.toml has an envs table, the environments under [tool.hatch.envs] in pyproject.toml are dead configuration.
merged_key implements that rule, and the lock detection and the dependency walk use it. require_pip_installer_documents does not: it looks for installer = "uv" or a uv-path in the envs table of every document. A project whose replaced pyproject.toml environments still say installer = "uv" is treated as a uv project although Hatch installs it with pip.
Two things follow, both refusals with the wrong reason:
- Vendored mode refuses the project:
pypi_hatch_unsupported, "vendored Hatch wheels require the pip installer: uv does not enforce local wheel fragment hashes" (pypi_hatch::preflight). uv_source_namestakes the same answer, so a hosted run refuses a project requirement that has a[tool.uv.sources]entry ("Hatch's uv installer resolves it through its [tool.uv.sources] entry…") in a project where pip ignores that table.
The check never fails open: a hatch.toml that selects uv, or a pyproject.toml that does with no envs in hatch.toml, is still refused.
Evidence
A throwaway test in utils/hatch.rs (not committed) feeds one project to both readers:
let uv = "\n[tool.hatch.envs.default]\ninstaller = \"uv\"\n";
// A: pyproject says uv; hatch.toml's `envs` replaces it, so Hatch uses pip.
let a = files(uv, Some("[envs.default]\ndependencies = []\n"));
// D: the same shape with `locked = true`, for the reader that follows the merge.
let d = files("\n[tool.hatch.envs.default]\nlocked = true\n", Some("[envs.default]\ndependencies = []\n"));
println!("PROBE A require_pip_installer = {:?}", require_pip_installer(&a));
println!("PROBE D is_hatch_lock = {:?}", is_hatch_lock(&d, "pylock.toml"));
$ cargo test -p socket-patch-core --lib probe_ -- --nocapture
PROBE A require_pip_installer = Err("vendored Hatch wheels require the pip installer: uv does not enforce local wheel fragment hashes")
PROBE D is_hatch_lock = false
is_hatch_lock ignores the replaced pyproject.toml environments (as hatch_lock_detection_follows_the_config_merge pins); require_pip_installer reads them.
Planned fix
require_pip_installer_documents reads the one envs table Hatch uses, through merged_key(pyproject, hatch_toml, "envs"), instead of walking each document. Its three callers (require_pip_installer, uv_source_names, run_round) keep their signatures or pass the two documents. A unit test gives project A to require_pip_installer and expects Ok, and keeps the two fail-closed cases refused.
About 20 changed production lines in crates/socket-patch-core/src/utils/hatch.rs.
Generated by Claude Code
- Lenguaje dominante
- Rust
- Estrellas
- 9
- Forks
- 2
- Merge medio
- 1 d 8 h
- PR fusionados (30 d)
- 313
Preparar el entorno
- 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 SocketDev/socket-patch
-
agent:triaged arch-audit bug priority:p2
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
SocketDev/socket-patch#2306 ·
Los mantenedores suelen responder en 1 día
-
agent:triaged arch-audit bug priority:p3
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
SocketDev/socket-patch#2296 ·
Los mantenedores suelen responder en 1 día
-
agent:needs-human agent:triaged ci-janitor priority:p1
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
SocketDev/socket-patch#2270 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
agent:triaged arch-audit priority:p3 refactor
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
SocketDev/socket-patch#1860 ·
Los mantenedores suelen responder en 1 día
-
agent:triaged arch-audit priority:p3 refactor
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
SocketDev/socket-patch#1838 ·
Los mantenedores suelen responder en 1 día
Todos los issues de SocketDev/socket-patch
Issues similares
-
Bash init calls `cygpath` unconditionally on Windows, which breaks non-Cygwin shells like `brush`Posiblemente ocupada @iliqiliev la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
ajeetdsouza/zoxide#1381 ·
Los mantenedores suelen responder en 5 días
-
triage
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
kornia/kornia-rs#1416 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
paritytech/revive#749 ·
Los mantenedores suelen responder en 3 días
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
swc-project/swc-next-issues#1043 ·