phase 0+1: project scaffold, k8s manifests, CI pipeline, steering, hooks, tests
- Repository structure for all services, infra, lakehouse, dashboards - K8s manifests targeting stonks-oracle namespace with GHCR images - Ingress via Traefik with ca-issuer TLS for internal services - ConfigMap wired to existing cluster services (pg, redis, minio, ollama) - GitHub Actions workflow for lint, test, multi-service container builds - Dockerfile with build-arg CMD per service - Makefile for local build/push/deploy - Steering rules for TDD workflow, K8s conventions, project context - Agent hooks for lint-on-save, test-on-save, k8s-validate, phase-commit - Ruff linter config, all lint issues fixed - 14 passing tests for schemas, config, redis keys - PostgreSQL migrations, Trino catalogs, Superset config, MinIO lifecycle
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
"""Basic tests for shared config loader."""
|
||||
from services.shared.config import load_config, AppConfig
|
||||
|
||||
|
||||
def test_load_config_returns_app_config():
|
||||
config = load_config()
|
||||
assert isinstance(config, AppConfig)
|
||||
|
||||
|
||||
def test_postgres_dsn_format():
|
||||
config = load_config()
|
||||
assert config.postgres.dsn.startswith("postgresql://")
|
||||
|
||||
|
||||
def test_redis_url_format():
|
||||
config = load_config()
|
||||
assert config.redis.url.startswith("redis://")
|
||||
|
||||
|
||||
def test_default_broker_mode():
|
||||
config = load_config()
|
||||
assert config.broker.mode == "paper"
|
||||
@@ -0,0 +1,31 @@
|
||||
"""Basic tests for Redis key conventions."""
|
||||
from services.shared.redis_keys import (
|
||||
lock_key,
|
||||
rate_limit_key,
|
||||
queue_key,
|
||||
dedupe_key,
|
||||
cache_key,
|
||||
QUEUE_INGESTION,
|
||||
QUEUE_PARSING,
|
||||
)
|
||||
|
||||
|
||||
def test_lock_key_format():
|
||||
assert lock_key("scheduler") == "stonks:lock:scheduler"
|
||||
|
||||
|
||||
def test_rate_limit_key_format():
|
||||
assert rate_limit_key("news_api", "202604111200") == "stonks:ratelimit:news_api:202604111200"
|
||||
|
||||
|
||||
def test_queue_key_format():
|
||||
assert queue_key(QUEUE_INGESTION) == "stonks:queue:ingestion"
|
||||
assert queue_key(QUEUE_PARSING) == "stonks:queue:parsing"
|
||||
|
||||
|
||||
def test_dedupe_key_format():
|
||||
assert dedupe_key("abc123").startswith("stonks:dedupe:")
|
||||
|
||||
|
||||
def test_cache_key_format():
|
||||
assert cache_key("companies", "AAPL") == "stonks:cache:companies:AAPL"
|
||||
@@ -0,0 +1,50 @@
|
||||
"""Basic smoke tests for shared schemas."""
|
||||
from services.shared.schemas import (
|
||||
DocumentIntelligence,
|
||||
TrendSummary,
|
||||
Recommendation,
|
||||
DocumentMetadata,
|
||||
CompanyImpact,
|
||||
Sentiment,
|
||||
CatalystType,
|
||||
ActionType,
|
||||
)
|
||||
|
||||
|
||||
def test_document_intelligence_defaults():
|
||||
di = DocumentIntelligence()
|
||||
assert di.document_id
|
||||
assert di.confidence == 0.5
|
||||
assert di.companies == []
|
||||
|
||||
|
||||
def test_company_impact_validation():
|
||||
ci = CompanyImpact(
|
||||
ticker="AAPL",
|
||||
company_name="Apple Inc.",
|
||||
relevance=0.9,
|
||||
sentiment=Sentiment.POSITIVE,
|
||||
impact_score=0.7,
|
||||
impact_horizon="1d_30d",
|
||||
catalyst_type=CatalystType.EARNINGS,
|
||||
)
|
||||
assert ci.ticker == "AAPL"
|
||||
assert ci.sentiment == Sentiment.POSITIVE
|
||||
|
||||
|
||||
def test_trend_summary_defaults():
|
||||
ts = TrendSummary()
|
||||
assert ts.trend_strength == 0.5
|
||||
assert ts.contradiction_score == 0.0
|
||||
|
||||
|
||||
def test_recommendation_defaults():
|
||||
rec = Recommendation()
|
||||
assert rec.action == ActionType.WATCH
|
||||
assert rec.position_sizing.portfolio_pct == 0.02
|
||||
|
||||
|
||||
def test_document_metadata_defaults():
|
||||
dm = DocumentMetadata()
|
||||
assert dm.document_id
|
||||
assert dm.language == "en"
|
||||
Reference in New Issue
Block a user