mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-09 22:48:57 +02:00
fix(benchmark): validate --timeout-ms as a positive integer
gstack-model-benchmark fed --timeout-ms straight through parseInt, so "abc" became NaN and "0"/"-1" passed through — a NaN or non-positive timeout silently disables the per-provider watchdog. Reject anything that isn't a positive (optionally +-prefixed) safe integer with a clear error and exit 1. Closes #1726. Contributed by @jbetala7 (PR #1727). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
36c608eb6e
commit
be671e80cc
@@ -73,6 +73,21 @@ describe('gstack-model-benchmark --dry-run', () => {
|
||||
expect(r.stdout).toContain('workdir: /tmp');
|
||||
});
|
||||
|
||||
test('--timeout-ms accepts plus-prefixed positive integers', () => {
|
||||
const r = run(['--prompt', 'hi', '--timeout-ms', '+2500', '--dry-run']);
|
||||
expect(r.status).toBe(0);
|
||||
expect(r.stdout).toContain('timeout_ms: 2500');
|
||||
});
|
||||
|
||||
test('--timeout-ms rejects malformed values', () => {
|
||||
for (const value of ['1abc', 'nope', '0', '-1', '1.5', '']) {
|
||||
const r = run(['--prompt', 'hi', '--timeout-ms', value, '--dry-run']);
|
||||
expect(r.status).toBe(1);
|
||||
expect(r.stderr).toContain('--timeout-ms requires a positive integer');
|
||||
expect(r.stdout).toBe('');
|
||||
}
|
||||
});
|
||||
|
||||
test('--judge flag reported in dry-run output', () => {
|
||||
const r = run(['--prompt', 'hi', '--judge', '--dry-run']);
|
||||
expect(r.status).toBe(0);
|
||||
|
||||
Reference in New Issue
Block a user