Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Duplicate Code] Extract repeated trusted enclave storage invocation plan fixture

Aperta Adatta ai principianti
#10,362 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Refactoring
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
testing

Direzione di ricerca

Leggi src/cloud-hypervisor/trusted-enclave-storage.test.ts intorno alle righe 341-357 e 430-446 per confrontare la configurazione ripetuta del piano e della radice di archiviazione. Estrai una funzione helper di test condivisa, mantenendo i valori specifici di ciascuno scenario. Il lavoro è completato quando entrambi i test usano la configurazione condivisa e i test esistenti per l’archiviazione trusted enclave passano.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

code-quality refactoring

Duplicate Code Opportunity

Summary
  • Pattern: Trusted enclave storage tests duplicate construction of the same HostExecutorInvocationPlan and derivation of its storage root.
  • Locations: src/cloud-hypervisor/trusted-enclave-storage.test.ts lines 341-357 and 430-446.
  • Impact: The repeated security-sensitive identity and invocation-path fixture can drift between mount-propagation and privatization tests; a shared builder would reduce maintenance and preserve consistent path assumptions.
Evidence

Both tests create the same plan fields and storage root:

Location A

  • src/cloud-hypervisor/trusted-enclave-storage.test.ts: lines 341-357
const plan = {
  runId: 'a'.repeat(32), entryId: 'script', invocationId: 'b'.repeat(32), executorKind: 'script',
  invocationHostDir: '/private/SECRET/invocations/script/invocation',
} as HostExecutorInvocationPlan;
const root = hostExecutorStorageDirectory(hostExecutorVmRunId(plan));

Location B

  • src/cloud-hypervisor/trusted-enclave-storage.test.ts: lines 430-446
const plan = {
  runId: 'a'.repeat(32), entryId: 'script', invocationId: 'b'.repeat(32), executorKind: 'script',
  invocationHostDir: '/private/SECRET/invocations/script/invocation',
} as HostExecutorInvocationPlan;
const root = hostExecutorStorageDirectory(hostExecutorVmRunId(plan));
Suggested Refactoring

Extract a createInvocationPlan(overrides = {}) test helper that returns the canonical HostExecutorInvocationPlan, and a small invocationStorageRoot(plan) helper or fixture wrapper for the derived root. Allow tests to override only the identity/path fields needed by a specific scenario.

Affected Files
  • src/cloud-hypervisor/trusted-enclave-storage.test.ts — lines 341-357
  • src/cloud-hypervisor/trusted-enclave-storage.test.ts — lines 430-446
Effort Estimate

Low


Detected by Duplicate Code Detector workflow. Run date: 2026-10-20

Generated by Duplicate Code Detector · copilot · gpt54mini · 1.03 AIC · ⊞ 30.1K · ◷

  • expires on Nov 19, 2026, 9:52 PM UTC
Lingua principale
TypeScript
Stelle
150
Fork
76
Merge medio
4h 19m
PR unite (30g)
445

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di github/gh-aw-firewall

Tutte le issue di github/gh-aw-firewall

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.