Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Duplicate Code] Extract repeated dynamic enclave entrypoint fixture setup

Closed Beginner friendly
#10,364 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@lpcox is already working on this.

Since Oct 21, 2026.

  • #10401 by @copilot-swe-agent — merged

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

code-quality refactoring

Duplicate Code Opportunity

Summary
  • Pattern: Two dynamic-enclave tests independently create the same temporary stage, agent directory, and bearer-token fixture before invoking the harness.
  • Locations: containers/api-proxy/providers is not involved; both copies are in src/enclave/dynamic-executor.test.ts at 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-680
  • src/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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from github/gh-aw-firewall

All issues in github/gh-aw-firewall

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.