Repository navigation
Description
Parent
SCOPE.md Part C (DG-O), atom O03: configuration, runbook and real-provider proof (ADR-0075 slice 9.3, §9.3 of the order of work). Closes T02 (its one-hour ETHUSDT proof, part 6, is this atom's proof). Design gate #504, registration #507. Requires O02 (merged, PR #524 / issue #523), T03, T04 (merged). Branch from implement/fid; the pull request targets implement/fid, never main.
Authority
ADR-0075 (§1 and §5 as built in O02; item 9.3; "Not claimed": the provider's exchange_ts ordering and the bounds are measured, not proven, by this proof) and its Amendment 1 (accepted); ADR-0074 (per-instrument unit template, capacity gate §6, T02 part 6); ADR-0043 §1 and §4 (loop, signals); ADR-0042 §5; ADR-0044 (unchanged). AGENTS.md governance boundary: no governance file is touched (the closeout is a separate governance issue).
Start gate
O02 merged (PR #524); O01 merged (PR #510); governance #507 and #518 merged; implement/fid contains main. SCOPE.md Part C row O03 reads "after O02 is merged".
Problem
O02 put the continuous session in the code behind LiveIngestServerConfigV1.continuous_session (default None): the CLI (tools/live_ingest_server.py), the two unit templates (infra/systemd/quant-platform-live-ingest.service, quant-platform-live-ingest@.service) and their env examples cannot enable it or set slice_seconds, slice_max_trades and the buffer bound, and the runbook says "in the code, not enabled". Nothing has run against the real provider: the ordering of the provider's exchange_ts, the ping policy, the real slice sizes and the captured share against the Bybit archive are assumptions (ADR-0075 "Not claimed"), and T02 part 6 (the one-hour ETHUSDT proof) is still open.
Objective
Make the continuous session operable (configuration, CLI, unit templates, runbook) and produce, from a real-provider run of at least one hour for ETHUSDT, a reproducible evidence report that states what was captured against the Bybit archive of the same day, what is readable through the DataGateway, how many ordering violations occurred and what the health signals said. The report states results; it does not hide a shortfall.
Design (configuration; no semantic decision beyond ADR-0075 and the accepted O02)
- CLI (
tools/live_ingest_server.py):--mode {cycles,continuous}(defaultcycles: the existing behaviour is unchanged);--slice-seconds,--slice-max-trades,--buffer-messages(defaults =LiveSessionConfigdefaults: 300, 50 000, 20 000), valid only with--mode continuous(argparse error otherwise: no silently ignored flag). The CLI only buildsLiveSessionConfigand passes it asLiveIngestServerConfigV1.continuous_session; it holds no ingest logic (C05). Invalid values (non-positive) are refused by the existingLiveSessionConfigvalidation, surfaced as a usage error.--max-cycleskeeps its meaning (health snapshots; in continuous mode one per published slice) and is documented as such. - Unit templates and env examples (BTC unit and the
@template):QP_LIVE_INGEST_MODE(defaultcyclesin both examples),QP_LIVE_INGEST_SLICE_SECONDS,QP_LIVE_INGEST_SLICE_MAX_TRADES,QP_LIVE_INGEST_BUFFER_MESSAGES, rendered intoExecStart. Existing env files that do not set them keep working (the units must not fail on an old env file: use systemd defaults or the CLI defaults, and say which). - Runbook (
docs/engineering/LIVE_INGEST_SERVER_DEPLOYMENT.md): replace "in the code, not enabled" with the operating steps (how to enable per instance, the three bounds, what the operator sees: interruption/gap/degraded signals, how to read the counters, rollback tocycles), and the proof procedure (below). Deployment of a changed server stays a manual operator step; nothing here installs or starts anything. - Proof tooling (read-only, no write to catalog or storage): a tool (e.g.
tools/live_window_evidence.py, name at the implementer's discretion within the mutation boundary) that, given an instrument, a UTC window, the Bybit archive file(s) of the day(s) the window touches, the catalog/storage the run wrote to, and the captured server stdout (thesignal ...lines), prints one JSON report and exits non-zero only on the stop conditions below:- archive trades in the window (by
trade_id) vs trades read through theDataGateway(real read path,strictcoverage over the window,VALID_ONLY): counts, the missing set (in archive, not read) and the extra set (read, not in archive), with the same equality oftrade_id, millisecond timestamp, side, price and size thattools/compare_archive_day.pyapplies; - the recorded interruptions and gaps (from the signals and the explicit gap records) with their spans, and for every missing archive trade whether it falls inside such a span;
- the number of
exchange_tsordering violations and of reconnects, the buffer high-water mark and capacity, the maximum slice lag, the number and size distribution of the published slices (partitions, rows), from the signals and the catalog; - the window, the unit/commit (
code_ref) and the configuration that ran.
- archive trades in the window (by
- The run (operator-executed, not part of CI; recorded in the PR as evidence):
ETHUSDT,--mode continuouswith the default bounds, at least one continuous hour against the real Bybit provider, on a disposable catalog and storage root (or a root chosen by the maintainer: this proof never touches theBTCUSDTdataset or its unit and enables nothing in production; the ADR-0074 §6 capacity gate stands). The archive of the day is available only after the day ends, so the report is generated after that (the PR can be updated with the evidence or the evidence can be attached by a follow-up commit/comment). The run is started and stopped (SIGTERM, a clean stop) by the maintainer; the agent does not start a real-provider run unless asked.
Mutation boundary
tools/live_ingest_server.py (flags and the construction of LiveSessionConfig only); application/live_ingest_server.py only if a config helper is needed (no behaviour change); infra/systemd/quant-platform-live-ingest.service, quant-platform-live-ingest@.service and their .env.example files; docs/engineering/LIVE_INGEST_SERVER_DEPLOYMENT.md; the evidence tool and its tests; the existing artifact/CLI tests (tests/test_live_ingest_server_cli_v1.py, tests/test_live_ingest_deployment_artifacts_v1.py, tests/test_live_ingest_template_artifacts_v1.py, tests/test_deployment_units_v1.py) extended; the new tests' CI wiring. Nothing else.
Forbidden: live_session.py, the assembler, the publication path, the checkpoint, the reconciliation, trade-v1, the ordering key, TradeKeyV1, dataset identities, ADRs, governance files, the cycle loop's behaviour and defaults, retention/cleanup code, the BTC unit's behaviour when its env file is unchanged, any deployment or production action.
Acceptance criteria
--mode cycles(or no flag) produces exactly the config of today (continuous_session is None) — the existing CLI and unit tests pass unchanged;--mode continuousbuilds aLiveSessionConfigwith the given bounds and defaults of 300 / 50 000 / 20 000.- A slice/buffer flag without
--mode continuousand any non-positive value are refused with a usage error (exit status 2) before any connection; no flag is silently ignored. - Both unit templates and both env examples carry the mode and the three bounds, render them into
ExecStart, and an env file that predates them still yields a valid command line (tested by the artifact tests); the@template still refusesBTCUSDT, builds the checkpoint from the instance and does not read the instrument from the environment. - The runbook describes enabling, the bounds, the signals and counters an operator sees, the rollback to
cycles, and the proof procedure, and no longer says the session is not enabled;python tools/check_markdown_links.pypasses. - The evidence tool, on a fixture (a small archive file, a published window through the real catalog/gateway test path, a captured signal log), reports the counts, the missing and extra sets, the interruption/gap spans and the missing-inside-span classification; it fails (non-zero) when an archive trade in the window is neither read nor inside a recorded interruption/gap span, and when a trade is read that the provider archive does not contain with a different payload (a conflict); it never writes to the catalog or to storage.
- Mutation checks: each rule above has a test that fails when the rule is weakened (flag validity, default mode, bounds propagation, env rendering, the stop conditions and the in-span classification of the tool).
- The real-provider proof, recorded as evidence in the PR (or attached after the archive of the day is published): ≥ 1 h of
ETHUSDT; the report with captured trades vs the archive of the same window, trades read through theDataGateway, ordering violations, reconnects/interruptions/gaps, buffer high-water, slice lag, slices published, and the signals' health summary. The numbers are reported as measured. Stop conditions (the issue is not closed as passed; report and wait for the maintainer): a missing archive trade outside any recorded interruption/gap span; a trade published that is not readable through the gateway; a conflicting payload against the archive; anexchange_tsordering violation is not a failure of the proof (it is a measurement the ADR asks for and an interruption by design) but its count and the consequent interruptions must be explained in the report. - Everything else is unchanged: the cycle loop, the BTC unit with an old env file,
T02parts 1 to 5, the ordering key,TradeKeyV1, identities.
Verification
python tools/run_tests.py; python tools/check_markdown_links.py; git diff --check; python tools/workflow.py preflight --base implement/fid; the PostgreSQL integration of the evidence tool on a disposable catalog if it reads through the real gateway (own CI job, as for O02); the operator's real run for criterion 7.
Out of scope
Changing the default mode of the CLI or of the BTC unit to continuous; deploying or restarting any unit; enabling any instrument in production (ADR-0074 §6); exposing ping_interval, pong_timeout, the reconnect backoff or recent_limit as configuration; consolidation of slices; the repair of damaged legacy days (DG-R); a second venue; the governance closeout (credit of T03, T02, O01 to O03 and the promotion PR), which are separate steps after this merge.
Risks, ambiguities and decisions to obtain before implementation
- Default mode. This issue keeps
cyclesas the default in the CLI, the env examples and the units (the ADR's "the default" is decided here conservatively: nothing changes for a host that does not opt in). Makingcontinuousthe default is a separate maintainer decision after the proof's numbers are known. [Confirm or redirect before implementation.] - Where the run executes. The proof needs a host with outbound access to Bybit and a catalog it may write to (disposable, or an ETHUSDT-only root). The maintainer chooses the host and starts the run; if it is the production server, enabling
ETHUSDTthere is bounded to the proof (ADR-0074 §6) and its data stays out of any other claim. - Archive availability. The archive of the day appears after the day ends: the report is produced after that, so criterion 7 may close a day or two after the code merges (the PR/issue records the evidence when it exists).
- Thin instrument.
O02waits for the first trade of a subscription before reconciling; on a quiet interval after a reconnect this delays the reconciliation (and a REST window behind the subscription becomes an explicit gap). The proof reports how often this happens; no behaviour change is proposed here. - The measurement may contradict an assumption (non-decreasing
exchange_ts; the bounds). A contradiction is a finding to report, not something this issue fixes silently; it may require an ADR amendment decided by the maintainer.
Atomicity check
One responsibility (make the continuous session operable and prove it on the real provider); justified by SCOPE.md Part C O03; no implicit dependency (O02 merged, closeout comes after); no semantic decision beyond ADR-0075 slice 9.3 (the default mode is flagged for confirmation); observable criteria with explicit stop conditions; reviewable as one slice (configuration + read-only evidence tool + runbook).
Activity
fix(data): O03 evidence declares a hole only by recorded evidence, ke…
fix(data): O03 evidence classifies each missing trade against the rec…
fix(data): O03 evidence classifies a hole's missing trades in linear …
github-actions commentedon Oct 25, 2026
Automatically closed by PR #526 merged into
implement/fid.