[Duplicate Code] Extract repeated dynamic enclave entrypoint fixture setup
Maintainers usually reply within 1 day
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 the two setup blocks in src/enclave/dynamic-executor.test.ts around lines 666-680 and 705-722, then compare how each test uses the stage and cleans it up. Extract a shared fixture helper while keeping environment overrides separate. Done means both tests use the helper and continue checking their existing acceptance and rejection behavior.
Written by the indexing model from the issue text.
Description
Duplicate Code Opportunity
Summary
- Pattern: Two dynamic-enclave tests independently create the same temporary stage,
agentdirectory, and bearer-token fixture before invoking the harness. - Locations:
containers/api-proxy/providersis not involved; both copies are insrc/enclave/dynamic-executor.test.tsat lines 666-680 and 705-722. - Impact: Centralizing the fixture would remove repeated setup and keep security-sensitive bearer-file and staging assumptions consistent across acceptance and rejection tests.
Evidence
The two tests repeat the same setup:
Location A
src/enclave/dynamic-executor.test.ts: lines 666-680
it('writes a bearer-only GitHub MCP config confined to the two delegated tools', () => {
const stage = fs.mkdtempSync(path.join(os.tmpdir(), 'awf-dynamic-entrypoint-'));
try {
fs.mkdirSync(path.join(stage, 'agent'));
fs.writeFileSync(path.join(stage, 'bearer'), 'dlgbearer_abcdef0123456789\\n');
const result = runHarness(
Location B
src/enclave/dynamic-executor.test.ts: lines 705-722
it.each([
['a non-fixed endpoint', { AWF_ENCLAVE_AGENT_GITHUB_MCP_URL: '(evil.example/redacted) }],
['a non-canonical repository', { AWF_ENCLAVE_AGENT_DYNAMIC_REPO: 'Octo-Org/Service' }],
])('refuses to build a dynamic MCP config with %s', (_label, overrides) => {
const stage = fs.mkdtempSync(path.join(os.tmpdir(), 'awf-dynamic-entrypoint-'));
try {
fs.mkdirSync(path.join(stage, 'agent'));
fs.writeFileSync(path.join(stage, 'bearer'), 'dlgbearer_abcdef0123456789\\n');
const result = runHarness(
Suggested Refactoring
Extract a createDynamicEntrypointStage() test helper that creates the temporary stage, required agent directory, and validated bearer fixture, returning the stage path and cleanup helper. Parameterize any environment overrides separately so the helper is shared without obscuring the security assertions.
Affected Files
src/enclave/dynamic-executor.test.ts— lines 666-680src/enclave/dynamic-executor.test.ts— lines 705-722
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
- 150
- Forks
- 76
- Avg merge
- 4h 17m
- Merged PRs (30d)
- 458
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
-
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 4/5 1-2 days Newbie friendliness 38/100
github/gh-aw-firewall#10438 ·
Maintainers usually reply within 1 day
-
[Duplicate Code] Share network configuration mock setup across network testsPossibly taken @lpcox claimed this today. Opencode-quality refactoring
github/gh-aw-firewall#10432 · 1 reaction · 2 assignees ·
Maintainers usually reply within 1 day
-
[Duplicate Code] Extract shared routed configuration fixture in compose-generator testsPossibly taken @lpcox claimed this today. Opencode-quality refactoring
github/gh-aw-firewall#10430 · 1 reaction · 2 assignees ·
Maintainers usually reply within 1 day
-
[Duplicate Code] Extract shared primary-agent profile fixture in Cloud Hypervisor testsPossibly taken @lpcox claimed this today. Opencode-quality refactoring
github/gh-aw-firewall#10431 · 1 reaction · 2 assignees ·
Maintainers usually reply within 1 day
All issues in github/gh-aw-firewall
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
cursor/community-plugins#465 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
vetro-protocol/vetro-monorepo#978 ·
Maintainers usually reply within 1 day
-
ai-generated bug category:security effort:s priority:p3
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
LanternOps/breeze#9697 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
maniator/verticopolis#1303 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
components-web-app/docs#297 ·