Self-bootstrapping startup: zero ordered setup commands - #20
Merged
Conversation
The app now provisions itself on boot: before the runtime pool connects it orchestrates the existing idempotent scripts (provision → migrate → access → seed) as the admin role, then serves as the least-privilege oms_user. Instruments auto-sync from every credentialed broker in the background so the ~8-min option-chain fetch never blocks listening. A fresh checkout is now just `run the app` — no make commands in any order. Routing + identity gaps that "instruments only" would have left: - broker_connection is created at boot for every broker whose creds are present — it's routing config, not fixture data; without it a configured broker can't take an order. - dev identity chain (principal/account/portfolio/api-key) is created when OMS_DEV_IDENTITY=true, so a fresh install can place a paper order with no admin setup. Off by default (it mints a known API secret). Knobs: OMS_BOOTSTRAP (auto|off), OMS_SYNC_ON_BOOT (if-empty|never), OMS_SYNC_UNDERLYINGS, OMS_DEV_IDENTITY. Bootstrap skips gracefully when provisioning creds are incomplete, so it never breaks an already-working DB. preflight: an empty instrument catalog is expected (not fatal) when a background sync will fill it. Fixture split by ownership — minimal_seed.sql keeps master-data only; dev_identity.sql holds the oms-schema chain.
maxkuttner
force-pushed
the
feat/self-bootstrap-startup
branch
from
July 23, 2026 06:08
e89d67f to
0e8de27
Compare
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.
What
A fresh checkout is now just run the app — no ordered make commands. The app self-provisions on boot and auto-syncs instruments.
How
src/setup/bootstrap.rs) runs before the runtime pool connects: orchestrates the existing idempotent scripts (provision.sh→migrate.sh up→access.sh→seed.sh) as the admin role, then the app serves as least-privilegeoms_user. Reuses tested SQL rather than reimplementing psql meta-commands.broker_connectionauto-created at boot for every broker whose creds are present. This is routing config, not fixture data — without it a configured broker can't take an order. (This was the "no brokers" gap.)principal/account/portfolio/api-key) created whenOMS_DEV_IDENTITY=true, so a fresh install can place a paper order with no admin setup. Off by default — it mints a known API secret, PAPER/dev only.Safety
OMS_BOOTSTRAP=off— it only adds the fresh-install path, never turns a working DB into a broken one. The runtime pool is stilloms_user; only the bounded boot step touches admin creds (already in.env).preflight: an empty catalog is expected (not fatal) when a background sync will fill it.Knobs
OMS_BOOTSTRAP(auto|off) ·OMS_SYNC_ON_BOOT(if-empty|never) ·OMS_SYNC_UNDERLYINGS·OMS_DEV_IDENTITY(default false)Fixture split
By ownership:
minimal_seed.sql= master-data only (admin role);dev_identity.sql= the oms-schema identity chain (include_str!'d, run asoms_user).Verification
alpaca-paper+binance-paperconnections created, full dev identity chain, 14,161 instruments synced in background — server bound immediately. Zero make commands.OMS_BOOTSTRAP=off: skips, boots asoms_user.tsc+ build clean, clippy clean on new code. Scratch DBs dropped.Context
Grew out of researching how a runtime-load framework does setup (in-memory cache, one config, no seeding) — we keep the DB-backed model but remove the ordered-command friction.