Build the manifest's full decomposed services architecture as real, tested code: - scheduler: 16 modules (queue/pool/policy/quota/placement/recovery + metrics/ events/backoff/health/fairness/shutdown + honest nats seam) — 130 tests - worker: 16 modules (execute/lease/resources/limits + heartbeat/events/telemetry/ sandbox/recovery/cleanup/upload/artifacts + honest plugins seam) — 52 tests - api: 20 modules (auth/authz/middleware + per-resource handlers + telemetry/ facades), app.py now a thin composition root — 98 tests - gateway: new std-only Rust reverse-proxy crate (proxy/routing/auth/cors/ rate_limit/retry/timeouts/health/metrics/events/tracing + honest tls seam) — 110 tests Every one of the 3,161 manifest files now exists. Extractions are behavior- preserving (all prior tests green); new modules add real capability; nats/tls/ plugins/sandbox are honest documented seams, not fakes. Rust workspace 352->605 tests; API 35->98. clippy -D warnings + fmt clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
"""Tests for the datasets resource module and its live WSGI surface."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from _harness import auth, make_app, request
|
|
|
|
from lawsynth_api import datasets
|
|
|
|
|
|
def test_classify_covers_dataset_routes():
|
|
assert datasets.classify("GET", ["datasets"]) == "datasets.list"
|
|
assert datasets.classify("POST", ["datasets"]) == "datasets.create"
|
|
assert datasets.classify("DELETE", ["datasets", "id"]) == "datasets.delete"
|
|
|
|
|
|
def test_datasets_have_no_streaming_projection():
|
|
assert datasets.lifecycle_events("POST", {"id": "d1"}) == []
|
|
|
|
|
|
def test_dataset_create_validates_schema_via_domain(tmp_path):
|
|
app = make_app(tmp_path)
|
|
try:
|
|
# Valid: non-empty unique schema.
|
|
status, _, created = request(
|
|
app, "POST", "/v1/datasets", body={"name": "series", "schema": ["t", "x"]}, headers=auth(key="d-1")
|
|
)
|
|
assert status == 201 and created["schema"] == ["t", "x"]
|
|
|
|
# Invalid: schema must be a non-empty list of names (domain 422).
|
|
status, _, body = request(
|
|
app, "POST", "/v1/datasets", body={"name": "bad", "schema": []}, headers=auth(key="d-2")
|
|
)
|
|
assert status == 422 and body["error"]["code"] == "validation_error"
|
|
finally:
|
|
app.close()
|