Some checks failed
deploy / deploy (push) Failing after 51s
Proof: npm test passed 159/159; focused node --test for service-snapshot-summary and ops-sentinel static coverage passed; failed rollout showed ops-sentinel could not import src/core/service-snapshot-summary.mjs and this commit adds the module plus regression coverage. Assumptions: Forgejo main push remains the deployment path; no manual kubectl reconciliation is needed because the failed rollout will be superseded by the repo workflow. Still fake: no live funds movement; production rollout evidence still depends on the follow-up Forgejo deployment completing.
55 lines
2 KiB
JavaScript
55 lines
2 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' },
|
|
last_result: { status: 'submitted' },
|
|
submitted_count: 100,
|
|
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.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);
|
|
});
|