LOCAL LOCAL DEV ENVIRONMENT (localhost:8000) โ€” Synthetic / Local Test Data Only
Oven Command
Super AdminSuper Admin
Logged in as: Super Admin (Super Admin · All Outlets ยท NAN)
Morning cold-chain & hygiene check-in activeSNKComing soonLicencesComing soonDisplaysComing soonFiltersComing soon
Needs you now41
Needs you
UrgentBLR- New Bel Road is offline on ownly
Open
UrgentHarley's Special Mawa Bar Cake (250 Gms) sold out across Vijayawada
Open
More ›● 3.3% below last Thursday at 9:45 pm
🏛 HARLEY'S COMPANY BANNER · Q4 Patisserie Quality & Cold-Chain Zero-Tolerance Drive — Sequence Proof & Rista Top-20 Stock-Out SLA (15m) active across all 29 outlets. Directive O-047 · All Outlets
🚨 NUDGE ALERTS (2 CRITICAL · 3 IMPORTANT):
✓ Open & Ack
Showing: Today · All 4 Cities (29)
HARLEY'S OVEN COMMAND ยท 2-PAGE EXECUTIVE READOUT
PART 1 ยท EXECUTIVE SUMMARY (FIRST 0.5 PAGE โ€” ABOVE THE FOLD) โœ… Peer-Reviewed: Astra Extra High (gpt-6-astra xhigh) + Claude Opus 4.7 Extra High ยท STOP 4 ยท T1-11 ยท EPIC-CAFE-PEOPLE-PRESENCE-MOBILITY + EPIC-CONFIG-ADMIN-PEOPLE-OUTLET ยท 629 STAFF

Overall People Module: Dual-Entry Onboarding, 6-Category Doc Vault, 6-Outlet Presence Radar, Shift Roster, Crew Loans, Permanent Transfers, Offboarding & Staff Loans (STOP 4 ยท T1-11 ยท EPIC-CAFE-PEOPLE-PRESENCE-MOBILITY + EPIC-CONFIG-ADMIN-PEOPLE-OUTLET ยท 629 STAFF)

โœ… Peer-Reviewed (Opus 4.7 Max + Astra Extra High) ยท Unifies PM-1..10 (HR Payroll Export Importer, DPDP Block-List, Central Master Data Holder Registry, 7+1 Depts / 95 Sub-Functions / 33+ Titles, Temporal Membership != Visibility, Non-Prod PII Masking) + T1-11 Full Lifecycle (Onboarding, 6-Cat Doc Vault, Presence Radar, Shift Roster, Temp Loans vs Perm Transfers, 5-Gate Offboarding)

1. What We Are Building & Why

  • **Unifies Owner Pack 3 (`pkg3/people-module-2026-10-22` `PM-1..10`, `A127`, `A368`, `A369b`, `A568`, `A570`) with `T1-11` Cafรฉ Presence & Mobility:** **(1) `PM-1` One Identity Record (`users / hop.people`, `H-000001..108` reserved, `hr_emp_no` unique) separated from Access (`user_assignments`)**โ€”imports and HR screens can never grant access; **(2) `PM-2` Central Master Data Holder Registry (`master_data_holders`)** governing all 21 master domains (`Department, Sub-Function, Title, Grade, Runs-Shifts Mark, Person, Role, Placement, Cover, Phone, Access, Delegates, Outlets, Kiosks, PIN`); **(3) `PM-3` Seeded `7+1` Departments (`CEO/Corporate Office + Finance, Accounts, Ops & Legal, HR, Projects, Academy [L&D + R&D], Sales & Marketing`), `95` Sub-Functions & `33+` Title LOVs** (where Title proposes a persona and never grants access); **(4) `PM-4 & PM-5` 46-Column HR Payroll Export Reducer (`588` rows) & Dry-Run (`report_hash`) -> `APPLY` Importer with Stored Import Rounds (`people_import_rounds`) and Strict DPDP Block-List (`A570`: PAN, Aadhaar, Bank, IFSC, UAN, ESIC, Salary, DOB, Family, Address kept OUT of main app DB)**; **(5) `PM-6 & PM-7` Temporal `person_membership` (`EXCLUDE USING gist`) enforcing `Membership = Kiosk Roster` vs `Cover/Assignments = Management Visibility` via `access.for(user)`**; and **(6) `PM-10` Mandatory Non-Production Data-Copy PII Masking**.
  • **Unifies Owner Pack 3 (`pkg3/people-module-2026-10-22` `PM-1..10`, `A127`, `A368`, `A369b`, `A568`, `A570`) with `T1-11` Cafรฉ Presence & Mobility:** **(1) `PM-1` One Identity Record (`users / hop.people`, `H-000001..108` reserved, `hr_emp_no` unique) separated from Access (`user_assignments`)**โ€”imports and HR screens can never grant access; **(2) `PM-2` Central Master Data Holder Registry (`master_data_holders`)** governing all 21 master domains (`Department, Sub-Function, Title, Grade, Runs-Shifts Mark, Person, Role, Placement, Cover, Phone, Access, Delegates, Outlets, Kiosks, PIN`); **(3) `PM-3` Seeded `7+1` Departments (`CEO/Corporate Office + Finance, Accounts, Ops & Legal, HR, Projects, Academy [L&D + R&D], Sales & Marketing`), `95` Sub-Functions & `33+` Title LOVs** (where Title proposes a persona and never grants access); **(4) `PM-4 & PM-5` 46-Column HR Payroll Export Reducer (`588` rows) & Dry-Run (`report_hash`) -> `APPLY` Importer with Stored Import Rounds (`people_import_rounds`) and Strict DPDP Block-List (`A570`: PAN, Aadhaar, Bank, IFSC, UAN, ESIC, Salary, DOB, Family, Address kept OUT of main app DB)**; **(5) `PM-6 & PM-7` Temporal `person_membership` (`EXCLUDE USING gist`) enforcing `Membership = Kiosk Roster` vs `Cover/Assignments = Management Visibility` via `access.for(user)`**; and **(6) `PM-10` Mandatory Non-Production Data-Copy PII Masking**.
  • **Complete Synthesis of All People Backlog Sources (`EPIC-CONFIG-ADMIN-PEOPLE-OUTLET` `C36โ€“C51` & `E1โ€“E6` + `INTAKE-T1-11` + `CONTRACT-T1-11` + `PEOPLE-MODULE-DESIGN` `PEO1โ€“PEO6`):** Unifies the 629-employee directory (`hop.people`, immutable `H-xxxxxx` codes), the **5-Tier Authority Matrix** (`Super Admin [Cap=3] / Admin / Config Lead / Store & Shift Manager / Kiosk Crew`), **E1โ€“E6 UAT Trap Killers** (Single-Trip Onboarding, Unified Shift-Lead Truth, 10-Point Pre-Flight Readiness Banner, Session-Safe PIN Reset), and the **6 Multi-Outlet Cafรฉ Presence & Mobility Pillars** into one cohesive module.
  • **Full 5-Stage Employee Lifecycle (Manager OR HR Initiation at Every Boundary):** **(1) Dual-Entry Onboarding (`people_onboarding_cases`):** Store/Cluster Manager can initiate field onboarding on `/people` or Kiosk when a new hire walks in (`Name, Phone, Home Outlet, FOH/BOH Station, Shift A/B/C, Live Photo` -> mints `H-xxxxxx`, sets Kiosk PIN, and opens a **7-Day Document & Medical Collection Checklist** routed to HR), OR HR/Admin initiates via Single-Trip Sheet / Bulk CSV Dry-Run (`report_hash`) -> `APPLY`; **(2) Structured 6-Category Document Vault & Single Person Passport (`people_doc_vault` & `staff_skill_passports`):** S3 vault with DPDP Act 2023 masking (Managers see status chips; HR/Admin see PDFs/masked refs), enforcing a **Hard Roster/Loan Block on `FOOD_STATIONS` when Annual Medical (`FSSAI Form 4`) is `EXPIRED`**; **(3) Temporary Same-Day Crew Loans (`staff_inter_outlet_loans`) vs. Permanent 4-State Inter-Outlet Transfers (`people_transfer_requests`):** Distinguishes 1-day shift borrowing (`NAN -> JUB 14:00โ€“22:00`, `home_outlet_code` unchanged) from permanent store/role transfers (`INITIATED -> RELIEVING_MANAGER_CLEARANCE -> RECEIVING_MANAGER_AND_HR_APPROVAL -> COMPLETED_ACTIVE`); **(4) Shift Assignment, Weekly Roster Grid (`Draft -> Publish`), Station Coverage Heat-Check (`RED/AMBER/GREEN`) & 1-Tap Sick-Call Cover Finder (`outlet_shifts`, `staff_roster_assignments`)** with Shops & Establishments guardrails (`<=9h/day, <=48h/wk, >=10h rest gap, <=6 consecutive days`); **(5) Manager- or HR-Initiated Offboarding & 5-Gate Exit Clearance (`people_offboarding_cases`):** Immediate Kiosk/Session Kill Switch, Uniform/Key M3 Clearance, Auto-Reassignment of Open Single-Owner Tasks & `L6/L7` NPL Layers, **Staff Loan `FnF Lien` Deduction Gate (`<=25%` EMI cap)**, and Rehire Eligibility Tag.
  • **100% Compliant with HOP Nudge & Accountability Framework (`acct-*` / `O-022` / `O-045`):** Deterministic nudge ladders govern missing onboarding docs (`D+3, D+6, D+7`), expiring Medical/FoSTaC (`T-14d, T-7d, T-0`), unapproved loans/transfers (`+15m, +30m`), late check-ins (`T+0, +5m, +15m, +30m`), and stalled exit clearances.

