Integrate BACKBEAT SDK and resolve KACHING license validation
Major integrations and fixes: - Added BACKBEAT SDK integration for P2P operation timing - Implemented beat-aware status tracking for distributed operations - Added Docker secrets support for secure license management - Resolved KACHING license validation via HTTPS/TLS - Updated docker-compose configuration for clean stack deployment - Disabled rollback policies to prevent deployment failures - Added license credential storage (CHORUS-DEV-MULTI-001) Technical improvements: - BACKBEAT P2P operation tracking with phase management - Enhanced configuration system with file-based secrets - Improved error handling for license validation - Clean separation of KACHING and CHORUS deployment stacks 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -13,7 +13,7 @@ type Joiner func(topic string) error
|
||||
// Publisher publishes a raw JSON payload to a topic.
|
||||
type Publisher func(topic string, payload []byte) error
|
||||
|
||||
// Adapter bridges BZZZ pub/sub to a RawPublisher-compatible interface.
|
||||
// Adapter bridges CHORUS pub/sub to a RawPublisher-compatible interface.
|
||||
// It does not impose any message envelope so HMMM can publish raw JSON frames.
|
||||
// The adapter provides additional features like topic caching, metrics, and validation.
|
||||
type Adapter struct {
|
||||
@@ -53,7 +53,7 @@ func DefaultAdapterConfig() AdapterConfig {
|
||||
}
|
||||
|
||||
// NewAdapter constructs a new adapter with explicit join/publish hooks.
|
||||
// Wire these to BZZZ pubsub methods, e.g., JoinDynamicTopic and a thin PublishRaw helper.
|
||||
// Wire these to CHORUS pubsub methods, e.g., JoinDynamicTopic and a thin PublishRaw helper.
|
||||
func NewAdapter(join Joiner, publish Publisher) *Adapter {
|
||||
return NewAdapterWithConfig(join, publish, DefaultAdapterConfig())
|
||||
}
|
||||
|
||||
@@ -13,10 +13,10 @@ import (
|
||||
func TestAdapter_Publish_OK(t *testing.T) {
|
||||
var joined, published bool
|
||||
a := NewAdapter(
|
||||
func(topic string) error { joined = (topic == "bzzz/meta/issue/42"); return nil },
|
||||
func(topic string, payload []byte) error { published = (topic == "bzzz/meta/issue/42" && len(payload) > 0); return nil },
|
||||
func(topic string) error { joined = (topic == "CHORUS/meta/issue/42"); return nil },
|
||||
func(topic string, payload []byte) error { published = (topic == "CHORUS/meta/issue/42" && len(payload) > 0); return nil },
|
||||
)
|
||||
if err := a.Publish(context.Background(), "bzzz/meta/issue/42", []byte(`{"ok":true}`)); err != nil {
|
||||
if err := a.Publish(context.Background(), "CHORUS/meta/issue/42", []byte(`{"ok":true}`)); err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
if !joined || !published {
|
||||
@@ -130,7 +130,7 @@ func TestAdapter_Publish_TopicCaching(t *testing.T) {
|
||||
func(topic string, payload []byte) error { return nil },
|
||||
)
|
||||
|
||||
topic := "bzzz/meta/issue/123"
|
||||
topic := "CHORUS/meta/issue/123"
|
||||
|
||||
// First publish should join
|
||||
err := a.Publish(context.Background(), topic, []byte(`{"msg1":true}`))
|
||||
@@ -233,7 +233,7 @@ func TestAdapter_ConcurrentPublish(t *testing.T) {
|
||||
for i := 0; i < numGoroutines; i++ {
|
||||
go func(id int) {
|
||||
defer wg.Done()
|
||||
topic := fmt.Sprintf("bzzz/meta/issue/%d", id%numTopics)
|
||||
topic := fmt.Sprintf("CHORUS/meta/issue/%d", id%numTopics)
|
||||
payload := fmt.Sprintf(`{"id":%d}`, id)
|
||||
|
||||
err := a.Publish(context.Background(), topic, []byte(payload))
|
||||
|
||||
@@ -7,12 +7,12 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"chorus.services/bzzz/p2p"
|
||||
"chorus.services/bzzz/pubsub"
|
||||
"chorus.services/hmmm/pkg/hmmm"
|
||||
"chorus/p2p"
|
||||
"chorus/pubsub"
|
||||
"chorus/pkg/hmmm"
|
||||
)
|
||||
|
||||
// TestAdapterPubSubIntegration tests the complete integration between the adapter and BZZZ pubsub
|
||||
// TestAdapterPubSubIntegration tests the complete integration between the adapter and CHORUS pubsub
|
||||
func TestAdapterPubSubIntegration(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
defer cancel()
|
||||
@@ -25,20 +25,20 @@ func TestAdapterPubSubIntegration(t *testing.T) {
|
||||
defer node.Close()
|
||||
|
||||
// Create PubSub system
|
||||
ps, err := pubsub.NewPubSub(ctx, node.Host(), "bzzz/test/coordination", "hmmm/test/meta-discussion")
|
||||
ps, err := pubsub.NewPubSub(ctx, node.Host(), "CHORUS/test/coordination", "hmmm/test/meta-discussion")
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create PubSub: %v", err)
|
||||
}
|
||||
defer ps.Close()
|
||||
|
||||
// Create adapter using actual BZZZ pubsub methods
|
||||
// Create adapter using actual CHORUS pubsub methods
|
||||
adapter := NewAdapter(
|
||||
ps.JoinDynamicTopic,
|
||||
ps.PublishRaw,
|
||||
)
|
||||
|
||||
// Test publishing to a per-issue topic
|
||||
topic := "bzzz/meta/issue/integration-test-42"
|
||||
topic := "CHORUS/meta/issue/integration-test-42"
|
||||
testPayload := []byte(`{"version": 1, "type": "meta_msg", "issue_id": 42, "message": "Integration test message"}`)
|
||||
|
||||
err = adapter.Publish(ctx, topic, testPayload)
|
||||
@@ -93,7 +93,7 @@ func TestHMMMRouterIntegration(t *testing.T) {
|
||||
defer node.Close()
|
||||
|
||||
// Create PubSub system
|
||||
ps, err := pubsub.NewPubSub(ctx, node.Host(), "bzzz/test/coordination", "hmmm/test/meta-discussion")
|
||||
ps, err := pubsub.NewPubSub(ctx, node.Host(), "CHORUS/test/coordination", "hmmm/test/meta-discussion")
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create PubSub: %v", err)
|
||||
}
|
||||
@@ -158,7 +158,7 @@ func TestPerIssueTopicPublishing(t *testing.T) {
|
||||
defer node.Close()
|
||||
|
||||
// Create PubSub system
|
||||
ps, err := pubsub.NewPubSub(ctx, node.Host(), "bzzz/test/coordination", "hmmm/test/meta-discussion")
|
||||
ps, err := pubsub.NewPubSub(ctx, node.Host(), "CHORUS/test/coordination", "hmmm/test/meta-discussion")
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create PubSub: %v", err)
|
||||
}
|
||||
@@ -238,7 +238,7 @@ func TestConcurrentPerIssuePublishing(t *testing.T) {
|
||||
defer node.Close()
|
||||
|
||||
// Create PubSub system
|
||||
ps, err := pubsub.NewPubSub(ctx, node.Host(), "bzzz/test/coordination", "hmmm/test/meta-discussion")
|
||||
ps, err := pubsub.NewPubSub(ctx, node.Host(), "CHORUS/test/coordination", "hmmm/test/meta-discussion")
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create PubSub: %v", err)
|
||||
}
|
||||
@@ -321,7 +321,7 @@ func TestAdapterValidation(t *testing.T) {
|
||||
defer node.Close()
|
||||
|
||||
// Create PubSub system
|
||||
ps, err := pubsub.NewPubSub(ctx, node.Host(), "bzzz/test/coordination", "hmmm/test/meta-discussion")
|
||||
ps, err := pubsub.NewPubSub(ctx, node.Host(), "CHORUS/test/coordination", "hmmm/test/meta-discussion")
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create PubSub: %v", err)
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// TestPerIssueTopicSmokeTest tests the per-issue topic functionality without full BZZZ integration
|
||||
// TestPerIssueTopicSmokeTest tests the per-issue topic functionality without full CHORUS integration
|
||||
func TestPerIssueTopicSmokeTest(t *testing.T) {
|
||||
// Mock pubsub functions that track calls
|
||||
joinedTopics := make(map[string]int)
|
||||
@@ -34,7 +34,7 @@ func TestPerIssueTopicSmokeTest(t *testing.T) {
|
||||
|
||||
// Test per-issue topic publishing
|
||||
issueID := int64(42)
|
||||
topic := fmt.Sprintf("bzzz/meta/issue/%d", issueID)
|
||||
topic := fmt.Sprintf("CHORUS/meta/issue/%d", issueID)
|
||||
|
||||
testMessage := map[string]interface{}{
|
||||
"version": 1,
|
||||
@@ -152,7 +152,7 @@ func TestMultiplePerIssueTopics(t *testing.T) {
|
||||
issueIDs := []int64{100, 200, 300}
|
||||
|
||||
for _, issueID := range issueIDs {
|
||||
topic := fmt.Sprintf("bzzz/meta/issue/%d", issueID)
|
||||
topic := fmt.Sprintf("CHORUS/meta/issue/%d", issueID)
|
||||
|
||||
testMessage := map[string]interface{}{
|
||||
"version": 1,
|
||||
@@ -180,7 +180,7 @@ func TestMultiplePerIssueTopics(t *testing.T) {
|
||||
// Verify all topics were joined once
|
||||
mu.Lock()
|
||||
for _, issueID := range issueIDs {
|
||||
topic := fmt.Sprintf("bzzz/meta/issue/%d", issueID)
|
||||
topic := fmt.Sprintf("CHORUS/meta/issue/%d", issueID)
|
||||
if joinedTopics[topic] != 1 {
|
||||
t.Errorf("Expected topic %s to be joined once, got %d times", topic, joinedTopics[topic])
|
||||
}
|
||||
@@ -258,7 +258,7 @@ func TestHMMMMessageFormat(t *testing.T) {
|
||||
t.Fatalf("Failed to marshal HMMM message: %v", err)
|
||||
}
|
||||
|
||||
topic := "bzzz/meta/issue/42"
|
||||
topic := "CHORUS/meta/issue/42"
|
||||
err = adapter.Publish(context.Background(), topic, payload)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to publish HMMM message: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user