Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pkg/workflow/action_reference_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func TestConvertToRemoteActionRef(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
compiler := NewCompilerWithVersion(tt.version)
compiler := NewCompiler(WithVersion(tt.version))

var data *WorkflowData
if !tt.nilData {
Expand Down Expand Up @@ -177,7 +177,7 @@ func TestResolveActionReference(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
compiler := NewCompilerWithVersion(tt.version)
compiler := NewCompiler(WithVersion(tt.version))
compiler.SetActionMode(tt.actionMode)

data := &WorkflowData{}
Expand Down Expand Up @@ -245,7 +245,7 @@ func TestCompilerActionTag(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
compiler := NewCompilerWithVersion(tt.version)
compiler := NewCompiler(WithVersion(tt.version))
compiler.SetActionMode(ActionModeRelease)
if tt.compilerActionTag != "" {
compiler.SetActionTag(tt.compilerActionTag)
Expand Down
2 changes: 1 addition & 1 deletion pkg/workflow/activation_checkout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ strict: false
t.Fatal(err)
}

compiler := NewCompilerWithVersion("dev")
compiler := NewCompiler(WithVersion("dev"))
// Use dev mode to use local action paths
compiler.SetActionMode(ActionModeDev)

Expand Down
2 changes: 1 addition & 1 deletion pkg/workflow/allow_github_references_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func TestAllowGitHubReferencesConfig(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
c := NewCompilerWithVersion("1.0.0")
c := NewCompiler(WithVersion("1.0.0"))
config := c.extractSafeOutputsConfig(tt.frontmatter)
require.NotNil(t, config, "extractSafeOutputsConfig() should not return nil")

Expand Down
2 changes: 1 addition & 1 deletion pkg/workflow/assign_to_agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This workflow tests canonical 'name' key.
err := os.WriteFile(testFile, []byte(workflow), 0644)
require.NoError(t, err, "Failed to write test workflow")

compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))
workflowData, err := compiler.ParseWorkflowFile(testFile)
require.NoError(t, err, "Failed to parse workflow")

Expand Down
10 changes: 5 additions & 5 deletions pkg/workflow/aw_info_versions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func TestCLIVersionInAwInfo(t *testing.T) {
// Set the release flag for this test
SetIsRelease(tt.isRelease)

compiler := NewCompilerWithVersion(tt.cliVersion)
compiler := NewCompiler(WithVersion(tt.cliVersion))
registry := GetGlobalEngineRegistry()
engine, err := registry.GetEngine(tt.engineID)
if err != nil {
Expand Down Expand Up @@ -192,7 +192,7 @@ func TestAwfVersionInAwInfo(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))
registry := GetGlobalEngineRegistry()
engine, err := registry.GetEngine("copilot")
if err != nil {
Expand Down Expand Up @@ -234,7 +234,7 @@ func TestBothVersionsInAwInfo(t *testing.T) {
SetIsRelease(true)

// Test that both CLI version and AWF version are present simultaneously
compiler := NewCompilerWithVersion("2.0.0-beta.5")
compiler := NewCompiler(WithVersion("2.0.0-beta.5"))
registry := GetGlobalEngineRegistry()
engine, err := registry.GetEngine("copilot")
if err != nil {
Expand Down Expand Up @@ -297,7 +297,7 @@ func TestAwmgVersionInAwInfo(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))
registry := GetGlobalEngineRegistry()
engine, err := registry.GetEngine("copilot")
if err != nil {
Expand Down Expand Up @@ -338,7 +338,7 @@ func TestAllVersionsInAwInfo(t *testing.T) {
SetIsRelease(true)

// Test that CLI version, AWF version, and AWMG version are present simultaneously
compiler := NewCompilerWithVersion("2.0.0-beta.5")
compiler := NewCompiler(WithVersion("2.0.0-beta.5"))
registry := GetGlobalEngineRegistry()
engine, err := registry.GetEngine("copilot")
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions pkg/workflow/blocked_domains_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Test workflow with blocked domains.
}

// Compile the workflow
compiler := NewCompilerWithVersion("test-blocked-domains")
compiler := NewCompiler(WithVersion("test-blocked-domains"))
compiler.SetSkipValidation(true)

if err := compiler.CompileWorkflow(workflowPath); err != nil {
Expand Down Expand Up @@ -126,7 +126,7 @@ Test workflow with blocked ecosystem.
}

// Compile the workflow
compiler := NewCompilerWithVersion("test-blocked-ecosystem")
compiler := NewCompiler(WithVersion("test-blocked-ecosystem"))
compiler.SetSkipValidation(true)

if err := compiler.CompileWorkflow(workflowPath); err != nil {
Expand Down Expand Up @@ -195,7 +195,7 @@ Test workflow without blocked domains.
}

// Compile the workflow
compiler := NewCompilerWithVersion("test-no-blocked")
compiler := NewCompiler(WithVersion("test-no-blocked"))
compiler.SetSkipValidation(true)

if err := compiler.CompileWorkflow(workflowPath); err != nil {
Expand Down Expand Up @@ -257,7 +257,7 @@ Test Claude workflow with blocked domains.
}

// Compile the workflow
compiler := NewCompilerWithVersion("test-claude-blocked")
compiler := NewCompiler(WithVersion("test-claude-blocked"))
compiler.SetSkipValidation(true)

if err := compiler.CompileWorkflow(workflowPath); err != nil {
Expand Down Expand Up @@ -319,7 +319,7 @@ Test Codex workflow with blocked domains.
}

// Compile the workflow
compiler := NewCompilerWithVersion("test-codex-blocked")
compiler := NewCompiler(WithVersion("test-codex-blocked"))
compiler.SetSkipValidation(true)

if err := compiler.CompileWorkflow(workflowPath); err != nil {
Expand Down
10 changes: 5 additions & 5 deletions pkg/workflow/call_workflow_compilation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func compileAndReadLock(t *testing.T, gatewayFile, markdown string) string {
err := os.WriteFile(gatewayFile, []byte(markdown), 0644)
require.NoError(t, err, "Failed to write gateway markdown")

compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))
err = compiler.CompileWorkflow(gatewayFile)
require.NoError(t, err, "Compilation should succeed")

Expand Down Expand Up @@ -476,7 +476,7 @@ safe-outputs:
gatewayFile := filepath.Join(workflowsDir, "gateway.md")
require.NoError(t, os.WriteFile(gatewayFile, []byte(gatewayMD), 0644))

compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))
err = compiler.CompileWorkflow(gatewayFile)
require.Error(t, err, "Should fail when worker lacks workflow_call trigger")
assert.Contains(t, err.Error(), "workflow_call", "Error should mention workflow_call")
Expand Down Expand Up @@ -506,7 +506,7 @@ safe-outputs:
gatewayFile := filepath.Join(workflowsDir, "gateway.md")
require.NoError(t, os.WriteFile(gatewayFile, []byte(gatewayMD), 0644))

compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))
err := compiler.CompileWorkflow(gatewayFile)
require.Error(t, err, "Should fail for self-reference")
assert.Contains(t, err.Error(), "self-reference", "Error should mention self-reference")
Expand Down Expand Up @@ -535,7 +535,7 @@ safe-outputs:
gatewayFile := filepath.Join(workflowsDir, "gateway.md")
require.NoError(t, os.WriteFile(gatewayFile, []byte(gatewayMD), 0644))

compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))
err := compiler.CompileWorkflow(gatewayFile)
require.Error(t, err, "Should fail for missing worker")
assert.Contains(t, err.Error(), "not found", "Error should mention not found")
Expand Down Expand Up @@ -570,7 +570,7 @@ safe-outputs:
gatewayFile := filepath.Join(workflowsDir, "gateway.md")
require.NoError(t, os.WriteFile(gatewayFile, []byte(gatewayMD), 0644))

compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))
err := compiler.CompileWorkflow(gatewayFile)
require.Error(t, err, "Should fail for duplicate workflow name")
assert.Contains(t, err.Error(), "duplicate", "Error should mention duplicate")
Expand Down
12 changes: 6 additions & 6 deletions pkg/workflow/call_workflow_permissions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func TestExtractCallWorkflowPermissions_FileNotFound(t *testing.T) {
// TestBuildCallWorkflowJobs_SetsPermissionsFromLockYML tests that call-workflow jobs
// include permissions extracted from the worker's .lock.yml file
func TestBuildCallWorkflowJobs_SetsPermissionsFromLockYML(t *testing.T) {
compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))