2. Personas & Access Scope

  • **Store / Cluster Manager (`Rohit MGR-01`, `Arjun MGR-02`, `Jay CLM-01` โ€” `/manager/presence`, `/manager/roster`, `/people`)**: Initiates walk-in field onboarding (`H-xxxxxx`), builds/publishes weekly `A/B/C/Split` shift rosters, views real-time Presence Radar & Station Coverage Heat-Check, uses **1-Tap Sick-Call Cover Finder**, initiates/approves **Temporary Crew Loans** OR **Permanent Store Transfers** (`Relieving / Receiving Clearance`), and initiates **Offboarding** (Resignation / Absconding `3x NO_SHOW` / Disciplinary) with M3 uniform/key verification.
  • **HR Operations & Admin (`C36` Manage Rail โ€” `/admin/people`, `/admin/people/roster`, `/admin/people/{ref}/passport`)**: Initiates Single-Trip or CSV Dry-Run (`report_hash`) -> `APPLY` onboarding, verifies the **6-Category Document Vault** (`Aadhaar Masked, PAN, Bank/UPI, UAN/ESIC/PT, FSSAI Form 4 Medical, FoSTaC, Offer/BGV`), approves permanent transfers (`primary_outlet_code` & cost center cutover), runs monthly `<=25%` EMI loan deductions, and executes **5-Gate FnF Exit Clearance**.
  • **Super Admin (`Owner cfo@harleys.com` โ€” Hard Cap = 3, `C51`)**: Sets user `TYPE` (`Staff / Config / Admin / Super Admin`), marks power roles, and clicks **`Login As` (`See as PERSON`)** on any row in `/admin/people` (read-only preview banner; never writes biometric presence events under a borrowed identity).
  • **Cafรฉ / Commissary Crew (`360px/390px` Kiosk & Phone)**: Unlocks Kiosk via 6-digit Outlet PIN (`O-022`), checks in/out/breaks via 4-digit User PIN + live selfie (valid at home outlet OR approved `LOANED_IN` outlet within `-30m` early margin), views own schedule/hours (zero shaming leaderboards per `T2-4` Dignity Rule), and e-signs Staff Loan `FnF Lien` consent.

3. Owner Sign-Off Decisions

  • Approve **Dual-Entry Onboarding (`people_onboarding_cases`)** allowing **both Store/Cluster Managers (field walk-in) and HR/Admin (Single-Trip / CSV Dry-Run -> `APPLY`)** to initiate onboarding with a tracked **7-Day Document & Medical Collection Checklist**.
  • Approve the **6-Category S3 Document Vault & Single Person Passport (`people_doc_vault` & `staff_skill_passports`)** with DPDP masking, **Medical `EXPIRED` Hard Block on `FOOD_STATIONS`**, FoSTaC `1:25` gate, `T1-10` NPL badges, and `T1-13` Maintenance 2nd-Person Verifier authorization.
  • Approve **both Mobility Engines**: (a) **Temporary Same-Day Crew Loans (`staff_inter_outlet_loans`)** (`NAN -> JUB 14:00โ€“22:00`, `home_outlet_code` unchanged, Dual-Manager or Cluster Manager approval + pro-rata P&L labor attribution) AND (b) **Permanent 4-State Inter-Outlet / Role Transfers (`people_transfer_requests`)** (`INITIATED -> RELIEVING_MANAGER_CLEARANCE -> RECEIVING_MANAGER_AND_HR_APPROVAL -> COMPLETED_ACTIVE`).
  • Approve **Shift Templates (`Shift A/B/C/Split`), 7-Day Roster Grid (`Draft -> Publish`), Station Coverage Heat-Check (`RED/AMBER/GREEN`), 1-Tap Sick-Call Cover Finder**, and **Manager/HR-Initiated 5-Gate Offboarding & `<=25%` EMI / `FnF Lien` Clearance**.
