Programme C: Commercial Surface — operator workflow, catalog, API, session reports - #3
Merged
Merged
Conversation
…ssion reports (C1-C6)
…ent; resolve starlette CVEs
…d API metrics, CI postgres, env-independent tests - PrometheusMetricsService now owns a per-instance CollectorRegistry, so repeated app builds / test instances no longer collide on the global registry (Duplicated timeseries). clear() resets the registry too. - Histograms register under a distinct *_seconds name, resolving the gauge/histogram same-name collision in TimingContext. - server.py uses one shared metrics service for the request middleware and the /metrics scrape endpoint instead of a new service per request. - Add postgres:16 service to the CI test job (DSN port 5433) so the 8 Postgres audit-chain tests run instead of erroring on connection refused. - test_validate_passes uses tmp_path so it passes on a fresh checkout without a local data/ directory. - binance default-connector test skips when the endpoint is network- blocked (HTTP 451/404) instead of failing CI.
…(Medium B608/B310/B108/B104 are pre-existing f-string-SQL false positives)
- bump psycopg2-binary 2.9.10 -> 2.9.12 (has a py3.14 manylinux wheel, so the python:3.14-slim Docker build no longer compiles from source) - install site-packages into /app/.local instead of /root/.local; /root is mode 700 so the non-root 'traderos' user could not read the entrypoint/site-packages and the container died at startup. Verified: docker build passes; container starts healthy; API + /metrics respond.
- Remove Dockerfile VOLUME (unsupported by Railway); declare volumes in railway.toml - Add railway.toml: Dockerfile builder, /v1/healthz healthcheck, /app/data + /app/exports volumes - Rewrite docker-compose.yml: postgres, traderos-api, traderos-daemon, postgres-test stack - Fix PG migrations: SERIAL PRIMARY KEY, BOOLEAN DEFAULT TRUE, drop legacy strategies/backtest_results from v001, _serial() + unified legacy rebuild in v006 - db check CLI uses cursor (psycopg2-compatible) - Add deploy-check CI job: compose validation, fresh-PG migration smoke (schema v6), API container health
…n + retention Deployment: - docker-compose.yml rewritten: postgres + api + daemon + test PG stack - Fresh-PG migrations E2E (v001 SERIAL PRIMARY KEY/BOOLEAN DEFAULT TRUE, legacy tables removed; v006 _serial() + unified legacy rebuild; db check cursor fix) - Railway: Dockerfile VOLUME removed, railway.toml (volumes, healthcheck, startCommand), API binds $PORT - CI deploy-check job: compose validation, fresh-PG migration smoke, API container health Maintenance/Release: - Single version source: pyproject.toml authoritative, VERSION file removed, settings.yaml synced, CI version-check job - release.yml: tag-triggered (version assertion, tests, wheel, GHCR image, GitHub Release) - SecretRotator wired into orchestrator lifecycle + status; order_events retention; rotating log files Docs: sprints/SPRINT_15.md, CHANGELOG Sprint 15 section
… dashboard, live-readiness, ops polish Layer 1 WP-3: API-key Auth/RBAC (require_read/operate/admin, /v1/auth/me, open-by-default) via infrastructure/auth.py + interfaces/api/security.py. Layer 2 WP-4: EventBroker + /v1/events SSE (event_stream generator), kill-switch alerting, Binance collector gating, server.reset_rate_limiter(). Layer 3 WP-1: static SPA dashboard mounted at /dashboard/ (root 307), packaged via setuptools package-data. Layer 4 WP-2: LiveReadinessService + GET /v1/live/check + workflow dry_run so operators rehearse controlled_live without live execution. Layer 5 WP-5: tests/conftest.py autouse rate-limiter reset makes the randomized full suite deterministic; lint/typecheck cleanup. Docs: sprints/SPRINT_16.md, CHANGELOG.md. Full suite: 1031 passed, 1 skipped; coverage 86.80%.
WP-2 Order surface: - BrokerAdapter ABC: place_stop_order, place_trailing_stop_order, modify_order - AlpacaBrokerAdapter: stop/trailing-stop placement + order modification - PaperBrokerAdapter: stateful positions, open orders, balance tracking - OrderStatus.MODIFIED; RateLimitedBroker pass-throughs WP-3 Service wiring: - BACKTEST mode now runs enabled strategies through BacktestingService with metrics recorded to the run manifest and backtest.complete events - Regime + breakout detection run each cycle, surfaced via cycle.analysis - Post-trade knowledge-graph nodes/edges + research observations recorded - Factory wires knowledge graph + research services (in-memory repos)
- GuardrailedBroker wraps the factory broker chain and rejects orders below TRADEROS_MIN_ORDER_QTY or above TRADEROS_MAX_ORDER_NOTIONAL before they reach the exchange (enabled by default; rejection counts toward kill switch) - Wire broker rate limiter into the factory broker chain - CORS now defaults to deny-all cross-origin; CORS_ORIGINS must be set explicitly (or '*') to allow browser access - Controlled-pilot runbook gains an order-size guardrail section
- 'traderos pilot readiness' runs the live-readiness gate (human/JSON), exits 0 only when ready - 'traderos pilot dry-run' rehearses the operator workflow end to end with dry_run=True; drives the state machine from its current step, skips strategy promotion (operator decision), stops at the first failing gate - CLI tests for both pilot subcommands; pilot readiness runbook
Adds sprints/SPRINT_17.md and the [Unreleased] Sprint 17 CHANGELOG section covering WP-2 order surface, WP-3 service wiring, WP-4 security hardening, and WP-5 pilot readiness.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Programme C (Commercial Surface) — Sprint 14. Turns TraderOS into a platform a human operator can run end-to-end, via an enforced workflow, a strategy catalog, a full operator REST API, and session reports.
OperatorWorkflow(10 canonical steps, strict ordering, re-run of current step) +OperatorSessionServicegating every step on a real check; transitions persisted viaOperatorWorkflowRepository(v006migration).StrategyCatalogService(seeded built-ins, versioned lifecycle, single promoted, clone/compare/review); execution loop consumes only enabled strategies./v1endpoints for positions, orders, trades, portfolio, equity-curve, pnl, kill-switch, preflight, readiness, workflow, strategies, lifecycle actions. Error semantics 400/404/409/501.SessionReportService(JSON + Markdown) +GET /v1/reports/session.docs/engineering/FINISH_LINE_DASHBOARD.md, README update,sprints/SPRINT_14.md, CHANGELOG.Gates
ruff check src/traderos— clean.pyright src/traderos— 0 errors (pinned 1.1.411).