ShiftCircle

Decision Log

Short records of important decisions. Status: Proposed → Accepted / Rejected / Superseded.

ADR-001 — Scope to a single swap workflow

Status: Superseded by ADR-009 (2026-11-19)

ADR-002 — Rules decide; humans approve

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.

ADR-003 — UI stack (Streamlit vs. FastAPI + HTMX)

Status: Superseded by ADR-006

ADR-004 — Synthetic facility, real public rules

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.

ADR-005 — No AI at runtime

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.

ADR-006 — Three containers: React SPA / ASP.NET Core / PostgreSQL

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).

ADR-007 — Rules engine: a fixed catalogue of rule types with database-stored settings

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.

ADR-008 — Simulated integrations kept inside the three containers

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.

ADR-009 — Scope: scheduling prototype for a correctional centre

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.

ADR-010 — Defer trades and notifications; size the simulation at 100 officers × 90 days

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.

ADR-011 — Middle tier: Java + Spring Boot

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.

ADR-012 — Rules engine: Drools decision tables that non-technical staff can edit

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.

ADR-013 — Coverage measured by unit and block

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.

ADR-014 — API conventions: REST, Problem Details, rule results in 422

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.

ADR-015 — Default shift times, configurable through the rules workflow

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.

ADR-016 — Overtime is based on hours in the pay period, not on shift length

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.

ADR-017 — UI build decisions: hourly coverage cells, lock precondition, counts-only rule review, explicit proposal decisions

Status: Accepted (2026-11-20, lead confirmed; proposed in docs/ui/build-notes.md §3) Decision:

  1. Coverage cells show the lowest hourly count and the short hours. 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.
  2. A pay period can’t be locked while any shift in it that has ended lacks an actual (a time entry or an absence). The API refuses with 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).
  3. The rule version review shows dry-run impact as counts by rule, unit and date, never names, because RULES_APPROVER has no roster access (09-access-control.md §2).
  4. Proposals are decided with an explicit Accept or Decline per item, sent once; accepted items re-run the rules and follow the normal 422 / acknowledge / override contract. (Built in v1.3 for proposals, with one change recorded in ADR-032: a Block is refused at approval with no override from a proposal; the supervisor declines and uses the board’s own override if an emergency truly needs the shift.) Why: (1) with hourly coverage (ADR-013) a single block number can read 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.

ADR-018 — Audit-log role grants deferred to a pilot; triggers are the prototype’s proof

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.

ADR-019 — S-04 (overtime authorization) is enforced by the workflow, not a decision table

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.

ADR-020 — Demo data sizing correction: 2% sick + 2% vacation, overtime band 3–8%

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):

ADR-021 — Save-time safeguards: one scope guard, one officer lock, overrides never swallow warnings

Status: Accepted (2026-11-20, from the dev-qa / review-r2 review of 0dc96e1; the lead routed the findings). Decision:

  1. Preview and save share one authorization path. 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.
  2. Saves are serialized per officer. 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.
  3. An emergency override does not acknowledge warnings. A request that overrides a BLOCK must also list every WARN code in acknowledgeWarnings; otherwise it is refused with 422 warnings-need-acknowledgement. Nothing auto-approves.
  4. Bad input never becomes a 500. Unknown identifiers answer 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.

ADR-022 — Pay-period lock, unlock and payroll export are facility-wide; double lock is idempotent

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:

  1. A pay period has no unit (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.
  2. Locking an already locked period is idempotent: it returns 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.

ADR-023: Override policy defaults. Only rules marked emergency can be overridden; the U-08, U-09 and U-14 Blocks can’t be

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.

ADR-024: Cross-unit cover. A supervisor may assign an officer from any unit into a unit they run

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:

ADR-025: The sign-in token stays in memory only; a refresh asks for sign-in and returns to the screen

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).

ADR-026: Quarter planner — deterministic heuristic, rule-verified draft, confirmed pattern defaults

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:

ADR-027 — D12/N12 crews and rule-set v2 (additive)

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).

ADR-027 addendum — Unit closures with dates, relief and the staffing estimate (Release 3, 2026-11-22)

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).

ADR-027 addendum — U-16 and its night window (Release 4, 2026-11-22)

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.

