Commit Graph

224 Commits

Author SHA1 Message Date
Celes Renata f4ccc8cbea ci: trigger woodpecker pipeline test 2026-04-18 20:14:33 +00:00
Celes Renata afcfde0ac2 perf: custom DinD template with 4 CPU/4Gi per runner + anti-affinity to spread across nodes 2026-04-18 10:25:33 +00:00
Celes Renata 886c9831c3 fix: pass GHCR_TOKEN to integration-test for image pull auth + add packages:read permission 2026-04-18 10:12:48 +00:00
Celes Renata 458e289cbf fix: install envsubst and python deps for integration-test runner 2026-04-18 05:14:35 +00:00
Celes Renata 32a3dc85e3 fix: use sudo for kubectl/helm install in integration-test runner 2026-04-18 04:48:12 +00:00
Celes Renata 0ed7ecbd65 fix: add kubectl/helm install + RBAC for integration-test CI job
- Install kubectl and helm in integration-test runner (DinD image lacks them)
- Configure kubectl with in-cluster service account credentials
- Add ClusterRoleBinding for runner SA to create inttest namespaces
- Add runner-rbac.yaml to runmefirst.sh install sequence
2026-04-18 04:31:43 +00:00
Celes Renata 7a0e26c77b fix: remove template override from ARC runner-scaleset — let chart manage DinD pod spec 2026-04-18 04:17:25 +00:00
Celes Renata 3b9f3d2ce6 ci: trigger pipeline test with DinD runner mode 2026-04-18 04:08:04 +00:00
Celes Renata c85c0068a2 fix: clean up utcnow deprecation warnings, fix 12 failing tests, add CI/CD pipeline manifests
- Replace all datetime.utcnow() with datetime.now(tz=timezone.utc) across 8 files
- Fix 12 failing tests to match current implementation behavior
- Fix pytest_plugins in non-top-level conftest (moved to root conftest.py)
- Auto-fix 189 lint issues (import sorting, unused imports)
- Add CI/CD pipeline infrastructure (ARC, ArgoCD, Kargo manifests)
- Add values-beta.yaml and values-paper.yaml for staged deployments
- Update GitHub Actions workflow to use self-hosted-gremlin runners
- Add integration-test job to CI pipeline

Result: 1596 passed, 0 failed, 0 warnings
2026-04-18 03:59:28 +00:00
Celes Renata 40227a4eb2 spec: integration test pipeline — requirements, design, and tasks 2026-04-18 00:12:49 +00:00
Celes Renata ee5fd30398 fix: backtest force-closes open positions at end + uses real market prices for exits 2026-04-18 00:03:51 +00:00
Celes Renata 6136a767da docs: add Windows Docker Desktop local dev setup guide 2026-04-17 23:47:51 +00:00
Celes Renata 82da8af02b fix: dedup recommendation queue at aggregation level — prevent duplicate ticker+window flooding 2026-04-17 22:11:59 +00:00
Celes Renata a6189fce6b fix: skip LLM thesis rewrite for informational/suppressed recs to prevent queue buildup 2026-04-17 19:29:41 +00:00
Celes Renata 7736554988 fix: recommendation worker now respects thesis-rewriter active=false toggle 2026-04-17 19:22:31 +00:00
Celes Renata d8f1b615c8 fix: add order status sync loop to broker adapter — pending orders now update to filled/cancelled 2026-04-17 17:38:10 +00:00
Celes Renata 7a541aa693 fix: trend_windows.id missing gen_random_uuid() default 2026-04-17 17:27:41 +00:00
Celes Renata 84b3c06b2f fix: sync agent DB prompts with code defaults + update model to qwen3.5:9b-fast 2026-04-17 17:12:09 +00:00
Celes Renata aa67523acd fix: ensure JSON output instruction in system prompt override + retry on ValueError 2026-04-17 17:03:58 +00:00
Celes Renata 523d3ea749 fix: catch ValueError in classification retry loop + add debug logging for raw output 2026-04-17 17:00:32 +00:00
Celes Renata f054e97b5b fix: event classifier unwraps single-element list from model output
Model sometimes returns [{...}] instead of {...}. Now unwraps
single-element lists before parsing the event fields.
2026-04-17 16:44:57 +00:00
Celes Renata 630837070a chore: add ruff lint to steering docs and auto-lint hook
- Steering: emphasize running ruff before committing Python changes
- Hook: auto-runs ruff check --fix on services/**/*.py when files are edited
2026-04-17 16:38:54 +00:00
Celes Renata 76ff7ae00a fix: ruff import sort order 2026-04-17 16:37:30 +00:00
Celes Renata 1394e6168b fix: event classifier now strips markdown fences and repairs JSON
_parse_classification_response receives raw model output (with thinking
tags, markdown fences, etc.) but was calling json.loads directly.
Now uses _strip_markdown_fences + _repair_json from the client module
before parsing, matching what _call_ollama does for extractions.
2026-04-17 16:35:13 +00:00
Celes Renata 759d868e3b fix: event classifier was blocked by extraction schema validation
_call_ollama validates against the document extraction schema, which
doesn't match event classification output. The event classifier was
checking 'if attempt.error is None' before trying its own parsing,
so it never got to parse the valid event JSON — 956 consecutive
failures.

