mirror of
https://github.com/blackboxprogramming/BlackRoad-Operating-System.git
synced 2026-03-17 01:57:11 -05:00
Implements complete Phase 2 scaffold across 6 core modules: ## New Modules ### 1. Backend API Enhancements - Add system router with /version, /config/public, /os/state endpoints - Register system router in main.py - Add comprehensive tests for system endpoints ### 2. Core OS Runtime (core_os/) - Implement UserSession, Window, OSState models - Add state management functions (open_window, close_window, etc.) - Create Backend API adapter for communication - Include full test suite for models and state ### 3. Operator Engine (operator_engine/) - Build job registry with example jobs - Implement simple scheduler with lifecycle management - Optional HTTP server on port 8001 - Complete tests for jobs and scheduler ### 4. Web Client Enhancements - Add CoreOSClient JavaScript class - Integrate system API endpoints - Event-driven architecture for state updates - Zero dependencies, vanilla JavaScript ### 5. Prism Console (prism-console/) - Modern dark-themed admin UI - Multi-tab navigation (Overview, Jobs, Agents, Logs, System) - Real-time metrics dashboard - Backend API integration with auto-refresh ### 6. Documentation (codex-docs/) - Complete MkDocs-based documentation - Architecture guides and component docs - Infrastructure setup guides - API reference documentation ## CI/CD - Add core-os-tests.yml workflow - Add operator-tests.yml workflow - Add docs-build.yml workflow ## Documentation - Create BLACKROAD_OS_REPO_MAP.md cross-reference - Add README for each module - Comprehensive integration documentation ## Summary - 37 new files created - ~3,500 lines of new code - 5 test suites with 15+ tests - 3 new CI workflows - 10+ documentation pages All modules are minimal working skeletons ready for integration. Designed to be extracted into separate repos if needed. Phase 2 scaffold complete and ready for review.
61 lines
1.8 KiB
Python
61 lines
1.8 KiB
Python
"""Tests for system endpoints"""
|
|
import pytest
|
|
from httpx import AsyncClient
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_version_endpoint(client: AsyncClient):
|
|
"""Test /api/system/version endpoint"""
|
|
response = await client.get("/api/system/version")
|
|
assert response.status_code == 200
|
|
|
|
data = response.json()
|
|
assert "version" in data
|
|
assert "build_time" in data
|
|
assert "env" in data
|
|
assert "git_sha" in data
|
|
assert "app_name" in data
|
|
assert data["app_name"] == "BlackRoad Operating System"
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_public_config_endpoint(client: AsyncClient):
|
|
"""Test /api/system/config/public endpoint"""
|
|
response = await client.get("/api/system/config/public")
|
|
assert response.status_code == 200
|
|
|
|
data = response.json()
|
|
assert "environment" in data
|
|
assert "app_name" in data
|
|
assert "version" in data
|
|
assert "features" in data
|
|
assert "limits" in data
|
|
assert "external_services" in data
|
|
|
|
# Verify features structure
|
|
features = data["features"]
|
|
assert "blockchain_enabled" in features
|
|
assert "ai_agents_enabled" in features
|
|
assert "video_streaming_enabled" in features
|
|
|
|
# Verify limits structure
|
|
limits = data["limits"]
|
|
assert "max_upload_size_mb" in limits
|
|
assert "session_timeout_minutes" in limits
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_os_state_endpoint(client: AsyncClient):
|
|
"""Test /api/system/os/state endpoint (stub)"""
|
|
response = await client.get("/api/system/os/state")
|
|
assert response.status_code == 200
|
|
|
|
data = response.json()
|
|
assert "status" in data
|
|
assert data["status"] == "ok"
|
|
assert "active_windows" in data
|
|
assert "running_apps" in data
|
|
assert "system_resources" in data
|
|
assert isinstance(data["active_windows"], list)
|
|
assert isinstance(data["running_apps"], list)
|