Repository navigation
QT desk: local simulator (sim/) - #136
Merged
Merged
Conversation
The real AlgoLens, the real engine (engine-rpc) and Postgres in Docker, on one clock that sim/simctl moves. libfaketime is preloaded in postgres, engine-rpc and the backend; all three read one offset from sim/clock/faketime.rc, so 09:29, 09:31 and 10:01 New York can be tested without waiting. Mailpit catches every e-mail. - sim/docker-compose.sim.yml, thin Dockerfiles adding libfaketime, an edge on :8080 with the production routes - sim/simctl (+ simctl.ps1): build, up, load, reset, save, clock, day, model-run, pass, status, mail, logs, psql - sim/snapshot.sh: read-only production snapshot over ssh (run by hand) - sim/seed: the sim users, and a synthetic fixture from trade-ngin's QT migrations for checking the stack without a snapshot - SIM_MODE=1 only: GET /api/sim and an App-level "SIMULATION" banner Claude-Session: https://claude.ai/code/session_01VCt4NHq2wcnzSiVtdabnEJ
…seed fixes - snapshot: the AlgoLens app role from the host's roles file; only the schemas and tables that login can read (pg_dump locks every table); the market data copied with \copy (SELECT *) as the engine's login, since TimescaleDB hypertables dump no rows from their parent; the definition of tables the first login cannot read (ohlcv_1d_raw). - load: restores schema-extra and every <schema>.<table>.csv.gz. - users seed: prod's auth.users has no unique email; replace the three sim users. - drop_from_day: tables without a date column use their timestamp in New York.
dominickdupuy
marked this pull request as ready for review
October 14, 2026 23:41
dominickdupuy
requested review from
colerottenberg,
jrile018,
patrickbott,
raohemdutt and
ry2009
as code owners
October 14, 2026 23:41
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.
A local simulator for the QT desk: the real AlgoLens, the real engine (
engine-rpcand the C++ binary it spawns) and Postgres in Docker, on one clock you can move. It answers "what happens at 09:29, 09:31, 10:01 New York" without waiting. Everything is undersim/;sim/README.mdis the guide.What is in it
sim/docker-compose.sim.yml: postgres:16, Mailpit, engine-rpc (ENGINE_IMAGE, defaulttrade-ngin:rpc-0b9dbf6e), the AlgoLens backend and frontend built from the checked-out branch, and an edge on http://localhost:8080 that mountsdeployment/edge-routes.conf.sim/clock/faketime.rc. An offset is used instead of@YYYY-MM-DD HH:MM:SS, because@restarts the clock in every new process, including each engine run the desk service spawns.sim/simctl(+simctl.ps1):build,up,down,load <snapshot|synthetic>,reset(from a template DB),save,clock HH:MM/+5m,day,model-run,pass(one scheduler pass),status,mail,logs,psql.sim/snapshot.sh: a read-only production snapshot over ssh (pg_dump and\copy ... TO STDOUT, streamed back; nothing is written on the server). It is never run by tooling; Dom runs it.sim/seed/users.sql:qt@,vp@,president@sim.local, passwordsim, screens member+qt.sim/seed/synthetic.sql: trade-ngin's QT migrations (021-029, read from the engine image) plus one seeded QT day, for checking the stack without a snapshot.SIM_MODE=1the backend registersGET /api/sim, andApp.tsxrenders a fixed "SIMULATION — clock ... New York" banner. Without that flag the route is absent (404), so the banner never shows. Covered bytests/test_sim_mode.pyandsrc/domain/sim/simClock.test.ts. It does not touchcomponents/qt/*orapplication/qt/*.Verified locally (synthetic fixture)
clock 09:29:datein postgres, engine-rpc and backend, andclock_timestamp()in Postgres, all read 2026-10-15 13:29:42 UTC, within 0.25 s of each other. Real time was 2026-10-14 20:30.qt@sim.localwithPOST /auth/loginthrough the edge, thenGET /portfolio/desk/QT_CONSERVATIVE_PORTFOLIO(cookie +X-CSRF-TOKEN).serverTimewas2026-10-15T13:29:02ZandapprovalClosedfalse. At 09:31 it was still false. At 10:01 it was true, andPOST .../publishreturned 409 "Approval of the 2026-10-15 book closed at 10:00 New York".2026-10-15 10:01:59. On synthetic data that run fails, as expected, and the president's alert landed in Mailpit (STARTTLS + login). Ansmtplibtest mail from the engine container also arrived.Not verified: real engine runs (model run, approval, send, fallback) need the production snapshot.
🤖 Generated with Claude Code
https://claude.ai/code/session_01VCt4NHq2wcnzSiVtdabnEJ