ADR-028 — Dataset 150: 120 full-time + 30 part-time with 20% leave (Release 3 addition)

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).

ADR-029 — Retire the 16 h shift (L16) (Release 5, 2026-11-22)

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.

ADR-029 addendum — Qualification coverage card (Release 6 #6, Option A, 2026-11-22)

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.

ADR-030 — Planner hand edits in an uncommitted draft (Release 7 #27)

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.

ADR-031 — Supervisor posts as SUPERVISION units; supervisors under the same rules, never on their own records (v1.3 S1–S8, owner item 17)

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:

  1. A post is a unit of kind 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.
  2. Rank is a reference row. 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).
  3. Cross-cover is a rule, not code (Q1): rule set v4 adds the ninth table, Who can work a post (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.
  4. Same rules for supervisors (Q5): rest, hours, runs, U-14 and pay (P-01/P-01b/P-04) apply as written. Many real agreements treat supervisors as excluded from overtime; a later rule row can scope P-01 by position if the owner wants that.
  5. Separate overtime pools (Q4): a supervisor post is offered to supervisors (O-01/O-02 with rank seniority), then to acting-qualified officers after every supervisor; an officer post to officers only. An offer naming someone outside the pool is 422 and writes nothing; confirm checks the pool again.
  6. Never on your own records (Q3): a supervisor can’t create, move, cancel or override their own shift, record their own actuals or absence, offer, give or confirm overtime to themselves, or decide their own proposal: 403 “You can’t change your own schedule; ask another supervisor.” (SelfActionGuard, shared with ADR-032). Accepting an offer on My schedule stays theirs.
  7. Every dataset gets supervisors (Q6), re-pinned once (S4): 10 on Dataset 100 (8 h D8/E8/N8), 10 on 120 and 12 on 150 (D12/N12 crews), seeded after every officer row from their own 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.
  8. Shown by rank (S6, S7): the board groups the posts under Supervisor posts, names the supervisor on duty on a line unit, badges cross-cover (Sup for a supervisor on an officer post; Officer or Acting for an officer on a post); the wall display shows each post as counts only; Hours and Overtime reports carry a Position column and filter; the plan inputs, scorecard (a separate Supervisor posts card; every existing card counts officers only) and commit dialog give the officer and supervisor split. Pins (moved once, S4): checksums 100 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.

ADR-032 — Shift proposals: decided per shift by the unit’s supervisor or the planner, no override, planted demo proposals (v1.3 P1–P5)

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:

  1. Per shift, by scope. Each proposed shift goes to the supervisors whose scope includes its unit; the PLANNER sees and decides every shift, as the fallback (Unit C has no demo supervisor; a supervisor’s own proposal needs another decider). A proposal on two units is decided in two sends. An inbox card shows a supervisor only the shifts on their units (it still says how many shifts there are in all, and its state counts every shift’s decision). The detail, by design, also lists the shifts on other units with their unit, time and decision, but no rule result, overtime figure or action (docs/07 §4.4).
  2. The planner writes a shift here. Approving creates a 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).
  3. No override from a proposal (owner Q3; this changes ADR-017 item 4 for proposals). An officer cannot send a Blocked draft. At approval the rules run again, with the shifts approved earlier in the same send as facts: a Block refuses the whole send (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.
  4. Nobody decides their own proposal (403, the SelfActionGuard the supervisors’ self-edit guard shares); their own count leaves it out.
  5. Expiry and withdraw. A waiting shift expires at its start, by the business clock; the officer withdraws only while every shift waits.
  6. Overtime order (owner Q1): approving a shift that matches an open shift fills it and withdraws its waiting offers; approving someone who is not first in the overtime order needs its own acknowledgement, which is audited.
  7. Planted demo proposals (P5). Every reset and fresh boot plants four: Tara’s Waiting proposal with a Unit B shift (for M. Ellis) and an Admissions shift (for J. Chen), her proposal Declined by J. Chen with a comment, one Expired, and M. Ellis’s own Waiting SUP-L day shift for J. Chen or the planner. So a fresh Dataset 100 shows Proposals (1) for Ellis and (2) for Chen. They are written after the roster, from their own 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).