Files
aitbc/docs/roadmap.md

116 lines
7.8 KiB
Markdown

# AITBC Development Roadmap
This roadmap aggregates high-priority tasks derived from the bootstrap specifications in `docs/bootstrap/` and tracks progress across the monorepo. Update this document as milestones evolve.
## Stage 1 — Core Services (MVP)
- **Coordinator API**
- ✅ Scaffold FastAPI project (`apps/coordinator-api/src/app/`).
- ✅ Implement job submission, status, result endpoints.
- ✅ Add miner registration, heartbeat, poll, result routes.
- ✅ Wire SQLite persistence for jobs, miners, receipts (historical `JobReceipt` table).
- ✅ Provide `.env.example`, `pyproject.toml`, and run scripts.
- **Miner Node**
- ✅ Implement capability probe and control loop (register → heartbeat → fetch jobs).
- ✅ Build CLI and Python runners with sandboxed work dirs (result reporting stubbed to coordinator).
- **Blockchain Node**
- ✅ Define SQLModel schema for blocks, transactions, accounts, receipts (`apps/blockchain-node/src/aitbc_chain/models.py`).
- ⏳ Harden schema parity across runtime + storage:
- Generate Alembic baseline and incremental migrations in `apps/blockchain-node/migrations/` mirroring the current SQLModel definitions.
- Wire explicit SQLModel relationships (`Relationship`, `ForeignKey`) for block ↔ transaction ↔ receipt joins per bootstrap spec.
- Add validation hooks (SQLModel validators / custom service checks) to enforce hash formatting, foreign key integrity, and enum bounds before persistence.
- ✅ Implement PoA proposer loop with block assembly (`apps/blockchain-node/src/aitbc_chain/consensus/poa.py`).
- ✅ Expose REST RPC endpoints for tx submission, balances, receipts (`apps/blockchain-node/src/aitbc_chain/rpc/router.py`).
- ⏳ Deliver WebSocket RPC + P2P gossip layer:
- Stand up WebSocket subscription endpoints (`apps/blockchain-node/src/aitbc_chain/rpc/websocket.py`) mirroring REST payloads.
- Implement pub/sub transport for block + transaction gossip backed by an in-memory broker (Starlette `Broadcast` or Redis) with configurable fan-out.
- Add integration tests and load-test harness ensuring gossip convergence and back-pressure handling.
- ✅ Ship devnet scripts (`apps/blockchain-node/scripts/`).
- ✅ Add observability hooks (JSON logging, Prometheus metrics) and integrate coordinator mock into devnet tooling.
- ⏳ Expand observability dashboards + miner mock integration:
- Build Grafana dashboards for consensus health (block intervals, proposer rotation) and RPC latency (`apps/blockchain-node/observability/`).
- Expose miner mock telemetry (job throughput, error rates) via shared Prometheus registry and ingest into blockchain-node dashboards.
- Add alerting rules (Prometheus `Alertmanager`) for stalled proposers, queue saturation, and miner mock disconnects.
- Wire coordinator mock into devnet tooling to simulate real-world load and validate observability hooks.
- **Receipt Schema**
- ✅ Finalize canonical JSON receipt format under `protocols/receipts/` (includes sample signed receipts).
- ✅ Implement signing/verification helpers in `packages/py/aitbc-crypto` (JS SDK pending).
- Translate `docs/bootstrap/aitbc_tech_plan.md` contract skeleton into Solidity project.
- Add deployment/test scripts and document minting flow.
- **Wallet Daemon**
- Implement encrypted keystore (Argon2id + XChaCha20-Poly1305).
- Provide REST and JSON-RPC endpoints for wallet management and signing.
- Add mock ledger adapter with SQLite backend.
- ✅ Integrate Python receipt verification helpers (`aitbc_sdk`) and expose API/service utilities validating miner + coordinator signatures.
- ⏳ Implement Wallet SDK receipt ingestion + attestation surfacing:
- Add client for `/v1/jobs/{job_id}/receipts` with pagination + retry support (`packages/py/aitbc-sdk/src/receipts.py`).
- Reuse signature verification helpers to validate miner + coordinator attestations before exposing results.
- Surface aggregated attestation status + failure reasons via SDK API for UI consumption; mirror logic in pending JS helper.
## Stage 3 — Pool Hub & Marketplace
- **Pool Hub**
- Implement miner registry, scoring engine, and `/v1/match` API.
- Integrate Redis/PostgreSQL backing stores per bootstrap spec.
- Add observability endpoints (`/v1/health`, `/v1/metrics`).
- **Marketplace Web**
- Initialize Vite project with vanilla TypeScript.
- Build offer list, bid form, stats views sourcing mock JSON.
- Provide API abstraction to switch between mock and real backends.
- **Explorer Web**
- ✅ Initialize Vite + TypeScript project scaffold (`apps/explorer-web/`).
- ✅ Add routed pages for overview, blocks, transactions, addresses, receipts.
- ✅ Seed mock datasets (`public/mock/`) and fetch helpers powering overview + blocks tables.
- ✅ Extend mock integrations to transactions, addresses, and receipts pages.
- ✅ Implement styling system, mock/live data toggle, and coordinator API wiring scaffold.
- ⏳ Validate live mode + responsive polish:
- Hit live coordinator endpoints (`/v1/blocks`, `/v1/transactions`, `/v1/addresses`, `/v1/receipts`) via `getDataMode() === "live"` and reconcile payloads with UI models.
- Add fallbacks + error surfacing for partial/failed live responses (toast + console diagnostics).
- Audit responsive breakpoints (`public/css/layout.css`) and adjust grid/typography for tablet + mobile; add regression checks in Percy/Playwright snapshots.
## Shared Libraries & Examples
- **Python SDK (`packages/py/aitbc-sdk`)**
- ✅ Implement coordinator receipt client + verification helpers (miner + coordinator attestation support).
- ⏳ Extend helpers to pool hub + wallet APIs and typed models:
- Add REST clients for upcoming Pool Hub endpoints (`/v1/match`, `/v1/miners`) and wallet daemon routes (`/v1/wallets`, `/v1/sign`) with retry/backoff helpers.
- Introduce pydantic/SQLModel-derived typed models mirroring `protocols/api/` and `protocols/receipts/` schemas.
- Provide end-to-end tests + examples validating Pool Hub + wallet flows leveraging the coordinator receipt verification primitives.
- **JavaScript SDK (`packages/js/aitbc-sdk`)**
- Provide fetch-based wrapper for web clients.
- Offer TypeScript definitions and basic auth handling.
- **Examples**
- Populate quickstart clients (Python/JS) with working code.
- Add receipt sign/verify samples using finalized schema.
## Tooling & Operations
- **Scripts & CI**
- ✅ Populate `scripts/ci/run_python_tests.sh` to run coordinator, SDK, wallet-daemon pytest suites with shared `PYTHONPATH` scaffolding.
- ✅ Add GitHub Actions workflow `.github/workflows/python-tests.yml` invoking the shared script on pushes/PRs targeting `main`.
- **Configs**
- Author systemd unit files in `configs/systemd/` for each service.
- Provide Nginx snippets in `configs/nginx/` for reverse proxies.
## Tracking
Use this roadmap as the canonical checklist during implementation. Mark completed tasks with ✅ and add dates or links to relevant PRs as development progresses.
## Upcoming Focus Areas
- **Blockchain Node**: bootstrap module layout (`apps/blockchain-node/src/`), implement SQLModel schemas and RPC stubs aligned with historical/attested receipts.
- **Explorer Web**: finish mock integration across all pages, add styling + mock/live toggle, and begin wiring coordinator endpoints (e.g., `/v1/jobs/{job_id}/receipts`).
- **Marketplace Web**: scaffold Vite/vanilla frontends with mock integrations consuming the coordinator receipt history endpoints and SDK examples.
- **Pool Hub**: initialize FastAPI project, scoring registry, and telemetry ingestion hooks leveraging coordinator/miner metrics.
- **CI Enhancements**: add blockchain-node tests once available and frontend build/lint checks to `.github/workflows/python-tests.yml` or follow-on workflows.
- ⏳ Add systemd unit and installer scripts under `scripts/`.