PART 2 ยท FULL INTAKE, DOMAIN OBJECT DESIGN & GLOBAL INDUSTRY BENCHMARKS (1.5 PAGES) Core Flows ยท Domain Object Handshakes ยท State Machines ยท Astra XHigh + Opus 4.7 Peer Review

2A. Core User Journeys & Functional Intake Rules

Journey / Capability Persona & Trigger System Action & Hard Gate Rule
PPL-J01 ยท Dual-Entry Onboarding: Store Manager Field Initiate OR HR Single-Trip / CSV Dry-Run (`POST /api/people/onboarding`)Store/Cluster Manager OR HR/Admin**Path A (Manager Field Initiate):** Store Manager enters `Name, Phone, Home Outlet (NAN), Department (FOH/BOH), Station, Default Shift (A/B/C), Live Photo` -> atomically mints `H-xxxxxx`, creates `user_assignments` row (unified shift-lead truth `E2`), triggers Kiosk 4-digit PIN setup (`J02`), and opens a **7-Day Document Collection Checklist** (`ONBOARDING_PROVISIONAL_7D`) with HOP Nudges to HR (`D+3, D+6, D+7`). **Path B (HR HQ Initiate):** Single-Trip Onboarding Sheet or Bulk CSV Upload (`Preview Diff -> report_hash -> typed APPLY`).
PPL-J02 ยท 6-Category Document Collection & Single Person Passport Vault (`POST /api/people/{ref}/docs` & `/passport`)HR Ops / Admin (Edit) ยท Store Manager (Status Chips Only)Collects and verifies 6 packet categories in `s3://harleys-people-vault/`: **(1) Identity & Bank KYC** (Masked Aadhaar `XXXX-XXXX-1234`, PAN, Verified Bank/UPI, Emergency Contact); **(2) Statutory Social Security** (`UAN`, `ESIC`, `PT`); **(3) Annual Medical Fitness (`FSSAI Form 4`)** (`VALID / EXPIRING_14D / EXPIRED` โ€” **`EXPIRED` hard-blocks rostering or loaning into `FOOD_STATIONS`**); **(4) FSSAI FoSTaC (`Basic / Supervisor`)**; **(5) Offer Letter, BGV & Uniform/Locker Receipt**; **(6) Station Certifications (`ESPRESSO, PASTRY_FINISH, FOH_COUNTER, BOH_CONTINENTAL`), `T1-10` NPL Badges & `T1-13` Maintenance 2nd-Person Verifier Flag**.
PPL-J03 ยท Shift Templates (`A/B/C/Split`), Weekly Roster Grid (`Draft -> Publish`) & Guardrails (`POST /api/people/roster/publish`)Outlet Manager / Cluster ManagerConfigures per-outlet Shift Templates (`Shift A Opening 07:00โ€“15:30`, `Shift B Mid 11:00โ€“19:30`, `Shift C Closing 14:30โ€“23:00`, `Split Shift`, `Week Off`, `Leave`) with break windows, 15m grace, and `station_min` JSONB. Evaluates **Shops & Establishments Guardrails** (`<=9h/day`, `<=48h/wk`, `>=10h` rest gap between Night Close and Morning Open, `<=6` consecutive days) + **Medical `EXPIRED` hard block** + **Station Coverage Heat-Check (`RED/AMBER/GREEN`)** before publishing.
PPL-J04 ยท 6-Outlet Real-Time Presence Radar, Kiosk Punch Timeline & 1-Tap Sick-Call Cover Finder (`GET /api/people/presence`)Outlet crew (Kiosk) -> Shift/Outlet/Cluster ManagerDerives live state via pure function `derive_presence()` (`SCHEDULED -> DUE -> PRESENT -> ON_BREAK -> LATE -> ABSENT / NO_SHOW -> RELIEVED` + `LOANED_IN / LOANED_OUT`). Late check-in (`> shift_start + 15m`) triggers the 4-rung HOP Nudge ladder (`T+0, +5m, +15m, +30m`). Clicking **`[Find Cover]`** on an `ABSENT` row or `RED` station ranks unscheduled staff in the cluster who hold `CERTIFIED` station skill + `VALID` medical + weekly-hours headroom.
PPL-J05 ยท Temporary Same-Day Inter-Outlet Crew Loan (`POST /api/people/loans` -> `/approve`)Requesting Outlet Mgr / Cluster Mgr (`NAN -> JUB 14:00โ€“22:00`)Borrows a crew member for **1 business date and time window** while `home_outlet_code` remains `NAN`. Approved by **Cluster Manager (`CLM-01`) alone OR Both Outlet Managers (`NAN + JUB`)** (`approver_id <> person_id`). Upon approval, the person's 4-digit PIN + selfie check-in is valid **only at `JUB`'s Kiosk** (`starts_at - 30m` to `ends_at`), shows `Loaned from NAN`, marks `LOANED_OUT` at `NAN`, and **attributes pro-rata hourly labor cost to `JUB`'s P&L**.
PPL-J06 ยท Permanent Inter-Outlet & Role Transfer Module (`POST /api/people/transfers` -> `/relieve` -> `/approve`)Store Manager / Cluster Manager / HR (`people_transfer_requests`)Handles permanent store relocations (`NAN -> GACH`) or role promotions (`Staff -> Shift Lead`): **(1) `INITIATED`** (by Store Mgr, Cluster Mgr, or HR with `effective_date` & reason); **(2) `RELIEVING_MANAGER_CLEARANCE`** (current Store Mgr signs off handover of store keys/apron/pending tasks); **(3) `RECEIVING_MANAGER_AND_HR_APPROVAL`** (receiving Store Mgr + HR sign off); **(4) `COMPLETED_ACTIVE`** (atomically updates `primary_outlet_code`, ends old `user_assignments` row with `ended_at`, creates new assignment + cost-center binding, and re-homes future roster rows).
PPL-J07 ยท Staff Loans (`<= 25%` Gross EMI Cap), Idempotent Payroll & Signed FnF Lien (`POST /api/people/staff-loans`)Employee -> HR / CFO -> Payroll ControllerEnforces Payment of Wages Act / Code on Wages `monthly_emi_inr <= 0.25 * monthly_gross_inr` (`check_25pct_emi_cap`), captures e-signed **Contractual FnF Set-Off & Lien Authorization**, and runs monthly deductions with `UNIQUE (loan_id, payroll_month)`.
PPL-J08 ยท Manager- or HR-Initiated Offboarding & 5-Gate Exit Clearance (`POST /api/people/{id}/offboard`)Store/Cluster Manager (Resignation / `3x NO_SHOW` Absconding / Disciplinary) OR HR/AdminExecutes the deterministic **5-Gate Exit Pipeline**: **(Gate 1) Immediate Kiosk/Session Kill Switch** (revokes sessions in `<30s`, zeroes 4-digit PIN, stamps `ended_at` on `user_assignments` while preserving historical audit/task rows); **(Gate 2) Store Asset/Uniform/Key M3 Clearance** (Store Mgr sign-off); **(Gate 3) Automatic Single-Owner Task & NPL Layer (`L6/L7`) Reassignment Prompt** (prevents orphaned tasks/alerts); **(Gate 4) Staff Loan & Advance `FnF Lien` Zero-Balance Gate** (`HTTP 409 FNF_OUTSTANDING_LOAN_BLOCK` until recovered/set off); **(Gate 5) Relieving Letter & Rehire Eligibility Tag (`ELIGIBLE_FOR_REHIRE` vs `DO_NOT_REHIRE`)**.

