feat(audit): add reaction-rate drift gate thresholds

Add optional reaction match-drop and skip-increase drift thresholds, expose CLI flags, and enable conservative defaults in cadence package scripts. Includes tests and docs/state sync.
This commit is contained in:
William Valentin
2026-02-27 13:23:28 -08:00
parent 0decf34760
commit 98f954de0d
10 changed files with 173 additions and 6 deletions
@@ -77,6 +77,8 @@ function usage(): string {
' --max-cancel-rate-increase-pp <number>',
' --max-error-rate-increase-pp <number>',
' --max-cancel-latency-p95-increase-ms <number>',
' --max-reaction-match-rate-drop-pp <number>',
' --max-reaction-skip-rate-increase-pp <number>',
].join('\n');
}
@@ -184,6 +186,8 @@ function buildThresholds(values: Record<string, string | boolean | undefined>):
maxCancelRateIncreasePp: parseOptionalNumber(values['max-cancel-rate-increase-pp'] as string | undefined, '--max-cancel-rate-increase-pp'),
maxErrorRateIncreasePp: parseOptionalNumber(values['max-error-rate-increase-pp'] as string | undefined, '--max-error-rate-increase-pp'),
maxCancelLatencyP95IncreaseMs: parseOptionalNumber(values['max-cancel-latency-p95-increase-ms'] as string | undefined, '--max-cancel-latency-p95-increase-ms'),
maxReactionMatchRateDropPp: parseOptionalNumber(values['max-reaction-match-rate-drop-pp'] as string | undefined, '--max-reaction-match-rate-drop-pp'),
maxReactionSkipRateIncreasePp: parseOptionalNumber(values['max-reaction-skip-rate-increase-pp'] as string | undefined, '--max-reaction-skip-rate-increase-pp'),
};
}
@@ -345,6 +349,8 @@ async function main(): Promise<void> {
'max-cancel-rate-increase-pp': { type: 'string' },
'max-error-rate-increase-pp': { type: 'string' },
'max-cancel-latency-p95-increase-ms': { type: 'string' },
'max-reaction-match-rate-drop-pp': { type: 'string' },
'max-reaction-skip-rate-increase-pp': { type: 'string' },
format: { type: 'string' },
out: { type: 'string' },
help: { type: 'boolean', short: 'h' },