Share one scoped env-var test guard: EnvGuard is copy-pasted 11 times across core unit and integration tests
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
- Tipo di issue
- Refactoring
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- rust
- Ambito
- developer-experience, testing
Direzione di ricerca
Start by reading the EnvGuard definitions named in the issue and the core test helper beside test_rng. Compare the unit-test and integration-test variants, including the OsStr and closure forms, then identify any existing injected-env helpers and test-support setup. Done means the touched tests share the guard, retain their existing #[serial] usage, and the stated grep finds one core definition.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
[agent] Filed by the scheduled architecture audit (audit-core). Register: register.
Kind: refactor (tests). Register ID: A37.
Problem
Tests that mutate process env each define their own restore-on-drop guard.
These three copies are byte-identical:
- go_crawler.rs L1518-L1542
- deno_crawler.rs L945-L969
- maven_crawler.rs L2508-L2532
These are variants:
npm_crawler.rsL5880, which takes anOsStrvaluepython_crawler.rsL7878 and L8107vendor/maven_repo.rsL2649patch/jvm_jar.rsL837tests/upstream_restore_golden.rsL188tests/crawler_deno_e2e.rsL24tests/crawler_npm_e2e.rsL357
There are also closure-style twins: utils/socket_cli_config.rs with_env (L311) and utils/fs.rs with_home_env (L1489).
grep -rn "struct EnvGuard" crates finds 11 definitions.
Proposed change
- Add one
#[cfg(test)] pub(crate) mod test_envin core, besidetest_rng. It holdsEnvGuard::set(key, value),::unset(key)and a multi-key form takingOsStrvalues, pluswith_env(pairs, f). - Unit tests use it.
- The three integration-test files share one copy in
tests/common/, or through atest-supportfeature if one already exists. - Where a function under test already takes injected env (
*_withvariants), switch the test to that and drop the guard.
Size
About 12 files, about −150 lines. Tests only.
Acceptance criteria
- No production code changes.
- Every touched test still runs under
#[serial]where it did before and passes. grep -rn "struct EnvGuard" crates/socket-patch-core/srcfinds one definition.
- Lingua principale
- Rust
- Stelle
- 8
- Fork
- 2
- Merge medio
- 19h 24m
- PR unite (30g)
- 669
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di SocketDev/socket-patch
-
agent:triaged arch-audit priority:p3 refactor
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
SocketDev/socket-patch#1860 ·
I maintainer di solito rispondono entro 1 giorno
-
agent:triaged arch-audit priority:p3 refactor
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
SocketDev/socket-patch#1838 ·
I maintainer di solito rispondono entro 1 giorno
-
Vendored npm rollback / remove / vendor --revert on a lockfileVersion 2 lock fail after any `npm install`, yet half-revert the lock: `packages` goes back to the registry while the legacy mirror keeps the patched integrity, and npm 6 then fails EINTEGRITYForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertabug bughunt pm:npm
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
SocketDev/socket-patch#1937 ·
I maintainer di solito rispondono entro 1 giorno
-
arch-audit refactor
Difficoltà 4/5 3-5 giorni Idoneità per principianti 22/100
SocketDev/socket-patch#1935 ·
I maintainer di solito rispondono entro 1 giorno
-
arch-audit bug
Difficoltà 3/5 Mezza giornata Idoneità per principianti 55/100
SocketDev/socket-patch#1934 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di SocketDev/socket-patch
Issue simili
-
Remove the em dashes from the skill smart-account referenceForse già presa @Vamsi-2581 l’ha presa oggi. Apertaagent-ready area: docs documentation good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
Soneso/stellar-agent-wallet#541 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
bovinemagnet/AdocFoundry#279 ·
I maintainer di solito rispondono entro 1 giorno
-
help wanted
Difficoltà 1/5 Mezza giornata Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 2 giorni
-
accessibility good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100