All checks were successful
deploy / deploy (push) Successful in 58s
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.
70 lines
2.5 KiB
JavaScript
70 lines
2.5 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
|
|
import {
|
|
summarizeServiceSnapshotForSentinel,
|
|
summarizeServiceState,
|
|
} from '../src/core/service-snapshot-summary.mjs';
|
|
|
|
test('sentinel snapshot summary keeps trade-executor health fields and drops retained command maps', () => {
|
|
const summary = summarizeServiceSnapshotForSentinel({
|
|
service: 'trade-executor',
|
|
label: 'Trade Executor',
|
|
base_url: 'http://trade-executor',
|
|
reachable: true,
|
|
health: { ok: true },
|
|
state: {
|
|
service: 'trade-executor',
|
|
namespace: 'unrip',
|
|
paused: false,
|
|
armed: true,
|
|
relay: { connected: true, last_message_at: '2026-05-06T15:00:00.000Z' },
|
|
verifier_salt_cache: {
|
|
salt_fresh: true,
|
|
salt_age_ms: 42,
|
|
refresh_in_flight: false,
|
|
},
|
|
executor_queue_delay: {
|
|
status: 'warning',
|
|
max_ms: 1500,
|
|
p90_ms: 1200,
|
|
},
|
|
last_result: { status: 'submitted' },
|
|
submitted_count: 100,
|
|
salt_unavailable_reject_count: 2,
|
|
last_salt_unavailable_at: '2026-05-06T15:00:01.000Z',
|
|
processed_idempotency_keys: Object.fromEntries(Array.from({ length: 100 }, (_, index) => [`quote:${index}`, true])),
|
|
submitted_commands: {
|
|
'cmd-1': { quote_id: 'quote-1', raw_response: { large: true } },
|
|
},
|
|
},
|
|
});
|
|
|
|
assert.equal(summary.state.armed, true);
|
|
assert.deepEqual(summary.state.relay, { connected: true, last_message_at: '2026-05-06T15:00:00.000Z' });
|
|
assert.equal(summary.state.verifier_salt_cache.salt_fresh, true);
|
|
assert.equal(summary.state.executor_queue_delay.status, 'warning');
|
|
assert.equal(summary.state.salt_unavailable_reject_count, 2);
|
|
assert.equal(summary.state.processed_idempotency_keys, undefined);
|
|
assert.equal(summary.state.submitted_commands, undefined);
|
|
});
|
|
|
|
test('sentinel snapshot summary keeps near-intents ingest truth fields', () => {
|
|
const state = summarizeServiceState('near-intents-ingest', {
|
|
service: 'near-intents-ingest',
|
|
namespace: 'unrip',
|
|
pair_filter: { pair: 'btc->eure' },
|
|
ingest: {
|
|
connected: true,
|
|
last_message_at: '2026-05-06T15:00:00.000Z',
|
|
last_matching_quote_at: '2026-05-06T09:56:42.742Z',
|
|
last_published_at: '2026-05-06T09:56:42.744Z',
|
|
filtered_count: 10,
|
|
},
|
|
bulky_unused_field: Object.fromEntries(Array.from({ length: 100 }, (_, index) => [index, index])),
|
|
});
|
|
|
|
assert.equal(state.ingest.connected, true);
|
|
assert.equal(state.ingest.last_matching_quote_at, '2026-05-06T09:56:42.742Z');
|
|
assert.equal(state.bulky_unused_field, undefined);
|
|
});
|