Drive pdm.lock and poetry.lock rewrites through one lock_fragments driver instead of two mirrored triads
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 35/100
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
[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.
- Langage dominant
- Rust
- Étoiles
- 9
- Forks
- 2
- Merge moyen
- 18 h 47 min
- PR mergées (30 j)
- 637
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de SocketDev/socket-patch
-
agent:triaged arch-audit priority:p3 refactor
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
SocketDev/socket-patch#1860 ·
Les mainteneurs répondent en général sous 1 jour
-
agent:triaged arch-audit priority:p3 refactor
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
SocketDev/socket-patch#1838 ·
Les mainteneurs répondent en général sous 1 jour
-
arch-audit refactor
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
SocketDev/socket-patch#1987 ·
Les mainteneurs répondent en général sous 1 jour
-
agent:triaged arch-audit priority:p3 refactor
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
SocketDev/socket-patch#1983 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
agent:triaged arch-audit bug priority:p3
Difficulté 3/5 Une demi-journée Accessibilité débutants 55/100
SocketDev/socket-patch#1982 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de SocketDev/socket-patch
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour
-
test(hydro_std): track_membership join and leave are untestedPeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
hydro-project/hydro#3289 ·
Les mainteneurs répondent en général sous 1 jour
-
diagram-bug good first issue help wanted
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
enhapu-afk/omaspec#4 ·
-
priority: low ☕️ type: bug 🐛
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
Les mainteneurs répondent en général sous 1 jour
-
bug security
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
Les mainteneurs répondent en général sous 4 jours