unrip/test/executor-queue-delay.test.mjs
philipp ddd3dfb9e2
All checks were successful
deploy / deploy (push) Successful in 58s
Remove verifier salt refresh from executor hot path
Proof: quote-response execution now uses verifierSaltCache.getCachedFreshSalt() only, rejects verifier_salt_unavailable before signing or relay when no fresh cached salt exists, preserves stale command expiry before salt lookup, exposes salt cache and executor queue-delay state in health/sentinel/dashboard surfaces, and is covered by targeted regression tests plus full npm test and dashboard build.

Assumptions: the existing verifier salt freshness policy remains safe for cached signing use; fixed in-code queue-delay warning thresholds are sufficient for operator alerts without new latency env vars; no strategy selection, pricing, edge, notional, inventory, arming, signer, or pair enablement behavior changed.

Still fake: venue-native terminal fill ids and fee-complete realized PnL remain unavailable; executor concurrency remains single-consumer; live post-deploy evidence still needs collection after repo-workflow deployment.
2026-06-12 18:00:03 +02:00

36 lines
1.1 KiB
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { createExecutorQueueDelayTracker } from '../src/core/executor-queue-delay.mjs';
test('executor queue delay tracker records recent percentiles and warning state', () => {
let nowMs = Date.parse('2026-06-12T10:00:00.000Z');
const tracker = createExecutorQueueDelayTracker({
sampleLimit: 5,
warningMs: 1_000,
criticalMs: 5_000,
now: () => nowMs,
});
for (const value of [10, 25, 100, 1_250, 7_500]) {
tracker.record({
commandToExecutorMs: value,
commandId: `cmd-${value}`,
quoteId: `quote-${value}`,
pair: 'nbtc->eure',
});
nowMs += 1_000;
}
const state = tracker.getState();
assert.equal(state.status, 'critical');
assert.equal(state.warning, true);
assert.equal(state.critical, true);
assert.equal(state.sample_count, 5);
assert.equal(state.latest_ms, 7_500);
assert.equal(state.max_ms, 7_500);
assert.equal(state.p50_ms, 100);
assert.equal(state.p90_ms, 7_500);
assert.equal(state.p99_ms, 7_500);
assert.match(state.warning_reason, /command_to_executor_ms/);
});