ShiftCircle

ShiftCircle — Test Strategy and Test Data

Status: v1.1 · 2026-11-19; current counts for release v1.3 (the course submission) 2026-11-25

1. Goals

  1. Prove every rule behaves correctly at its limits (the most likely place for bugs, and what labour relations will ask about).
  2. Prove the safeguards: an emergency-override Block (U-01, U-05, and U-03, which is dormant outside test fixtures: its row keys on the retired L16 template) can’t be bypassed without a reason, and any other Block (e.g. U-08, U-09, U-14) can’t be bypassed at all (ADR-023); maker/checker can’t be skipped; locked pay periods can’t change; employees can’t see others’ data.
  3. Give the demo and the build record repeatable data and scenarios.
  4. Produce 2–5 clear test cases (expected vs actual, including a failure or boundary case) for the build record.

2. Test layers

Layer Tool What it covers Runs
Rule boundary tests JUnit 5 + AssertJ, in shiftcircle-rules (no Spring, no DB) Each fact builder and each rule table row at under / exactly / over its limit (§3) Every build, < 10 s
Scenario library Same module; scenarios in RuleScenarioRunner (Java) Named end-to-end rule scenarios with expected outcomes (§4). The rules publish pipeline runs T1–T6 (T1–T5 plus the O-02 ranking check); T7–T14 are API/database tests. Every build + every rule publish
Use-case / repository tests Spring Boot Test + Testcontainers PostgreSQL Services with a real database: overlap constraint, locked-period trigger, audit append-only, maker/checker check, ranking, payroll classification Every build
API and authorization tests Spring MockMvc or RestAssured against the running app (Testcontainers) Every endpoint’s happy path, the 422 rule contract, 412 stale ETag, and the permission matrix (09-access-control.md, grouped by area method plus per-endpoint authorization tests) Every build
Payroll golden file Use-case test Export for planted pay period PP-2026-11 must equal golden/payroll-2026-10-26.csv byte for byte Every build
Generator self-check Runs at the end of DemoDataGenerator and as a test Dataset invariants (§6.6); build fails if any break Every build + on demo start
Frontend unit tests Vitest + React Testing Library Components: ShiftChip, RuleResultList, decision-table editor validation, the preview → 422 → override hook Every build
End-to-end Playwright against docker compose up The 5 demo flows (§5), on desktop and tablet viewport Before submission (and in CI if time allows)
Accessibility @axe-core/playwright in the E2E run No serious/critical axe violations on each screen; keyboard-only run of flows E1 and E3 Before submission
Performance smoke JUnit timing test (PerformanceSmokeTest); Playwright does not assert timings Planning board (100 officers × 14 days) < 1 s; rule check < 200 ms; 90-day report < 2 s (NFR-05) Before submission

Measured performance (NFR-05, 2026-11-20)

Full demo dataset as it was before release v1.3 S4 added the supervisors (100 officers, 6,456 assignments, 84 schedule periods, checksum 4156077d76d41bd5fcf6d6a9a0f51111e9007d16c8a0c6b311e09c6fe801da6b; measured before S4, not re-measured since), PostgreSQL 17 in a Testcontainer, PerformanceSmokeTest in maven:3.9-eclipse-temurin-21 on Docker Desktop for macOS. That is a VM, slower than the target host, so a pass here is pessimistic. Five warm-up calls, then 20 timed calls; the board range is four weeks (NFR-05 says 14 days, so this is stricter); the publish figures are single calls.

Case Median p95 Limit
Planning board, Unit A, 4 weeks (GET /schedule) 11 ms 15 ms 1,000 ms
Rule check, busiest officer, 28-day look-back (POST /rule-checks) 2 ms 4 ms 200 ms
90-day coverage report (GET /reports/coverage) 6 ms 9 ms 2,000 ms
Rule-set build (compile + scenarios + dry run) 498 ms — recorded, no NFR
Rule-set publish (compiles again, then swaps) 433 ms — recorded, no NFR

These figures are from the clean-worktree run at fe6487d (the dataset with the 84 roster weeks). The run at the tip 2537dd4 gave 17/22, 3/6 and 7/21 ms with a 889 ms build and a 739 ms publish, and an earlier run on a busier host gave 54/58, 4/7 and 7/15 ms with a 655 ms build and a 516 ms publish; the host is shared, so expect this spread. The test asserts the median and the p95 against the NFR limits, so a regression fails the build rather than being noticed in the demo.

Definition of done for any feature: its rule and use-case tests pass, its endpoints have authorization tests, and the demo flow touching it passes in Playwright.

Current counts (release v1.3, the course submission; 25 Nov 2026)

Read this block for today’s numbers. Measured on the final main for v1.3 (d3d1d28: S1–S7 and P1–P5), on S8’s branch at bd7d377 (S8 changes only docs, install.sh’s pin and BUILD_RECORD.md):

