Drive pdm.lock and poetry.lock rewrites through one lock_fragments driver instead of two mirrored triads
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
Línea de trabajo
Start by reading crates/socket-patch-core/src/utils/lock_fragments.rs, pdm_lock.rs, and poetry_lock.rs, especially the driver, pairing, and equivalence test sections cited in the issue. Then trace the listed call sites in redirect/pdm.rs, redirect/poetry.rs, vendor/pypi_pdm.rs, and vendor/pypi_poetry.rs. Done means one shared driver and pairing helper, equivalence coverage for both formats, and all exact byte tests passing unchanged.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
[agent] Filed by the scheduled architecture audit (audit-core). Register: register.
Kind: refactor. Register ID: A05.
Problem
utils/pdm_lock.rs and utils/poetry_lock.rs each carry the same driver around utils::lock_fragments:
- Poetry has
rewrite_poetry_lock/_with_edits/_in/_all/_all_with_version/_batch/_steps: poetry_lock.rs L426-L731. - PDM has the mirror: pdm_lock.rs L136-L353.
- The test modules are mirrored too.
parse_reuse_equivalence_testsandbatch_equivalence_testsexist in both files, and the "fragments changed shape" test exists three times (lock_fragmentsL595,pdm_lockL921,poetry_lock).
The _steps loops have already drifted:
- PDM calls
rewrite.edits()?before its Unchanged check: pdm_lock.rs L333-L340. - Poetry compares the text first: poetry_lock.rs L710-L719.
- This looks unreachable today, but nothing stops it from becoming reachable.
Inside lock_fragments itself, fragment pairing is written three times, and the copies disagree on how uniqueness is counted:
pair_fragmentsL191-L210 counts non-overlapping matches on both sides.- the
finishloop L316-L336 checksoldin the text andnewin the spliced result. rewrite_batchL473-L495 counts overlappingsole_occurrences.- The shape-change length check is repeated at L198, L322 and L477.
Proposed change
- Move the
_steps,_alland_with_editsdrivers intolock_fragments, generic over a small per-format value:plan,mutate,fragments_in. - Delete the per-format wrappers and the
PoetryLockRewrite/PoetryLockParsealiases. - Have
finishandrewrite_batchcall one pairing helper. - Keep one copy of each equivalence test, parameterized over both formats.
Size
Three files (lock_fragments.rs, pdm_lock.rs, poetry_lock.rs), plus call-site renames in redirect/pdm.rs, redirect/poetry.rs, vendor/pypi_pdm.rs and vendor/pypi_poetry.rs. About −250 net lines.
Acceptance criteria
- Every pdm/poetry exact-bytes test passes unchanged, including the batch and parse-reuse equivalence tests (kept once, run for both formats).
- The duplicated shape-change test is kept once, in
lock_fragments. - No user-visible change.
- Lenguaje dominante
- Rust
- Estrellas
- 9
- Forks
- 2
- Merge medio
- 18 h 47 min
- PR fusionados (30 d)
- 637
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 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
-
arch-audit refactor
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
SocketDev/socket-patch#1987 ·
Los mantenedores suelen responder en 1 día
-
agent:triaged arch-audit priority:p3 refactor
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
SocketDev/socket-patch#1983 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
agent:triaged arch-audit bug priority:p3
Dificultad 3/5 Medio día Aptitud para principiantes 55/100
SocketDev/socket-patch#1982 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de SocketDev/socket-patch
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 70/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
limitlessprojects/Go-Hybrid#3342 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
librespeed/speedtest-rust#52 · 1 comentario ·
-
enhancement needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
bherbruck/solvecraft#11246 · 1 comentario · 1 reacción ·
-
example
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
rust-lang-nursery/rust-cookbook#954 ·
Los mantenedores suelen responder en 1 día