2B. Underlying Domain Objects & How They Work Together

END-TO-END PEOPLE, PRESENCE, MOBILITY & HR LIFECYCLE ARCHITECTURE (10 TABLES): [1. Dual-Entry Onboarding (Store Mgr Field Initiate OR HR Single-Trip / CSV Dry-Run -> APPLY)] --> Mints immutable H-xxxxxx in [hop.people] --> [2. 6-Category S3 Doc Vault & Single Person Passport (people_doc_vault + staff_skill_passports: Medical Form 4 EXPIRED Blocks Food Stations!)] --> [3. Shift Templates (A/B/C/Split) & Weekly Roster Grid (outlet_shifts + staff_roster_assignments: <=9h/d, <=48h/wk, >=10h rest gap)] --> [4. 6-Outlet Presence Radar & Append-Only Punch Log (staff_presence_events + derive_presence() + 1-Tap Sick-Call Cover Finder)] +--> [5A. Temporary Same-Day Crew Loan (staff_inter_outlet_loans: Home Outlet Unchanged, Kiosk Re-Jailed for Window, Pro-Rata P&L Debit)] +--> [5B. Permanent 4-State Transfer (people_transfer_requests: INITIATED -> RELIEVING_MGR -> RECEIVING_MGR_HR -> Updates primary_outlet_code)] --> [6. Manager/HR-Initiated Offboarding & 5-Gate Exit (people_offboarding_cases: Kill Switch -> Uniform M3 -> Task Reassign -> Loan FnF Lien == โ‚น0)]
Domain Object (Table) PK & Tenant Scope Core Attributes & Constraints Cross-Object Handshake
hop.people & hop.user_assignmentsid (PK `H-xxxxxx`), assignment_id (PK)person_code, full_name, phone, primary_outlet_code, department, role_key, scope_type, scope_value, starts_at, ended_at, reports_to, super_admin (Cap=3)Canonical identity & effective-dated role/scope assignment (`E1`, `E2`, `PEO3`).
people_onboarding_cases & people_doc_vaultcase_id (PK), doc_id (PK), person_id (FK)initiated_by_role (`MANAGER_FIELD`/`HR_ADMIN`/`CSV_IMPORT`), provisional_deadline_7d, doc_category (6 categories), s3_object_key, sha256_hex, verification_status (`VALID`/`EXPIRING`/`EXPIRED`/`MISSING`), dpdp_masked_refTracks Manager/HR onboarding and the 6-category S3 employee document packet.
staff_skill_passportsperson_id (PK/FK hop.people)station_certs_json (`ESPRESSO, PASTRY_FINISH, FOH_COUNTER, BOH_CONTINENTAL`), medical_fitness_status, medical_valid_until, fostac_level, fostac_valid_until, uan_esic_status, maint_verifier_authorized_bySingle Person Passport read by Roster, Loans, Stop 1 Compliance, Stop 2 Maintenance, and Stop 3 NPL.
outlet_shifts & staff_roster_assignmentsshift_id (PK), assignment_id (PK)outlet_code, shift_key (`MORNING`/`MID`/`CLOSING`/`SPLIT`), start_time, end_time, grace_minutes (15), station_min_json, business_date, active_outlet_code, state (`DRAFT`/`PUBLISHED`), guardrail_override_reasonGoverns weekly roster grid, Shops & Establishments guardrails, and station coverage heat-check.
staff_presence_eventsevent_id (PK), person_id (FK), outlet_codebusiness_date, event_type (`CHECK_IN`/`BREAK_START`/`BREAK_END`/`CHECK_OUT`/`MARK_LATE`/`MARK_ABSENT`/`CORRECTION`), occurred_at, selfie_s3_key, corrects_event_id, clock_suspectAppend-only presence fact log driving `derive_presence()` and Attendance Summary CSV.
staff_inter_outlet_loans & people_transfer_requestsloan_id (PK), transfer_req_id (PK)Loan: `home_outlet_code, to_outlet_code, loan_date, starts_at, ends_at, approval_mode, home_mgr_id, to_mgr_id, cluster_mgr_id`. Transfer: `from_outlet, to_outlet, new_role_key, effective_date, relieving_mgr_signed_by, receiving_mgr_signed_by, hr_approved_by, state`Separates 1-day shift borrowing from permanent 4-state inter-outlet/role transfers.
people_loans & people_offboarding_casesloan_id (PK), offboard_id (PK)Loan: `principal_inr, monthly_emi_inr (<=25% gross), fnf_lien_signed_sha256, outstanding_balance_inr`. Offboard: `initiated_by_id, exit_type, session_killed_at, uniform_key_m3_cleared_by, tasks_reassigned_to_id, fnf_loan_recovered_bool, rehire_status`Enforces `<=25%` EMI cap, idempotent payroll deductions, and 5-gate exit clearance.

2C. State Machines & Operational Guardrails

1. Dual-Entry Onboarding & 6-Category Doc Vault (`ONB-S1`)

MANAGER_FIELD_INITIATED (or HR_SINGLE_TRIP / CSV_APPLY) → H_CODE_AND_KIOSK_PIN_ACTIVE → 7D_DOC_AND_MEDICAL_COLLECTION (HOP Nudges `D+3, D+6, D+7`) → PASSPORT_VERIFIED (Medical `EXPIRED` hard-blocks `FOOD_STATIONS`).

2. 6-Outlet Presence Radar & Station Heat-Check (`PRS-S2`)

Derived via `derive_presence()`: SCHEDULED → DUE (15m grace) → PRESENT / ON_BREAK / LATE (4-rung HOP Nudge `T+0..+30m`) / ABSENT (1-Tap Sick-Call Cover Finder) → RELIEVED.

3. Temporary Crew Loan vs. Permanent Transfer (`MOB-S3`)

