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
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func (s *Service) GetAgentInformation(ctx context.Context, _ *agentv0.AgentInfor
// format this binary speaks is whatever that release emits — reading
// it back is the declaration, not a claim made beside it.
StartupProtocolVersion: agents.ProtocolVersion,
Capabilities: []string{contract.ContainerRecoveryScope, contract.RuntimeInitDependencyMappings},
Capabilities: []string{contract.ContainerRecoveryScope, contract.RuntimeInitDependencyMappings, contract.DeploymentCompositionProvenance},
}
return advertisement, nil
}
Expand Down
28 changes: 28 additions & 0 deletions provenance_contract_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package main

import (
"context"
"slices"
"testing"

"github.com/codefly-dev/core/agents/contract"
agentv0 "github.com/codefly-dev/core/generated/go/codefly/services/agent/v0"
)

// TestAdvertisementAdoptsDeploymentCompositionProvenance: the host requires the
// live contract capability before it trusts this agent to judge a deployment's
// dependency edges with the request's composition provenance (core#752). The
// deployment path here is core's DeployKustomize, which does; the
// advertisement must say so, and keep the base contract it extends.
func TestAdvertisementAdoptsDeploymentCompositionProvenance(t *testing.T) {
info, err := NewService().GetAgentInformation(context.Background(), &agentv0.AgentInformationRequest{})
if err != nil {
t.Fatalf("GetAgentInformation: %v", err)
}
if !slices.Contains(info.GetContract().GetCapabilities(), contract.DeploymentCompositionProvenance) {
t.Fatalf("contract capabilities %v do not advertise %s", info.GetContract().GetCapabilities(), contract.DeploymentCompositionProvenance)
}
if err := contract.Check(info.GetContract(), contract.ContainerRecoveryScope); err != nil {
t.Fatalf("the base contract is no longer satisfied: %v", err)
}
}
Loading