tmpDir := t.TempDir()
workflowsDir := filepath.Join(tmpDir, ".github", "workflows")
Expand Down Expand Up @@ -281,7 +281,7 @@ jobs:
// TestBuildCallWorkflowJobs_SetsPermissionsFromMD tests that call-workflow jobs
// include permissions from .md frontmatter for same-batch compilation targets
func TestBuildCallWorkflowJobs_SetsPermissionsFromMD(t *testing.T) {
compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))

tmpDir := t.TempDir()
workflowsDir := filepath.Join(tmpDir, ".github", "workflows")
Expand Down Expand Up @@ -329,7 +329,7 @@ permissions:
// TestBuildCallWorkflowJobs_NoPermissionsWhenWorkerHasNone tests that call-workflow
// jobs omit the permissions block when the worker's jobs have no permissions
func TestBuildCallWorkflowJobs_NoPermissionsWhenWorkerHasNone(t *testing.T) {
compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))

tmpDir := t.TempDir()
workflowsDir := filepath.Join(tmpDir, ".github", "workflows")
Expand Down Expand Up @@ -373,7 +373,7 @@ jobs:
// TestCallWorkflowJobYAMLOutput_WithPermissions tests the YAML output of a call-workflow
// job includes the permissions block derived from the worker's .lock.yml
func TestCallWorkflowJobYAMLOutput_WithPermissions(t *testing.T) {
compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))

