Skip to content

Commit 22d709e

Browse files
committed
Weaviate version and expose gRPC port; adjust service dependencies
fix(analytics-service): enhance Dockerfile for runtime requirements and healthcheck test(rls): add tests for RLS GUC context management in database connections test(security): implement tests for async token revocation and rate limiting middleware feat(security): add RS256/JWKS signing and migration from HS256
1 parent d102a40 commit 22d709e

17 files changed

Lines changed: 903 additions & 175 deletions

.editorconfig

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 78 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@ concurrency:
1212

1313
env:
1414
PYTHON_VERSION: "3.12"
15+
# Test-only CI secrets/config, inherited by all test jobs below.
16+
AUTH_SECRET_KEY: ci-test-secret-key-minimum-32-characters-long!!
17+
SECURITY_JWT_SECRET: ci-test-secret-key-minimum-32-characters-long!!
18+
USER_SERVICE_JWT_SECRET_KEY: ci-test-secret-key-minimum-32-characters-long!!
19+
ENCRYPTION_MASTER_KEY: ci-test-encrypt-key-exactly-32ch
20+
USER_SERVICE_FIELD_ENCRYPTION_KEY: ci-test-encrypt-key-exactly-32ch
21+
FERNET_TOKEN_KEY: sp1gRbNPAdgva1NX4vYC3gZDNu--cUiGM5H9xhtltN8=
22+
FERNET_FIELD_KEY: aQyP7tOjb06jmhH0Ni3Y04CqcrzrnK_KnuurAOUWl4c=
23+
POSTGRES_PASSWORD: ci_test_password
24+
USER_DB_PASSWORD: ci_test_password
25+
SERVICE_AUTH_SERVICE_SECRET: ci-test-service-secret-for-auth-32chars!!
26+
ENVIRONMENT: test
27+
KAFKA_ENABLED: "false"
28+
LOG_LEVEL: WARNING
1529

1630
jobs:
1731
lint:
@@ -37,29 +51,12 @@ jobs:
3751
continue-on-error: true
3852
run: ruff check . --statistics 2>&1 | tail -25
3953

54+
# Shared-library + cross-cutting suites. All steps HARD-GATED (no masking):
55+
# a red step fails the job, which is the whole point of Phase 0.
4056
test:
41-
name: Unit Tests
57+
name: Core & Shared Tests
4258
runs-on: ubuntu-latest
4359
needs: lint
44-
env:
45-
# Auth / JWT
46-
AUTH_SECRET_KEY: ci-test-secret-key-minimum-32-characters-long!!
47-
SECURITY_JWT_SECRET: ci-test-secret-key-minimum-32-characters-long!!
48-
USER_SERVICE_JWT_SECRET_KEY: ci-test-secret-key-minimum-32-characters-long!!
49-
# Encryption
50-
ENCRYPTION_MASTER_KEY: ci-test-encrypt-key-exactly-32ch
51-
USER_SERVICE_FIELD_ENCRYPTION_KEY: ci-test-encrypt-key-exactly-32ch
52-
FERNET_TOKEN_KEY: sp1gRbNPAdgva1NX4vYC3gZDNu--cUiGM5H9xhtltN8=
53-
FERNET_FIELD_KEY: aQyP7tOjb06jmhH0Ni3Y04CqcrzrnK_KnuurAOUWl4c=
54-
# Database
55-
POSTGRES_PASSWORD: ci_test_password
56-
USER_DB_PASSWORD: ci_test_password
57-
# Service Auth
58-
SERVICE_AUTH_SERVICE_SECRET: ci-test-service-secret-for-auth-32chars!!
59-
# Runtime
60-
ENVIRONMENT: test
61-
KAFKA_ENABLED: "false"
62-
LOG_LEVEL: WARNING
6360
steps:
6461
- uses: actions/checkout@v4
6562

@@ -82,23 +79,71 @@ jobs:
8279
run: pytest tests/alignment/ -x -q --no-header
8380

