Share one scoped env-var test guard: EnvGuard is copy-pasted 11 times across core unit and integration tests
Mantenedores costumam responder em até 1 dia
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 55/100
- Tipo de issue
- Refatoração
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- rust
- Domínio
- developer-experience, testing
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
[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.
- Linguagem predominante
- Rust
- Estrelas
- 8
- Forks
- 2
- Merge médio
- 19h 12min
- PRs com merge (30d)
- 709
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de SocketDev/socket-patch
-
agent:triaged arch-audit priority:p3 refactor
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 83/100
SocketDev/socket-patch#1860 ·
Mantenedores costumam responder em até 1 dia
-
agent:triaged arch-audit priority:p3 refactor
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
SocketDev/socket-patch#1838 ·
Mantenedores costumam responder em até 1 dia
-
Memoize env-keyed subprocess probes through one helper: composer, python and ruby each define the same env key and drifted on when an answer is keptTalvez já em andamento @mikolalysenko assumiu hoje. Abertaagent:claimed agent:triaged arch-audit priority:p1 refactor
Dificuldade 4/5 1-2 dias Facilidade para iniciantes 25/100
SocketDev/socket-patch#1888 · 3 comentários ·
Mantenedores costumam responder em até 1 dia
-
agent:triaged arch-audit priority:p3 refactor
Dificuldade 4/5 1-2 dias Facilidade para iniciantes 55/100
SocketDev/socket-patch#1887 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
agent:needs-human agent:triaged arch-audit priority:p3 refactor
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 38/100
SocketDev/socket-patch#1881 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de SocketDev/socket-patch
Issues semelhantes
-
bug priority: low ui
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
storytold/photocraft#10370 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
area:doc bug in progress needs-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
bherbruck/solvecraft#9634 · 2 comentários · 1 reação ·
-
inflate: total_in uses plain += on c_ulong (32-bit on Windows), panics in debug for streams > 4 GiBAberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
trifectatechfoundation/zlib-rs#570 · 1 comentário ·
-
bug discord-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
LanternOps/breeze#10755 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
aranya-project/aranya#803 ·