Now tries _parse_classification_response whenever raw_output exists,
regardless of the extraction validation error.
2026-04-17 16:28:39 +00:00
Celes Renata 678072e96b fix: build Redis URL from REDIS_HOST/PORT/PASSWORD/DB env vars
Redis uses separate env vars, not a single REDIS_URL. Script now
builds the connection string from REDIS_HOST, REDIS_PORT, REDIS_DB,
and REDIS_PASSWORD — matching how services/shared/config.py does it.
2026-04-17 08:21:16 +00:00
Celes Renata 06e1e7ea0f fix: reclassify script reads DB/Redis creds from pod env vars
No more hardcoded passwords — pulls POSTGRES_HOST, POSTGRES_USER,
POSTGRES_PASSWORD, POSTGRES_DB, and REDIS_URL from the pod's
environment (injected by k8s secrets).
2026-04-17 08:19:23 +00:00
Celes Renata 9c4118c0e7 fix: force-recreate GHCR pull secret on every deploy
The repo is now private (BSL license), so pods need valid GHCR
credentials to pull images. runmefirst.sh now:
- Verifies the token can authenticate with GHCR
- Force-recreates the ghcr-credentials secret before Helm deploy
- Warns if the token is expired or missing scopes
2026-04-17 08:10:34 +00:00
Celes Renata 1842b2039c ops: add SQL query test script and macro reclassify/reaggregate runner
- scripts/test_saved_queries.py: tests all 24 saved SQL explorer queries
  against the live Trino API (all 24 pass)
- scripts/run_reclassify_and_reaggregate.sh: self-contained script to
  re-classify macro events with updated prompts and re-aggregate all
  tickers. Scales aggregation to 16 pods, monitors queues, scales back.
2026-04-17 08:03:14 +00:00
Celes Renata 98de4ee7c9 chore: add BSL 1.1 license and copyright notice
Licensed under Business Source License 1.1.
Copyright (c) 2025-2026 Celes Hillyerd. All rights reserved.
Production use requires written approval from the author.
Change Date: 2030-04-17 (converts to GPL v2+ after that).
2026-04-17 07:45:30 +00:00
Celes Renata c5b7bddadb fix: backfill recommendation evidence for existing recommendations
Migration 028: For each recommendation with no evidence rows, finds
the closest matching trend_window (by ticker + time_horizon + timestamp)
and re-inserts evidence from top_supporting/opposing_evidence arrays.
Filters out non-UUID pattern IDs and verifies documents exist.

This fixes 'No evidence linked' on recommendations created before the
UUID filtering fix in persist_recommendation.
2026-04-17 07:37:14 +00:00
Celes Renata 5efccb1e03 fix: deduplicate evidence refs in trend summaries
Backend: assemble_trend_with_evidence now deduplicates document IDs
via dict.fromkeys() (the rollup code already did this, but the base
assembly didn't — same doc could appear multiple times from different
intelligence extractions).

Frontend: Trends.tsx deduplicates via Set before rendering as a safety
net for existing data already stored with duplicates.
2026-04-17 07:25:32 +00:00
Celes Renata d243142705 fix: trend evidence shows document titles instead of truncated UUIDs
- EvidenceRef component now fetches document details via useDocument()
  hook and displays the title instead of 'doc:43156423…'
- TanStack Query deduplicates and caches lookups for repeated doc IDs
- Pattern IDs still render as before (e.g. 'pattern META other (1d)')
- Override Trade button changed from brand-600 to red-600
2026-04-17 07:18:41 +00:00
Celes Renata e53b9fc1bf fix: macro tab MSW mock returns wrong response shape
The handler for /api/macro/impacts/:ticker was returning the impacts
array directly instead of { exposure_profile, impacts }. The frontend
destructures macroData.impacts which was undefined, falling back to
an empty array — so the Macro tab always showed 'No active macro impacts'
even with mock data present.
2026-04-17 07:14:50 +00:00
Celes Renata 419cf7558a fix: evidence articles missing on recommendations + Lucide title prop CI failure
- recommendation worker: filter out non-UUID document IDs (synthetic
  pattern:* IDs from competitive signals) before inserting into
  recommendation_evidence table — the uuid cast was failing and
  silently dropping all evidence rows
- wrap executemany in try/except so partial failures don't lose all evidence
- SqlExplorer: wrap Lucide icons in <span title=...> instead of passing
  title prop directly (not supported by lucide-react, broke CI build)
2026-04-17 07:10:21 +00:00
Celes Renata 913fe8b0b3 feat: override trade tab — manual order entry with auto-registration
Backend:
- OverrideOrderRequest/Response Pydantic models with ticker, quantity, price validators
- POST /api/trading/override/order endpoint (enqueue to Redis broker queue)
- auto_register_symbol() module for untracked ticker registration via Symbol Registry
- Unit tests (17) and property-based tests (3 x 100 examples)