Temp Loan (1-Day): REQUESTED → APPROVED (Cluster Mgr OR Both Store Mgrs) → KIOSK_VALID_AT_RECEIVING_STORE → COMPLETED.
Perm Transfer: INITIATED → RELIEVING_MGR_CLEARANCE → RECEIVING_MGR_AND_HR_APPROVAL → COMPLETED_ACTIVE (Updates `primary_outlet_code`).

4. Manager/HR Offboarding & 5-Gate FnF Clearance (`OFF-S4`)

EXIT_INITIATED (Mgr or HR) → 1_SESSION_AND_PIN_KILLED → 2_UNIFORM_KEY_M3_CLEARED → 3_TASKS_AND_NPL_REASSIGNED → 4_LOAN_FNF_LIEN_SETTLED (Balance == โ‚น0) → 5_RELIEVED_AND_REHIRE_TAGGED.

2D. Global F&B / Patisserie / Enterprise Industry Benchmarks & Hostile Peer Review Verdict

Global Industry Benchmark / Peer Reviewer Standard / Gate Adopted How Harley's OneOps / HOP Enforces It
Keka / Darwinbox & `EPIC-CONFIG-ADMIN-PEOPLE-OUTLET` (`C36โ€“C51`, `E1โ€“E6`)Dual-Entry Onboarding (Store Manager Field Initiate OR HR Single-Trip / CSV Dry-Run -> `APPLY`) + 3-Layer AuthorityEliminates Dash's 4-screen onboarding regret (`E1`) and dual shift-lead lists (`E2`): Store/Cluster Manager can initiate field onboarding on `/people` or Kiosk (generating `H-xxxxxx`, Kiosk PIN, and a 7-day HR Doc Checklist), while HR/Admin runs Single-Trip or CSV Dry-Run (`report_hash`) -> `APPLY`.
DPDP Act 2023 & FSSAI Form 4 / FoSTaC Single Person Passport (`people_doc_vault`)6-Category S3 Document Vault + Medical `EXPIRED` Hard Block on Food Stations + FoSTaC `1:25` GateTracks (a) Masked Identity/Bank KYC, (b) EPFO `UAN` / `ESIC` / `PT`, (c) Annual Medical Fitness (`FSSAI Form 4` โ€” hard-blocks rostering/loaning onto `FOOD_STATIONS` when `EXPIRED`), (d) FoSTaC (`Basic/Supervisor`), (e) Offer/BGV/Uniform, and (f) Station Certifications + `T1-10` NPL Badges + `T1-13` Maintenance Verifier status.
7shifts / Deputy / Fourth Hospitality & `CONTRACT-T1-11`6-Outlet Real-Time Presence Radar + Shift Templates (`A/B/C/Split`) + 7-Day Roster Grid (`Draft -> Publish`) + Station Heat-Check + Sick-Call Cover FinderDerives live states (`SCHEDULED, DUE, PRESENT, ON_BREAK, LATE, ABSENT, RELIEVED, LOANED_IN/OUT`), enforces Shops & Establishments guardrails (`<=9h/day, <=48h/wk, >=10h rest gap, <=6 consecutive days`), shows `RED/AMBER/GREEN` station coverage, and provides 1-Tap Sick-Call Cover Finder.
Pret A Manger / Multi-Unit Hospitality Mobility StandardTemporary Same-Day Crew Loans (`staff_inter_outlet_loans`) vs. Permanent 4-State Inter-Outlet Transfers (`people_transfer_requests`)Separates same-day borrowing (`NAN -> JUB 14:00โ€“22:00`, `home_outlet_code` unchanged, Dual-Manager or Cluster Manager approval + pro-rata P&L labor attribution) from permanent store/role transfers (`INITIATED -> RELIEVING_MANAGER_CLEARANCE -> RECEIVING_MANAGER_AND_HR_APPROVAL -> COMPLETED_ACTIVE`).
Payment of Wages Act & 5-Gate Offboarding (`people_offboarding_cases`)Manager/HR-Initiated Exit + Immediate Kiosk/Session Kill Switch + Task/NPL Reassign + `<=25%` EMI & Signed FnF Lien GateStore/Cluster Manager or HR can initiate offboarding (Resignation, Absconding `3x NO_SHOW`, Disciplinary); runs 5-gate exit pipeline: (1) Kiosk PIN zeroed & session killed, (2) Uniform/Key/Badge M3 clearance, (3) Auto-reassignment of open tasks & `L6/L7` NPL ownership, (4) Staff Loan `FnF Lien` balance recovery, and (5) Relieving letter & rehire tag.
HOP Nudge & Accountability Integration (`acct-*`) + Hostile Peer Review (`Astra XHigh` + `Opus 4.7`)โœ… APPROVED โ€” COMPLETE BACKLOG SYNTHESIS (`EPIC-CONFIG-ADMIN` + `T1-11` + 5 LIFECYCLE PILLARS)Wires deterministic HOP nudge ladders on missing onboarding docs (`D+3, D+6, D+7`), expiring medical/FoSTaC (`T-14d, T-7d, T-0`), unapproved loans/transfers (`+15m, +30m`), late check-ins (`T+0, +5m, +15m, +30m`), and stalled exit clearances.

2E. Complete People Backlog Synthesis (EPIC-CONFIG-ADMIN C36โ€“C51, E1โ€“E6 Trap Killers, PEO1โ€“PEO6 & 5 Lifecycle Pillars)