Suite Result How it was obtained
API (Maven, Testcontainers) 624 = 140 rules + 38 infrastructure + 446 api, 0 failures, errors or skipped docker compose -p sc-sc-s8 --profile test run --rm --build api-test (mvn -B verify), BUILD SUCCESS, default class order
Web unit tests (Vitest) 695 passed in 66 files (the v1.3 gate; on main after v1.3: 718 in 67, see web/README.md) pnpm test in Docker. pnpm lint: 4 warnings, 0 errors. tsc -b clean
Playwright, real api, desktop desktop-datasets: 144 passed, 0 failed Fresh stack (own project sc-sc-s8, port 18848), EXPECT_COMMIT=bd7d377, E2E_WORKERS=1: the parallel desktop project, then the stack-wide specs one at a time
Playwright, real api, tablet tablet-datasets: 143 passed, 1 skipped, 0 failed The same on a second fresh stack; the TV-size check is desktop-only
Dataset checksums, payroll golden, plan rows unchanged since S4 100 beb2e222…b7d1, 120 ca73467d…a64a, 150 353e2e62…91a5; golden 1,124 lines b946ef1f…00e6; plan rows 7,266 / 5,595 / 5,877 (the paragraph “v1.3 S4” below has the full pins and the officers-only invariance). check-audit-codes.sh: 55 codes

The fixtures-mode web suite was not re-run for v1.3. The sections after this one are the history of how the counts grew, release by release.

Earlier current-counts block (API and Playwright at 5a38580, web unit tests at 8ae4bbd, 24 Nov 2026; history)

