Some checks failed
Cross-Node Transaction Testing / transaction-test (push) Successful in 11s
Security Scanning / security-scan (push) Waiting to run
Deploy to Testnet / deploy-testnet (push) Successful in 1m36s
Integration Tests / test-service-integration (push) Has been cancelled
Multi-Node Stress Testing / stress-test (push) Has been cancelled
Node Failover Simulation / failover-test (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
Deploy to Testnet / notify-deployment (push) Successful in 11s
AITBC Governance Service
Manages governance operations.
Installation
cd /opt/aitbc
poetry install --with governance-service
Database Setup
Create a separate database for the governance service:
sudo -u postgres psql -f apps/governance-service/scripts/setup-database.sql
Or manually:
CREATE DATABASE aitbc_governance;
CREATE USER aitbc_governance WITH PASSWORD 'password';
GRANT ALL PRIVILEGES ON DATABASE aitbc_governance TO aitbc_governance;
Running
# Development
python -m governance_service.main
# Production (systemd)
sudo systemctl start governance-service
sudo systemctl enable governance-service
Endpoints
GET /health- Health checkGET /governance/status- Get governance statusGET /v1/governance/profiles- Get governance profilesGET /v1/governance/profiles/{profile_id}- Get specific profilePOST /v1/governance/profiles- Create new profileGET /v1/governance/proposals- Get proposalsGET /v1/governance/proposals/{proposal_id}- Get specific proposalPOST /v1/governance/proposals- Create new proposalGET /v1/governance/votes- Get votesPOST /v1/governance/votes- Create new voteGET /v1/governance/treasury- Get DAO treasuryGET /v1/governance/analytics- Get governance analytics
Testing
Prerequisites
- PostgreSQL running and aitbc_governance database created
- Poetry dependencies installed
Database Setup
sudo -u postgres psql -f scripts/setup-database.sql
Start Service (Development)
python -m governance_service.main
Health Check
curl http://localhost:8105/health
Expected response:
{"status": "healthy", "service": "governance-service"}
Governance Status
curl http://localhost:8105/governance/status
Expected response:
{
"status": "operational",
"service": "governance-service",
"message": "Governance service is running"
}
Get Governance Proposals
curl http://localhost:8105/v1/governance/proposals
Expected response:
[]
Create Governance Proposal
curl -X POST http://localhost:8105/v1/governance/proposals \
-H "Content-Type: application/json" \
-d '{
"proposer_id": "test_proposer",
"title": "Test Proposal",
"description": "Test description",
"category": "general",
"voting_starts": "2026-05-01T00:00:00Z",
"voting_ends": "2026-05-08T00:00:00Z"
}'
Test Through Gateway
-
Start the API gateway:
python -m api_gateway.main -
Test governance endpoints through the gateway:
curl http://localhost:8080/governance/health curl http://localhost:8080/governance/v1/governance/proposals
For comprehensive testing procedures, see MICROSERVICES_TESTING_GUIDE.md.
Service Configuration
- Port: 8105
- Database: aitbc_governance
- Gateway route: /governance/*
Migration Status
Completed:
- Extracted governance domain models (GovernanceProfile, Proposal, Vote, DaoTreasury, TransparencyReport)
- Extracted governance services (GovernanceService with CRUD operations)
- Set up database session management
- Extracted governance router endpoints
- Created systemd service configuration
- Created database setup script
Remaining:
- Remove governance routers from coordinator-api
- Remove governance services from coordinator-api
- Remove governance domain models from coordinator-api
- Run database migration script to create aitbc_governance database
- Install and enable systemd service
- End-to-end testing with gateway
Note: The governance service is ~50K lines, so full removal from coordinator-api requires careful coordination to avoid breaking existing functionality. The foundation is in place for gradual migration.