tmpDir := t.TempDir()
workflowsDir := filepath.Join(tmpDir, ".github", "workflows")
Expand Down Expand Up @@ -474,7 +474,7 @@ jobs:
// TestCallWorkflowPermissions_EndToEnd tests full gateway compilation with permissioned workers —
// the generated lock file must include job-level permissions blocks on every call-* job.
func TestCallWorkflowPermissions_EndToEnd(t *testing.T) {
compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))

tmpDir := t.TempDir()
workflowsDir := filepath.Join(tmpDir, ".github", "workflows")
Expand Down Expand Up @@ -599,7 +599,7 @@ Analyse the issue and determine which worker to run.
// TestCallWorkflowPermissions_EndToEnd_YMLWorker tests that a worker referenced via a .yml
// file (not .lock.yml) also gets its permissions propagated in the generated call-* job.
func TestCallWorkflowPermissions_EndToEnd_YMLWorker(t *testing.T) {
compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))

tmpDir := t.TempDir()
workflowsDir := filepath.Join(tmpDir, ".github", "workflows")
Expand Down
10 changes: 5 additions & 5 deletions pkg/workflow/call_workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

// TestParseCallWorkflowConfig_ArrayFormat tests parsing call-workflow with array format
func TestParseCallWorkflowConfig_ArrayFormat(t *testing.T) {
compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))

