skill issue
This commit is contained in:
@@ -1834,13 +1834,46 @@ record('a week nobody was rostered for is not reported as 0% attendance',
|
||||
|
||||
/* ── Anomalies: what it finds, and what it stays quiet about ─────────────── */
|
||||
|
||||
const findings = attendance.attendanceAnomalies(SHIFTS);
|
||||
/* Anchored, not live.
|
||||
*
|
||||
* These shifts are generated by counting back from a day, and which of them
|
||||
* land in a *complete* week depends on where that day sits in one. Asserting
|
||||
* against the live set meant asserting against the calendar: the seeded
|
||||
* overtime climb is detected on a Thursday and not on a Friday, so this check
|
||||
* failed every Friday and Saturday and passed the rest of the week.
|
||||
*
|
||||
* The anchor is the same instant the rest of this file pins, and the same date
|
||||
* is passed as `now` — shifts built around one day and bucketed around another
|
||||
* describe two different windows, which is its own way to be wrong. */
|
||||
const ANCHOR = new Date('2026-08-20T09:00:00.000Z');
|
||||
const ANCHORED_SHIFTS = shiftSeed.buildShiftsAt(ANCHOR);
|
||||
const findings = attendance.attendanceAnomalies(ANCHORED_SHIFTS, { now: ANCHOR });
|
||||
record('the seeded attendance decline is found',
|
||||
findings.some((f) => f.kind === 'attendance'),
|
||||
findings.filter((f) => f.kind === 'attendance').map((f) => f.title).join(' | ') || 'NOT FOUND');
|
||||
record('the seeded overtime climb is found',
|
||||
findings.some((f) => f.kind === 'overtime'),
|
||||
findings.find((f) => f.kind === 'overtime')?.detail || 'NOT FOUND');
|
||||
|
||||
/* And that it does not depend on the day, measured rather than assumed.
|
||||
*
|
||||
* Pinning the anchor makes this file deterministic; it does not make the
|
||||
* product insensitive to the day, and it was not: the climb was reported Sunday
|
||||
* through Thursday and vanished on Friday and Saturday, because the oldest week
|
||||
* in the window is a partial one and thinned to two shifts as the week wore on,
|
||||
* inflating the baseline every later week was compared against.
|
||||
*
|
||||
* Fixed in attendanceAnomalies by dropping a leading week rostered well below
|
||||
* the usual. This is the number that keeps it fixed: a change that reintroduces
|
||||
* a calendar-shaped blind spot fails here even though the pinned assertion
|
||||
* above still passes. */
|
||||
const detectableOn = Array.from({ length: 28 }, (_, i) => new Date(2026, 7, i + 1, 12))
|
||||
.filter((day) => attendance
|
||||
.attendanceAnomalies(shiftSeed.buildShiftsAt(day), { now: day })
|
||||
.some((f) => f.kind === 'overtime')).length;
|
||||
record('the seeded overtime climb is detectable on every day of the week',
|
||||
detectableOn === 28,
|
||||
`${detectableOn}/28 anchors`);
|
||||
record('every finding carries the figures behind it',
|
||||
findings.every((f) => f.title && f.detail && f.severity && f.metric));
|
||||
record('findings are ordered most severe first',
|
||||
|
||||
Reference in New Issue
Block a user