Skip to content

feat(console-api): inbox, account drafts and performance contracts - #669

Merged
Pigbibi merged 2 commits into
mainfrom
feat/console-api-contracts
Oct 15, 2026
Merged

Pigbibi merged 2 commits into
mainfrom
feat/console-api-contracts

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Add stable backend contracts for the console inbox, account drafts and performance reads. Keep the existing UI and save routes compatible.

Why

A console frontend needs structured differences, stored history and explicit data availability without interpreting technical evidence or treating missing financial data as zero.

Changes

Endpoints Behavior
GET /api/decisions-inbox Categorized, prioritized, deduplicated display projection with structured differences
GET /api/owner-decisions/history Paginated stored human intent history with actor aliases and evidence fingerprints
GET /api/accounts Draft/decision counts and latest stored change time
GET /api/account-settings/diff, GET /api/account-settings/history Effective-versus-draft rows and existing stored save/approval history
POST /api/account-settings/draft Atomic combined draft save using existing identity/revision checks and HTTP 409 behavior
GET /api/performance/calendar, /summary, /returns, /assets, /holdings, /trades Stored-data statistics with status, coverage and stable reason codes

Contracts: web/strategy-switch-console/frontend/src/api/contracts.ts and web/strategy-switch-console/contracts/console-api.schema.json. Reference: docs/console-api.md and docs/console-performance-charts.md.

Move the existing chart calculations into a shared Worker/frontend module, preserving the frontend import path and bundle output. Extend the loopback synthetic demo with every endpoint and ready, empty, partial, stale, not-connected, read-failed and conflict scenarios. No runtime dependency is added.

Stored source Available data Limits
LongBridge, IBKR, Schwab, Firstrade Existing daily account snapshots Complete external cash flows absent; values are asset changes, qualified TWR/drawdown unavailable
Binance Existing USDT wallet history Complete external cash flows absent
IBKR / Schwab positions Current scoped positions, optional average cost Unrealized P/L only where cost exists; no period attribution
Console fills Not connected Trade stats return no numbers
Settings history Existing bounded save log and profile approvals Effect-verification event source unavailable
Mixed native currencies Separate percentage curves No aggregate amount or implied combined portfolio return

Testing

  • Frontend TypeScript/build, existing operations/performance suites and generated-asset parity passed.
  • All 56 Node validation commands from the Validate workflow passed, including the corrected fixture-format rerun.
  • New schema, pure statistics and real Worker tests passed, including atomic rollback, concurrent 200/409 outcomes, origin/admin denial and legacy-save compatibility.
  • Synthetic HTTP demo passed 84 endpoint/scenario checks.
  • All 698 Python unit tests completed successfully (10 expected skips) using a job-local GNU Bash runtime; actionlint, configuration checks and whitespace validation passed.
  • Pinned IBKR/Schwab producer fixture regeneration was deterministic and the offline receiver roundtrip passed.

Risk and rollback

Changes are additive backend projections and a draft-only save alias. Existing read routes, exact receipts and four UI saves remain supported. Revert this change to remove the new contracts.

No trading, strategy, risk, RECONCILE_ONLY, unknown-result guard, secret, IAM, permission or authentication behavior was changed. No real account/market data are committed, no financial values are fabricated, and no new upstream source is called. There are no batch actions. Production verification is read-only.

Breaking changes

None.

Pigbibi and others added 2 commits October 15, 2026 12:56
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant