Drive pdm.lock and poetry.lock rewrites through one lock_fragments driver instead of two mirrored triads
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 35/100
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
[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.
- Vorherrschende Sprache
- Rust
- Sterne
- 8
- Forks
- 2
- Ø Merge
- 18 Std. 47 Min.
- Gemergte PRs (30 T.)
- 637
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus SocketDev/socket-patch
-
agent:triaged arch-audit priority:p3 refactor
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
SocketDev/socket-patch#1860 ·
Maintainer antworten meist innerhalb von 1 Tag
-
agent:triaged arch-audit priority:p3 refactor
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
SocketDev/socket-patch#1838 ·
Maintainer antworten meist innerhalb von 1 Tag
-
arch-audit refactor
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
SocketDev/socket-patch#1987 ·
Maintainer antworten meist innerhalb von 1 Tag
-
agent:triaged arch-audit priority:p3 refactor
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
SocketDev/socket-patch#1983 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
agent:triaged arch-audit bug priority:p3
Schwierigkeit 3/5 Ein halber Tag Anfängerfreundlichkeit 55/100
SocketDev/socket-patch#1982 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in SocketDev/socket-patch
Ähnliche Issues
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 70/100
OpenZeppelin/openzeppelin-relayer#967 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
src/runs.rs:1987: a missing --source-run-id now answers 400 "Source run ... does not exist", not 404Offennightly-audit
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
antithesishq/snouty#602 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
libnativeapi/nativeapi#21 ·