Commit Graph

203 Commits

Author SHA1 Message Date
aitbc
124ae79c83 Fix bare except patterns in coordinator-api
- Fixed monitoring_dashboard.py: replaced bare except with ValueError, AttributeError
- Fixed cross_chain_bridge_enhanced.py: replaced bare except with Exception (with logging)
- Fixed enterprise_integration.py: replaced bare except with specific exceptions

This starts Phase 3: Exception Handling Improvement
2026-04-30 10:58:07 +02:00
aitbc
d28aa6d18b Add integration test for blockchain-payments interaction
- Added test_integration_blockchain_payments.py with test for payment recording on blockchain
- This continues Phase 2.4: Add integration tests
2026-04-30 10:56:42 +02:00
aitbc
084fbd7ab5 Add integration test for agent-marketplace interaction
- Added test_integration_agent_marketplace.py with test for agent registration and marketplace listing
- This starts Phase 2.4: Add integration tests
2026-04-30 10:56:21 +02:00
aitbc
acbb7ca65e Add staking service tests
- Added test_services_staking.py with tests for staking info and stake operations
- This continues Phase 2.3: Add tests for core services
2026-04-30 10:55:54 +02:00
aitbc
49a028b15b Add governance service tests
- Added test_services_governance.py with tests for governance proposals and voting
- This continues Phase 2.3: Add tests for core services
2026-04-30 10:55:31 +02:00
aitbc
ced745f90a Add payments service tests
- Added test_services_payments.py with tests for payment creation and status
- This continues Phase 2.3: Add tests for core services
2026-04-30 10:55:12 +02:00
aitbc
6906bb88d9 Add unit tests for core services
- Added test_services_blockchain.py with tests for blockchain service
- Added test_services_marketplace.py with tests for marketplace service
- Added test_services_agent.py with tests for agent service

This is Phase 2.3: Add tests for core services
2026-04-30 10:54:48 +02:00
aitbc
7cc76dc370 Add staking router tests
- Added test_routers_staking.py with tests for staking info and stake operations
- This continues Phase 2.2: Add tests for coordinator-api routers
2026-04-30 10:53:54 +02:00
aitbc
bc14f2c729 Add unit tests for coordinator-api routers
- Added test_routers_blockchain.py with tests for blockchain status and sync status
- Added test_routers_governance.py with tests for governance proposals and voting
- Added test_routers_marketplace.py with tests for marketplace listings
- Added test_routers_agent.py with tests for agent list, register, and status
- Added test_routers_payments.py with tests for payment creation and status

This is Phase 2.2: Add tests for coordinator-api routers
2026-04-30 10:53:29 +02:00
aitbc
a31258cc2d Remove duplicate dependencies from app-specific pyproject.toml files
- Updated all 6 app pyproject.toml files to reference root dependencies
- coordinator-api, blockchain-node, wallet, agent-coordinator, pool-hub, blockchain-event-bridge
- Kept package structure definitions and local path dependencies
- This completes dependency consolidation to single source of truth at root
2026-04-30 10:47:50 +02:00
aitbc
8a0f9947f5 Add __init__.py files to bare Python packages
Added __init__.py files to directories with Python files that were
missing them to fix imports and pytest discovery:

- apps/agent-coordinator/src/app and subdirectories (auth, monitoring, protocols, routing)
- apps/coordinator-api/src/app/agent_identity, reputation, utils
- apps/wallet/src/app/keystore, crypto, receipts
- apps/pool-hub/src/poolhub/services
- Test directories for agent-coordinator, blockchain-node, coordinator-api, pool-hub, wallet
- Source directories for agent-services and ai-engine
- blockchain-node subdirectories (contracts, economics, network, rpc)
- Migration directories for blockchain-node, coordinator-api, pool-hub

This improves import reliability and reduces the need for sys.path
manipulation in conftest.py.
2026-04-30 10:34:11 +02:00
aitbc
dc9863afec Replace hardcoded IPs with environment variables
Fixed hardcoded IP addresses in production code by replacing them with
environment variables or config settings:

- apps/blockchain-node/src/aitbc_chain/sync_cli.py: Use AITBC_SYNC_SOURCE
  and AITBC_SYNC_IMPORT_URL env vars for RPC URLs
- apps/blockchain-node/src/aitbc_chain/app.py: Use AITBC_TRUSTED_IPS
  env var for rate limiting bypass
- apps/coordinator-api/src/app/routers/client.py: Use settings.blockchain_rpc_url
  for RPC endpoint
