unrip/test/ops-sentinel-static.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

50 lines
2.4 KiB
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
const source = readFileSync(new URL('../src/apps/ops-sentinel.mjs', import.meta.url), 'utf8');
test('ops sentinel imports executor containment guard used by runtime evaluation', () => {
assert.match(source, /shouldContainExecutorForAlerts\(alerts\)/);
assert.match(
source,
/import\s*\{[\s\S]*shouldContainExecutorForAlerts[\s\S]*\}\s*from\s*'\.\.\/core\/runtime-health\.mjs';/,
);
});
test('ops sentinel polls official NEAR status and publishes environment status without alerting', () => {
assert.match(source, /pollNearIntentsEnvironmentStatus/);
assert.match(source, /kafkaTopicOpsEnvironmentStatus/);
assert.match(source, /buildNearIntentsStatusEventPayload/);
assert.match(source, /normalized\.status_fingerprint === state\.last_environment_status_fingerprint/);
assert.match(source, /assertEnvironmentStatusEvent/);
});
test('ops sentinel exposes trimmed service snapshots and computed runtime alerts', () => {
assert.match(source, /summarizeServiceSnapshotForSentinel/);
assert.match(source, /serviceSnapshots\.map\(summarizeServiceSnapshotForSentinel\)/);
assert.match(source, /latest_runtime_alerts: state\.latest_runtime_alerts/);
assert.match(source, /active_alerts: state\.latest_runtime_alerts/);
assert.match(source, /activeAlerts: desiredRuntimeAlerts/);
assert.match(source, /state\.latest_runtime_alerts = desiredRuntimeAlerts/);
});
test('ops sentinel turns dashboard maker competitiveness truth into runtime alerts', () => {
assert.match(source, /buildMakerCompetitivenessRuntimeAlerts/);
assert.match(source, /latest_maker_competitiveness/);
});
test('ops sentinel turns quote lifecycle retention health into storage alerts', () => {
assert.match(source, /quote_lifecycle_retention_policy_invalid/);
assert.match(source, /quote_lifecycle_rollup_stale/);
assert.match(source, /quote_lifecycle_storage_pressure/);
assert.match(source, /writerState\.retention_mode/);
assert.match(source, /writerState\.retention_summary/);
});
test('ops sentinel turns executor salt and queue state into runtime alerts', () => {
assert.match(source, /buildExecutorRuntimeAlerts/);
assert.match(source, /alerts\.push\(\.\.\.buildExecutorRuntimeAlerts/);
assert.match(source, /executor,\s*thresholds,\s*now,\s*pair: config\.activePair/);
});