Skip to content
Merged
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
19 changes: 19 additions & 0 deletions pkg/workflow/compiler_activation_jobs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,25 @@ func TestBuildActivationJob_ReactionAfterSetupScripts(t *testing.T) {
assert.Less(t, awInfoIdx, reactIdx, "Reaction step should appear after generate_aw_info")
}

// TestBuildActivationJob_SkipsSecretValidationWithEnvironment verifies that top-level
// environment configuration disables activation token validation.
func TestBuildActivationJob_SkipsSecretValidationWithEnvironment(t *testing.T) {
compiler := NewCompiler()

workflowData := &WorkflowData{
Name: "Test Workflow",
Environment: "environment: production",
}

job, err := compiler.buildActivationJob(workflowData, false, "", "test.lock.yml")
require.NoError(t, err, "buildActivationJob should succeed")
require.NotNil(t, job)

stepsStr := strings.Join(job.Steps, "")
assert.NotContains(t, stepsStr, "id: validate-secret", "Activation job should skip validate-secret when top-level environment is configured")
assert.NotContains(t, job.Outputs, "secret_verification_result", "Activation job should not expose secret_verification_result output when validate-secret is skipped")
}
Comment on lines +287 to +302
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

This test relies on the default engine/config to decide whether a validate-secret step would normally be emitted. To make the regression intent explicit (and avoid false positives if defaults change, e.g. default engine or feature flags), consider setting workflowData.AI (or engine) to a known engine that requires secret validation (e.g. copilot) and adding a quick control assertion that id: validate-secret/secret_verification_result are present when Environment is empty, then absent when Environment is set.

Copilot uses AI. Check for mistakes.

// TestBuildMainJob_Basic tests building a basic main job
func TestBuildMainJob_Basic(t *testing.T) {
compiler := NewCompiler()
Expand Down
Loading