outputMap := map[string]any{
"call-workflow": []any{"worker-a", "worker-b", "worker-c"},
Expand All @@ -25,7 +25,7 @@ func TestParseCallWorkflowConfig_ArrayFormat(t *testing.T) {

// TestParseCallWorkflowConfig_MapFormat tests parsing call-workflow with map format
func TestParseCallWorkflowConfig_MapFormat(t *testing.T) {
compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))

outputMap := map[string]any{
"call-workflow": map[string]any{
Expand All @@ -42,7 +42,7 @@ func TestParseCallWorkflowConfig_MapFormat(t *testing.T) {

// TestParseCallWorkflowConfig_DefaultMax tests that max defaults to 1
func TestParseCallWorkflowConfig_DefaultMax(t *testing.T) {
compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))

outputMap := map[string]any{
"call-workflow": map[string]any{
Expand All @@ -57,7 +57,7 @@ func TestParseCallWorkflowConfig_DefaultMax(t *testing.T) {

// TestParseCallWorkflowConfig_MaxCap tests that max is capped at 50
func TestParseCallWorkflowConfig_MaxCap(t *testing.T) {
compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))

outputMap := map[string]any{
"call-workflow": map[string]any{
Expand All @@ -73,7 +73,7 @@ func TestParseCallWorkflowConfig_MaxCap(t *testing.T) {

// TestParseCallWorkflowConfig_NotPresent tests that nil is returned when call-workflow is not configured
func TestParseCallWorkflowConfig_NotPresent(t *testing.T) {
compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))

outputMap := map[string]any{}

Expand Down
14 changes: 7 additions & 7 deletions pkg/workflow/call_workflow_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

// TestValidateCallWorkflow_EmptyList tests that empty workflow list returns an error
func TestValidateCallWorkflow_EmptyList(t *testing.T) {
compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))

tmpDir := t.TempDir()
awDir := filepath.Join(tmpDir, ".github", "aw")
Expand All @@ -40,7 +40,7 @@ func TestValidateCallWorkflow_EmptyList(t *testing.T) {

// TestValidateCallWorkflow_NoConfig tests that nil config passes validation
func TestValidateCallWorkflow_NoConfig(t *testing.T) {
compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))

workflowData := &WorkflowData{
SafeOutputs: &SafeOutputsConfig{},
Expand All @@ -52,7 +52,7 @@ func TestValidateCallWorkflow_NoConfig(t *testing.T) {

// TestValidateCallWorkflow_SelfReference tests that self-reference is rejected
func TestValidateCallWorkflow_SelfReference(t *testing.T) {
compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))

tmpDir := t.TempDir()
awDir := filepath.Join(tmpDir, ".github", "aw")
Expand Down Expand Up @@ -80,7 +80,7 @@ func TestValidateCallWorkflow_SelfReference(t *testing.T) {

// TestValidateCallWorkflow_WorkflowNotFound tests that a missing workflow fails validation
func TestValidateCallWorkflow_WorkflowNotFound(t *testing.T) {
compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))

tmpDir := t.TempDir()
awDir := filepath.Join(tmpDir, ".github", "aw")
Expand Down Expand Up @@ -109,7 +109,7 @@ func TestValidateCallWorkflow_WorkflowNotFound(t *testing.T) {
// TestValidateCallWorkflow_WorkflowWithoutWorkflowCall tests that a workflow missing
// workflow_call trigger fails validation
func TestValidateCallWorkflow_WorkflowWithoutWorkflowCall(t *testing.T) {
compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))

tmpDir := t.TempDir()
awDir := filepath.Join(tmpDir, ".github", "aw")
Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:

// TestValidateCallWorkflow_ValidWorkflow tests that a valid worker passes validation
func TestValidateCallWorkflow_ValidWorkflow(t *testing.T) {
compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))

tmpDir := t.TempDir()
awDir := filepath.Join(tmpDir, ".github", "aw")
Expand Down Expand Up @@ -201,7 +201,7 @@ jobs:
// TestValidateCallWorkflow_MDSourceWithWorkflowCall tests that a .md source with workflow_call
// trigger passes validation (same-batch compilation target)
func TestValidateCallWorkflow_MDSourceWithWorkflowCall(t *testing.T) {
compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))

tmpDir := t.TempDir()
awDir := filepath.Join(tmpDir, ".github", "aw")
Expand Down
10 changes: 5 additions & 5 deletions pkg/workflow/checkout_import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
// TestCheckoutImportFromSharedWorkflow tests that a checkout block defined in a shared
// workflow is inherited by the importing workflow.
func TestCheckoutImportFromSharedWorkflow(t *testing.T) {
compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))

tmpDir := t.TempDir()
workflowsDir := filepath.Join(tmpDir, ".github", "workflows")
Expand Down Expand Up @@ -70,7 +70,7 @@ This workflow inherits the checkout configuration from the shared workflow.
// TestCheckoutImportMainWorkflowTakesPrecedence tests that the main workflow's checkout
// takes precedence over an imported checkout for the same (repository, path) key.
func TestCheckoutImportMainWorkflowTakesPrecedence(t *testing.T) {
compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))

tmpDir := t.TempDir()
workflowsDir := filepath.Join(tmpDir, ".github", "workflows")
Expand Down Expand Up @@ -131,7 +131,7 @@ This workflow overrides the checkout from the shared workflow.
// TestCheckoutImportDisabledByMainWorkflow tests that checkout: false in the main workflow
// suppresses imported checkout configs.
func TestCheckoutImportDisabledByMainWorkflow(t *testing.T) {
compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))

tmpDir := t.TempDir()
workflowsDir := filepath.Join(tmpDir, ".github", "workflows")
Expand Down Expand Up @@ -179,7 +179,7 @@ This workflow disables checkout entirely.
// TestCheckoutImportMultipleImports tests that checkout configs from multiple shared
// workflows are all merged into the importing workflow.
func TestCheckoutImportMultipleImports(t *testing.T) {
compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))

tmpDir := t.TempDir()
workflowsDir := filepath.Join(tmpDir, ".github", "workflows")
Expand Down Expand Up @@ -240,7 +240,7 @@ imports:
// when an imported shared workflow defines conflicting auth for the same (repository, path).
// A main workflow github-token must not be overridden by an imported github-app, and vice versa.
func TestCheckoutImportAuthPrecedence(t *testing.T) {
compiler := NewCompilerWithVersion("1.0.0")
compiler := NewCompiler(WithVersion("1.0.0"))

tmpDir := t.TempDir()
workflowsDir := filepath.Join(tmpDir, ".github", "workflows")
Expand Down
Loading
Loading