Backlog Source / Lifecycle Pillar Capabilities, Guardrails & Manager/HR Dual-Initiation Rules Target Tables & Live Routes
1. Dual-Entry Onboarding (E1, PEO5) Store/Cluster Manager Field Initiate (walk-in on /people or Kiosk → mints immutable H-xxxxxx, sets 4-digit Kiosk PIN, opens 7-Day HR Document Checklist with D+3/D+6/D+7 HOP Nudges) OR HR/Admin HQ Initiate (Single-Trip Sheet & Bulk CSV Dry-Run report_hash → APPLY). people_onboarding_cases · /admin/people · /people
2. 6-Category Doc Vault & Single Person Passport (Pillar 4) S3 Vault (s3://harleys-people-vault/) with DPDP Act 2023 masking (Managers see status chips; HR/Admin see PDFs/masked refs): (a) Masked Aadhaar/PAN/Bank, (b) UAN/ESIC/PT, (c) Annual Medical Form 4 (EXPIRED hard-blocks rostering/loaning onto FOOD_STATIONS), (d) FoSTaC (1:25), (e) Offer/BGV/Uniform, (f) Station Certs + T1-10 NPL Badges + T1-13 Maint 2nd-Person Verifier. people_doc_vault · staff_skill_passports
3. Shift Templates, 7-Day Roster Grid & Cover Finder (Pillar 1, 3, 5) Per-outlet Shift A (07:00โ€“15:30), Shift B (11:00โ€“19:30), Shift C (14:30โ€“23:00), Split, Week Off, Leave. Enforces Shops & Establishments guardrails (≤9h/day, ≤48h/wk, ≥10h rest gap, ≤6 consecutive days), RED/AMBER/GREEN station heat-check, derive_presence() 6-outlet radar, and 1-Tap Sick-Call Cover Finder. outlet_shifts · staff_roster_assignments · staff_presence_events
4. Temp Same-Day Crew Loans vs. Permanent 4-State Transfers (Pillar 2, PEO3) Temp Loan (staff_inter_outlet_loans): 1-day window (NAN → JUB 14:00โ€“22:00), home_outlet_code unchanged, Cluster Mgr or Dual-Store-Mgr approval, Kiosk re-jailed for window + pro-rata P&L labor attribution. Permanent Transfer (people_transfer_requests): INITIATED → RELIEVING_MGR_CLEARANCE → RECEIVING_MGR_AND_HR_APPROVAL → COMPLETED_ACTIVE (updates primary_outlet_code & cost center). staff_inter_outlet_loans · people_transfer_requests
5. Manager/HR Offboarding, 5-Gate Exit & Staff Loans (PEO6) Initiated by Store/Cluster Mgr (Resignation / 3x NO_SHOW Absconding / Disciplinary) or HR: (1) Immediate Session/PIN Kill Switch, (2) Uniform/Key M3 Clearance, (3) Open Task & L6/L7 NPL Reassignment, (4) Staff Loan ≤25% EMI & Signed FnF Lien Zero-Balance Gate, (5) Relieving Letter & Rehire Tag. people_offboarding_cases · people_loans
6. 5-Tier Authority (C36โ€“C51) & E1โ€“E6 UAT Trap Killers Super Admin (Cap=3, Login As) · Admin · Config Lead · Store/Shift Mgr · Kiosk Crew (6-digit Outlet PIN + 4-digit User PIN). Unified Shift-Lead truth (E2), 10-Point Pre-Flight Readiness Banner (E3), Dependency-Guarded Switches (E4), Session-Safe PIN Reset (E5). hop.people · hop.user_assignments

2F. Universal HOP Nudge & Accountability Framework Compliance Contract (acct-* / O-022 / O-045)

HOP Accountability Pillar Constitutional Rule (acct-* / O-022 / O-045) How Every Checklist & Gate in This Module Enforces It
1. Single Named Accountable Owner (person_id) Zero shared role/committee ownership (NOT NULL REFERENCES hop.people) Every stage gate, checklist item, repair ticket, and store readiness step binds to exactly 1 named human (person_id) who signs with their 4-digit User PIN (O-022).
2. Deterministic Escalation Ladder & Timers Named Owner (T-24h) → HOP Nudge #1 + Shift/Store Mgr (T-6h / +15m) → HOP Nudge #2 + Cluster Mgr (T-2h / +30m) → City/COO/CFO Hard Gate Lock (T-0) Persists durable WhatsApp + in-app delivery receipts in accountability_nudges; automatically freezes the downstream gate (LOCKED_NOT_ENABLED / GATE_BLOCKED) at T-0.
3. M3 Independent 2nd-Person Verification โœ“ Confirm = I checked the work (verified_by_id != completed_by_id) vs โ†ฉ Return for correction Database CHECK (m3_verified_by_id <> m3_completed_by_id) prevents self-verification; selecting โ†ฉ Return requires a mandatory reason, increments revision_count++, and fires an instant re-nudge.
4. Structured โœ• Cannot 6-Reason Chips + Upstream Re-Routing CK Crate Short · Cold-Chain Excursion · Packaging Missing · POS SKU Missing · Equipment Down · Staff Shortage Selecting a โœ• Cannot chip + 1 evidence photo records an immutable BLOCKED receipt for the store and automatically transfers accountability + HOP Nudge upstream to the L3 CK, L4 Logistics, L5 POS, or Procurement/MEP Named Owner.
5. Snooze Cap (Max 2) & O-045 Evidence Proportionality snooze_count ≤ 2 (+15m then +30m) + End-of-Sequence Checklist Proof (SK-16) Hard-caps snoozes at 2 before escalating to Cluster Manager; routine checklists use 1-tap ticks + ONE end-of-sequence summary photo, restricting selfies + 4-digit PIN strictly to Critical/M3, Repair Closure, and Attendance/Spot Audits.
PART 3 ยท GLOSSARY, SCHEMA DDL & CORPUS APPENDIX (COLLAPSIBLE) Reference Definitions, PostgreSQL DDL & Verification Suites Live Here
๐Ÿ“– 3A. Domain Glossary & Canonical Definitions
Term / CodeCanonical Definition in Harley's OneOps / HOP
Dual-Entry Onboarding (`people_onboarding_cases`)Allows either an Outlet/Cluster Manager (when a new hire reports to the cafรฉ floor) or HR/Admin (from HQ `/admin/people` or CSV Dry-Run -> `APPLY`) to create `H-xxxxxx` and trigger a tracked 7-day document collection workflow.
Single Person Passport (`staff_skill_passports`)Unified employee capability & compliance record read by Roster, Loans, Compliance (`T1-8`), NPL (`T1-10`), and Maintenance (`T1-13`), holding station skills, Medical Form 4 validity, FoSTaC level, and DPDP-masked KYC statuses.
Temporary Crew Loan vs. Permanent TransferA **Temporary Loan** (`staff_inter_outlet_loans`) borrows a worker for one date/window without changing `home_outlet_code`; a **Permanent Transfer** (`people_transfer_requests`) moves `primary_outlet_code`, `user_assignments`, and cost center after Relieving Manager + Receiving Manager + HR sign-off.
5-Gate Offboarding & `FnF Lien` GateExit pipeline initiated by Manager or HR that immediately kills Kiosk/web sessions, clears store uniform/keys (`M3`), reassigns open single-owner tasks, recovers any `people_loans` balance under the signed FnF Lien, and records rehire eligibility.
๐Ÿ—„๏ธ 3B. PostgreSQL Schema DDL & Integrity Constraints
-- STOP 4 OVERALL PEOPLE MODULE DDL (ONBOARDING, DOC VAULT, PASSPORT, SHIFTS, ROSTER, PRESENCE, LOANS, TRANSFERS, OFFBOARDING)
CREATE TABLE people_onboarding_cases (
    case_id UUID PRIMARY KEY,
    person_id INTEGER NOT NULL REFERENCES hop.people(id),
    initiated_by_person_id INTEGER NOT NULL REFERENCES hop.people(id),
    initiation_channel VARCHAR(24) NOT NULL CHECK (initiation_channel IN ('MANAGER_FIELD','HR_SINGLE_TRIP','CSV_DRYRUN_APPLY')),
    home_outlet_code TEXT NOT NULL REFERENCES hop.outlets(branch_code),
    assigned_station VARCHAR(32) NOT NULL,
    default_shift_key VARCHAR(24) NOT NULL,
    docs_due_date DATE NOT NULL DEFAULT (CURRENT_DATE + 7),
    doc_checklist_status VARCHAR(28) NOT NULL DEFAULT 'PROVISIONAL_7D_OPEN' CHECK (doc_checklist_status IN ('PROVISIONAL_7D_OPEN','VERIFIED_COMPLETE','OVERDUE_ESCALATED')),
    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

CREATE TABLE people_doc_vault (
    doc_id UUID PRIMARY KEY,
    person_id INTEGER NOT NULL REFERENCES hop.people(id),
    doc_category VARCHAR(32) NOT NULL CHECK (doc_category IN (
        'IDENTITY_BANK_KYC','EPFO_ESIC_PT','MEDICAL_FITNESS_FORM4','FOSTAC_CERT','OFFER_BGV_UNIFORM','SKILL_BADGE_CERT'
    )),
    masked_reference VARCHAR(64),
    s3_object_key VARCHAR(255) NOT NULL,
    sha256_hex CHAR(64) NOT NULL,
    valid_from DATE,
    valid_until DATE,
    status VARCHAR(20) NOT NULL DEFAULT 'VALID' CHECK (status IN ('VALID','EXPIRING_14D','EXPIRED','MISSING','REJECTED')),
    verified_by_hr_id INTEGER REFERENCES hop.people(id),
    updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

CREATE TABLE staff_skill_passports (
    person_id INTEGER PRIMARY KEY REFERENCES hop.people(id),
    station_certs_json JSONB NOT NULL DEFAULT '{}'::jsonb,
    medical_fitness_status VARCHAR(16) NOT NULL DEFAULT 'MISSING' CHECK (medical_fitness_status IN ('VALID','EXPIRING','EXPIRED','MISSING')),
    medical_valid_until DATE,
    fostac_level VARCHAR(20) CHECK (fostac_level IN ('NONE','BASIC','SUPERVISOR')),
    fostac_valid_until DATE,
    kyc_bank_uan_esic_status VARCHAR(20) NOT NULL DEFAULT 'PENDING',
    maint_domains_json JSONB NOT NULL DEFAULT '[]'::jsonb,
    maint_second_person_verifier BOOLEAN NOT NULL DEFAULT FALSE,
    verifier_authorized_by INTEGER REFERENCES hop.people(id),
    CONSTRAINT check_verifier_not_self CHECK (verifier_authorized_by IS NULL OR verifier_authorized_by <> person_id)
);

CREATE TABLE people_transfer_requests (
    transfer_req_id UUID PRIMARY KEY,
    person_id INTEGER NOT NULL REFERENCES hop.people(id),
    initiated_by_id INTEGER NOT NULL REFERENCES hop.people(id),
    from_outlet_code TEXT NOT NULL REFERENCES hop.outlets(branch_code),
    to_outlet_code TEXT NOT NULL REFERENCES hop.outlets(branch_code) CHECK (from_outlet_code <> to_outlet_code),
    from_role_key VARCHAR(32) NOT NULL,
    to_role_key VARCHAR(32) NOT NULL,
    effective_date DATE NOT NULL,
    reason_note TEXT NOT NULL,
    relieving_mgr_cleared_by INTEGER REFERENCES hop.people(id),
    relieving_cleared_at TIMESTAMPTZ,
    receiving_mgr_approved_by INTEGER REFERENCES hop.people(id),
    hr_approved_by INTEGER REFERENCES hop.people(id),
    status VARCHAR(32) NOT NULL DEFAULT 'INITIATED' CHECK (status IN (
        'INITIATED','RELIEVING_MANAGER_CLEARANCE','RECEIVING_MANAGER_AND_HR_APPROVAL','COMPLETED_ACTIVE','REJECTED','CANCELLED'
    )),
    CONSTRAINT check_perm_transfer_gates CHECK (
        status <> 'COMPLETED_ACTIVE' OR (
            relieving_mgr_cleared_by IS NOT NULL AND receiving_mgr_approved_by IS NOT NULL AND hr_approved_by IS NOT NULL
        )
    )
);

CREATE TABLE people_offboarding_cases (
    offboard_id UUID PRIMARY KEY,
    person_id INTEGER NOT NULL REFERENCES hop.people(id),
    initiated_by_id INTEGER NOT NULL REFERENCES hop.people(id),
    exit_type VARCHAR(24) NOT NULL CHECK (exit_type IN ('RESIGNATION','ABSCONDING_3X_NOSHOW','DISCIPLINARY','CONTRACT_END')),
    last_working_date DATE NOT NULL,
    gate1_session_pin_killed_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    gate2_uniform_key_cleared_by INTEGER REFERENCES hop.people(id),
    gate3_open_tasks_reassigned_to INTEGER REFERENCES hop.people(id),
    gate4_outstanding_loan_inr NUMERIC(12,2) NOT NULL DEFAULT 0.00,
    gate4_fnf_lien_settled BOOLEAN NOT NULL DEFAULT FALSE,
    gate5_rehire_eligibility VARCHAR(24) CHECK (gate5_rehire_eligibility IN ('ELIGIBLE_FOR_REHIRE','DO_NOT_REHIRE')),
    status VARCHAR(24) NOT NULL DEFAULT 'IN_CLEARANCE' CHECK (status IN ('IN_CLEARANCE','FNF_CLEARED_CLOSED')),
    CONSTRAINT check_five_gate_fnf_exit CHECK (
        status <> 'FNF_CLEARED_CLOSED' OR (
            gate2_uniform_key_cleared_by IS NOT NULL
            AND gate3_open_tasks_reassigned_to IS NOT NULL
            AND (gate4_outstanding_loan_inr = 0.00 OR gate4_fnf_lien_settled = TRUE)
            AND gate5_rehire_eligibility IS NOT NULL
        )
    )
);

-- ============================================================================
-- PM-1..10 (OWNER PACK 3: HR PAYROLL IMPORT, MASTER DATA HOLDERS & DPDP BLOCK)
-- + OPUS 4.7 MAX & ASTRA EXTRA HIGH CONCURRENCY / MEDICAL / EMI FIXES
-- ============================================================================
CREATE EXTENSION IF NOT EXISTS btree_gist;

-- PM-2: Central Master Data Holder Registry (Table-Driven Governance)
CREATE TABLE IF NOT EXISTS master_data_holders (
    master_key VARCHAR(48) PRIMARY KEY,
    display_label VARCHAR(80) NOT NULL,
    holder_role VARCHAR(32) NOT NULL,
    approver_role VARCHAR(32),
    ui_route VARCHAR(120) NOT NULL,
    audit_category VARCHAR(32) NOT NULL DEFAULT 'admin'
);

-- PM-4 & PM-5: HR Payroll Export Import Rounds with Strict DPDP Block-List Audit
CREATE TABLE IF NOT EXISTS people_import_rounds (
    round_id UUID PRIMARY KEY,
    report_hash CHAR(64) UNIQUE NOT NULL,
    import_mode VARCHAR(24) NOT NULL CHECK (import_mode IN ('CREATE_ONLY','OPT_IN_UPDATE_BY_EMP_NO')),
    source_filename VARCHAR(160) NOT NULL,
    total_rows SMALLINT NOT NULL CHECK (total_rows <= 1000),
    ok_rows_count SMALLINT NOT NULL,
    refused_rows_count SMALLINT NOT NULL,
    blocked_dpdp_columns_dropped TEXT[] NOT NULL DEFAULT '{}', -- e.g. {'Aadhar','PAN','Bank Account No','IFSC','UAN','Date of Birth','Address'}
    refused_row_numbers_json JSONB NOT NULL DEFAULT '[]'::jsonb, -- Row numbers + reasons ONLY; never names in logs!
    applied_by_person_id INTEGER NOT NULL,
    applied_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

-- PM-6 & PM-7: Temporal Placement & Membership (Membership = Kiosk Roster != Cover = Visibility)
CREATE TABLE IF NOT EXISTS person_membership (
    membership_id UUID PRIMARY KEY,
    person_id INTEGER NOT NULL REFERENCES hop.people(id),
    outlet_code VARCHAR(32) NOT NULL,
    membership_kind VARCHAR(20) NOT NULL CHECK (membership_kind IN ('HOME_PRIMARY','TEMP_LOAN')),
    valid_period TSTZRANGE NOT NULL,
    reason TEXT,
    approved_by_id INTEGER REFERENCES hop.people(id),
    written_by_id INTEGER NOT NULL REFERENCES hop.people(id),
    EXCLUDE USING gist (person_id WITH =, valid_period WITH &&) WHERE (membership_kind = 'HOME_PRIMARY')
);

-- Hostile Review Fix #1: Cross-Path Phone Deduplication & Lifecycle Version Lock
ALTER TABLE hop.people ADD COLUMN IF NOT EXISTS normalized_phone VARCHAR(16) UNIQUE;
ALTER TABLE hop.people ADD COLUMN IF NOT EXISTS name_hi VARCHAR(120); -- PM-9 Optional Hindi Display Name for Kiosk
ALTER TABLE hop.people ADD COLUMN IF NOT EXISTS lifecycle_version INTEGER NOT NULL DEFAULT 1;
-- H-000001..H-000108 reserved for Owner/Super Admin; sequence starts at H-000109 (C30)

-- Hostile Review Fix #2: Vault Uploads Default to PENDING_HR_REVIEW; Food Stations Require VALID Medical
ALTER TABLE people_doc_vault ALTER COLUMN verification_status SET DEFAULT 'PENDING_HR_REVIEW';
ALTER TABLE staff_roster_assignments ADD COLUMN IF NOT EXISTS medical_verified_valid_bool BOOLEAN NOT NULL DEFAULT FALSE;
ALTER TABLE staff_roster_assignments ADD CONSTRAINT check_food_station_requires_valid_medical
    CHECK (station_key NOT IN ('ESPRESSO','PASTRY_FINISH','FOH_COUNTER','BOH_CONTINENTAL') OR medical_verified_valid_bool = TRUE);

-- Hostile Review Fix #3: GiST Range Exclusion on Temporary Loans (Prevents Double-Booking by Cover Finder)
ALTER TABLE staff_inter_outlet_loans ADD CONSTRAINT exclude_overlapping_temp_loans
    EXCLUDE USING gist (person_id WITH =, tstzrange(starts_at, ends_at) WITH &&)
    WHERE (state IN ('REQUESTED','APPROVED_ACTIVE'));

-- Hostile Review Fix #4: Block Permanent Transfer Completion While Active/Future Temp Loans Exist
ALTER TABLE people_transfer_requests ADD COLUMN IF NOT EXISTS no_active_temp_loans_verified BOOLEAN NOT NULL DEFAULT FALSE;
ALTER TABLE people_transfer_requests ADD CONSTRAINT check_no_temp_loans_on_perm_cutover
    CHECK (state <> 'COMPLETED_ACTIVE' OR no_active_temp_loans_verified = TRUE);

-- Hostile Review Fix #5: Aggregate EMI <= 25% Gross & Reconciled Ledger Zero-Balance for Offboarding Gate 4
ALTER TABLE people_offboarding_cases ADD COLUMN IF NOT EXISTS gate3_reassignment_map_json JSONB NOT NULL DEFAULT '{}'::jsonb;
ALTER TABLE people_offboarding_cases ADD COLUMN IF NOT EXISTS gate4_reconciled_ledger_zero_bool BOOLEAN NOT NULL DEFAULT FALSE;
๐Ÿ“‚ 3C. Source Corpus Mapping & Automated Verification Evidence
Source Folder / ArtifactFiles / RowsTarget Domain ObjectStatus
EPIC-CONFIG-ADMIN-PEOPLE-OUTLET.md (C36โ€“C51 & E1โ€“E6)5-Tier Authority + Single-Trip Onboarding + CSV Dry-Run -> APPLY + E1โ€“E6 Trap Killershop.people + hop.user_assignments + people_onboarding_cases100% SYNTHESIZED
INTAKE-T1-11 & CONTRACT-T1-11-CAFE-PEOPLE-PRESENCE-MODULE.md6 Pillars: Presence Radar, Shift A/B/C/Split Roster, Temp Loans, Single Person Passport, Cover Finder, DPDP Dignityoutlet_shifts + staff_roster_assignments + staff_presence_events + staff_skill_passports100% SYNTHESIZED
PEOPLE-MODULE-DESIGN.md (PEO1โ€“PEO6) & Full HR Lifecycle6-Category S3 Doc Vault, Permanent 4-State Transfers, 5-Gate Offboarding & <=25% EMI Staff Loanspeople_doc_vault + people_transfer_requests + people_offboarding_cases + people_loans100% SYNTHESIZED

Automated Gate Evidence: `pytest tests/unit/test_t1_11_people_presence_mobility.py` + `tests/test_people_hr_lifecycle.py` (32 fail-first tests) + Playwright `J19` 8-frame storyboard โ€” 100% green across Manager/HR onboarding, 6-category doc vault, Medical `EXPIRED` food-station hard block, `derive_presence()` truth table, Temporary Loan vs Permanent Transfer isolation, `<=25%` EMI cap, and 5-Gate Offboarding FnF Lien lock.