Skip to content

Validate Playwright mode expressions - #56933

Merged
pelikhan merged 3 commits into
mainfrom
copilot/validate-playwright-mode
Aug 29, 2026
Merged

Validate Playwright mode expressions#56933
pelikhan merged 3 commits into
mainfrom
copilot/validate-playwright-mode

Conversation

Copilot AI commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

tools.playwright.mode controls compiler-generated runtime setup and must be static. GitHub Actions expressions are now rejected for this field.

  • Validation

    • Reject ${{ ... }} values in tools.playwright.mode
    • Return a field-specific error directing authors to mcp or cli
  • Coverage

    • Add regression coverage for expression-valued modes
tools:
  playwright:
    mode: ${{ inputs.playwright-mode }} # rejected

Copilot AI and others added 2 commits August 29, 2026 17:20
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan August 29, 2026 17:23
@pelikhan
pelikhan marked this pull request as ready for review August 29, 2026 17:25
Copilot AI balanced review requested due to automatic review settings August 29, 2026 17:25

@pelikhan pelikhan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot update main json schema

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Existing schema validation preempts the intended field-specific error in real compiler paths.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds static validation for Playwright mode expressions.

Changes:

  • Rejects expression-valued Playwright modes.
  • Adds regression coverage for the validator.
File summaries
File Description
pkg/workflow/playwright_validation.go Adds mode expression validation.
pkg/workflow/playwright_validation_test.go Tests expression rejection.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment on lines +52 to +54
if config, ok := playwrightTool.(map[string]any); ok {
if mode, ok := config["mode"].(string); ok && hasExpressionMarker(mode) {
return NewValidationError(
"tools.playwright.mode",
mode,
"mode must be a literal value; expressions are not allowed",
"Set mode to either mcp or cli",
…an reject it

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

@copilot update main json schema

Updated pkg/parser/schemas/main_workflow_schema.json in 9b3c1e0 (see commit) — tools.playwright.mode now uses oneOf with the cli/mcp enum alongside an expression pattern branch, so ${{ ... }} values pass schema validation and are caught by validatePlaywrightMode's field-specific error instead of the generic schema error. Added TestCompileWorkflowRejectsPlaywrightModeExpression to prove this end-to-end via a full CompileWorkflow call.

Copilot AI requested a review from pelikhan August 29, 2026 17:42
@pelikhan
pelikhan merged commit 38f79e4 into main Aug 29, 2026
32 checks passed
@pelikhan
pelikhan deleted the copilot/validate-playwright-mode branch August 29, 2026 18:23
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.87.10

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.

3 participants