unrip/test/history-writer-static.test.mjs
philipp 348c4f9b0b
All checks were successful
deploy / deploy (push) Successful in 47s
Batch durable history writes
Proof: History-writer now writes routed event batches with one bulk insert per table, preserving decision and normalized quote history while reducing Kafka lag that delayed durable strategy decision rows.

Assumptions: Kafka message order within a topic partition remains sufficient for durability; environment status events keep their dedicated dedupe path; this change does not alter strategy, edge, notional, inventory, arming, or relay submission behavior.

Still fake: Venue-native terminal fill ids and fee-complete realized PnL remain unavailable; historical decision rows can still lag until the deployed batch writer drains existing backlog.
2026-05-19 15:53:52 +02:00

18 lines
853 B
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
const source = readFileSync(new URL('../src/apps/history-writer.mjs', import.meta.url), 'utf8');
test('history writer replays durable topics but joins the raw quote firehose live', () => {
assert.match(source, /fromBeginning:\s*topic !== config\.kafkaTopicRawNearIntentsQuote/);
assert.match(source, /Raw quote volume is a live firehose/);
assert.match(source, /eachBatch/);
assert.match(source, /insertHistoryEvents/);
});
test('history writer passes tracked assets into portfolio valuation', () => {
assert.match(source, /trackedAssets:\s*tradingConfig\.trackedAssets/);
assert.match(source, /valuationAssets:\s*inputs\.valuationAssets \|\| \[\]/);
assert.match(source, /inputs\.valuationAssets[\s\S]+asset\.priceId/);
});