fix(yardstick): a new-work order without a slug leaves the use numerator not measured (green)

The numerator joins an order to a Voyage run by `slug:`. When a new-work order
carries none, the row is NOT COUNTABLE: the denominator is still read and shown,
the matches that were possible are reported, and the missing key is named.

Real queue 2026-10-03: use = not countable, denominator 2 (2 prove), 2 of 2
carry no slug; 4 ikke-nytt; 684 not measured. Suite 1304 -> 1309 (1307/0/2).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-10-03 18:21:33 +02:00
commit dfc5a6bdbd
Signed by: ktg
SSH key fingerprint: SHA256:JakMjO6FTBBzN0Bhfj9saOoEjaFxlSdYuZQQpM/lF9Q

View file

@ -207,10 +207,11 @@ export function measureUse({ queue, slugs, cutoff }) {
const unmarked = inWindow.length - newWork.length - notNew.length;
const beforeMarker = queue.orders.length - inWindow.length;
const through = newWork.filter((o) => o.fm.slug && slugs.has(o.fm.slug));
const withoutSlug = newWork.filter((o) => !o.fm.slug).length;
const facts = {
scanned: queue.orders.length, files: queue.files, unreadable: queue.unreadable.length,
withMarker: withMarker.length, newWork: newWork.length, notNew: notNew.length,
unmarked, beforeMarker, notMeasured: unmarked + beforeMarker, withVoyageRun: through.length,
unmarked, beforeMarker, notMeasured: unmarked + beforeMarker, withVoyageRun: through.length, withoutSlug,
};
const perMailbox = {};
for (const o of queue.orders) perMailbox[o.repo] = (perMailbox[o.repo] ?? 0) + 1;
@ -225,11 +226,16 @@ export function measureUse({ queue, slugs, cutoff }) {
return { ...base, denominator: 0, facts, ...notCountable(
`${census}; 0 new-work orders dated >= ${from} - the denominator is empty`) };
}
const unmatched = newWork.filter((o) => !o.fm.slug).length;
// The numerator joins an order to a Voyage run by its `slug:`. An order without one cannot
// match anything, so its "no" would be the missing key talking - the numerator is not measured.
if (withoutSlug > 0) {
return { ...base, denominator: newWork.length, facts, ...notCountable(
`${census}; ${withoutSlug} of ${newWork.length} new-work orders carry no slug - the numerator is not measured`
+ ` (${through.length} matched a Voyage run)`) };
}
return {
...base, countable: true, value: through.length, denominator: newWork.length, facts,
detail: `${census}; ${through.length} of ${newWork.length} new-work orders have a Voyage run in the stats with the order's slug`
+ (unmatched ? `; ${unmatched} new-work order(s) carry no slug and cannot match` : ''),
detail: `${census}; ${through.length} of ${newWork.length} new-work orders have a Voyage run in the stats with the order's slug`,
};
}