An "ancient" range a group: articles 1 … low watermark − 1, never filled
Test and deploy / deploy (push) Successful in 3m49s
Test and deploy / test (push) Successful in 3m19s

Every group is tiled from article 1 now: one range with status 'ancient'
covers what had expired on the server before the group was planned.
Nothing selects it (leases, prefetcher, corpus fill, tail merger all take
'planned'), the status panel reports it apart, the search's history stats
leave it out. Migration 6700 adds it for the groups planned before;
Planner.historyRows (now a pure function, unit-tested) for new groups.
The status bands are ordered by an explicit key: the ancient row at
priority 0 tied "history 0-999" with "window 0".

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Daan MeijerandClaude Fable 5.1 committed 2026-10-28 09:12:05 +01:00
1 parent c18c320927
commit 68b480c97e
7 files changed
+119 -20

No files matched your search

@@ -0,0 +1,36 @@
import { test } from '@japa/runner'
import { historyRows } from '#services/planner'
test.group('Planner / history rows', () => {
test('a group planned for the first time: the ancient range below the low watermark, then the slices', ({
assert,
}) => {
const rows = historyRows(7, { low: 1001, high: 3500 }, 0, 1000)
assert.deepEqual(
rows.map((r) => [r.start_id, r.end_id, r.next_id, r.priority, r.status ?? 'planned']),
[
[1, 1000, 1, 0, 'ancient'],
[1001, 2000, 1001, 0, 'planned'],
[2001, 3000, 2001, 400, 'planned'],
[3001, 3500, 3001, 800, 'planned'],
]
)
})
test('no ancient range when the group starts at article 1, nor when planning again', ({
assert,
}) => {
assert.deepEqual(
historyRows(7, { low: 1, high: 1500 }, 0, 1000).map((r) => [r.start_id, r.end_id, r.status]),
[
[1, 1000, undefined],
[1001, 1500, undefined],
]
)
// Planned before up to 3500: only the new articles, no second ancient range.
assert.deepEqual(
historyRows(7, { low: 1200, high: 4100 }, 3500, 1000).map((r) => [r.start_id, r.end_id]),
[[3501, 4100]]
)
})
})