- dev/scripts/dev_heartbeat.py: Use AITBC_LOCAL_RPC and AITBC_GENESIS_RPC
  env vars for RPC URLs
- cli/aitbc_cli.py: Use AITBC_FOLLOWER_HOST and AITBC_FOLLOWER_PORT
  env vars for network peer display

This makes the codebase more portable and configurable for different
deployment environments.
2026-04-30 10:33:04 +02:00
aitbc
59d7070ab9 Replace datetime.utcnow() with datetime.now(datetime.UTC)
Fixed Python 3.12+ deprecation warning by replacing all 357 occurrences
of datetime.utcnow() with datetime.now(datetime.UTC) across 49 files.

This change ensures timezone-aware datetime objects and fixes the deprecation
warning introduced in Python 3.12 (target version is 3.13).
2026-04-30 10:31:29 +02:00
aitbc
09b0edc212 Fix type annotation gaps in coordinator-api routers
- Add return type annotations to all async functions
- Add argument type annotations to functions missing them
- Add missing imports for typing (Any, Annotated, etc.)
- Add missing imports for FastAPI components (Query, Body, HTTPException)
- Fix validator functions in bounty.py and staking.py
- Fix dependency injection functions in agent_identity.py
- All 236 Ruff ANN001/ANN201 errors resolved across 26 files
2026-04-30 10:24:17 +02:00
aitbc
ed128014c6 fix: add type annotations to coordinator-api routers (client, admin)
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 14s
Deploy to Testnet / deploy-testnet (push) Successful in 1m1s
Integration Tests / test-service-integration (push) Successful in 2m58s
Python Tests / test-python (push) Failing after 7s
Security Scanning / security-scan (push) Successful in 13s
Deploy to Testnet / notify-deployment (push) Successful in 1s
Node Failover Simulation / failover-test (push) Failing after 9s
Multi-Node Stress Testing / stress-test (push) Successful in 12s
Cross-Node Transaction Testing / transaction-test (push) Successful in 13s
- Add return type annotation to create_agent_network in client.py
- Add return type annotation to get_execution_receipt in client.py
- Add return type annotation to create_agent_network in admin.py
- Add return type annotation to get_execution_receipt in admin.py
- Addresses ruff ANN201 warnings in critical router files
2026-04-30 09:28:41 +02:00
aitbc
c1fc240cd8 fix: add type annotations to coordinator-api main.py
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 27s
Cross-Node Transaction Testing / transaction-test (push) Successful in 16s
Deploy to Testnet / deploy-testnet (push) Has started running
Deploy to Testnet / notify-deployment (push) Has been cancelled
Integration Tests / test-service-integration (push) Has been cancelled
Node Failover Simulation / failover-test (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
Multi-Node Stress Testing / stress-test (push) Successful in 11s
Security Scanning / security-scan (push) Successful in 2m49s
- Add AsyncIterator, Callable, Awaitable imports from typing
- Add return type annotation to lifespan function (AsyncIterator[None])
- Add return type annotation to request_metrics_middleware (Response)
- Add type annotation to call_next parameter (Callable[[Request], Awaitable[Response]])
- Add return type annotation to rate_limit_metrics function (Response)
- Addresses ruff ANN001, ANN201, ANN202 warnings in main entrypoint
2026-04-30 09:27:26 +02:00
aitbc
7596ef1c1a fix: consolidate coordinator-api entrypoints
Some checks failed
Deploy to Testnet / deploy-testnet (push) Waiting to run
Integration Tests / test-service-integration (push) Waiting to run
Multi-Node Stress Testing / stress-test (push) Waiting to run
Node Failover Simulation / failover-test (push) Waiting to run
API Endpoint Tests / test-api-endpoints (push) Successful in 22s
Cross-Node Transaction Testing / transaction-test (push) Successful in 15s
Python Tests / test-python (push) Failing after 15s
Security Scanning / security-scan (push) Successful in 18s
Deploy to Testnet / notify-deployment (push) Has been cancelled
- Fix app.py to properly import FastAPI app from main.py
- Remove unused python_13_optimized.py variant
- Ensure single clean entrypoint for coordinator-api service
- Systemd wrapper uses app.main:app which now properly resolves
2026-04-30 09:11:48 +02:00
aitbc
750f81a098 fix: replace bare except with except Exception in critical files
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 19s
Blockchain Synchronization Verification / sync-verification (push) Successful in 8s
Cross-Chain Functionality Tests / test-cross-chain-sync (push) Failing after 8s
Cross-Chain Functionality Tests / test-cross-chain-transactions (push) Successful in 12s
Cross-Chain Functionality Tests / test-cross-chain-bridge (push) Has been skipped
Cross-Node Transaction Testing / transaction-test (push) Has been cancelled
Cross-Chain Functionality Tests / test-multi-chain-consensus (push) Failing after 8s
Deploy to Testnet / deploy-testnet (push) Has been cancelled
Cross-Chain Functionality Tests / aggregate-results (push) Has been skipped
Deploy to Testnet / notify-deployment (push) Has been cancelled
Integration Tests / test-service-integration (push) Has started running
Multi-Node Stress Testing / stress-test (push) Has been cancelled
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 7s
Node Failover Simulation / failover-test (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
P2P Network Verification / p2p-verification (push) Successful in 10s
- Fixed bare except clauses in blockchain-node p2p_network.py
- Fixed bare except clauses in blockchain-node rpc/router.py
- Fixed bare except clauses in coordinator-api migration scripts
- Fixed bare except clause in coordinator-api agent_integration_router.py
- Addresses ruff E722 warnings in critical application code
- Note: 170 bare except clauses remain in tests/dev/plugins (lower priority)
2026-04-30 09:10:16 +02:00
aitbc
5bee7f03fb cleanup: remove Docker references from codebase
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 37s
CLI Tests / test-cli (push) Successful in 10s
Cross-Node Transaction Testing / transaction-test (push) Successful in 10s
Deploy to Testnet / deploy-testnet (push) Successful in 1m7s
Integration Tests / test-service-integration (push) Successful in 2m57s
Multi-Node Stress Testing / stress-test (push) Successful in 10s
Node Failover Simulation / failover-test (push) Successful in 6s
Deploy to Testnet / notify-deployment (push) Has been cancelled
Python Tests / test-python (push) Failing after 32s
Security Scanning / security-scan (push) Successful in 28s
- Remove host.docker.internal from api-endpoint-tests.yml CI workflow
- Remove Docker build/push commands from production-deploy.sh
- Remove Docker prerequisite checks from deploy.sh
- Remove Docker from CLI deployment instructions
- Remove Docker from marketplace_scaler.py scaling comment
- Remove Docker from agent_security.py sandbox config and comments
- Remove Docker from developer_platform.py skills list
- Remove Dockerfile/docker-compose.yml from final-cleanup.sh output
- Addresses request to remove all Docker support references
2026-04-30 08:51:01 +02:00
aitbc
8254182eeb fix: add __init__.py to bare packages across the codebase
- Add __init__.py to agent-coordinator ai, consensus, coordination, decision, lifecycle
- Add __init__.py to wallet crypto package
- Add __init__.py to coordinator-api middleware, repositories, sdk
- Addresses report item #9 (missing package initialization files)
2026-04-30 08:38:40 +02:00
aitbc
5f03ded7ff fix: replace deprecated datetime.utcnow() with datetime.now(datetime.UTC)
- Replace all 2,087 uses of datetime.utcnow() across 294 files
- Add UTC import to datetime statements where needed
- Addresses Python 3.12+ deprecation warning (report item #3)
2026-04-30 08:36:55 +02:00
aitbc
99d1666eda cleanup: remove legacy coordinator-api entrypoints and backup files
- Delete unused main_enhanced.py, main_minimal.py, main_simple.py variants
- Delete config.py.backup, main.py.backup, db.py.backup files
- Delete 14 additional backup/temp files across the repo
- Clean up technical debt from report item #6
2026-04-30 08:33:18 +02:00
aitbc
6182108d6c Fix payment service: update exchange API URL from port 23000 to 8001
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 13s
Integration Tests / test-service-integration (push) Successful in 2m27s
Python Tests / test-python (push) Successful in 8s
Security Scanning / security-scan (push) Successful in 25s
Node Failover Simulation / failover-test (push) Failing after 18s
P2P Network Verification / p2p-verification (push) Successful in 3s
Multi-Node Blockchain Health Monitoring / health-check (push) Failing after 3s
Blockchain Synchronization Verification / sync-verification (push) Failing after 3s
2026-04-28 21:21:31 +02:00
aitbc
f0ef4619e9 Add essential model imports to ensure database tables are created
All checks were successful
API Endpoint Tests / test-api-endpoints (push) Successful in 12s
Integration Tests / test-service-integration (push) Successful in 2m57s
Python Tests / test-python (push) Successful in 8s
Security Scanning / security-scan (push) Successful in 26s
2026-04-28 21:11:43 +02:00
aitbc
909b7502f2 Add essential model imports to ensure database tables are created
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 13s
Integration Tests / test-service-integration (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
2026-04-28 21:09:49 +02:00
aitbc
6b7702426b Revert to using main session for job creation to debug persistence issue
All checks were successful
API Endpoint Tests / test-api-endpoints (push) Successful in 1m14s
Integration Tests / test-service-integration (push) Successful in 2m57s
Python Tests / test-python (push) Successful in 10s
Security Scanning / security-scan (push) Successful in 29s
2026-04-28 21:01:16 +02:00
aitbc
5a64f5ba24 Use separate sessions for job and payment creation to avoid rollback issues
All checks were successful
API Endpoint Tests / test-api-endpoints (push) Successful in 43s
Integration Tests / test-service-integration (push) Successful in 2m57s
Python Tests / test-python (push) Successful in 10s
Security Scanning / security-scan (push) Successful in 23s
2026-04-28 20:56:00 +02:00
aitbc
67a0f8ea6c Fix job persistence by committing job separately from payment creation
All checks were successful
API Endpoint Tests / test-api-endpoints (push) Successful in 17s
Integration Tests / test-service-integration (push) Successful in 2m57s
Python Tests / test-python (push) Successful in 10s
Security Scanning / security-scan (push) Successful in 23s
2026-04-28 20:51:05 +02:00
aitbc
b11b65ba63 Add logging to track job and payment creation success
All checks were successful
API Endpoint Tests / test-api-endpoints (push) Successful in 44s
Integration Tests / test-service-integration (push) Successful in 2m27s
Python Tests / test-python (push) Successful in 13s
Security Scanning / security-scan (push) Successful in 16s
2026-04-28 20:45:48 +02:00
aitbc
22be0ceed4 Add AI job scheduling and payment flow to GPU purchase with lazy loading to avoid startup blocking
All checks were successful
API Endpoint Tests / test-api-endpoints (push) Successful in 12s
Integration Tests / test-service-integration (push) Successful in 2m27s
Python Tests / test-python (push) Successful in 19s
Security Scanning / security-scan (push) Successful in 48s
2026-04-28 20:41:53 +02:00
aitbc
169a2eb403 Fix GPU status update to ensure it's marked as booked after purchase
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 14s
Integration Tests / test-service-integration (push) Has been cancelled
Python Tests / test-python (push) Has started running
Security Scanning / security-scan (push) Has been cancelled
2026-04-28 20:38:38 +02:00
aitbc
17de73c6a2 Revert to simpler GPU purchase endpoint without job/payment integration
All checks were successful
API Endpoint Tests / test-api-endpoints (push) Successful in 28s
Integration Tests / test-service-integration (push) Successful in 3m0s
Python Tests / test-python (push) Successful in 9s
Security Scanning / security-scan (push) Successful in 28s
2026-04-28 20:32:24 +02:00
aitbc
d029d2ddbf Revert job and payment integration to fix service startup - use simpler approach
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Has started running
Integration Tests / test-service-integration (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
Python Tests / test-python (push) Successful in 14s
2026-04-28 20:31:27 +02:00
aitbc
d5758f2cc5 Revert job and payment integration to fix service startup - use simpler approach
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 1m47s
Integration Tests / test-service-integration (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
2026-04-28 20:28:58 +02:00
aitbc
6462fedda7 Fix marketplace_gpu import: use direct storage.db import to avoid circular import
Some checks are pending
API Endpoint Tests / test-api-endpoints (push) Waiting to run
Integration Tests / test-service-integration (push) Successful in 3m7s
Python Tests / test-python (push) Successful in 24s
Security Scanning / security-scan (push) Has started running
2026-04-28 20:24:28 +02:00
aitbc
d35c7a919f Add get_session import to fix service startup
Some checks failed
Python Tests / test-python (push) Waiting to run
Security Scanning / security-scan (push) Waiting to run
API Endpoint Tests / test-api-endpoints (push) Successful in 19s
Integration Tests / test-service-integration (push) Has been cancelled
2026-04-28 20:22:39 +02:00
aitbc
d615cc162b Add MarketDataCollector import to fix service startup
All checks were successful
API Endpoint Tests / test-api-endpoints (push) Successful in 15s
Integration Tests / test-service-integration (push) Successful in 2m57s
Python Tests / test-python (push) Successful in 12s
Security Scanning / security-scan (push) Successful in 48s
2026-04-28 20:18:14 +02:00
aitbc
0001c643c1 Fix imports for JobService and PaymentService in marketplace_gpu.py
All checks were successful
API Endpoint Tests / test-api-endpoints (push) Successful in 15s
Integration Tests / test-service-integration (push) Successful in 2m56s
Python Tests / test-python (push) Successful in 12s
Security Scanning / security-scan (push) Successful in 34s
2026-04-28 20:12:19 +02:00
aitbc
56d219582d Connect GPU marketplace purchases to AI job scheduling and payment flow
All checks were successful
API Endpoint Tests / test-api-endpoints (push) Successful in 1m31s
Integration Tests / test-service-integration (push) Successful in 2m57s
Python Tests / test-python (push) Successful in 10s
Security Scanning / security-scan (push) Successful in 1m2s
2026-04-28 20:06:50 +02:00
aitbc
01b4c4ea33 Fix admin router conditional check and ensure marketplace_gpu router is imported
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 1m54s
Integration Tests / test-service-integration (push) Successful in 3m1s
Python Tests / test-python (push) Successful in 16s
Security Scanning / security-scan (push) Successful in 48s
Multi-Node Blockchain Health Monitoring / health-check (push) Failing after 2s
Blockchain Synchronization Verification / sync-verification (push) Failing after 6s
2026-04-28 19:44:31 +02:00
aitbc
6861621842 Fix admin router import error and add Optional import for GPUSellRequest
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Has started running
Integration Tests / test-service-integration (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
2026-04-28 19:43:46 +02:00
aitbc
807eff5ea9 Fix broken GPU purchase flow - add missing request models and endpoints
All checks were successful
API Endpoint Tests / test-api-endpoints (push) Successful in 12s
Integration Tests / test-service-integration (push) Successful in 2m56s
Python Tests / test-python (push) Successful in 8s
Security Scanning / security-scan (push) Successful in 16s
2026-04-28 18:51:16 +02:00
aitbc
3993ce79c2 Fix broken GPU purchase flow - add missing request models and endpoints
All checks were successful
API Endpoint Tests / test-api-endpoints (push) Successful in 14s
Integration Tests / test-service-integration (push) Successful in 2m57s
Python Tests / test-python (push) Successful in 12s
Security Scanning / security-scan (push) Successful in 17s
2026-04-28 18:45:54 +02:00
aitbc
4abda10883 Add missing buy_gpu endpoint to marketplace GPU router
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 12s
Integration Tests / test-service-integration (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
2026-04-28 18:42:12 +02:00
aitbc
bcc7ff0f0b Fix broken GPU purchase flow by adding missing GPUBuyRequest and GPUSellRequest models
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 44s
Integration Tests / test-service-integration (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
2026-04-28 18:41:23 +02:00
aitbc
36b1937fcb Fix import errors in handlers - use absolute imports instead of relative imports
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 13s
CLI Tests / test-cli (push) Failing after 2s
Security Scanning / security-scan (push) Has been cancelled
Integration Tests / test-service-integration (push) Successful in 2m57s
Python Tests / test-python (push) Successful in 11s
2026-04-28 18:21:48 +02:00
aitbc
31df4d538f Simplify marketplace buy/sell endpoint paths to avoid conflicts
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 49s
CLI Tests / test-cli (push) Failing after 2s
Integration Tests / test-service-integration (push) Has started running
Python Tests / test-python (push) Has been cancelled
Security Scanning / security-scan (push) Has started running
2026-04-28 18:19:49 +02:00
aitbc
0c995f7412 Change GPU buy/sell endpoints to avoid path conflicts
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 12s
CLI Tests / test-cli (push) Failing after 1s
Security Scanning / security-scan (push) Has been cancelled
Integration Tests / test-service-integration (push) Successful in 1m57s
Python Tests / test-python (push) Successful in 26s
2026-04-28 18:12:20 +02:00
aitbc
aeaae04544 Change GPU buy/sell endpoints to use gpu_id path parameter
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 12s
Python Tests / test-python (push) Has been cancelled
Integration Tests / test-service-integration (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
2026-04-28 18:11:11 +02:00
aitbc
70b725e13c Remove status_code from buy endpoint decorator
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 13s
Integration Tests / test-service-integration (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
2026-04-28 18:10:11 +02:00