Merge branch 'crew/cluster1' into crew-integration
This commit is contained in:
commit
49da68fb25
13 files changed
+63
-1747
No files matched your search
@@ -590,6 +590,7 @@ type TaskConfig struct {
|
||||
DiffCapLines int `json:"diff_cap_lines"`
|
||||
Notify Notify `json:"notify"`
|
||||
Forge TaskForge `json:"forge"`
|
||||
ToolPolicy ToolPolicy `json:"tool_policy"`
|
||||
}
|
||||
|
||||
// TaskForge is the non-secret forge configuration needed by workflow stages.
|
||||
@@ -610,6 +611,7 @@ func (c Config) ForTask() TaskConfig {
|
||||
DiffCapLines: c.DiffCapLines,
|
||||
Notify: c.Notify,
|
||||
Forge: TaskForge{Host: c.Forge.Host},
|
||||
ToolPolicy: c.Tools.Policy,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -628,6 +630,7 @@ func (tc TaskConfig) ToConfig() Config {
|
||||
DiffCapLines: tc.DiffCapLines,
|
||||
Notify: tc.Notify,
|
||||
Forge: Forge{Host: tc.Forge.Host},
|
||||
Tools: ToolsConfig{Policy: tc.ToolPolicy},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,9 +20,13 @@ func TestTaskConfigToConfigRoundTrip(t *testing.T) {
|
||||
Dispatch: Dispatch{Trigger: "label", AckReaction: "eyes", Labels: map[string]string{"working": "bot:working"}},
|
||||
Notify: Notify{Webhook: "https://notify.example.test/hook"},
|
||||
Forge: Forge{Type: "github", Host: "https://forge.example.test", Token: SecretRef{Engine: "env", Key: "TOP_SECRET"}},
|
||||
Tools: ToolsConfig{Policy: ToolPolicy{MaxResultChars: 50_000, SpillDir: "/var/tmp/archie-spill"}},
|
||||
}
|
||||
|
||||
got := cfg.ForTask().ToConfig()
|
||||
if got.Tools.Policy != cfg.Tools.Policy {
|
||||
t.Fatalf("Tools.Policy = %#v, want %#v", got.Tools.Policy, cfg.Tools.Policy)
|
||||
}
|
||||
if !reflect.DeepEqual(got.Models, cfg.Models) {
|
||||
t.Fatalf("Models = %#v, want %#v", got.Models, cfg.Models)
|
||||
}
|
||||
@@ -110,7 +114,8 @@ func TestConfigForTaskJSONRoundTrip(t *testing.T) {
|
||||
Providers: map[string]Provider{
|
||||
"secret": {APIKeyEnv: "TOP_SECRET_PROVIDER_TOKEN"},
|
||||
},
|
||||
NATS: NATSConfig{TokenEnv: "TOP_SECRET_NATS_TOKEN"},
|
||||
NATS: NATSConfig{TokenEnv: "TOP_SECRET_NATS_TOKEN"},
|
||||
Tools: ToolsConfig{Policy: ToolPolicy{MaxResultChars: 50_000, SpillDir: "/var/tmp/archie-spill"}},
|
||||
}
|
||||
|
||||
want := TaskConfig{
|
||||
@@ -122,6 +127,7 @@ func TestConfigForTaskJSONRoundTrip(t *testing.T) {
|
||||
DiffCapLines: cfg.DiffCapLines,
|
||||
Notify: cfg.Notify,
|
||||
Forge: TaskForge{Host: cfg.Forge.Host},
|
||||
ToolPolicy: cfg.Tools.Policy,
|
||||
}
|
||||
got := cfg.ForTask()
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
@@ -148,7 +154,7 @@ func TestConfigForTaskJSONRoundTrip(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
assertJSONKeys(t, data, "bot_user", "bot_email", "models", "budgets", "dispatch", "diff_cap_lines", "notify", "forge")
|
||||
assertJSONKeys(t, data, "bot_user", "bot_email", "models", "budgets", "dispatch", "diff_cap_lines", "notify", "forge", "tool_policy")
|
||||
|
||||
var forgePayload map[string]json.RawMessage
|
||||
var payload map[string]json.RawMessage
|
||||
|
||||
Reference in new issue
Block a user