Skip to content

Comments

Add integration tests for schema restriction enforcement in included files#10412

Closed
Copilot wants to merge 3 commits intomainfrom
copilot/add-integration-tests-schema-restrictions
Closed

Add integration tests for schema restriction enforcement in included files#10412
Copilot wants to merge 3 commits intomainfrom
copilot/add-integration-tests-schema-restrictions

Conversation

Copy link
Contributor

Copilot AI commented Jan 17, 2026

Schema restrictions exist between included workflow files and main workflows, but lacked test coverage to prevent regressions.

Changes

Added TestSchemaRestrictionEnforcement to pkg/parser/schema_test.go with 6 subtests:

  • engine.command restriction: Verifies rejected in included files, allowed in main workflows
  • on field requirement: Verifies required in main workflows, rejected in included files
  • MCP server configuration: Confirms command/args/env allowed in both schemas via mcp-servers property
  • Valid property sets: Tests all 15 allowed properties (description, metadata, inputs, applyTo, services, mcp-servers, steps, tools, engine, safe-outputs, safe-inputs, secret-masking, runtimes, network, permissions)

Example

// engine.command rejected in included files
includedFrontmatter := map[string]any{
    "engine": map[string]any{
        "id":      "claude",
        "command": "custom-command", // ❌ Error: additional properties 'command' not allowed
    },
}
err := ValidateIncludedFileFrontmatterWithSchema(includedFrontmatter)

// Same config allowed in main workflows
mainFrontmatter := map[string]any{
    "on": "push",
    "engine": map[string]any{
        "id":      "claude", 
        "command": "custom-command", // ✅ Valid
    },
}
err = ValidateMainWorkflowFrontmatterWithSchema(mainFrontmatter)

Tests follow existing table-driven patterns and validate both successful cases and expected error messages.

Original prompt

This section details on the original issue you should resolve

<issue_title>[plan] Add integration tests for schema restriction enforcement</issue_title>
<issue_description>## Objective

Add integration tests that verify schema restrictions are properly enforced when compiling included workflow files.

Context

The security model restricts certain properties in included files, but we need tests to ensure these restrictions are enforced and don't regress over time.

Approach

Add test cases to relevant test files (likely pkg/parser/frontmatter_test.go or pkg/workflow/compiler_test.go):

  1. Test: engine.command rejected in included files

    • Create included file with engine.command property
    • Compile and verify error message
    • Verify same property works in main workflow
  2. Test: Full MCP config rejected in included files

    • Create included file with full MCP config (command, args, env)
    • Compile and verify error message
    • Verify same config works in main workflow
  3. Test: Missing 'on' field in main workflow

    • Create main workflow without on field
    • Verify validation error
    • Verify included file works without on
  4. Test: Valid included file with allowed properties

    • Create included file with only allowed properties
    • Verify successful compilation
    • Verify all 15 included-supported properties work

Files to Modify

  • pkg/parser/frontmatter_test.go - Add validation tests
  • pkg/workflow/compiler_test.go - Add compilation tests
  • Test fixtures in appropriate directory (e.g., testdata/)

Acceptance Criteria

  • Test verifies engine.command is rejected in included files
  • Test verifies full MCP config is rejected in included files
  • Test verifies 'on' is required in main workflows
  • Test verifies valid included files compile successfully
  • Error messages in tests match expected format
  • Tests use table-driven pattern for multiple scenarios
  • All tests pass with current implementation
    Related to [plan] Document schema design philosophy and security model differences #10219

AI generated by Plan Command for discussion #10151

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


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits January 17, 2026 04:14
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
- Test engine.command rejected in included files but allowed in main workflows
- Test 'on' field required in main workflows but rejected in included files
- Test MCP configuration in mcp-servers allowed in both schemas
- Test valid included files with all 15 allowed properties
- Test valid included files with subset of allowed properties
- All new tests pass successfully

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot AI changed the title [WIP] Add integration tests for schema restriction enforcement Add integration tests for schema restriction enforcement in included files Jan 17, 2026
Copilot AI requested a review from mnkiefer January 17, 2026 04:28
@pelikhan pelikhan closed this Jan 17, 2026
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] Add integration tests for schema restriction enforcement

3 participants