Counting method: @Test methods on their own line (no parameterised tests), and each suite’s own runner. Every number below was run on 5a38580 (release 11 5a3be22 plus the docs PRs and the PR-H rules-wording fix), on a fresh stack per viewport; the API suite ran in GitHub CI (mvn verify on PR #19, the same command).

v1.2 (PR-O, PR-M, PR-N and PR-Q; not the submission tag, whose counts are the table below): API 503 = 127 rules + 28 infrastructure + 348 api (mvn verify in GitHub CI on PR #24, reproduced by the v1.2 release walk; PR-N adds 23: PlanGeneratorOptionsTest 14, PlannerOptionsApiTest 6, PlanInputsFillOrderTest 3; PR-Q changes no api code); web unit tests 591 in 58 files (the walk measured 583 in 57 at 958209c; PR-Q adds 8); Playwright, a fresh stack per viewport, E2E_WORKERS=1: desktop 132 passed, tablet 131 passed and 1 skipped (the walk measured 129 and 128 + 1 at 958209c; PR-Q adds the three planner-inputs staffing tests). Before PR-N: API 480, web 567 in 56 files, lint 4 warnings, tsc -b clean; Playwright on PR-M’s code before the PR-O merge (421627a, a fresh stack per viewport): desktop-datasets 126 passed, tablet-datasets 125 passed, 1 skipped (run with E2E_WORKERS=1 on a loaded host), fixtures (all four projects) 45 passed, 159 skipped. Checksums, payroll golden and plan fingerprints unchanged.

v1.3 S4 (supervisors in the datasets; the single re-pin). Every dataset pin moves once, and the officers alone still produce the old ones. New pins: checksums 100 beb2e222b8c9100c98d329e37f5ffcf670f81d0083045d84f179f7f0681ab7d1, 120 ca73467d7c8436f8be28d5e5488b63b80b2dc162a8c815527dd674fe6dcfa64a, 150 353e2e62a1627a9ba31b7e411064065e2d0c36510a3e145f010251c4713991a5; plan fingerprints 100 94aeae1f…7c11, 120 5a3763c7…983f, 150 7368ef13…0587; draft rows 7,266 / 5,595 / 5,877 (officers 6,586 / 5,103 / 5,414 plus supervisors 680 / 492 / 463); scorecard warnings (the officers’ card) 135 / 7 / 39 and all warnings 155 / 7 / 41; supervisor-post block-days short 230 / 0 / 93 of 588 (Dataset 100’s planner puts no 8 h staff on nights, so the posts’ nights are short there, as the 8 h officers’ are); payroll golden for 26 Oct – 8 Nov 1,124 lines, sha256 b946ef1f9f3d3529bd826e41a9452fe35633d9e1ee38e7d79d7a70732bc200e6. The officer-only pins are asserted in GeneratorCharacterizationTest: DemoChecksum.officersOnly (100) and officersOnlyWithNames (120/150) equal 4156077d…da6b, 82b19cf8…32ca and 2e6cd938…d7f8; the officers’ plan fingerprints equal ec337014…, e8b29ce6… and a1e093f7… with 6,586 / 5,103 / 5,414 rows; the export’s first 1,038 lines are the old file byte for byte (9f2d51b3…04ff) and every later line is an S-… supervisor row. Counts for the S4 run are in docs/process/release-notes.md.

Suite Result How it was obtained
API (Maven, Testcontainers) 470 = 127 rules + 28 infrastructure + 315 api, 0 failures, errors or skipped docker compose --profile test run --rm --build api-test (mvn -B verify), BUILD SUCCESS, default class order (locally on 5a3be22; in CI on 5a38580). The @Test count in the three modules agrees. The release 8 gate was 464 in both class orders; reverse and random order were not re-run for this tip
Web unit tests (Vitest) 532 passed in 54 files (at 8ae4bbd, PR #22’s head) pnpm test in Docker. pnpm lint: 4 warnings, 0 errors. tsc -b clean
Playwright, real api, desktop desktop-datasets: 124 passed, 0 failed The whole desktop suite: the parallel desktop project (108 tests) then the stack-wide specs one at a time (16 more, E3 among them). Fresh stack, EXPECT_COMMIT=5a38580
Playwright, real api, tablet tablet-datasets: 123 passed, 1 skipped, 0 failed The same on a second fresh stack; the TV-size check is desktop-only
Playwright, fixtures-mode web 23 passed, 79 skipped, 0 failed --grep-invert @api --project desktop-datasets against the fixtures build; the skipped tests need the real api
Dataset checksums, payroll golden, plan fingerprints unchanged no migration or generator change since release 8: 100 4156077d…da6b, 120 82b19cf8…32ca, 150 2e6cd938…d7f8, payroll golden 9f2d51b3…04ff (asserted by the reset and generator tests in the API run above). Moved once in release v1.3 S4; see the paragraph above the table
Earlier states (history)

Final verified state (5d0f810, 2026-11-21; the security fixes below are newer). dev-qa’s independent pipeline on the candidate: API 422 = 123 rules + 27 infrastructure + 272 api tests, green in the default order and with random seed 20261121; web 277 vitest; Playwright against the real api, fresh stack per viewport: desktop 101 passed / 0 failed, tablet 100 passed + 1 skipped / 0 failed (the TV-size check is desktop-only); fixtures 22 / 21 passed. Counts are @Test methods on their own line; no parameterised tests. The 100 dataset checksum is 4156077d76d41bd5fcf6d6a9a0f51111e9007d16c8a0c6b311e09c6fe801da6b and the payroll golden 9f2d51b38581abea673fe5c85aead3670ca45b36db390fee1d2033d1faa004ff; the 120 dataset checksum is 82b19cf814acde5c5740f9a9aa1162e61d4b7f5598848f99861d2f4ea66732ca.

Security fixes (p3-sec, code 74a58c0). review-r3’s P3-1..P3-5 add three api tests (PlannerDiscardRaceApiTest, DemoResetFailureTest, and the concurrency method in PlannerAbsenceApiTest). An author run at that tip is 425 = 123 rules + 27 infrastructure + 275 api in both orders; dev-qa verification is pending. The last independently verified tip is still 5d0f810 at 422.

Phase 3 preference/pattern (p3-pref, merged tip 78fb935; dev-qa gate pending). The branch adds 19 api tests over p3-sec’s 425: preference multi-select (V9, legacy value, validation), the V9 backfill, coverage extraPercent and the axis floor, the ACKNOWLEDGE-Block sentence, the V10 default/backfill, the pattern API and validation, mixed-cohort generation, and the two plan fingerprints. Author run from a clean worktree at the code tip 761f763 (Java identical to the handover tip): 444 = 123 rules + 27 infrastructure + 294 api, 0 failures/errors/skipped in the default order (dev-qa’s gate runs both orders); web 290 at the merged tip. The 120 draft is 5,103 assignment rows and the 100 draft 6,586, each sha256-identical to c9ac073; the 100/120 checksums and the payroll golden are unchanged. dev-qa’s full gate is pending.

Release 3 unit closures and staffing (p4-unit, code tip ee4020c; dev-qa gate pending). The branch adds 8 api tests: V11 and the shared unit_active_on function, the Units/closures API with its plain validation, the flagged future shifts, the staffing split/formula/allocations, the mid-quarter Unit C close with relief and determinism, and the no-closure identity assertions in Demo120ResetApiTest. Author run: 450 = 123 rules + 27 infrastructure + 300 api in a clean default run before dataset 150, then demo 100/120/150, UnitApi, UnitPlanning and the V11 migration green at the 150 tip (12 targeted tests). The full 452 = 123 + 27 + 302 run is dev-qa’s gate; my repeat at the 150 tip was killed by the harness timeout under host load (no test failure in the log). Web 313 at the merged tip; Playwright counts follow the merged-stack run. The 100/120 checksums, payroll golden and both plan fingerprints are unchanged while no unit is closed.

Release 4 (p5, code tip a23fa47; docs handover tip follows; dev-qa gate pending). The release adds 8 tests: 4 rules (EightHourNightWarningTest ×3, the shift-types alternative check in RuleRowValidatorTest) and 4 api (RuleSentenceTest pin, RuleSetV3SeedTest, the NOT_ROSTERED headline test, the owner-token test). Author run on the merged tree: 460 = 127 rules + 27 infrastructure + 306 api, 0 failures/errors/skipped in the default order; web 316; audit codes 49. The five changes are: #20 release 3’s Block + ACKNOWLEDGE sentence is pinned over all three rows; #14 a shift-less officer reads NOT_ROSTERED and is excluded from the scorecard/Compare preference counts (120: 195/240 → 196/214, 92%); #17 the demo lock is owner-token based, so the reset’s explicit release plus finally cannot free a new owner’s permit (N-2 is unchanged and reported: a failed reset needs a retry); #10 V12 publishes rule-set v3 with U-16 (Warn/acknowledge) for an 8 h officer on a night shift, 100/120/150 plan fingerprints unchanged because the planner never makes that assignment; #16 the remaining “Week over 60 hours” web fixture strings and the U-14 message now read 48/60. Dev-qa’s gate also found the pre-existing literal-route shadow that made the Shift types table (and U-16) unreachable; dev-build2 removed it red-first and the router test now opens /rules/7/shift-types. The 100/120/150 checksums and the payroll golden are exact.

Release 5 (p6, API tip 60f8f7d; web merges follow; dev-qa gate pending). L16 is retired: the 100 seed has no L16 rows (was 270), V13 retires the template (active=false) without deleting old history, and new assignments/open shifts naming it get a plain 400. PC-03 is now P12 + a 5 h extension (17 h actual). New 100 pins: checksum 4156077d...da6b, payroll golden 9f2d51b3...04ff (1,037 rows, 8,197.60 worked h), plan fingerprint unchanged ec337014...409e1b (6,586 rows, 727 gaps); its warnings move 117 -> 135 because removing L16 history removed U-14 baseline keys, exposing 18 real U-14 plan warnings (U-12 78, U-14 57). The gate finding that PC-01 lost U-14 and Tara had no block-free pick-up was repaired in the seed (Nia: Mon 16 P12, Thu 19 E8, Sat 14 removed; Tara: Sun 29 removed), and the self-check asserts both; the repaired PC-01 block set is U-01/U-05/U-08/U-14 (64 h). Golden and plan stayed exact. The 120 and 150 checksums/fingerprints are exact. Author run: 462 = 127 rules + 28 infrastructure + 307 api, 0 failures/errors/skipped; web 318/318 at the merged tip, build clean, lint 4 pre-existing warnings, audit codes 49.

Release 7 #27 (p8, API tip 5c6e922; merged code tip eb7132c with p8-web 0c888da; final docs tip follows; dev-qa gate pending). Planner draft edits: preview, add, move/reassign and remove, PLANNER and DRAFT only, If-Match draft version; Pass saves, Warn needs acknowledgeWarnings:true, Block refuses; one edit_plan_draft audit code with kind ADD|MOVE|REASSIGN|REMOVE; full synchronous recompute of gaps/warnings/scorecard (qualification included) via the extracted PlanGenerator.assess; commit still re-verifies every row. The pre-extraction characterization GeneratorCharacterizationTest at 84d0ea0 pinned the 100/120/150 checksums, the payroll golden, plan fingerprints, row counts and warning totals; it stays in the suite at the tip and the extracted path keeps it green. PlanDraftEditApiTest covers: preview saves nothing; remove+add restores the 5,103-row fingerprint and reproduces the generated scorecard (every key except generatedMs); a fresh generate after those edits is the unedited fingerprint again; duplicate 409, stale 412, missing If-Match 428, non-PLANNER 403, retired L16 400, closed unit 409; a one-way reassign audits REASSIGN; the UI-shaped Wade ESC D12 -> N8 same-day move is a Block 422 that saves nothing; the Bram E8 move is 422 warnings-need-acknowledgement then 200 with the acknowledgement; commit after edits 200 and a later edit 409. Generate/discard delete edits. The author run uses -DargLine="-Xmx1536m -Dspring.test.context.cache.maxSize=1" so the 26+ Spring contexts cannot exhaust the Docker VM (the default cache is 32); the tests themselves are unchanged. Author run: 464 = 127 rules + 28 infrastructure + 309 api, 0 failures/errors/skipped, default and reverse order; web 341/341 at 0c888da, tsc -b/build clean, lint 4 pre-existing warnings, audit 50 and check-audit-codes.sh agrees (web label “Draft shift edited”).

3. Rule boundary matrix

Each line is at least three tests: just under, exactly at, just over. Times are local (America/Regina).

Rule Under (expected) Exactly (expected) Over (expected)
U-01 min 8 h rest in 24 h 7 h 59 m rest → BLOCK 8 h 00 m → PASS (inclusive) 8 h 01 m → PASS
U-02 target 12 h between regular shifts 11 h 59 m → WARN 12 h → PASS 13 h → PASS
U-03 12 h after a 16 h shift (fixture-only: the row keys on the retired L16 template, so it does not fire on live data) 11 h 59 m → BLOCK 12 h → PASS —
U-04 10 h after OT extension ≥ 4 h extension 4 h + rest 9 h 59 m → WARN; extension 3 h 59 m + rest 8 h → PASS (rule not triggered) 10 h → PASS —
U-05 max 16 h in any 24 h rostered 16 h shift (exactly 16 h) → PASS 16 h shift + 15 min extension → BLOCK (emergency override only) —
U-08 max 7 consecutive work days (8 h) 7 → PASS 8th day scheduled → BLOCK; 8th day via overtime → WARN —
U-09 max 4 consecutive 12 h shifts 4 → PASS 5th scheduled → BLOCK; 5th via OT → WARN —
U-10 max 4 consecutive 12 h overnight (19–07; A12 00–12 and N12 19–07) shifts 4 → PASS 5th → WARN —
U-11 16 h shifts: 3 per 7 d, 10 per 28 d 3 in 7 d → PASS 4th within 7 d → WARN; 11th within 28 d → WARN 4th exactly 7 d after the 1st → PASS (window boundary)
U-12 2 consecutive days off per 7 48 h off → PASS 47 h 59 m off → WARN (a break of 24 h or less isn’t a day of rest) —
U-14 weekly ceiling: warn above 48 h, block above 60 h 48 h → PASS 48.25 h → WARN; 60.00 h → WARN (the limit itself passes; the Block is above it); 60.25 h → BLOCK (no override, ADR-023) —
U-16 8 h officer on a night shift D8 07:00 → no result N8 23:00 → WARN (acknowledged, not overridden); N12 19:00 → no result —
P-01 overtime by pay period (threshold 80 h) 80 h worked → 80 REG 80.5 h → 80 REG + 0.5 OT15 96 h incl. a picked-up 16 h shift → 80 REG + 16 OT15; rostered 16 h shifts within 80 h → all REG
P-02 day of rest: 2×, min 2 h (off by default; test when switched on) 1 h worked → paid 2 h OT20 2 h → 2 h OT20 8 h → 8 h OT20
P-04 OT under 30 min unpaid 29 m → 0 30 m → 0.5 h —
L-01 / S-03 16 h regular only where allowed 16 h rostered on a unit with allows_16h → PASS 16 h rostered on a unit without it → BLOCK —
Pay-period lock precondition (ADR-017) one shift ended 1 min before now with no actual → lock 409 missing-actuals shift ending exactly now (end_at = now) with no actual → 409 (it counts as ended); with an actual or absence → lock succeeds shift ending 1 min after now with no actual → not counted; lock succeeds if all ended shifts are recorded
Time zones / midnight Night 23:00–07:00 crossing midnight: work_date = start date; a 12:00–24:00 shift ends at 00:00 the next day (not 23:59); 00:00–12:00 shift belongs to its own date; a 16 h shift 20:00–12:00 spans two dates; N12 19:00–07:00 crosses midnight with work_date = the start date and counts 12 h in the 168 h window; rest maths correct across midnight and month end (31 Oct → 1 Nov)    

U-15 is a board status, not a rule row. The board reads the pay period that contains the requested from date and shows UNDER below 72 h, APPROACHING from 72 h, and IN_OVERTIME from 80 h. ScheduleApiTest#overtimeStatusChangesAtThePayPeriodThresholdBoundaries pins 71.99 h, exactly 72 h, 79.99 h, exactly 80 h and 80.01 h (the hours column is 2 dp, so 71.99 h is 71 h 59 m 24 s); #overtimeStatusUsesThePeriodThatContainsTheBoardDateAndCountsAMidnightCrossing checks the last day, a 23:00–07:00 entry and a separate 2027 period.

4. Scenario library (named, reusable)

These are the verification cases. Pick 2–5 for the build record (recommended: T2, T3, T7, T8, T9). The rules publish pipeline runs T1–T5 and the T6 ranking check (RuleScenarioRunner); T7–T14 are covered by their own API/database tests because a rule row cannot affect payroll, maker/checker or lock behaviour.

ID Scenario Expected
T1 Assign a day shift to a rested, qualified officer under the threshold Saved; all rules PASS
T2 12 h shift Fri 12:00–24:00; assign a Day 8 h shift Sat 07:00 (7 h rest; 17 h in 24 h) (planted PC-01) BLOCK U-01 and U-05; message names both shifts; nothing saved. U-14 also blocks when the proposal takes the week over the 60 h ceiling (it does for the demo’s Nia: 64 h), and U-08 blocks because the proposal makes 8 consecutive work days
T3 Boundary: Night 8 h ends 07:00; Evening starts 15:00 (exactly 8 h) (planted PC-02) U-01 PASS; U-02 WARN; saves after acknowledgement
T4 A 16 h shift 20:00–12:00, then a shift starting 20:00 the same day (8 h rest) U-01 PASS (exactly 8 h), BLOCK U-03 (needs 12 h after a 16 h shift; fixture-only: an L16 row is inserted, no live data has one)
T5 Fifth consecutive 12 h overnight 19–07 shift (planted PC-04) WARN U-10; saves after acknowledgement
T6 Overtime candidates for planted open shift PC-08 Order matches fewest-OT-then-seniority; an officer with insufficient rest is SKIPPED and keeps their place; unqualified officer UNAVAILABLE for Control (PC-09)
T7 Rules admin lowers U-10 from 4 to 3 nights; build + dry run Dry run lists the existing 4-night runs (PC-06) as new warnings; after approval and publish, the same check now warns; no code change
T8 Payroll export for locked period 26 Oct – 8 Nov (planted PC-05) CSV equals the golden file; per-officer totals equal actual hours; overtime only for hours beyond the 80 h period threshold
T9 Human judgment: lockdown; supervisor needs an officer for 17 h (planted PC-03) BLOCK without override; with a reason (≥ 10 chars) it saves, creates an override record, appears in the audit log and the overrides report
T10 Rules admin tries to approve their own draft 403 from the API and rejected by the database check
T11 Supervisor edits an actual in a locked pay period 409; database trigger also refuses
T12 Employee requests another officer’s hours 404 (not revealed)
T13 Validation: a rule row value below the legal floor (U-01 = 7) Build fails validation with a plain message; can’t be submitted
T14 Supervisor locks a pay period with 3 ended shifts lacking actuals (ADR-017) 409 missing-actuals listing the 3; period stays open; after recording them, lock succeeds and is audited

5. End-to-end demo flows (Playwright)

ID Flow Checks
E1 Supervisor tries to assign Nia Thompson to Sat days → blocked → “Find eligible officer” → offers to two officers Block banner and messages; ranked list order; offer recorded
E2 Employee (Tara) accepts the offer; supervisor confirms Offer status changes; assignment appears on both screens; overtime status updates
E3 Rules admin changes U-02 (rest target between shifts) from 12 to 14 h → build → submit; approver approves and publishes The live sentence names the shift kinds in words (no stored pattern, no repeated clause); checklist states; dry-run numbers (real api: 1 result changes, U-02 in Unit A); live version increments; maker can’t approve
E4 Supervisor records actuals, locks the period, exports payroll Lock prevents edits; CSV downloads and matches
E5 Wall display Shows counts only; no names anywhere in the DOM; refreshes

These five flows are also the backbone of the ≤ 5-minute demo recording.

6. Demo dataset specification (DemoDataGenerator)

6.1 Fixed parameters

Parameter Value
Seed 20261001 (SC_DEMO_SEED)
Window 1 Oct – 29 Dec 2026 (90 days)
“Today” 19 Nov 2026 (SC_DEMO_TODAY): days before today get actuals; today and later are planned only
Pay periods Biweekly, Monday start: 28 Sep, 12 Oct, 26 Oct, 9 Nov, 23 Nov, 7 Dec, 21 Dec. Periods ending before today are LOCKED.
Schedule periods One roster week (Monday–Sunday) per unit, from the Monday before the window (28 Sep) to the week that starts in it (28 Dec): 14 weeks × 6 units = 84 rows. Weeks that ended before “today” are PUBLISHED (the morning after they ended); the week “today” falls in and the weeks after it are DRAFT, so a supervisor has a period to publish. Every shift points at the period that covers its work date.
Rule set v1 from 05-union-rules.md, published 1 Oct; the generator then creates demo versions v2–v7 (history only) so the Rules screen shows a realistic version list

6.2 Units and required staffing (by block, ADR-013)

Unit Day 07–15 Evening 15–23 Night 23–07 Qualification rule
Unit A · Living unit 5 5 4 ≥ 1 FIRST_AID per block
Unit B · Living unit 5 5 4 ≥ 1 FIRST_AID per block
Unit C · Living unit 5 4 4 ≥ 1 FIRST_AID per block
Admissions 3 3 2 —
Control 3 3 3 all CONTROL
Escort & transport 6 4 2 all ESCORT
Total 27 24 19  

12-hour patterns are allowed on Units A–C and Control (allows_12h); the allows_16h flag remains in the data for old history, but the 100 seed no longer creates 16 h slots (ADR-029); Admissions and Escort use 8-hour shifts only.

6.3 Why these numbers produce realistic overtime

6.4 People

Item Rule
Names First and last names drawn from fixed fictional lists (60 + 60) in the repo, combined uniquely by the seeded random generator. The named demo characters (Tara Nakamura, Nia Thompson, Ruth Okafor, Marc Desjardins, Kari Lindqvist, Sam Abara, Piotr Kowalczyk, Leah Morin, Devon Clarke, Aiden Bergeron) are created first with fixed IDs, matching the UI design.
Home units Spread to fit requirements; Control and Escort staff hold those qualifications
Qualifications CONTROL 25 officers; ESCORT 30; FIRST_AID 70 (overlaps allowed)
Seniority dates Spread 2006–2025; include two officers with equal OT hours and different seniority (tie-break test)
Classification Officers CO, FTE 1.00. Since release v1.3 (S4) also 10 supervisors (CS, S-001…S-010, five per supervisor post SUP-L and SUP-O), with service dates 2004–2014 and position_since 2018–2025. They are seeded after every officer row from their own Random (seed XOR 0x509): 8 h D8/E8/N8 shifts from the same roster walk, the same 2% sick + 2% vacation, sick calls offered as overtime to the other supervisors only, and their actuals. M. Ellis is S-001 Morgan Ellis (SUP-L) and J. Chen is S-006 Jamie Chen (SUP-O); both sign-ins are linked, so My schedule has rows. The officers’ rows are byte-identical to the pre-S4 dataset (DemoChecksum.officersOnly = 4156077d…da6b). Datasets 120 and 150 get 10 and 12 supervisors on D12/N12 crews (150: plus a D8 day supervisor, a 0.6 FTE part-timer, 20% leave from their own Random and M. Ellis’s vacation week 8–14 Feb 2027); see DemoSupervisorCrews

6.5 Events

Event Rule
Sick days ~2% of past and near-future shifts, random (seeded); recorded as type SICK only (ADR-020)
Vacation ~2% of shifts, as blocks of 3–7 consecutive days, booked in advance (ADR-020)
Gap filling For each hour below requirement, create an open shift; fill using the real ranking and rules: candidates in O-02 order, skip any with a Block, voluntary acceptance with probability 0.7 (seeded). Leave ~1–2% of gaps unfilled so reports show imperfection.
Actuals (past days) Worked as scheduled, except: absences; ~3% of shifts extended by 0.5–2 h (extra hours; overtime only if the officer ends the period over 80 h); a few early leaves. Time entries get pay codes from the pay-classification rules.
Overrides Exactly one: the planted PC-03. (An earlier version also planted three decorative overrides; they were removed after review because they were audit records of events that never happened.)
Audit Every generated change writes an audit event with actor system:generator

6.6 Planted cases (stable IDs, used by tests and the demo)

ID What Where
PC-01 Nia Thompson: P12 Fri 20 Nov 12:00–24:00; assigning her D8 Sat 21 Nov 07:00 is blocked by U-01 (7 h rest), U-05 (17 h in 24 h), U-08 (8 consecutive work days with the following week) and U-14 (the week reaches 64 h) Unit B
PC-02 An officer with N8 ending Thu 26 Nov 07:00 and an E8 slot open at 15:00 (exactly 8 h). Caveat (dev-qa, 2026-11-20): the planted officer (E-003) is also at 10 consecutive days in the base roster, so U-08 blocks the assignment too. Use PC-02 to show the boundary rule result (U-01 silent at exactly 8 h, U-02 WARN for 8 h against the 12 h target), not as an assignment to save Unit A
PC-03 P12 shift starting Tue 3 Nov 12:00 and ending 24:00, with a 5 h actual extension to 05:00 on Wed 4 Nov (17 h worked; the assignment stays 12 h) and override reason “Lockdown, relief unavailable” (E-047 Pia Nguyen). Unit C is in no demo supervisor’s scope, so it shows on the auditor’s (facility-wide) overrides report, not a supervisor’s Unit C
PC-04 Piotr Kowalczyk: four consecutive A12 (00:00–12:00) ending Mon 23 Nov, with a fifth available Control
PC-05 Pay period 26 Oct – 8 Nov, LOCKED, with officers under, exactly at and over the 80 h threshold, and a 29-minute extension (unpaid) All
PC-06 At least three 4-night runs in the published roster (for the dry-run test T7) Mixed
PC-07 Two officers with identical OT hours this quarter, different seniority Unit A
PC-08 Open shift Sat 21 Nov Unit B Days with candidates matching the UI’s Overtime board; Tara Nakamura (the demo employee account) is free to take it Unit B
PC-09 An officer without CONTROL qualification ranked first for a Control open shift Control
PC-10 (v1.3 P5) Planted shift proposals: Tara’s Waiting proposal (Tue 22 Dec E8 Unit B for M. Ellis, Wed 30 Dec E8 Admissions for J. Chen), her Sun 22 Nov Admissions proposal Declined by J. Chen with a comment, her Mon 16 Nov Unit B proposal Expired, and M. Ellis’s own Waiting Sun 29 Nov D8 on SUP-L for J. Chen or the planner. Nav counts on a fresh reset: Ellis 1, Chen 2. No shift is created, so no checksum moves; written after the roster from their own Random (seed XOR 0x5050), with each waiting shift’s real non-Block rule result (on 120/150, the first eligible dates, for that dataset’s Tara Nakamura). ADR-032; walk in docs/demo-script.md §8 B, ADM, SUP-L

6.7 Self-check (generator fails the build if any is false)

  1. No overlapping assignments for any officer.
  2. Apart from planted cases PC-01 to PC-04 and the logged overrides, no saved assignment breaks a Block rule of the rule set in force on its date.
  3. Coverage: ≥ 97.5% of hour-slots meet requirement across the window; at least 5 unfilled gaps exist.
  4. Overtime: total 3–8% of worked hours (ADR-020); at least 10 officers with zero overtime and at least 5 above 25 h this quarter (skew).
  5. For every locked pay period: sum of actual time entries = sum of payroll export lines per officer. (Checkable only once the payroll export exists, step 9; until then the self-check doesn’t assert it.)
  6. Every person row has is_synthetic = true; no name appears outside the fixed lists. (Enforced by construction, since names are drawn only from the fixed lists, rather than by a separate assertion.)
  7. Re-running with the same seed produces identical row counts and a matching checksum of assignments.
  8. Every assignment that ended before “today” has an actual time entry or an absence (so every past period can be locked, ADR-017).
  9. Schedule periods: every unit has one Monday-to-Sunday period per week of the window, no two periods of a unit overlap, the weeks that ended before “today” are published and the current and later weeks are drafts, and every shift points at the period that covers its work date.
  10. Supervisors (release v1.3): 10 supervisors; no officer shift on a supervisor post and no supervisor shift on an officer post; ≥ 97.5% of the posts’ hour-slots covered; M. Ellis and J. Chen linked to supervisor records. Checks 3 (line units) and 4 and PC-07/PC-09 (overtime) are measured over the officers only.

7. Test data hygiene

8. Intentionally not built

Things the design describes that the prototype does not have. They are listed so that nothing reads as an implied feature, and no test claims to cover them. Checked against the code on 2026-11-20 and re-checked for v1.3 on 2026-11-25.

Not built What exists instead Where it is designed
Excel round-trip for rule tables (download/upload .xlsx) The in-app grid only. No export or import endpoint, no Apache POI dependency docs/04 §2, docs/07 §4.7, FR-74
Waiting proposals drawn on the planning board Built since v1.3 P4: the supervisor’s Proposals inbox (/proposals) decides proposals, and an approved one is an extra chip with “from an approved proposal” in its tooltip. A waiting proposal is not drawn on the board (plan §3.2: the inbox is the place); the ! D proposed chip exists only in the fixtures web docs/07 §4.4, docs/ui/README §6
My hours (/me/hours) and a separate rule version review page (/rules/{version}/review) Placeholder pages; the approver reviews and approves on the rules screen docs/ui/README §6
Withdrawing or expiring an overtime offer Offers are accepted or declined. The schema has WITHDRAWN and EXPIRED statuses, but nothing sets them docs/07 §4.2 (move and cancel)
ETag/If-Match in general Only assignment move and cancel (docs/07 §4.2); rule drafts rely on the build fingerprint docs/07 §1
Per-officer “changed since published” flag and the short-notice check (FR-07, P-05/S-01) The board returns publishedState.unpublishedChanges as a real count (the shifts of the period changed after it was published, from the audit trail) and names the period in period; no P-05/S-01 rule row and no per-officer changed marker FR-07, docs/06 schedule_period, docs/05 P-05/S-01
OpenAPI document and Swagger UI (NFR-09) docs/07 is the written contract. No springdoc dependency, no /api/v1/openapi.json and no Swagger UI NFR-09, docs/07 §1
Editing shift-template start times through the rules flow (ADR-015, FR-02) The templates are seeded in V2 (six), V6 adds D12/N12 and V13 retires L16 (eight rows, seven active). The rules screen’s /rules/{version}/shift-types route resolves to the SHIFT_LENGTHS table (allowed lengths), not a shift-template editor ADR-015, docs/ui/README §6
Full token claims: nbf, iss, aud The mock issuer’s tokens are checked for signature, exp and the identity claims only. A real identity provider over OIDC would bring the rest (pilot) docs/09 §4
A payroll-clerk role for lock, unlock and export Any supervisor with a unit in scope, audited (ADR-022) ADR-022 pilot note
Arrow-key (roving tabindex) navigation in the roster grid Every chip is reachable by Tab, with a skip link; reaching one can take many presses ai-dev-log #51
Tablet-specific layouts Responsive layouts; the e2e suite runs at 768×1024 with axe. No tablet-specific design or touch testing docs/ui/README §4
Wall display “open shifts in the next 48 h” list Counts of open shifts today per unit and in total (the api returns counts only) WallDisplay.dc.html
Notifications, shift trades Offers are in-app only ADR-010
A session that survives a refresh on prod-like (token persistence) The token is memory-only by decision on prod-like; the demo profile does keep it in sessionStorage (ADR-025 amendment, built and tested): on prod-like a refresh, new tab or deep link shows “Please sign in to continue.” and returns to the screen after sign-in ADR-025

Phase 3 test classes (for the acceptance table)

New or materially extended in phase 3: PlannerApiTest (draft/commit/scorecard/preferences/compare/committed read), PlanGeneratorFteTest (FTE bands and casual target), PlanGeneratorCrewTest (D12/N12/D8/E8 separation, 4/4 coverage), WeekendRotationProbeTest, RotatingBreakProbeTest (variant A-F evidence for ADR-026), DemoResetApiTest (100 reset twice, checksum, audit, guards), DemoResetProfileTest (not in prod-like), DemoResetGatingTest (sc.demo.generate=false), DemoOperationLockTest (cross-thread release), Demo120ResetApiTest (120 composition, deterministic checksum, reset back to 100, 120 plan gaps/warnings/no Block, qualification report), PlannerAbsenceApiTest (read-only skip, idempotency, authz, concurrent one-row guarantee), PlannerHistoryActualApiTest (an extension on the 21-29 Dec look-back history reaches the generator), ActualTimesInRulesTest (the roster/actual envelope: U-04/U-05 and rest see an extension, a short actual cannot relax a Block), PlannerDiscardRaceApiTest (a discard racing a commit is 409, never a false DISCARDED), DemoResetFailureTest (an Error releases the lock, sets FAILED and hides the raw text), PlannerPreferenceKindsTest (F10: D12/N12 score by their template row; scorecard == compare; N12 12/NIGHT MET, D12 8h NOT_MET), HoursAndRunsRulesTest (D12/N12 boundary cases), ReferenceDataMatchesRuleRowsTest (published v2 == code rows), SchemaConstraintsTest (V6 baseline), ReferenceApiTest (eight templates), PayrollApiTest (contradictory time-entry body), JwtServiceTest (tamper test flake fix). The final counts are in §2.