[Duplicate Code] Extract repeated trusted enclave storage invocation plan fixture
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Refactor
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- testing
Research direction
Read src/cloud-hypervisor/trusted-enclave-storage.test.ts around lines 341-357 and 430-446 to compare the repeated plan and storage-root setup. Extract a shared test helper while preserving any scenario-specific values. Done when both tests use the shared setup and the existing trusted enclave storage tests pass.
Written by the indexing model from the issue text.
Description
Duplicate Code Opportunity
Summary
- Pattern: Trusted enclave storage tests duplicate construction of the same
HostExecutorInvocationPlanand derivation of its storage root. - Locations:
src/cloud-hypervisor/trusted-enclave-storage.test.tslines 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-357src/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
- Dominant language
- TypeScript
- Stars
- 149
- Forks
- 77
- Avg merge
- 4h 19m
- Merged PRs (30d)
- 445
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from github/gh-aw-firewall
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
github/gh-aw-firewall#10364 ·
Maintainers usually reply within 1 day
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
github/gh-aw-firewall#10363 ·
Maintainers usually reply within 1 day
-
agentic-workflows automated dependencies
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
github/gh-aw-firewall#3837 ·
Maintainers usually reply within 1 day
-
agentic-workflows
Difficulty 2/5 1-3 hours Newbie friendliness 46/100
github/gh-aw-firewall#10368 ·
Maintainers usually reply within 1 day
-
agentic-workflows
Difficulty 4/5 1-2 days Newbie friendliness 25/100
github/gh-aw-firewall#10367 ·
Maintainers usually reply within 1 day
All issues in github/gh-aw-firewall
Similar issues
-
area:editor bug issue-form:bug P0 platform:windows review: low
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
1lck/Lithe-IDEA#1388 ·
Maintainers usually reply within 1 day
-
fix(api): isToolAuditEnabled swallows database read errors on auditToolOperations without loggingOpenarea: backend bug priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
snapotter-hq/SnapOtter#3238 ·
Maintainers usually reply within 1 day
-
rig up --plan times out after 5 s and reports an UNKNOWN outcome while the daemon completes the planOpen
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
modelcontextprotocol/servers#5216 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day