fix: resolve CI failures from workflow rewrite
All checks were successful
API Endpoint Tests / test-api-endpoints (push) Successful in 29s
Integration Tests / test-service-integration (push) Successful in 44s
Package Tests / test-python-packages (map[name:aitbc-agent-sdk path:packages/py/aitbc-agent-sdk]) (push) Successful in 35s
Package Tests / test-python-packages (map[name:aitbc-core path:packages/py/aitbc-core]) (push) Successful in 24s
Package Tests / test-python-packages (map[name:aitbc-crypto path:packages/py/aitbc-crypto]) (push) Successful in 21s
Package Tests / test-python-packages (map[name:aitbc-sdk path:packages/py/aitbc-sdk]) (push) Successful in 25s
Package Tests / test-javascript-packages (map[name:aitbc-sdk-js path:packages/js/aitbc-sdk]) (push) Successful in 20s
Package Tests / test-javascript-packages (map[name:aitbc-token path:packages/solidity/aitbc-token]) (push) Successful in 30s
Python Tests / test-python (push) Successful in 1m18s
Systemd Sync / sync-systemd (push) Successful in 2s
Security Scanning / security-scan (push) Successful in 1m14s

Fixes based on first CI run results:

Workflow fixes:
- python-tests.yml: Add pytest-timeout and click to pip install
  (--timeout=30 unrecognized, conftest.py needs click)
- integration-tests.yml: Add click, pytest-timeout to pip install
  Fix systemctl status capture (multiline output in subshell)
- systemd-sync.yml: Fix printf output — $(cmd || echo) captures
  multiline; use $(cmd) || var=fallback instead
- test_api_endpoints.py: Count 404/405 as reachable in perf test
  (APIs return 404 on root but are running)

Missing module fixes:
- aitbc-agent-sdk: Create compute_consumer.py and platform_builder.py
  (__init__.py imported them but files didn't exist)
- aitbc-core: Create logging.py module with StructuredLogFormatter,
  setup_logger, get_audit_logger (tests existed but module was missing)
  Fix __init__.py duplicate imports
This commit is contained in:
aitbc1
2026-03-29 12:53:26 +02:00
parent 2d2b261384
commit 1f932d42e3
8 changed files with 225 additions and 11 deletions

View File

@@ -0,0 +1,49 @@
"""
Platform Builder - factory for constructing AITBC agent platform configurations
"""
import logging
from typing import Dict, List, Any, Optional
from .agent import Agent, AgentCapabilities, AgentIdentity
from .compute_provider import ComputeProvider
from .compute_consumer import ComputeConsumer
from .swarm_coordinator import SwarmCoordinator
logger = logging.getLogger(__name__)
class PlatformBuilder:
"""Builder pattern for constructing AITBC agent platforms"""
def __init__(self, platform_name: str = "default") -> None:
self.platform_name = platform_name
self.agents: List[Agent] = []
self.config: Dict[str, Any] = {}
def with_config(self, config: Dict[str, Any]) -> "PlatformBuilder":
"""Set platform configuration"""
self.config.update(config)
return self
def add_provider(self, name: str, capabilities: Dict[str, Any]) -> "PlatformBuilder":
"""Add a compute provider agent"""
agent = Agent.create(name, "compute_provider", capabilities)
self.agents.append(agent)
logger.info(f"Added provider: {name}")
return self
def add_consumer(self, name: str, capabilities: Dict[str, Any]) -> "PlatformBuilder":
"""Add a compute consumer agent"""
agent = Agent.create(name, "compute_consumer", capabilities)
self.agents.append(agent)
logger.info(f"Added consumer: {name}")
return self
def build(self) -> Dict[str, Any]:
"""Build and return the platform configuration"""
return {
"platform_name": self.platform_name,
"agents": [a.to_dict() for a in self.agents],
"config": self.config,
"agent_count": len(self.agents),
}