Frontend:
- OverrideTradePanel component (order form + positions display)
- Override tab in TradingEngine page with URL search param navigation
- Override Trade button on Trading Controls page
- useSubmitOverrideOrder mutation hook
- MSW handler and 13 component/integration tests

Steering:
- Updated steering docs for Ubuntu dev machine with nvm/Node 24
2026-04-17 07:02:30 +00:00
Celes Renata 7f67725ec8 fix: mock handler returns 'impacts' to match frontend GlobalEventDetail type 2026-04-17 06:25:05 +00:00
Celes Renata cbe3fbe8b4 feat: enrich SQL explorer schema browser with PK/FK, row counts, search, collapsible tables 2026-04-17 06:22:04 +00:00
Celes Renata bbf7a6ee7b fix: sort imports in api/app.py to fix ruff lint 2026-04-17 06:19:03 +00:00
Celes Renata b149f70507 fix: operator approval workflow — add approval toggle, lockout CRUD, and PBT tests
- Add GET/PUT /api/admin/trading/approval-config endpoints
- Add POST/DELETE /api/admin/trading/lockouts endpoints
- Add useApprovalConfig, useUpdateApprovalConfig, useCreateLockout, useDeleteLockout hooks
- Add Paper Order Approval toggle card with confirmation dialog
- Add lockout creation form and delete button to Active Lockouts card
- Add MSW handlers for all new endpoints
- Add property-based tests for bug condition exploration and preservation
2026-04-17 06:14:46 +00:00
Celes Renata 3b7ded37cc fix: global event detail returns 'impacts' field to match frontend type
API was returning 'affected_companies' but frontend GlobalEventDetail
type expects 'impacts'. Renamed the response field.
2026-04-17 05:30:36 +00:00
Celes Renata bb3060c3b7 fix: render trend evidence as readable labels instead of raw UUIDs
- Pattern IDs (pattern:META:other:1d) shown as 'pattern META other (1d)'
- Document UUIDs shown as clickable 'doc:43156423…' links to document detail
- Unknown formats shown truncated as fallback
2026-04-17 05:29:00 +00:00
Celes Renata 62769c9b7e fix: macro impacts API returns {exposure_profile, impacts} to match frontend type
API was returning a flat array but frontend expects CompanyMacroImpacts
wrapper with exposure_profile and impacts fields. Also queries the
exposure_profiles table for the company's active profile.
2026-04-17 05:26:08 +00:00
Celes Renata d712d6b118 chore: gitignore .hypothesis/ cache directory 2026-04-17 05:16:47 +00:00
Celes Renata 7c23c044d7 feat: agent variants — migration, API, service integration, frontend, tests
- Migration 027: agent_variants table with single-active enforcement,
  variant_id column on agent_performance_log
- API: full CRUD, clone from agent/variant, activate/deactivate,
  per-variant performance metrics and history endpoints
- Services: extractor, event classifier, thesis rewriter all wired
  to AgentConfigResolver with variant override support
- Frontend: variant list, comparison view, create/edit/clone forms,
  activate/delete actions on Agents page
- Tests: API tests + 5 property-based tests (single-active invariant,
  clone preservation, config resolution, slug determinism, update idempotence)
- Spec files for agent-variants feature
2026-04-17 05:15:42 +00:00
Celes Renata 734bf001a7 feat: risk tier selector on Trading page + confidence filter on Recommendations
- Trading page: added conservative/moderate/aggressive selector that
  updates the trading engine config via PUT /api/trading/config
- Recommendations page: added risk tier dropdown that defaults to the
  engine's current tier and filters recs by the tier's min_confidence
- Backend: added min_confidence query param to GET /api/recommendations
- Risk tier thresholds: conservative ≥0.75, moderate ≥0.55, aggressive ≥0.40
2026-04-17 05:08:54 +00:00
Celes Renata 49e3955fab fix: add missing agent_config.py — was untracked, causing extractor crash in cluster 2026-04-17 04:41:58 +00:00
Celes Renata 0f06cf8971 docs: update README, runbook, and steering files for today's changes
- README: added AI agent management section, updated paper trading
  description (no manual capital controls, broker-synced reset)
- Steering: migration numbers updated to 027 (next: 028), added
  trading engine endpoint, ruff pinning and isort config notes
- Runbook: already had reset/Alpaca sections from earlier commits
2026-04-17 04:37:44 +00:00
Celes Renata fde819ec09 docs: update README and runbook for broker-synced reset, confidence dampener, paper account workflow 2026-04-17 04:32:49 +00:00
Celes Renata fd862da29e fix: remove broken capital controls, reset now queries broker for real balance
- Removed PUT /api/trading/capital (set capital) — only touched in-memory state
- Removed POST /api/trading/capital/adjust (add/withdraw) — same problem
- Reset endpoint now: liquidates Alpaca positions, cancels orders, clears DB,
  then queries Alpaca for real portfolio_value to set engine capital
- Frontend: replaced CapitalCard with simple ResetCard (one button)
- Removed useSetTradingCapital and useAdjustCapital hooks
2026-04-17 04:24:10 +00:00