[Duplicate Code] Extract the dynamic enclave launch config fixture in dynamic-executor.test.ts
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Refactor
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- testing
Research direction
Start in src/enclave/dynamic-executor.test.ts at lines 123-150 and 488-514, and compare the two repeated configuration fixtures. Extract a shared buildDynamicExecutorConfig() helper or fixture factory, parameterizing the fields that differ between the direct spec and runner-launch tests. Run the test file and confirm both test paths still pass.
Written by the indexing model from the issue text.
Description
Duplicate Code Opportunity
Summary
- Pattern: The dynamic enclave launch tests repeat the same large configuration fixture in two places inside one file.
- Locations:
src/enclave/dynamic-executor.test.ts:123-150,src/enclave/dynamic-executor.test.ts:488-514 - Impact: 24 duplicated lines. Changes to enclave defaults, image names, network settings, or resource limits must be kept in sync across two separate fixtures.
Evidence
A. src/enclave/dynamic-executor.test.ts:123-150
const config = {
dynamicEnabled: true,
dynamicGithubMcpUrl: '(172.31.0.40/redacted)
dynamicRepository: 'octo-org/service',
dynamicReadMode: 'live',
enclaveGithubBearerPath: ENCLAVE_GITHUB_BEARER_PATH,
hostWorkDir: '/var/tmp/work',
enclaveSeccompPath: '/opt/awf/enclave-seccomp.json',
enclaveMountDir: '/agent',
enclaveSeedPath: '/awf/seed',
enclaveTaskPath: '/awf/task.txt',
enclaveSchemaPath: '/awf/schema.json',
enclaveUid: 65534,
enclaveGid: 65534,
enclaveImage: 'ghcr.io/example/enclave-agent:test',
engine: 'copilot',
profile: 'openai',
model: 'gpt-test',
apiEndpoint: '(172.31.0.30/redacted)
network: 'awf-enclave-agent',
timeoutSeconds: 120,
memoryLimit: '1g',
cpuLimit: '1',
pidsLimit: 128,
tmpfsLimit: '256m',
maxOutputBytes: 8192,
};
B. src/enclave/dynamic-executor.test.ts:488-514
const runnerConfig = {
backend: 'docker',
dynamicEnabled: true,
dynamicGithubMcpUrl: '(172.31.0.40/redacted)
githubGatewayContainer: 'awmg-mcpg',
enclaveGithubBearerPath: ENCLAVE_GITHUB_BEARER_PATH,
hostWorkDir: '/var/tmp/work',
enclaveSeccompPath: '/opt/awf/enclave-seccomp.json',
enclaveMountDir: '/agent',
enclaveSeedPath: '/awf/seed',
enclaveTaskPath: '/awf/task.txt',
enclaveSchemaPath: '/awf/schema.json',
enclaveUid: 65534,
enclaveGid: 65534,
enclaveImage: 'ghcr.io/example/enclave-agent:test',
engine: 'copilot',
profile: 'openai',
model: 'gpt-test',
apiEndpoint: '(172.31.0.30/redacted)
network: 'awf-enclave-agent',
timeoutSeconds: 120,
memoryLimit: '1g',
cpuLimit: '1',
pidsLimit: 128,
tmpfsLimit: '256m',
maxOutputBytes: 8192,
};
Suggested Refactoring
Extract a shared buildDynamicExecutorConfig() helper or fixture factory and parameterize only the fields that differ between the direct spec test and the runner-launch test.
Affected Files
src/enclave/dynamic-executor.test.ts— lines 123-150src/enclave/dynamic-executor.test.ts— lines 488-514
Effort Estimate
Low
Detected by Duplicate Code Detector workflow. Run date: 2026-09-24
Generated by Duplicate Code Detector · copilot · gpt50mini · 9.48 AIC · ⊞ 21K · ◷
- expires on Oct 24, 2026, 9:43 PM UTC
- Dominant language
- TypeScript
- Stars
- 145
- Forks
- 63
- Avg merge
- 6h 22m
- Merged PRs (30d)
- 232
Contributor 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
-
[Duplicate Code] Share the Cloud Hypervisor network-plan fixture between launch and config tests Opencode-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
github/gh-aw-firewall#8974 ·
-
agentic-workflows automated dependencies
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
github/gh-aw-firewall#8898 ·
-
agentic-workflows automated dependencies
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
github/gh-aw-firewall#3837 ·
-
Gh rate point limit Open
Difficulty 3/5 1-2 days Newbie friendliness 58/100
github/gh-aw-firewall#8977 ·
-
agentic-workflows
Difficulty 4/5 3-5 days Newbie friendliness 35/100
github/gh-aw-firewall#8976 ·
All issues in github/gh-aw-firewall
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
security
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
IBM/node-sdk-core#373 ·
-
e2e-failure ready-to-code
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
chore
Difficulty 2/5 1-3 hours Newbie friendliness 88/100