Short records of important decisions. Status: Proposed → Accepted / Rejected / Superseded.
Status: Superseded by ADR-009 (2026-11-19)
Status: Accepted Decision: A deterministic rules engine decides whether any schedule change is allowed. A supervisor is accountable for every change and override. Nothing is auto-approved.
Status: Superseded by ADR-006
Status: Accepted Decision: A fictional facility with synthetic staff and staffing levels. R-01 and R-02 come from public Saskatchewan employment-standards guidance. Collective-agreement values are placeholders, flagged in the UI. Real-world domain knowledge shapes the workflows; no real or non-public operational data is used.
Status: Accepted
Context: Scheduling decisions affect employment rights, pay and facility safety.
Decision: No AI in the running system. AI is used during design and development (required by the assessment) and logged in process/ai-dev-log.md.
Consequences: Simpler governance (no model risk, no external data flow); everything is reproducible. Future AI uses (drafting notifications, summarizing reports) are documented but not built.
Status: Superseded in part by ADR-011 (middle tier is now Java + Spring Boot; the three-container layout stands) Decision: Front end: React + TypeScript + MUI, served by nginx. Middle tier: ASP.NET Core Web API on .NET 10 (LTS). Database: PostgreSQL. Orchestrated with docker compose. Why .NET: widely used in government and enterprise (including Microsoft-centric public-sector shops), long-term support, strong typing for rules logic, and first-class OpenAPI and EF Core with PostgreSQL. Alternatives: Java 21 + Spring Boot (equally enterprise-grade; choose it if the target team is Java-oriented); Node/NestJS (fast, but less common for government middle tiers).
Status: Superseded by ADR-012
Decision: Coded rule types, configured through database rows with schema-checked settings, versioning and effective dates. See 04-rules-engine.md.
Alternatives: Microsoft RulesEngine (JSON expressions), Drools (Java), or a domain-specific language. Rejected for the prototype because they’re harder for non-developers to change safely and harder to test exhaustively.
Status: Accepted, and built (checked 23 Nov 2026): the payroll CSV export and the mock sign-in live inside the api and db containers; there is no fourth container. Decision: Payroll CSV export and mock identity live inside the existing containers. No extra containers, so we stay within the three-container constraint.
Status: Accepted Decision: Planning board, employee view, overtime, time tracking with payroll export, reports, and a configurable rules engine (trades and notifications moved out by ADR-010). Features are tiered Must / Should / Could to fit seven days and a five-minute demo. Risk: The scope is large for seven days. Should items are cut first.
Status: Accepted (2026-11-19)
Decision: Shift trades (with monthly/quarterly limits) and notifications/alerts move to future work. The simulation uses 100 fictional officers over a 90-day quarter, with past actuals and future planned shifts.
Why: It narrows the build to the core: planning, rules, overtime, time/payroll and reports. A 90-day window with 100 officers is big enough to show realistic coverage gaps, overtime distribution and quarter-level reports.
Consequences: The rules engine keeps room for a MaxCountInPeriod rule type for trades later. The performance targets (NFR-05) are set for 100 officers.
Status: Accepted (2026-11-19); Java version revised by ADR-012 Decision: The API container runs a Spring Boot 4.x application on Java 21 (LTS), built with Maven, using Spring Data JPA / Hibernate, Flyway and Spring Security, against PostgreSQL. The three-container layout (web / api / db) is unchanged. Why: Java with Spring is a long-established enterprise and government standard with a large talent pool, long-term support and mature tooling for REST APIs, security and database migrations. It fits the brief that the middle tier should be technology a government or enterprise would use. Consequences: The rules engine is a framework-free Maven module (plain Java), so it can be unit-tested in isolation and reused elsewhere. Spring Boot minor versions get roughly 12 months of free support, so a pilot would plan regular upgrades.
Status: Accepted (2026-11-19) Context: Rules must be understandable and changeable by a non-technical person (HR, labour relations), and should run on a recognized engine. Decision: Use Drools 10.x (Apache KIE), embedded in the API. Developers write rule templates and Java fact builders (the time-window maths). Non-technical admins edit decision-table rows in a friendly in-app grid, with plain-language previews and an Excel round-trip (the round-trip was not built in the prototype: docs/10 §8). Changes go through validate → compile → regression test → dry run → maker/checker approval → hot publish, with versioning and rollback. Alternatives: (a) a custom rule-type catalogue (ADR-007): simpler, but not a recognized engine; (b) raw DRL rule files: too technical for the target editors; (c) DMN with visual editors: standards-based, but needs tooling outside the three containers. Noted as a future option. Consequences: The Java target moves from 25 to 21 LTS, because KIE’s published support covers Java 21. Spring Boot 4.x compatibility is confirmed by a Day 1 spike; the fallback is Spring Boot 3.5.x (past free support, a recorded governance risk). Apache KIE is an incubating project, so its support model needs confirming before a pilot.
Status: Accepted (2026-11-19)
Decision: Required staffing is defined per unit per block (Day 07–15, Evening 15–23, Night 23–07), optionally with a qualification minimum. Revised the same day: coverage is measured hourly: each block’s requirement applies to every hour in it, and a block is covered when every hour meets it. (The first version, “a shift counts toward a block if it covers half of it”, double-counted 12-hour shifts; see ai-dev-log #10.)
Alternatives: headcount per shift only (too coarse for qualification checks); named posts (most realistic, but much more setup). Named posts remain a future extension of unit_requirement.
Status note: still to be confirmed against real practice (open question 1 in docs/process/HANDOFF.md §8); the prototype uses the hourly by-unit-and-block model throughout.
Status: Accepted (2026-11-19)
Decision: REST/JSON under /api/v1, OpenAPI generated from code, RFC 9457 Problem Details for errors, rule outcomes returned as 422 with a ruleResults extension, a separate preview endpoint (/rule-checks), explicit acknowledgeWarnings and override.reason fields, and optimistic locking with ETags.
Why: predictable for reviewers and future integrators; makes “the rules said no” a first-class, explainable response rather than a generic error.
Status: Accepted (2026-11-19)
Decision: Defaults set by the project lead: 8 h shifts 07:00–15:00, 15:00–23:00, 23:00–07:00; 12 h shifts 00:00–12:00 and 12:00–24:00; 16 h shifts 20:00–12:00 (regular, on units that allow them; revised the same day, they were first recorded as overtime-only doubles). Shift templates are configuration (shift_template), edited on a “Shift types” table in the Rules screen and published through the same draft → build → dry run → approve flow, because changing shift times changes rest and hours outcomes.
Consequences: The 12 h rotation must run 00–12, 00–12, 12–24, 12–24, then 4 off; a 12–24 shift followed by a 00–12 shift would give zero rest. Existing assignments keep their own times when a template changes. The UI mockups still show the earlier 07–19 / 19–07 12 h times; the build uses the new defaults.
To confirm: actual shift start times at the centre.
Status: Accepted (2026-11-19)
Decision: Overtime = hours worked beyond the threshold for the period (default 80 h per 2-week pay period; a weekly 40 h threshold is not selectable in the prototype, the validator refuses it), in time order. Rostered 8, 12 and 16-hour shifts are regular hours. Shifts carry ROSTERED / EXTRA, not “overtime”. Default rate: 1.5× for all overtime hours, with an optional higher band (MOCK). Day-of-rest double time (P-02) is off by default pending confirmation.
Why: the lead’s direction; matches averaging arrangements for long-shift rotations.
Governance note: the Saskatchewan Employment Act’s default overtime is daily/weekly; period averaging relies on a modified work arrangement or collective agreement provisions. Recorded as an assumption to confirm.
Consequences: pay codes are recalculated for the whole period after any change and frozen on lock; the overtime ranking still uses overtime hours this quarter.
Status: Accepted (2026-11-20, lead confirmed; proposed in docs/ui/build-notes.md §3)
Decision:
GET /schedule and GET /display/today return, per block, lowestHourly, shortHours and covered (07-api-spec.md §4.2). The wall display stays counts only.409 missing-actuals; the UI disables “Lock pay period” and says how many are missing. The demo generator must give every past shift an actual (self-check 8).RULES_APPROVER has no roster access (09-access-control.md §2).5 / 5 while two hours are short; (2) exporting a period with unrecorded shifts would put wrong figures into payroll; (3) keeps the permission matrix true on every screen; (4) “not yet decided” must stay visible, and nothing auto-approves (HANDOFF guardrail 3).
Consequences: extra fields in two endpoints; one new problem type; boundary test and scenario T14 in 10-testing.md; generator self-check 8.Status: Accepted (2026-11-20, from review of 502c434)
Decision: V1__schema.sql creates no database roles or grants. The prototype runs migrations and the app as one database user (the postgres image’s POSTGRES_USER). Append-only audit is enforced by triggers that raise an error on UPDATE, DELETE and TRUNCATE of audit_event, and repository tests prove them.
Why: a separate application role needs a second set of credentials and a role-aware Flyway setup, which adds setup risk for the reviewer without changing what the demo can show. The triggers block every application path, including bugs.
Limit (stated honestly): the single user owns the tables and is a superuser in the official image, so it could drop or disable the triggers. The trigger protects against application error and ordinary SQL, not against someone holding the database owner’s credentials.
Pilot: a migration-owner role and an application role with INSERT, SELECT only on audit_event; audit retention per the records schedule. Recorded in 08-deployment.md §9.
Supersedes: the earlier wording in 06-data-model.md and 09-access-control.md that the application role had INSERT, SELECT only.
Status: Accepted (2026-11-20, lead’s decision). Confirmed by the person on 2026-11-20.
Decision: S-04 has no rule table and no RequiresAuthorization template. EXTRA shifts and overtime offers can be created or confirmed only by a SUPERVISOR (POST /assignments, POST /open-shifts/{id}/offers|assign, POST /offers/{id}/confirm, POST /proposals/{id}/decision), and each writes an audit_event with actor and time. An employee accepting an offer doesn’t create the assignment; the supervisor’s confirmation does.
Why: “who may authorize” is a permission, already enforced by role and scope checks (09-access-control.md §3) and proven by the authorization tests; a configurable table would let an admin switch off a safeguard (HANDOFF guardrail 3).
Consequences: 05-union-rules.md §2E and §4 updated; S-04 is tested by the authorization tests (an EMPLOYEE creating or confirming an EXTRA shift gets 403) and by checking the audit event, not by the rule boundary matrix.
Status: Accepted (2026-11-20, orch.lead while the project lead was away). Confirmed by the person on 2026-11-20. Found by the generator build (docs/process/ai-dev-log.md #27).
Decision: the demo generator uses about 2% sick + 2% vacation (was 4% + 4%), and self-check 4 accepts 3–8% overtime of worked hours (was 3–6%).
Arithmetic (per 2-week pay period, 80 h threshold, ADR-016):
These are upper bounds: an absent 12 h officer also loses some of their own structural overtime. Doesn’t change: HANDOFF §4’s dataset decisions (100 fictional officers, 90 days 1 Oct – 29 Dec 2026, “today” 19 Nov, seed 20261001), the rotations, the staffing requirements, or the overtime rule. It changes only the absence rates and one self-check threshold. Trade-off: fewer absences mean fewer coverage gaps to demonstrate. Gap filling, unfilled gaps (self-check 3) and the planted cases are unaffected.
Status: Accepted (2026-11-20, from the dev-qa / review-r2 review of 0dc96e1; the lead routed the findings).
Decision:
POST /rule-checks delegates to the same service method as POST /assignments, so a supervisor’s preview is unit-scope checked (404 outside scope) and an employee can preview only their own record on their own unit.POST /assignments takes pg_advisory_xact_lock on the employee id before evaluating the rules, so two concurrent saves cannot both pass against the same old roster. The overlap exclusion constraint stays as the last line of defence and now answers 409 rather than an error page.BLOCK must also list every WARN code in acknowledgeWarnings; otherwise it is refused with 422 warnings-need-acknowledgement. Nothing auto-approves.404, a malformed or incomplete body answers 400, and every error is RFC 9457 problem+json with no stack trace or internal class name.
Why: the review proved each of these with a working probe: a supervisor previewed a unit outside their scope; two parallel saves both created shifts that break U-01; an override silently approved warnings; and bogus ids returned 500 pages. All four are HANDOFF guardrail 3 or the RFC 9457 contract in 07-api-spec.md §1/§3.
Consequences: the preview’s employee-own path is unchanged; the rule check now reads the published version from rule_set_version instead of a constant (so a published v2 is reported without a code change); existingShifts reads 28 days back (U-11 needs 28 days) and 14 days forward; AuthorizationMatrixTest, AssignmentApiTest and ProblemDetailsApiTest prove each case.Status: Accepted (2026-11-20, orch.lead while the project lead was away, from dev-qa’s step 9 PASS). Confirmed by the person on 2026-11-20.
Decision:
pay_period in 06-data-model.md), so locking, unlocking and exporting can’t be scoped to units. Any supervisor with at least one unit in scope may lock, unlock (with a reason) and export the facility’s period. The auditor reads it. Each action is audited with the actor; unlock also records the reason, and export records the file hash.200 with the period view and writes no second audit row.
Why: payroll runs per period for the whole facility. Splitting a period by unit would mean partial locks and partial exports that payroll can’t use. The idempotent lock makes a double click or a retry harmless, without a misleading second audit entry.
Trade-off (stated plainly): one supervisor can lock or unlock the period for every unit, and the export carries pay lines (employee number, hours, pay codes) for officers outside that supervisor’s scope. This is wider than the unit scope used everywhere else (09-access-control.md §2). The audit trail makes it visible, but it doesn’t prevent it.
Pilot: restrict lock and export to a payroll-clerk role (or a payroll office), or require a second approver for unlock and export, and review who can see facility-wide pay lines under FOIP.
Consequences: 09-access-control.md §2 (the record-actuals row stays unit-scoped; lock, unlock and export are facility-wide) and 07-api-spec.md §4.5 updated; each facility-wide cell needs an authorization test (a supervisor with any scope allowed, the auditor and others refused) — check they exist before calling step 9 complete.Status: Accepted (2026-11-20, orch.lead while the project lead was away). Confirmed by the person on 2026-11-20.
Context: 05-union-rules.md said U-14’s Block allowed an override. Rule set v1 (RuleRowsV1.java, V2__reference_data.sql) gives U-14, U-08 and U-09 the override policy ACKNOWLEDGE, and the api refuses an emergency override for a Block with that policy. The full-stack e2e run made this visible: PC-01 (Nia) blocks on U-01, U-05 and U-14 (and, after the release-5 seed repair, U-08), and no override is offered.
Decision: keep the code. Only Blocks whose policy is EMERGENCY can be overridden, with a reason of ≥ 10 characters, and audited: U-01, U-03 and U-05 in v1 (U-06 when built). The U-08 (consecutive days), U-09 (consecutive 12 h shifts) and U-14 (60 h weekly ceiling) Blocks can’t be overridden in v1. The override policy is a column of each rule row, so a ministry can loosen it through the rules admin’s maker/checker flow without a code change.
Why: a Block that nothing can override is the safer default; no safeguard is weakened. Loosening a rule then becomes a deliberate, approved and audited rule change, not a per-shift decision.
Trade-off (stated plainly): a real lockdown that needs a 61st hour in a week, or an 8th consecutive day, can’t be saved without a rules change. The answer today is to change the rule through maker/checker. That is slower than an emergency override, but fully audited.
Consequences: 05-union-rules.md §2 (legend, U-06, U-08, U-09, U-14), §3 notes and the §5 example; 10-testing.md §1 and the U-14 boundary row; 09-access-control.md §2 override row; 02-requirements.md FR-23. The demo shows PC-01 as the Block with no way around it, and PC-03 (U-05, a lockdown) as the legitimate override.
Status: Accepted (2026-11-20, orch.lead while the project lead was away, from review-r3’s authorization pass). Confirmed by the person on 2026-11-20: keep it.
Context: docs/09 §3 said the scope guard checks “the target unit, or the target employee’s unit”. The code checks the target unit only for a supervisor (AssignmentService.preview and assign call ScopeGuard.requireUnit on the shift’s unit). So a supervisor can preview and save a shift for an officer whose home unit is outside their scope, as long as the shift is in a unit they run.
Decision: keep the code. This is cross-unit cover: an officer from another unit works an extra or covering shift in a unit the supervisor runs, which a 24/7 centre needs when relief is short. A supervisor:
404);09-access-control.md §2 (assign row) and §3 (API scope); 07-api-spec.md §4.2 Roles.Status: Accepted. Confirmed by the person on 2026-11-20. Raised by the UI test round (defect D11, found by dev-qa).
Context: the web keeps the signed token in memory, not in localStorage or sessionStorage. A full page reload or a deep link therefore starts without a session. Before the fix, that showed four 401 answers and page errors on screens such as Reports instead of the sign-in screen.
Decision: keep the token memory-only: no localStorage, no sessionStorage, no cookie written by the web. A screen opened without a session goes to /login with “Please sign in to continue.” After sign-in the person returns to the screen they asked for when that screen is in their role’s menu, and otherwise goes to their role’s home (after v1.3: landingFor, so an officer is not dropped on a supervisor screen; the bare address / is never remembered). The return path is validated (web/src/shell/returnPath.ts: in-app paths only), so the sign-in screen cannot be used as an open redirect.
Why: a token in web storage can be read by any script that runs on the page. The prototype’s sessions are short (8 h), and a refresh is cheap with mock sign-in. A pilot moves to government SSO, where the session is the identity provider’s.
Trade-off (stated plainly): every refresh, new tab or deep link asks for sign-in again.
Consequences: web/src/shell/RequireSession.tsx, LoginPage.tsx; e2e session-and-nav.spec.ts (reload on /reports/coverage and /planning lands on sign-in with the notice and no page errors, then returns); 10-testing.md §8 and README list it as a known limit.
Amendment (S11, 2026-11-23): on the demo profile only, the token also survives a refresh in sessionStorage.
Context: losing the session on every refresh is painful in a live demo, and the demo’s sign-in is mock (any listed user, no secret).
Decision: at start-up the web asks GET /api/v1/version; only when it reports demoMode: true does it enable persistence (enableSessionPersistence in web/src/api/session.ts). The token and user are then kept in sessionStorage (key sc.demoSession: per tab, gone when the tab closes), restored on load, and removed on sign-out and on any 401. On prod-like (no demoMode), or if the version call fails, nothing is written and the original memory-only rule above is unchanged. VITE_PERSIST_DEMO_SESSION=false at build time (a .env value passed through docker-compose.yml and web/Dockerfile; exactly the string false) switches it off entirely. No localStorage, no cookie.
Trade-off (stated plainly): on the demo, a script running on the page can read the token, and can also write a forged user or role list into the saved value, which the UI trusts until the next 401 (the api still enforces roles). Accepted because the demo’s tokens are mock, short (8 h), and the data is synthetic. A pilot (SSO) keeps the memory-only rule.
Consequences: session.ts, main.tsx; unit tests session.test.ts; e2e session-and-nav.spec.ts (refresh keeps the demo session; sign-out and 401 clear it; clearing storage reproduces the memory-only reload cases, now used by the reload tests in planner-committed and officer-pattern).
Status: Accepted (2026-11-21). Confirmed by the person on 2026-11-21 (via operator-agent), with the later refinements recorded here: the plan starts Mon 4 Jan 2027 (00:28Z); weekends rotate (00:29Z); the 8 h default is the rotating 5 on / 2 off pattern (option F, 01:56Z); only 12 h officers work nights (02:24Z); the real 12 h shifts are D12 07:00–19:00 and N12 19:00–07:00, run by separate day and night crews (02:26Z); a “16 h shift” is a 12 h shift plus about 4 h worked as an extension (02:29Z); actual times feed the rule checks where a time entry exists (02:35Z); dataset 120 is 100 full-time crew officers plus 20 casual relief officers (04:19Z); planned absences are a read-only planner input (05:21Z). Context: the person wants a facility-level planner to build a whole-quarter draft from preferences and seniority, then supervisors adjust it. The rules engine is the product’s safety boundary; a solver would put a second copy of the rules beside it, and a time-boxed solver would not be deterministic. The deadline leaves one day for verification. Decision:
PlannerApiTest#theSameSeedAndDataProduceTheSamePlan).RuleCheckService.evaluate(proposed, facts) — the same fact builders and published rule base as the planning board — against the draft’s own assignments plus the committed history before the window. A Block rule means the shift is not placed and the hour stays a visible gap; warnings are kept and counted. This is the seam review-r2 checks.ROTATING_5_2, period −1 (21 Dec – 3 Jan) would have the pair one weekday later than period 0; the seeded history is read, never rewritten. The committed quarter also creates its seven pay periods and each unit’s seven schedule periods (review-r2 gap), so the plan can be locked and paid.ROTATING_5_2 (default, chosen by the person on 2026-11-21): the days-off pair retreats one weekday per pay period; at the Sun-Mon wrap it takes a 3-day break (Mon-Wed) plus a Mon-Tue break, so the changeover period is 72 h and there is no Sun-Mon state. For some phases the pattern would create a seventh consecutive work day; the engine blocks that shift, so the generator leaves it out and the officer has a second 72 h period instead. The person accepted the honest cost. Weekends rotate for every officer. The person accepted the honest cost: at the changeover an officer has one U-12 warning and one U-14 warning per quarter, and hours are balanced over the quarter (72 h one period, 80 h the rest), not per period. Evidence: RotatingBreakProbeTest (variant F) and the decision table (F avg 0.86 U-12/U-14 per officer, 72-80 h, quarter 78.86, weekends 22/22/22); fixed is 0 warnings and exactly 80 h but pins weekends.5_ON_2_OFF (selectable): fixed pair per officer, phases staggered; 80 h every period, no warnings, some officers always work weekends (scorecard weekends min/avg/max).7_ON_3_OFF (selectable): the existing 10-day cycle; warnings show honestly.allows_12h=false for those two units). An 8 h officer’s NIGHT preference stays stored and is shown unmet with the plain reason “only 12-hour officers work nights”; the scorecard carries the same nightPolicy sentence. With crew rows (the 120 dataset) the N12 crew is fixed and the dataset seeds the newest officers into it; the scorecard reports n12Officers, n12NightShifts and a crew note. Without crew rows (the 100 seed) the night block takes volunteers first in seniority order, most senior first, then the rest newest-first (seniority date descending, ties by employee id). Cross-unit cover is never generated. The scorecard’s newestFirstHeld and sentence come from this ordering.timeOfDay is accepted on input for one release (mapped to a one-element set; NONE/null to empty), and responses carry timesOfDay only. Preferences are visible to PLANNER only; an officer edits their own at /me/preferences. Where staffing and the rules do not allow a wish, the scorecard counts it unmet rather than bending a rule.employee.shift_pattern (ROTATING_5_2 default, 5_ON_2_OFF, 7_ON_3_OFF check) and lets plan_draft.pattern8h be null when a draft uses each officer’s own value. The column is the 8 h pattern; a 12 h officer’s 4-on/4-off cycle stays derived from the existing crew rotation_pattern row, so there is one source and no drift, and the officer’s pattern is read-only. The facility-wide select and its default send are gone from the web; pattern8h remains an optional one-release API override. The generator resolves works() per officer and staggers phases per pattern cohort, so rotating, fixed and 7/3 officers sit side by side; the same rule engine verifies every proposal, so a pattern that would create a Block day leaves a gap rather than breaking a rule. With every 8 h officer on the default, the 100 and 120 drafts are shift-for-shift the c9ac073 drafts (120: 5,103 rows, e8b29ce6…fe9d31; 100: 6,586 rows, ec337014…409e1b), pinned in Demo120ResetApiTest. A small mixed 120 seed was optional and is not seeded: keeping the default proves identity and keeps the release gate’s expected numbers exact; mixed cohorts are covered by PlanGeneratorPatternTest. A pattern change takes effect on the next generate exactly like a preference change; the product has no draft-staleness flag.plan_draft, plan_draft_assignment and plan_draft_gap and never touches shift_assignment until commit. Commit (a) re-runs every rule check against the current committed state, refusing any Block with a per-assignment failure list; (b) requires the exact warning list count to be acknowledged in one decision; (c) requires If-Match with the draft version and answers 412 when stale; (d) refuses a locked period with 409; (e) writes every row and one commit_plan audit event in a single transaction, linking each row to its draft (shift_assignment.plan_draft_id). Overrides are never implied (ADR-021).PLANNER role (all units), read-only on the planning board like the auditor. Supervisors stay unit-scoped. GET /planner/preferences is PLANNER-only.nightPolicy (only 12 h officers work nights), officers and hours over 80 per period, generation milliseconds, and weekends worked per officer (min/avg/max).POST /planner/absences (employee, date, type); the next generate reads absence rows in the quarter and skips that officer on those dates, leaving the post to a relief/casual officer or a visible gap. This is a read-only input, not leave management: no approval, no screens, and the 120 seed does not seed leave by default. The scorecard carries an absences line/counts. The 100 seed’s 2026 absences fall outside the 2027 window, so its plan is unchanged.employee.fte now drives planning: full-time officers
(FTE 1.0) get the pattern above; officers with FTE < 1.0 are a fill pool with no guaranteed hours,
taken after full-timers are placed, nights first, newest-first, one shift at a time, each proposal
engine-verified and never above FTE × 80 hours in a pay period. The scorecard reports hours
against target by FTE band and says plainly that part-time/casual officers fill what is left;
unfilled gaps stay gaps.RuleCheckService.history). The PUT /time-entries body that carried both
workedAsScheduled and actual times is now 400 and writes nothing. The 100 checksum and the
payroll golden are unchanged; 132 seeded entries legitimately differ from the roster, so some
seeded checks now cite actual times (e.g. Unit A N8 13 Nov: U-01/U-05/U-14 BLOCK with a
94-minute actual). Known limit: an actual recorded after later shifts already exist is not
re-checked (audited, post-freeze).100 (the default seed, unchanged) or 120 = 100 full-time crew officers + 20 casual relief
officers (FTE 0.4–0.8). The reset is a Flyway clean+migrate seeded by the selected provider,
asynchronous, one at a time, PLANNER-only and audited; a reset back to 100 restores the 100
checksum and the V3 unit flags. The 120 provider is the crew dataset in
DATASET120-SPEC.md (38 N12 + 54 D12 + 3 E8 + 5 relief + 20 casuals); it is a separate provider,
not a change to the 100 seed.
ESC evening cover (known): Escort & transport has only D12/N12 crews and no E8 officer; its 19-23 evening requirement is deliberately thin, and all 38 gaps in the 120 plan are ESC evening block-days (measured). Adding an E8 crew or more N12 posts would close them; the demo states this rather than hiding it.
Trade-offs (stated plainly): the default rotates weekends but every officer still gets a fixed 5/2 rhythm within a period; the fixed pattern keeps some officers on weekends and says so; a constructive plan has more gaps than a solver might (gaps are visible and fillable, never hidden); a draft can become stale between preview and commit, which the ETag and the re-check catch. Night capacity is now explicit: with 14 effective 12 h officers for 19 night posts a day, every unit-night is short (588 short night block-days; 727 gaps of 1,764 in the default plan after the paired 12 h phases; DAY 109, EVENING 30), and 8 h casuals cannot fill nights. The 120 dataset must carry at least 38 N12-capable officers (4-on/4-off) plus the qualified mix before the night gaps can close.
Consequences: V5__planner.sql, PlanGenerator, PlannerService, PlannerController, PreferenceController, RuleCheckService.evaluate(ShiftFact, List<ShiftFact>); PlannerApiTest, WeekendRotationProbeTest; 07-api-spec.md §4.9, 09-access-control.md §2, 06-data-model.md §6.Status: Accepted (2026-11-21), after the person’s amendments 13/14 (02:24Z and 02:26Z), the GO on D12/N12 at 02:27Z, and the option-B dataset 120 choice at 04:19Z.
Decision: V6 adds the D12 07:00–19:00 and N12 19:00–07:00 templates (effective 2027-01-04)
and publishes baseline rule-set version 2. U-02’s afterShiftKind becomes
(D8|E8|N8|A12|P12|D12|N12) — additive, existing kinds unchanged — and U-10’s wording is
“overnight 19-07” (its SHIFTS_NIGHT_12H counts A12 and N12). ShiftFact.isTwelveHour and
nominalMinutes recognise both; the consecutive-run builder counts N12 as an overnight. No rule is
loosened, no severity or override policy changes.
Isolation: the 100 seed keeps A12/P12/L16 assignments, its checksum
3390148255...6539, the payroll golden and allows_12h=false for ADM/ESC; a reset test pins all
four. The 120 dataset provider sets allows_12h=true for ADM/ESC when it seeds (the reset is
Flyway clean+migrate, so switching back to 100 restores the V3 flags). The planner reads
rotation_pattern.code (D12_*, N12_*, D8_*, E8_*, CASUAL_12/8) and keeps crews separate;
12 h phases are paired (j and j+4) so a crew of 2p covers exactly p posts every day. The 100 plan
gained day cover from the pairing (789 → 727 gaps), which is an allocation improvement, not a rule
change.
Governance (review-r2, SAFE WITH NOTES): V6 seeds version 2 directly as PUBLISHED, exactly like
version 1: created_by/approved_by are NULL, change_reason is recorded, and there is no
audit_event row. That is the baseline-seeding exception, not the product’s change path; every
later version goes through maker/checker (ADR-019, docs/04 §6). U-10’s message now reads “overnight
(00-12 or 19-07)” because the counter still includes A12 00-12 night-block shifts from v1 as well as
N12 19-07; behaviour is otherwise unchanged.
Evidence: HoursAndRunsRulesTest D12/N12 cases (U-02 after N12, U-09 4/5, U-10 4/5, U-14
48/60/68, U-05 16/16.25), PlanGeneratorCrewTest (196 N12 on 98 nights, separate crews, no
N8/L16), ReferenceDataMatchesRuleRowsTest, DemoResetApiTest, DemoOperationLockTest.
Post-freeze: retire L16 once the person confirms; re-check the payroll golden if the 100 seed
ever switches to D12/N12 (N12 crosses midnight and pay-period boundaries).
Status: Accepted (person, 2026-11-21 23:04Z) and built on p4-unit.
Closures. V11 adds unit_availability(unit_id, disabled_from NOT NULL, enabled_from NULL, reason, created_by, created_at) with enabled_from > disabled_from; disabled_from is the first closed day and enabled_from the first open day again. Overlaps for a unit are refused by the service with the spec’s plain words; closures are written only through UnitsService (the planner API/screen), and the unique (unit_id, disabled_from) index additionally stops a duplicate start. unit.active stays the hard off switch and is not the date source. The leave setting’s DB check now matches the screen cap (0–50%). One SQL function, unit_active_on(unit, day), is the shared answer: a unit is open when active and no window covers the day. No row means open on every day, so the 100/120 seeds, their checksums and the 120/100 plan fingerprints stay exactly as they were.
Readers. ActiveUnits wraps the function and is used by the planner generator, the planner’s roster/draft coverage, the board (ScheduleQuery), the Coverage report and the wall display; ReferenceController keeps returning the unit list with active. Historical readers deliberately stay date-agnostic because history is never deleted: payroll and overtime history, audit queries, assignment history, schedule periods and an officer’s own schedule. A closed unit’s future published shifts stay in shift_assignment; GET /planner/flagged-shifts lists them and the planner is told to send a supervisor to move or cancel them. Nothing is deleted silently.
Planner. A closed unit has no requirement, roster or gap on a closed day. Before the closure its rows are unchanged. Full-time officers whose home unit is closed are offered to other units’ remaining gaps after that unit’s own staff and its own casual pool, in the order home-unit code, seniority, employee number. A 12 h officer only enters a unit whose allows12h is true; an 8 h officer may fill any 8 h shift. Every proposal still goes through the same verifier; the planner has no qualification check and none is invented. The relief pass has a fixed 5,000-proposal cap shared across the pass; if it is ever reached the remaining gaps stay visible gaps (no silent relaxation), and it did not bind in the 120 tests. Closed-unit casuals stay a fill pool with no guaranteed hours, stated on the tile.
Staffing. unit_staffing(unit_id, allocated_headcount) stores the planner’s allocation (default: active officers homed in the unit); staffing_setting.leave_allowance defaults to 0.20 and both are audited. The estimate, stated in words on the panel, is: with 12 h allowed, a DAY minimum becomes a 12 h day post, a NIGHT minimum a 12 h night post, and the 8 h evening posts are max(0, EVENING - NIGHT) (the 19-23 hours the night crew does not cover); a unit without 12 h uses 8 h posts for every block. rawNeeded = 2 × (posts12Day + posts12Night) + 1.4 × posts8, and needed = ceil(rawNeeded / (1 - leaveAllowance)). shortfall = max(0, needed - filled); a unit closed for the whole period needs 0. Staffing periods split at every closure boundary (so a unit is open or closed for a whole period, never part), and at most the three with the most shortage are shown.
Evidence: UnitAvailabilityMigrationTest (V11 function and defaults), UnitApiTest (read/preview/add/change/remove, validation, 403, flagged shifts, staffing split/breakdown/totals/allocation/leave), UnitPlanningApiTest (Unit C closed 2027-02-15: no C roster or gap after it, the days before bit-identical, relief in other units, no Block, deterministic, reopen), Demo120ResetApiTest (no closure rows, fingerprints and checksums unchanged), check-audit-codes.sh (49 codes).
Status: Built on p5; U-16 is a Warn/acknowledge row in rule-set v3 (V12), and v2 stays as history.
Night window (review-r2). U-16 fires for a 480-minute shift that starts in 23:00–07:00, the N8 template’s window; that is deliberately narrower than ShiftKinds.timeOfDay’s preference classification (DAY 07:00, EVENING 12:00/15:00, everything else NIGHT), so an 8 h 19:00 start is an evening for this safeguard, not a night. The flag is computed once in ShiftLengthFactBuilder and carried on ShiftLengthFact, so the template has one source.
Evidence: EightHourNightWarningTest (N8 warns; D8 and N12 do not), RuleSetV3SeedTest (v3 published with U-16, v2 retained), the 100/120/150 fingerprints.
Status: Accepted by the person on 2026-11-22 00:19Z; built on p4-unit after ADR-027’s closure work.
Decision: a third selectable demo dataset, 150, on the 120 shape: 120 full-time (N12 50, D12 67, E8 3; by unit A 25, B 24, C 22, ADM 13, CTL 14, ESC 22) plus 30 part-time (12 N12-capable, 18 8 h; five per unit; FTE 0.4–0.8 cycling). ADM and ESC keep their 12 h agreements. Full-time officers get a deterministic 20% leave placement: 20 of the 98 quarter days per officer in blocks of 1–14 days from a fixed seed, stored as planned absences; part-timers have no leave and remain the fill pool. The source of the mix is STAFFING-SWEEP.md (review-r3) and its loader; the sweep’s mean over five leave placements is 88.6 short block-days (5.0%) and about 98% of posts staffed.
Measured here (not tuned): checksum 2e6cd938254002892c06d9800652666e5a9e786f78f5ca2ed11c7005a987d7f8; plan fingerprint a1e093f7c3630371a0762067a8aed55d6ccb1b6f7a30372257e326d892ceb381; 100 short block-days of 1,764 (5.7%), 39 warnings, 5,414 shifts, 150 officers. The difference from the sweep’s mean is the fixed leave placement and the seeded history, both honest inputs; the data is not tuned to look better. The Staffing tile’s needed figure is a floor: the minimums plus 20% leave, not a promise that every post is filled; the by-unit panel and the tile say so.
Isolation: the 100 and 120 providers, checksums (3390148255…6539, 82b19cf8…32ca), payroll golden d502848d…d06a and plan fingerprints (e8b29ce6…fe9d31, ec337014…409e1b) are untouched. Demo150ResetApiTest pins the reset twice, the plan numbers and the Unit C mid-quarter close on 150. The provider is registered like the others, so /version and the reset API list 100, 120, 150.
Evidence: Demo150ResetApiTest (checksum, counts, leave rows, pinned plan and close-on-150), Demo120ResetApiTest/DemoResetApiTest (100/120 unchanged), UnitAvailabilityMigrationTest and UnitApiTest (the closure/staffing API the dataset uses).
Status: Accepted by the person (“yes to all”) and built on p6; option (b) full plus the cheap V13 half of (a), not (c).
Decision: the 100 seed no longer creates a 16 h template slot: RosterPlanner stops the 16 h swap and the generator maps no longer contain L16. The L16 template row stays for history but V13 sets it inactive, so new assignments and new open shifts that name it are refused with a plain 400; the web pickers no longer offer it, while history chips still render on an old database. PC-03 is rebuilt as the over-limit extension the person described: E-047 Pia Nguyen, Unit C, P12 12:00–24:00 on 3 Nov plus a 5 h actual to 05:00 on 4 Nov (17 h), still U-05 with the emergency override “Lockdown, relief unavailable”. The assignment stays 12 h; the actual carries the 17 h.
Pins (old -> new): 100 checksum 3390148255…6539 -> 01b05436…322e58 (first L16-free pin) -> 4156077d76d41bd5fcf6d6a9a0f51111e9007d16c8a0c6b311e09c6fe801da6b (after the gate repair below); payroll golden d502848d…d06a (1,009 rows, 8,357.18 worked h) -> 9f2d51b38581abea673fe5c85aead3670ca45b36db390fee1d2033d1faa004ff (1,037 rows, 8,197.60 worked h). The 100 plan is shift-for-shift unchanged: fingerprint ec337014…409e1b, 6,586 rows, 727 gaps. Its warning count moves 117 -> 135 (U-12 78 + U-14 57): the plan rows are identical, but the old L16 history supplied U-14 baseline keys for those officers; removing it exposes 18 real plan U-14 warnings. This is the same warningsCard query, not U-16 and not a counting change; measured on both images (old 78+39, new 78+57). Gate finding (dev-qa, phase C): retiring L16 also dropped PC-01’s U-14 block and Tara’s block-free pick-up. Repaired in the seed: Nia’s Mon 16 E8 becomes a P12 (+4 h), a Thu 19 E8 is added (+8 h) and her previous Sat 14 is removed, so the saved week is 56 h and the Sat 21 D8 proposal reaches 64 h with U-01/U-05/U-08/U-14; Tara’s Sun 29 base shift is removed, restoring a block-free Sun 29 D8. The self-check now asserts PC-01’s block set and Tara’s free slot. Golden and plan unchanged; only the 100 checksum moved. The 120 checksum 82b19cf8…32ca, 120 plan e8b29ce6…fe9d31, 150 checksum 2e6cd938…d7f8, 150 plan a1e093f7…838030 are exact.
Rules untouched: L-01 still allows [8,12,16], S-03 and U-03/U-04/U-05/U-11 stay, and the 12 h + extension tests stay: a “16 h shift” in the rules means 12 h + extension, not this template. No rule-set version changes.
Old database: V13 is one UPDATE; 270 old L16 assignments and their actuals remain, and the board/roster/payroll readers still join the inactive template. L16RetirementMigrationTest migrates to V12, inserts an L16 assignment, applies V13 and proves the row survives and the template is inactive.
Evidence: DemoDataGeneratorTest (no L16 rows, template inactive, PC-03 is 12 h + 17 h actual), DemoResetApiTest (new checksum/golden), PlannerApiTest (135 = 78+57 with the unchanged fingerprint), AssignmentApiTest/OvertimeApiTest (plain 400), ReferenceApiTest (seven active templates), Demo120ResetApiTest/Demo150ResetApiTest (120/150 exact), L16RetirementMigrationTest.
Status: Accepted by the person (Sun 22:30Z); built on p7. No migration.
Decision: the quarter-plan scorecard gains a read-only qualification card. For every active unit requirement with min_with_qualification > 0, it counts block-days where fewer qualified officers are on duty than the minimum; it reports failing and checked block-days per unit/block, three sentence forms, and validFromRespected: false with the note “Qualification start dates are not checked: an officer with a qualification counts as qualified for the whole quarter.” The planner still does not enforce qualifications, and every placement path is untouched. Closed unit-days are excluded through ActiveUnits; an officer placed as relief is counted in the unit where they are placed, with their own qualifications. qualificationPolicy is removed.
Measured: 100 346 of 1,470 (A NIGHT 98, B NIGHT 13, C NIGHT 13, CTL DAY 1, CTL NIGHT 98, ESC DAY 24, ESC NIGHT 98, A EVENING 1); 120 0 of 1,470; 150 103 of 1,470 (full breakdown in docs/10). The 1,470 is 15 requirements × 98 days; the earlier plan’s 1,274 was wrong.
Isolation: 100/120/150 checksums 4156077d…da6b/82b19cf8…32ca/2e6cd938…d7f8, payroll golden 9f2d51b3…04ff and plan fingerprints ec337014…409e1b/e8b29ce6…fe9d31/a1e093f7…838030 are unchanged. The card is computed after the generator returns; it cannot alter a placement.
Evidence: Demo120ResetApiTest and Demo150ResetApiTest compare the card total and per-unit/block counts with an independent SQL count; UnitPlanningApiTest closes Unit C and asserts only 42 checked days per C requirement (no C failure after the closure); PlannerApiTest pins the card key.
Status: Accepted by the person (Mon 2026-11-23 01:40Z) and built on p8.
Decision: a PLANNER may add, move (time or unit), reassign one-way (not a two-way swap) or remove one shift in a DRAFT, on the draft Roster tab/API only. Live shift_assignment is never written until commit. Every save requires If-Match with the draft version (428/412) and uses the same RuleCheckService seam as the planner: a Block is 422 blocked-by-rules with ruleResults and saves nothing; a Warn without acknowledgeWarnings:true is 422 warnings-need-acknowledgement and saves nothing; a Pass or acknowledged Warn writes one row, bumps plan_draft.version, writes one edit_plan_draft audit row and recomputes gaps, warnings and the scorecard synchronously. No EMERGENCY override in a draft. Closed unit, duplicate (employee,start), unknown id, retired template, non-PLANNER, busy reset/generate → plain problem detail. Generate/discard delete hand edits (UI confirms); commit still re-verifies every row, edits included. Edits are visible to the planner only until commit. The draft editor also accepts kind: "EXTRA" (default ROSTERED), which the generator never produces. The re-score skips a draft row whose officer, unit or template it cannot resolve (PlanGenerator.assess) rather than failing; commit still re-verifies every row.
Isolation: no migration; no seed, live-board or generator placement change. PlanGenerator’s scorecard assembly is exposed as assess(...); its generation path is unchanged. 100/120/150 checksums 4156077d…da6b/82b19cf8…32ca/2e6cd938…d7f8, payroll golden 9f2d51b3…04ff and plan fingerprints ec337014…409e1b/e8b29ce6…fe9d31/a1e093f7…838030 stay exact; a no-edit generate is byte-identical.
Evidence: PlanDraftEditApiTest, the pre-extraction characterization at 84d0ea0, the existing reset/planner fingerprint tests, and P8-SPEC.md.
Status: Accepted by the person (plan v1.2-supervisors, owner answers Q1 to Q6, 2026-11-24; the plan file says v1.2, the release is v1.3); built in v1.3 S1–S7 and recorded here in S8.
Context: Until v1.3 every person was an officer and supervisors existed only as sign-ins: they ran the board but had no rostered shifts, no rank and no seniority of their own. Owner item 17 asked for supervisors with their own posts, rostered and paid under the same rules as officers.
Decision:
SUPERVISION (option A of the plan), not a new position column on unit_requirement (B) and not a supervisor minimum on each line unit (C). The board, hourly coverage, gaps, publishing, closures, staffing, payroll and the reports already key on unit_id, so they work unchanged, and shift_assignment.unit_id stays NOT NULL. Two posts, one supervisor per block, 24/7 (Q2): SUP-L “Supervision · Living units” covers A, B and C and SUP-O “Supervision · Operations” covers Admissions, Control and Escort (unit_supervision, V19). Both demo supervisors have both posts in scope; their officer-unit scope is unchanged. A post can’t be closed (409 “Supervisor posts can’t be closed; change the minimum instead”), because closing it would send its supervisors into the officers’ relief pool.position (CO 1, CS 2 supervisory) with employee.classification as its foreign key; a new rank is a row. Seniority within rank = coalesce(position_since, seniority_date): a newly promoted supervisor is junior among supervisors, and every officer ordering is unchanged (an officer’s position_since is null).POSTS): R-01 an officer on a supervisor post is a Block with no override, softened to a Warn/acknowledge only by the ACTING_SUP qualification held on the shift’s date; R-02 a supervisor on an officer post is a Warn/acknowledge and counts toward the unit minimum. Both are Must rows edited through maker/checker. The planner never cross-covers: every placement pass keeps each rank on its own posts before the rule check, so R-01/R-02 fire only on a manual assignment, a draft edit or a proposal.422 and writes nothing; confirm checks the pool again.403 “You can’t change your own schedule; ask another supervisor.” (SelfActionGuard, shared with ADR-032). Accepting an offer on My schedule stays theirs.Random streams, so the officers’ rows are byte-identical. M. Ellis and J. Chen are linked to supervisor records (SUP-L and SUP-O, D12 day crew on 120/150), so they have My schedule.beb2e222…b7d1, 120 ca73467d…a64a, 150 353e2e62…91a5; plan rows 7,266 / 5,595 / 5,877; payroll golden 1,124 lines b946ef1f…00e6. The officers alone still give the earlier pins (4156077d…da6b, 82b19cf8…32ca, 2e6cd938…d7f8; plan fingerprints ec337014…, e8b29ce6…, a1e093f7…; the golden’s first 1,038 lines are 9f2d51b3…04ff byte for byte), asserted by GeneratorCharacterizationTest. The earlier submission tag v1.1.2-submission keeps the pre-supervisor numbers.
Consequences: “unit” now also means “post area”, so every unit list groups the posts and every officer-only path has a kind guard. Dataset 100’s planner puts no 8 h person on nights, so 230 of its 588 supervisor-post block-days stay short (all 196 nights plus about 34 days and evenings); Dataset 150’s 93 of 588 come from the supervisors’ 20% leave with one relief per post.
Evidence: PositionTest, SchemaConstraintsTest (V16, V19), PostEligibilityRulesTest, RuleSetV4SeedTest, ReferenceDataMatchesRuleRowsTest, PostEligibilityApiTest, PostsMakerCheckerApiTest, PlannerPostEligibilityApiTest, PlanGeneratorSupervisorTest, PlannerSupervisorApiTest, UnitApiTest (the 409), SupervisorDatasetsApiTest, SelfEditGuardApiTest, OvertimeSupervisorPoolApiTest, GeneratorCharacterizationTest, ScheduleApiTest; web supervisorPosts.test.tsx, gapFill.test.ts; e2e supervisor-posts.spec.ts, supervisor-my-schedule.spec.ts.Status: Accepted by the person (plan v1.2-proposals, owner answers Q1 to Q5, 2026-11-24); built in v1.3 P1–P4, recorded with the demo data in P5.
Context: ADR-017 item 4 said proposals are decided with an explicit Accept or Decline per item and follow the normal 422 / acknowledge / override contract, but the feature was not built. The owner then decided (item 18) to build it properly, add-only.
Decision:
shift_assignment (kind EXTRA, source PROPOSAL) through the board’s own write path (AssignmentWriter). This is the only place a PLANNER writes a shift outside a plan commit (docs/09 matrix row). A later plan commit treats PROPOSAL rows like supervisor edits (ADR-030: refuse rather than overwrite).422, nothing saved), a Warn needs the current codes acknowledged. If an emergency truly needs the shift, the supervisor declines it and uses the board, which has its own override, reason and audit.403, the SelfActionGuard the supervisors’ self-edit guard shares); their own count leaves it out.Random (seed XOR 0x5050), and their “rules when sent” are the live rule set’s real results on the generated roster (no Block for a waiting shift: the next eligible date is taken). On Datasets 120 and 150 they are planted for that dataset’s own Tara Nakamura, whom the T. Nakamura sign-in is not linked to. The audit trail has a row for each planted send (by the proposer’s sign-in), the decline (by J. Chen) and the expiry (by the system, as a real expiry is), each marked planted: true. A failure while planting at boot is logged and boot goes on; a failure during a reset fails the reset.
Pins: a proposal creates no shift until it is approved, and none of the planted ones is, so the 100/120/150 checksums (beb2e222…b7d1, ca73467d…a64a, 353e2e62…91a5), the officers-only checksums, the payroll golden and the plan fingerprints are unchanged. Proposals added four audit codes (submit_proposal, withdraw_proposal, decide_proposal_item, expire_proposal_item); the planted rows use them, so P5 adds none (check-audit-codes.sh: 55 with the supervisors’ codes).
Evidence: ProposalApiTest, ProposalDecisionApiTest (scope, count, mixed-scope card, Block 422, Warn ack, self-approval, planner decides, open-shift fill and order); DemoResetApiTest (the planted proposals, the same ids on two resets, counts Ellis 1 / Chen 2 / planner 2, checksums unchanged), SupervisorDatasetsApiTest (the same on 120 and 150), Demo120ResetApiTest/Demo150ResetApiTest (checksums); e2e proposals-officer, proposals-inbox, proposals-demo (the docs/demo-script.md §8 walk).