Skip to content

[Duplicate Code] Agent-volume tests repeat the baseline WrapperConfig fixture #6166

Description

@github-actions

Duplicate Code Opportunity

Summary

  • Pattern: The Docker-socket and workspace-mount test suites each define the same makeConfig helper with identical baseline WrapperConfig values.
  • Locations: src/services/agent-volumes/docker-socket-branches.test.ts:21-28 and src/services/agent-volumes/workspace-mounts.test.ts:17-24.
  • Impact: These tests cover security-sensitive bind-mount and Docker-socket behavior; duplicated defaults can drift and cause suites to exercise different effective policies while appearing equivalent.

Evidence

src/services/agent-volumes/docker-socket-branches.test.ts:21-28:

function makeConfig(overrides: Partial<WrapperConfig> = {}): WrapperConfig {
  return {
    allowDomains: 'example.com',
    agentCommand: 'echo test',
    workDir: '/tmp/awf-test',
    ...overrides,
  } as WrapperConfig;
}

src/services/agent-volumes/workspace-mounts.test.ts:17-24:

function makeConfig(overrides: Partial<WrapperConfig> = {}): WrapperConfig {
  return {
    allowDomains: 'example.com',
    agentCommand: 'echo test',
    workDir: '/tmp/awf-test',
    ...overrides,
  } as WrapperConfig;
}

Suggested Refactoring

Extract a shared makeAgentVolumeConfig fixture into src/services/agent-volumes/test-utils.ts and import it from all agent-volume suites. Keep suite-specific parameter builders, such as makeParams, local where their fields differ.

Affected Files

  • src/services/agent-volumes/docker-socket-branches.test.ts — lines 21-28
  • src/services/agent-volumes/workspace-mounts.test.ts — lines 17-24

Effort Estimate

Low


Detected by Duplicate Code Detector workflow. Run date: 2026-07-13

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • awmgmcpg

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

Generated by Duplicate Code Detector · 8.41 AIC · ⊞ 20.1K ·

  • expires on Aug 12, 2026, 6:44 AM UTC

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions