Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 20, 2026

Replaces []any in Playwright tool configuration with strongly-typed slices, eliminating type assertions throughout the codebase.

Changes

New types (pkg/workflow/tools_types.go):

  • PlaywrightDomain and PlaywrightAllowedDomains with ToStringSlice() method
  • PlaywrightToolConfig.AllowedDomains changed from []string to PlaywrightAllowedDomains

Parser enhancement (pkg/workflow/tools_parser.go):

  • parsePlaywrightTool() now handles numeric version formats and both []any / []string args
  • Returns *PlaywrightToolConfig directly, no type assertions needed

Function signatures updated (11 files):

// Before
func generatePlaywrightDockerArgs(playwrightTool any) PlaywrightDockerArgs

// After  
func generatePlaywrightDockerArgs(playwrightConfig *PlaywrightToolConfig) PlaywrightDockerArgs

Applied to: generatePlaywrightAllowedDomains, getPlaywrightCustomArgs, getPlaywrightDockerImageVersion, getPlaywrightMCPPackageVersion, and all render functions.

Call sites (mcp_servers.go, mcp_renderer.go, mcp-config-playwright.go):

  • Parse configuration at entry point: playwrightConfig := parsePlaywrightTool(playwrightTool)
  • Pass typed config to downstream functions

Tests updated (5 files):

  • All test fixtures now parse before passing to functions
Original prompt

This section details on the original issue you should resolve

<issue_title>[plan] Type Playwright tool configuration arrays</issue_title>
<issue_description>## Objective

Replace []any usage in Playwright tool configuration with strongly-typed slices for allowed domains and other configuration arrays.

Context

From discussion #10816: The Playwright tool configuration uses []any for configuration arrays, requiring type assertions. This affects domain allowlists and other array-based configuration.

Approach

  1. Define semantic types in pkg/workflow/tools_types.go:

    type PlaywrightDomain string
    type PlaywrightAllowedDomains []PlaywrightDomain
    // Add other Playwright-specific types as needed
  2. Update PlaywrightToolConfig struct to use typed slices:

    • Change domain allowlist field to use PlaywrightAllowedDomains
    • Update other array fields in Playwright configuration
  3. Update Playwright tool parsing in pkg/workflow/tools_parser.go:

    • Remove type assertions for domain lists
    • Use direct type conversion from YAML
  4. Update code that validates and uses Playwright configuration:

    • Search for Playwright tool usage in pkg/workflow/
    • Remove type assertion logic
  5. Update test fixtures

Files to Modify

  • Update: pkg/workflow/tools_types.go (add Playwright semantic types)
  • Update: pkg/workflow/tools_parser.go (update Playwright parsing)
  • Update: Files that validate or use Playwright configuration
  • Update: Test files with Playwright tool fixtures

Acceptance Criteria

  • Semantic types for Playwright domains are defined
  • PlaywrightToolConfig uses typed slices instead of []any
  • Type assertions for Playwright arrays are eliminated
  • All existing tests pass
  • Run make agent-finish successfully before committing

AI generated by Plan Command for discussion #10816

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 21, 2026 00:11
…ly-typed slices

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review January 21, 2026 00:21
Copilot AI changed the title [WIP] Replace any usage in Playwright config with typed slices Type Playwright tool configuration arrays Jan 21, 2026
Copilot AI requested a review from mnkiefer January 21, 2026 00:21
@pelikhan pelikhan merged commit c5e92b1 into main Jan 21, 2026
116 checks passed
@pelikhan pelikhan deleted the copilot/type-playwright-config-arrays branch January 21, 2026 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[plan] Type Playwright tool configuration arrays

3 participants