-
Notifications
You must be signed in to change notification settings - Fork 455
Run evals in parallel with safe_outputs by rewiring compiler job needs
#45752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
40e1834
257dd39
ba5d1c9
006fb26
393cad0
3a1112b
8cb9ea3
9efe460
543311a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| package workflow | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/assert" | ||
| "github.com/stretchr/testify/require" | ||
|
|
||
| "github.com/github/gh-aw/pkg/constants" | ||
| ) | ||
|
|
||
| func TestBuildEvalsJobNeedsWithoutDetection(t *testing.T) { | ||
| compiler := NewCompiler() | ||
|
|
||
| data := &WorkflowData{ | ||
| AI: "copilot", | ||
| Evals: &EvalsConfig{ | ||
| Questions: []EvalDefinition{ | ||
| {ID: "q1", Question: "Does it build?"}, | ||
| }, | ||
| }, | ||
| SafeOutputs: &SafeOutputsConfig{}, | ||
| } | ||
|
|
||
| job, err := compiler.buildEvalsJob(data) | ||
| require.NoError(t, err) | ||
| require.NotNil(t, job) | ||
|
|
||
| assert.ElementsMatch(t, []string{ | ||
| string(constants.AgentJobName), | ||
| string(constants.ActivationJobName), | ||
| }, job.Needs) | ||
| assert.NotContains(t, job.Needs, string(constants.SafeOutputsJobName)) | ||
| assert.NotContains(t, job.Needs, string(constants.DetectionJobName)) | ||
| assert.Contains(t, job.If, "needs.agent.result") | ||
| assert.NotContains(t, job.If, "needs.safe_outputs.result") | ||
| } | ||
|
|
||
| func TestBuildEvalsJobNeedsWithDetection(t *testing.T) { | ||
| compiler := NewCompiler() | ||
|
|
||
| data := &WorkflowData{ | ||
| AI: "copilot", | ||
| Evals: &EvalsConfig{ | ||
| Questions: []EvalDefinition{ | ||
| {ID: "q1", Question: "Does it build?"}, | ||
| }, | ||
| }, | ||
| SafeOutputs: &SafeOutputsConfig{ | ||
| ThreatDetection: &ThreatDetectionConfig{}, | ||
| }, | ||
| } | ||
|
|
||
| job, err := compiler.buildEvalsJob(data) | ||
| require.NoError(t, err) | ||
| require.NotNil(t, job) | ||
|
|
||
| assert.ElementsMatch(t, []string{ | ||
| string(constants.AgentJobName), | ||
| string(constants.ActivationJobName), | ||
| string(constants.DetectionJobName), | ||
| }, job.Needs) | ||
| assert.NotContains(t, job.Needs, string(constants.SafeOutputsJobName)) | ||
| assert.Contains(t, job.If, "needs.agent.result") | ||
| assert.NotContains(t, job.If, "needs.safe_outputs.result") | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[/tdd] Missing test for the
SafeOutputs == nilpath — the old code had an explicitif data.SafeOutputs != nilbranch covering this case.The new code handles it correctly via
IsDetectionJobEnabled(nil) == false, but a test withSafeOutputs: nilwould lock that in as a regression guard.💡 Suggested test
@copilot please address this.