Commit Graph

36 Commits

Author SHA1 Message Date
d067bea22d docs: add CODEX_RESUME_PROMPT.md for agent hand-off
Self-contained brief that any coding agent (Codex, Claude, Gemini, etc.)
running on this machine can paste in to resume the redesign+audit work.

Covers, in order:
  - Required reads (the 4 source-of-truth docs in both repos)
  - Environment setup (source ~/.zshrc for GITEA_NPM_TOKEN)
  - Verification gates per repo (must run before AND after every change)
  - 12-item priority queue with effort estimates, top to bottom
  - Commit conventions (subject `<type>(<id>):`, audit-doc tick, model
    Co-Authored-By line)
  - Six explicit "do not" rules (don't commit incidental lockfile
    regens, don't touch nomgap WIP, don't skip gates, don't bulk-fix
    platform lint, don't push --force, etc.)
  - When-to-stop-and-ask criteria so the agent doesn't guess on
    ambiguous specs or break public API surfaces

Bottom of the file has a short copy-paste prompt that points back at
this doc, so the human just pastes 7 lines into Codex and the agent
self-bootstraps from the full brief.

Refs: docs/HANDOVER.md, docs/AUDIT_REDESIGN.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 14:36:54 -07:00
372b83820f docs: add HANDOVER.md for the next contributor
Self-contained hand-off note covering:
  - Current health snapshot (build/typecheck/test status, with the
    4 known pre-existing test failures called out so they aren't
    misread as regressions)
  - Critical lockfile situation (web deps in package.json but not
    in root pnpm-lock.yaml — needs `pnpm install -r` from a machine
    with GITEA_NPM_TOKEN; tracked as audit item E2)
  - Audit doc reference (docs/AUDIT_REDESIGN.md, 52 items, the 5
    cleared so far + 47 still open)
  - Suggested priority order: E2 lockfile → B1 chart indicators →
    B2/B3 ticker header → C1 strategy code sandboxing → C2 FMP cache
    → F6 backend tests → G mobile parity
  - Backup-branch reference for emergency rollback
  - Note on vendored @bytelyst/* packages and the Vite alias resolver

Companion HANDOVER.md exists in the sibling learning_ai_common_plat
repo for the platform-side audit pushed in that repo's commit 8f541c9.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 14:24:02 -07:00
255bb070a3 chore(audit-E2): stop stray subpackage lockfiles from coming back
Partial fix for the lockfile drift caught in the audit. The previous
session ran `npm install` inside web/ as a workaround for a Vite vendor-
resolution issue, which left three lockfiles in the wrong places:
  - web/package-lock.json  (npm artifact in a pnpm monorepo)
  - web/pnpm-lock.yaml     (per-package pnpm lockfile, also wrong)
  - backend/pnpm-lock.yaml (same issue)

This commit:
  - Deletes those three files from the working tree.
  - Adds .gitignore entries so they can't be re-committed by accident.
  - Also gitignores .claude/ (Claude Code session metadata).

What's still missing: the root pnpm-lock.yaml needs `react-router-dom`,
`@monaco-editor/react`, `@dnd-kit/{core,sortable,utilities}` added to
its resolution graph. That requires `pnpm install -r --no-frozen-lockfile`
from the repo root on a workstation with GITEA_NPM_TOKEN exported (the
mobile workspace pulls @bytelyst/* private packages from the org's
private registry; this session has no token so the install errors out
on the mobile resolve). It's a one-line follow-up — tracked in
AUDIT_REDESIGN.md item E2.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 06:25:31 -07:00
ddbffb6cd1 fix(audit-A): repair the 5 critical broken integrations
A1+A2 — CodeStrategyEditor backtest call
  Was: POST /api/backtest with { symbol, strategyCode, mode: 'code' }
  Now: POST /api/backtest/run with { symbols: [s], strategyConfig: {
       type: 'code', language: 'javascript', code } }
  The backend route is /api/backtest/run (not /api/backtest), and
  /api/backtest/run validates `symbols[]` and `strategyConfig`, not the
  ad-hoc fields we were sending. Also unwraps the { success, results }
  envelope the engine returns and surfaces success:false errors.

A3 — VisualRuleBuilder save shape
  Was: hand-rolled fetch to /api/profiles with { name, symbol, strategyType,
       visualRules, description } — backend's saveTradeProfileForUser ignored
       all of that and either 400'd or persisted a half-empty row.
  Now: uses the canonical createTradeProfile() helper from lib/profileApi
       with the documented TradeProfilePayload shape. Visual rules go inside
       strategy_config.{type:'visual', version:1, rules:[...]} so the engine
       can fan out to a visual interpreter without conflicting with the
       existing rule-based engine. Allocated capital + risk pct pulled from
       botState.settings so the profile inherits the user's current sizing.
       is_active defaults false so the user activates explicitly.

A4+A5 — RightPanel.NewsFeed auth + runtime
  Was: raw fetch() to import.meta.env.VITE_TRADING_API_URL with no
       Authorization header → 401 on every render in any environment that
       requires auth, and prod-broken where the runtime resolver is the
       only source of truth for the API base URL.
  Now: uses fetchNews() from lib/marketApi which already carries the
       platform Bearer token and routes through tradingRuntime.tradingApiUrl.
       Adds an error state in the UI for visibility instead of silently
       leaving the panel blank.

Verified: web/ tsc --noEmit passes. No behavioural change to non-affected
code paths (RightPanel portfolio summary, ResearchView other tabs, etc.).

Refs: docs/AUDIT_REDESIGN.md items A1–A5.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 06:23:52 -07:00
4a09d4ba26 docs: add post-redesign systematic audit (52 items across 7 buckets)
Catalogues every gap, bug, and miss found in the web redesign work:
- A: critical broken integrations (wrong endpoint, wrong payload, missing auth)
- B: functional gaps from the original plan (chart indicators, watchlist
  buttons, company name placeholder, etc.)
- C: security & correctness (sandboxing, FMP cache, query-param leakage)
- D: UX/UI polish (skeletons, dark-tab contrast, responsive breakpoints)
- E: build/infra (1 MB bundle, lockfile drift, Monaco workers, README)
- F: test coverage (zero tests for marketApi, builders, screener, endpoints)
- G: mobile parity (none of the new features exist on mobile)

Each row has a severity tag, status box, and a slot for the fix-commit hash.
Subsequent commits will reference items by ID (e.g. fix(A1): ...).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 06:21:30 -07:00
d955d00c00 feat(contracts): shared socket namespaces, tab flags, cutover docs, README
- shared/realtime.ts: add SOCKET_NAMESPACES constants (/trading, /admin, root)
- shared/feature-flags.ts: add tabs.marketplace and tabs.membership to
  TradingFeatureFlagsResponse; add FEATURE_FLAG_KEYS constants
- .env.example: remove /api suffix from VITE/NEXT_PUBLIC trading URL vars
  (web appends /api itself); add tab visibility flag vars with comments
- web: add useTabFeatureFlags hook + DOM test; wire tab visibility into App.tsx
- web/vite.config.ts: finalize build config
- mobile/providers/TradingDataProvider.tsx: deriveSocketParams for proxy-safe
  socket origin/path resolution (already landed upstream, conflict resolved)
- docs: add CUTOVER_WEB.md, CUTOVER_MOBILE.md checklists; update OPERATIONS.md
  with Docker commands and resolved gap log; update ROADMAP.md to Done;
  add BACKEND_AUDIT_SCHEMA.md, BACKEND_API_DEPRECATION.md, CONVENTIONS.md;
  add audit-events container entry to AZURE_INFRASTRUCTURE.md
- README.md: full rewrite with workspace table, arch summary, env var reference

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-29 19:35:53 -04:00
4cfb446f57 feat(backend): WebSocket namespaces, audit persistence, tab flags, telemetry
- Add /trading and /admin named Socket.IO namespaces; root namespace kept for
  backward compat; admin namespace rejects non-admins at connect time
- Wire auditRepository.ts: persist TradeAuditEvent to Cosmos audit-events
  container (best-effort); expose GET /api/admin/audit for admin queries
- Add tradingTelemetry singleton (Node.js Map-based storage adapter); init
  and fatal-error tracking wired in index.ts main()
- Add TAB_MARKETPLACE_ENABLED / TAB_MEMBERSHIP_ENABLED config flags; expose
  tabs.* shape in GET /api/feature-flags response
- Fix SupabaseService URL validation (regex check before createClient)
- Wire check:api-contract and check:audit-repository into npm run test
- Switch @bytelyst/* deps to file:../vendor/* references

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-29 19:35:00 -04:00
a256571480 docs(azure): mark KV wiring and AzureOpenAI items complete in audit log
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-05 18:29:13 -07:00
bb59b918d6 docs(azure): add infrastructure audit doc for invttrdg Azure resources
Records Cosmos DB setup (12 containers), Azure OpenAI deployments (gpt-4o,
gpt-4o-mini), Key Vault secrets, and pending work items.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-05 13:18:38 -07:00
bcb6bf4d71 docs(roadmap): mark root backend script legacy Supabase audit done
Made-with: Cursor
2026-04-04 20:47:43 -07:00
ac5d91c9ef docs: list backend root scripts still importing SupabaseService
Made-with: Cursor
2026-04-04 20:44:26 -07:00
eb70ef6c03 docs(roadmap): sync snapshot with legacy access and contract cleanup
Made-with: Cursor
2026-04-04 20:34:23 -07:00
b4d312ce74 refactor: remove dynamic config legacy fallback 2026-04-04 18:13:41 -07:00
5bba149a7b refactor: share feature flag contract across backend and web 2026-04-04 18:10:34 -07:00
d99cb94d19 feat: standardize request ids across operator flows 2026-04-04 18:07:43 -07:00
ffa60fcfb7 refactor: remove live web supabase dependency 2026-04-04 18:03:49 -07:00
f73f855eb0 fix: align web verification with platform session contracts 2026-04-04 18:00:30 -07:00
5d3be081ee refactor: move runtime trading records to cosmos 2026-04-04 17:48:49 -07:00
e043f3c79d refactor: move user metadata and presets onto cosmos paths 2026-04-04 17:24:55 -07:00
0baf32bfcf feat: add explicit feature flag contract 2026-04-04 17:18:20 -07:00
77c7b32ac0 refactor: seed cosmos stores and standardize request ids 2026-04-04 17:16:18 -07:00
790213513f test: add release smoke coverage and runbook 2026-04-04 17:07:48 -07:00
560c95a599 refactor: move capital ledger to cosmos-first repository 2026-04-04 16:37:54 -07:00
5685cb3449 docs: add operations runbook and refresh roadmap status 2026-04-04 14:36:41 -07:00
d78aeeffc2 feat: adopt platform auth and cosmos trading control 2026-04-04 13:13:08 -07:00
8f7d5358aa refactor: share realtime socket auth helpers 2026-04-04 12:11:43 -07:00
e1bb6e790e feat: surface mobile degraded state 2026-04-04 11:57:47 -07:00
4cdff95c26 feat: harden mobile session storage 2026-04-04 11:53:44 -07:00
856a683f18 feat: add mobile telemetry capture 2026-04-04 11:45:10 -07:00
c9aadfae8e feat: add mobile websocket sync 2026-04-04 11:39:47 -07:00
0d9654e742 feat: add mobile live trading integration 2026-04-04 11:33:11 -07:00
3cbbd6ccaa feat: scaffold trading monorepo foundation 2026-04-04 11:18:21 -07:00
30551b876b docs: convert roadmap into execution tracker 2026-04-04 02:32:17 -07:00
c747fe82fe docs: clarify mobile v1 scope and trading control ownership 2026-04-04 02:28:21 -07:00
401671a5eb docs: strengthen trading monorepo prd and roadmap 2026-04-04 01:51:38 -07:00
abcac4fa5a docs: add trading monorepo prd and roadmap 2026-04-04 01:38:43 -07:00