feat(voyage): validate iterations_remaining in progress-validator

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-06-20 21:26:22 +02:00
commit e986b10431
2 changed files with 46 additions and 0 deletions

View file

@ -65,6 +65,36 @@ test('validateProgress — step count mismatch is warning', () => {
assert.ok(r.warnings.find(w => w.code === 'PROGRESS_STEP_COUNT_MISMATCH'));
});
test('validateProgress — iterations_remaining non-negative integer is valid', () => {
const p = goodProgress();
p.iterations_remaining = 7;
const r = validateProgressObject(p);
assert.equal(r.valid, true, JSON.stringify(r.errors));
});
test('validateProgress — iterations_remaining absent is valid (backward-compat)', () => {
const p = goodProgress();
delete p.iterations_remaining;
const r = validateProgressObject(p);
assert.equal(r.valid, true, JSON.stringify(r.errors));
});
test('validateProgress — iterations_remaining negative is invalid', () => {
const p = goodProgress();
p.iterations_remaining = -1;
const r = validateProgressObject(p);
assert.equal(r.valid, false);
assert.ok(r.errors.find(e => e.code === 'PROGRESS_ITERATIONS_REMAINING_INVALID'));
});
test('validateProgress — iterations_remaining non-integer is invalid', () => {
const p = goodProgress();
p.iterations_remaining = 3.5;
const r = validateProgressObject(p);
assert.equal(r.valid, false);
assert.ok(r.errors.find(e => e.code === 'PROGRESS_ITERATIONS_REMAINING_INVALID'));
});
test('checkResumeReadiness — completed run cannot resume', () => {
const p = goodProgress();
p.status = 'completed';