8481
- name: Run shared library tests
85-
continue-on-error: true
8682
run: |
87-
pytest tests/solace_common/ -x -q --no-header 2>&1 || true
88-
pytest tests/solace_security/ -x -q --no-header 2>&1 || true
83+
pytest tests/solace_common/ -q --no-header
84+
pytest tests/solace_security/ -q --no-header
8985
90-
- name: Run service unit tests
91-
continue-on-error: true
86+
# Per-service unit tests, one matrix leg each. HARD-GATED, fail-fast off so
87+
# every service reports independently. config_service has no tests dir yet.
88+
service-tests:
89+
name: Service Tests (${{ matrix.service.name }})
90+
runs-on: ubuntu-latest
91+
needs: lint
92+
strategy:
93+
fail-fast: false
94+
matrix:
95+
service:
96+
- { dir: "safety_service", name: "safety" }
97+
- { dir: "diagnosis_service", name: "diagnosis" }
98+
- { dir: "therapy_service", name: "therapy" }
99+
- { dir: "memory_service", name: "memory" }
100+
- { dir: "personality_service", name: "personality" }
101+
- { dir: "orchestrator_service", name: "orchestrator" }
102+
- { dir: "user-service", name: "user" }
103+
- { dir: "notification-service", name: "notification" }
104+
- { dir: "analytics-service", name: "analytics" }
105+
steps:
106+
- uses: actions/checkout@v4
107+
108+
- name: Set up Python
109+
uses: actions/setup-python@v5
110+
with:
111+
python-version: ${{ env.PYTHON_VERSION }}
112+
cache: pip
113+
114+
- name: Install dependencies
115+
run: |
116+
python -m pip install --upgrade pip
117+
pip install -e ".[dev]"
118+
pip install pytest-mock pytest-asyncio httpx
119+
120+
- name: Run ${{ matrix.service.name }} tests
121+
run: pytest services/${{ matrix.service.dir }}/tests/ -q --no-header
122+
123+
# Integration suites that run against mocked/in-memory deps. HARD-GATED.
124+
# The live-infra file needs real Postgres/Redis/Kafka/Weaviate and is deferred
125+
# to Sprint B.3 (staging) rather than silently masked here.
126+
integration-tests:
127+
name: Integration Tests
128+
runs-on: ubuntu-latest
129+
needs: lint
130+
steps:
131+
- uses: actions/checkout@v4
132+
133+
- name: Set up Python
134+
uses: actions/setup-python@v5
135+
with:
136+
python-version: ${{ env.PYTHON_VERSION }}
137+
cache: pip
138+
139+
- name: Install dependencies
92140
run: |
93-
pytest services/safety_service/tests/ -q --no-header --ignore=services/safety_service/tests/test_api.py 2>&1 || true
94-
pytest services/diagnosis_service/tests/ -q --no-header 2>&1 || true
95-
pytest services/therapy_service/tests/ -q --no-header 2>&1 || true
96-
pytest services/memory_service/tests/ -q --no-header 2>&1 || true
97-
pytest services/personality_service/tests/ -q --no-header 2>&1 || true
141+
python -m pip install --upgrade pip
142+
pip install -e ".[dev]"
143+
pip install pytest-mock pytest-asyncio httpx
98144
99-
- name: Run integration tests
100-
continue-on-error: true
101-
run: pytest tests/integration/ -q --no-header 2>&1 || true
145+
- name: Run integration tests (mocked deps)
146+
run: pytest tests/integration/ -q --no-header --ignore=tests/integration/test_service_integration.py
102147

103148
docker-build:
104149
name: Docker Build

conftest.py

Lines changed: 0 additions & 48 deletions
This file was deleted.

docker-compose.prod.yml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
# Solace-AI production override (Sprint 8).
22
#
3-
# Applied on top of the base ``docker-compose.yml``:
4-
# docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d
3+
# Applied on top of the base ``docker-compose.yml``. Deploy with --env-file so that
4+
# ${...} interpolation is sourced from .env.prod (NOT the shell / a dev .env), and so the
5+
# required-secret guards below actually read the prod values:
6+
# docker compose --env-file .env.prod -f docker-compose.yml -f docker-compose.prod.yml up -d
7+
#
8+
# The dev debug UIs (mailhog, kafka-ui) are behind the "dev" profile in the base file, so
9+
# they are never started here (no --profile dev). Secrets below use the ${VAR:?msg} form:
10+
# compose FAILS FAST if a required secret is missing from .env.prod instead of silently
11+
# falling back to the base file's dev default (REV-11).
512
#
613
# Adds:
714
# - Caddy as the TLS-terminating reverse proxy (the only container with
@@ -33,6 +40,11 @@ x-logging: &default-logging
3340
x-restart: &default-restart
3441
restart: unless-stopped
3542

43+
# Required secrets — override the base file's dev-default fallbacks so a missing value in
44+
# .env.prod fails the deploy instead of silently shipping the dev JWT key to prod (REV-11).
45+
x-app-secrets: &app-secrets
46+
AUTH_SECRET_KEY: ${JWT_SECRET_KEY:?JWT_SECRET_KEY must be set in .env.prod}
47+
3648
services:
3749
caddy:
3850
image: caddy:2.8-alpine
@@ -64,6 +76,8 @@ services:
6476
orchestrator-service:
6577
ports: [] # Only reachable via Caddy
6678
env_file: .env.prod
79+
environment:
80+
<<: *app-secrets
6781
logging: *default-logging
6882
<<: *default-restart
6983
deploy:
@@ -74,6 +88,14 @@ services:
7488
user-service:
7589
ports: []
7690
env_file: .env.prod
91+
environment:
92+
<<: *app-secrets
93+
USER_SERVICE_JWT_SECRET_KEY: ${JWT_SECRET_KEY:?JWT_SECRET_KEY must be set in .env.prod}
94+
SECURITY_JWT_SECRET: ${JWT_SECRET_KEY:?JWT_SECRET_KEY must be set in .env.prod}
95+
USER_SERVICE_FIELD_ENCRYPTION_KEY: ${FIELD_ENCRYPTION_KEY:?FIELD_ENCRYPTION_KEY must be set in .env.prod}
96+
FERNET_TOKEN_KEY: ${FERNET_TOKEN_KEY:?FERNET_TOKEN_KEY must be set in .env.prod}
97+
FERNET_FIELD_KEY: ${FERNET_FIELD_KEY:?FERNET_FIELD_KEY must be set in .env.prod}
98+
USER_DB_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD must be set in .env.prod}
7799
logging: *default-logging
78100
<<: *default-restart
79101
deploy:
@@ -84,6 +106,8 @@ services:
84106
safety-service:
85107
ports: []
86108
env_file: .env.prod
109+
environment:
110+
<<: *app-secrets
87111
logging: *default-logging
88112
<<: *default-restart
89113
deploy:
@@ -154,7 +178,7 @@ services:
154178
postgres:
155179
ports: []
156180
environment:
157-
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
181+
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD must be set in .env.prod}
158182
logging: *default-logging
159183
<<: *default-restart
160184
deploy:

0 commit comments

Comments
 (0)