Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 31, 2025

After fixing three version field type handling issues, add comprehensive regression tests to prevent future inconsistencies when handling string, int, and float version types.

Changes

  • Created pkg/workflow/engine_test.go with version type tests covering:

    • String, int, int64, uint64, float64 conversions
    • Semantic versioning and build metadata formats
    • Default behavior when version is omitted
    • Version field interaction with other engine config fields
  • Verified existing coverage in pkg/parser/mcp_test.go:

    • GitHub MCP: string, int, float versions
    • Playwright: string, int, float, int64 versions

Test Coverage

All three version fields now have regression protection:

// Engine version handling
frontmatter := map[string]any{
    "engine": map[string]any{
        "id":      "copilot",
        "version": 3.11,  // numeric types convert to strings
    },
}
_, config := compiler.ExtractEngineConfig(frontmatter)
// config.Version == "3.11"

Similar coverage exists for tools.github.version and tools.playwright.version in existing MCP tests.

Original prompt

This section details on the original issue you should resolve

<issue_title>[plan] Add regression tests for numeric version type handling</issue_title>
<issue_description>## Objective

Add comprehensive regression tests to ensure version fields correctly handle numeric types and prevent future type handling inconsistencies.

Context

After fixing the three version field type handling issues, we need tests to prevent regression and validate that both string and numeric types work as advertised in the schema.

Test Coverage Needed

1. Engine Version Tests (pkg/workflow/engine_test.go)

  • String version: engine.version: "beta"
  • Integer version: engine.version: 20
  • Float version: engine.version: 3.11

2. GitHub MCP Version Tests (pkg/parser/mcp_test.go)

  • String version: tools.github.version: "v1.0.0"
  • Integer version: tools.github.version: 20
  • Float version: tools.github.version: 3.11

3. Playwright Version Tests (pkg/parser/mcp_test.go)

  • String version: tools.playwright.version: "v1.41.0"
  • Integer version: tools.playwright.version: 20
  • Float version: tools.playwright.version: 1.41

Test Structure

Use table-driven tests with descriptive names:

func TestVersionTypeHandling(t *testing.T) {
    tests := []struct {
        name     string
        version  interface{}
        expected string
    }{
        {"string version", "beta", "beta"},
        {"integer version", 20, "20"},
        {"float version", 3.11, "3.11"},
    }
    
    for _, tt := range tests {
        t.Run(tt.name, func(t *testing.T) {
            // Test implementation
        })
    }
}

Files to Modify

  • Update: pkg/workflow/engine_test.go
  • Update: pkg/parser/mcp_test.go

Acceptance Criteria

  • All three version fields have test coverage for string, int, and float types
  • Tests validate correct string conversion from numeric types
  • Tests follow existing test patterns in the codebase
  • All tests pass with make test-unit

Estimated Effort

~30 minutes implementation
Related to #8221

AI generated by Plan Command for discussion #8218

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.

- Created pkg/workflow/engine_test.go with comprehensive version type tests
- Tests cover string, int, int64, uint64, and float version types
- Verified existing MCP tests already cover GitHub and Playwright version types
- All tests passing with make test-unit

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot AI changed the title [WIP] Add regression tests for numeric version type handling Add regression tests for numeric version type handling Dec 31, 2025
Copilot AI requested a review from mnkiefer December 31, 2025 02:42
@pelikhan pelikhan marked this pull request as ready for review December 31, 2025 02:43
@pelikhan pelikhan merged commit baad44d into main Dec 31, 2025
4 checks passed
@pelikhan pelikhan deleted the copilot/add-regression-tests-numeric-version branch December 31, 2025 02:43
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 regression tests for numeric version type handling

3 participants