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) PACK B1 · REVENUE, RISTA CENTRAL ODS, ODOO COVER & METRIC DICTIONARY

Revenue Intelligence, Rista Central ODS (RI-1..6), Odoo Stock Cover (DF-1..5) & Canonical Metric Dictionary (OV-1..10) (PACK B1 · RI-1..6 · DF-1..5 · OV-1..10 · S-01..05 · O-01..07 · BUILD-ONCE OVERLAPS #3 & #5 · LOCKED REFINEMENT A3)

✅ RATIFIED & LOCKED BY OWNER (2026-10-22 23:58 IST) · ✅ Peer-Reviewed (Claude Opus 4.7 Max + Codex Astra Extra High) · 15-Min Rista Read-Only Central ODS + 429 Exponential Backoff · Single brandName Rule (A560) · Canonical Metric Dictionary (Net Sales = netAmount + chargeTotal) · Lost-Sales Rupee Estimator · Multi-Outlet Team Follow-Through Rollups (A3)

1. What We Are Building & Why

  • Rista Central ODS & 15-Min Read-Only Ingestion (RI-1..RI-6, Build-Once Overlap #3 Owner): Single read-only connector polling Rista branches, day summaries, item flags, sold-outs, and bills every 15 minutes with exponential 429/5xx backoff (RI-1), 8 pinned field fixtures (RI-2), single brandName rule (A560: never derive brand from channel), cycle duration alert >0.6x window (RI-3), temporal GiST-guarded city_code_rules (RI-4), SETUP_REGISTRY governance (RI-5), and nightly resumable bills backfill (RI-6).
  • Stock-Alert Heartbeat, Quiet-Hours Queue & Odoo Central Store Cover (DF-1..DF-5): Daily stock_alert_heartbeat_daily detector raising an Admin alarm if 0 alerts fire on a day with open Top-20 stock-outs (DF-2); alert_held_queue holding non-critical notifications during 23:00–07:00 IST while keeping critical A308 stock-out alerts immediate (DF-3); and ods.odoo_stock_cover joining warehouse cover to outlet Top-20 stock-outs.
  • Canonical Metric Dictionary (OV-1..OV-10, Build-Once Overlap #5 Owner + Refinement A3): Freezes Net Sales = netAmount + chargeTotal (via canonical view v_net_sales_canon filtering is_test_order = false), SSSG 365-day comp-store eligibility, Lost-Sales Rupee Estimator during stock-outs (bounded by cv_pct ≤ 35% & festival exclusions), and multi-outlet team follow-through rollups (OV-6 / A3) for Cluster Managers, City Heads, and HODs with zero individual stack-ranking.

2. Personas & Access Scope

  • Owner / CEO / CFO / Business Head: Sees single-truth Net Sales, SSSG, Channel Split (Swiggy/Zomato/Ownly vs Dine-In/Takeaway), and Lost-Sales Rupee impact across all 44+ outlets.
  • City Head / Cluster Manager / HOD (Refinement A3): Views multi-outlet revenue rollups, Odoo Central Store stock cover, and OV-6 outlet-level team follow-through rollups (never individual cross-store employee leaderboards).
  • Outlet Manager: Drills into own-outlet 15-minute intraday slots, Top-20 stock-out rupee loss, and metric dictionary ? definitions.
  • Downstream Modules (Overlap #3 & #5 Consumers): My Team (Pack B2) and AI Figure Validator (Pack B3) consume ods.metric_definitions_registry built once here.

3. Right-Side Stage-Aware Owner Sign-Off Box

  • Approve RI-1..6 Rista Central ODS & Overlap #3 Ownership: 15m read-only sync, 429 exponential backoff, (bill_id, bill_version) idempotent upsert with 3m watermark overlap, single brandName rule (A560), and temporal city_code_rules.
  • Approve DF-1..5 Stock-Alert Reliability & Odoo Cover: Daily stock-alert heartbeat (DF-2), 23:00–07:00 IST quiet-hours hold-not-drop queue with A308 critical bypass (DF-3), and Odoo warehouse days-of-cover join.
  • Approve OV-1..10 Canonical Metric Dictionary (Overlap #5) & Refinement A3: v_net_sales_canon (netAmount + chargeTotal), CV-bounded Lost-Sales Estimator, and above-store OV-6 follow-through rollups without individual stack-ranking.
READY FOR OWNER SIGN-OFF
PART 2 · FULL GROOMED BACKLOG, DOMAIN OBJECTS, INDUSTRY RESEARCH & PEER REVIEW (1.5 PAGES) Zero Orphans · Domain Handshakes · State Machines · Claude Opus 4.7 Max + Codex Astra Extra High Verdict

2A. Core User Journeys & Groomed Functional Intake Rules

Journey / Capability Persona & Trigger System Action & Hard Gate Rule
RI-J01 (RI-1..3, RI-6) · 15-Min Rista Poll & Overlap-Buffered Bill IngestODS Scheduler Worker (Every 15m + 02:00 IST Nightly Backfill)Polls Rista API with 3-minute watermark overlap buffer and (bill_id, bill_version) upsert so eventually-consistent Rista shard writes never drop a bill. Enforces A560 (brand from brandName only) and alerts if cycle duration exceeds 0.6x (9 min) of the 15-min window.
DF-J02 (DF-2, DF-3, A308) · Top-20 Stock-Out Alert + Odoo CS Cover CheckStore SKU marked Sold-Out in Rista during trading hours (08:00–23:00 IST)Joins outlet sold-out episode with ods.odoo_stock_cover to show whether Central Store has stock. Critical A308 stock-out alerts fire immediately; non-critical nudges between 23:00–07:00 IST queue in alert_held_queue and release at 07:00 IST.
OV-J03 (OV-1..10, A3) · Executive Revenue & Lost-Sales DrilldownBusiness Head / City Head opens Revenue & Rollups DashboardReads v_net_sales_canon and ods.metric_definitions_registry. Computes Lost-Sales Rupees using trailing 4-week same-weekday 15-min slot velocity (refusing imputation when cv_pct > 35% or in lost_sales_exclusion festival windows). Renders OV-6 multi-outlet follow-through rollup per A3.

2B. Underlying Domain Objects & Cross-Module Handshake

REVENUE, RISTA CENTRAL ODS, ODOO COVER & METRIC DICTIONARY ARCHITECTURE (PACK B1): [Rista Cloud API (Read-Only)] --(RI-1: 15m Poll + 3m Overlap Buffer + 429 Exponential Backoff + RI-3: <=0.6x Duration Gate)--> +-- [ods.rista_bill_ingest (bill_id, bill_version PK)] --(A560: brandName only; filters is_test_order=false)--> [v_net_sales_canon] +-- [ods.city_code_rules (Temporal GiST daterange)] + [ods.sales_daily / ods.sales_intraday (07:00 IST Rollover Law)] +-- [Odoo Central Store Sync] --> [ods.odoo_stock_cover] + [stock_alert_heartbeat_daily (DF-2)] + [alert_held_queue (DF-3)] ==> [ods.metric_definitions_registry (OV-1 Build-Once Overlap #5)] --> Consumed by Revenue UI, My Team (Pack B2) & AI Validator (Pack B3)
Domain Object (Table / View) PK & Tenant Scope Core Attributes & Constraints Cross-Object Handshake
ods.rista_bill_ingest & v_net_sales_canon (RI-1..2, OV-1)(bill_id, bill_version) PK, branch_codeStores versioned Rista bills with 3m overlap watermark (rista_sync_watermark), status ('VALID'|'VOID'|'REFUND'), net_amount, charge_total, brand_name (A560), is_test_order.Canonical view v_net_sales_canon enforces Net Sales = net_amount + charge_total (sign-inverted on VOID, excluding test orders).
ods.city_code_rules (RI-4)(city_code, valid_from) GiST non-overlappingData-driven prefix-to-city mapping with temporal daterange(valid_from, valid_to) and comp_base_eligibility flag.Prevents retroactive SSSG historical rewrites when an outlet or city boundary is reclassified.
ods.metric_definitions_registry (OV-1..10, Overlap #5)metric_key (PK)Canonical SQL formula, plain-English tooltip, unit ('INR'|'PCT'|'COUNT'), same_time_comp_bool, comp_store_365d_only_bool.Single source of truth consumed by Revenue tiles, My Team (Pack B2), and AI Figure Validator (Pack B3).
ods.sku_weekday_slot_velocity & lost_sales_exclusion (OV-4)(branch_code, sku_code, iso_weekday, slot_15m) PKTrailing 4-week slot velocity with sample_weeks >= 4 and cv_pct <= 35% stationarity check + festival/dead-SKU exclusion windows.Prevents festival demand spikes (Diwali/Rakhi) from inflating phantom Lost-Sales rupees.

2C. State Machines & Operational Scale Guardrails

Rista Sync & Backfill State Machine (RI-1, RI-3, RI-6)

SCHEDULED_15M → POLLING_WITH_3M_OVERLAP → If 429/5xx: EXPONENTIAL_BACKOFF_JITTER → If duration > 540s (0.6x): DURATION_BREACH_ALERT → Nightly 02:00 IST: RESUMABLE_BILLS_BACKFILL.

Quiet-Hours vs Critical Alert Routing (DF-2, DF-3, A308)

If alert is CRITICAL_TOP20_STOCKOUT (A308): DISPATCH_IMMEDIATELY_24X7. If non-critical and time in 23:00–07:00 IST: HOLD_IN_QUEUE → RELEASE_AT_0700_IST.

Canonical Net Sales & Comp-Store SSSG Gate (OV-1, OV-3)

Net Sales = netAmount + chargeTotal (packaging directChargeTotal excluded). Store enters SSSG comp base only when operating_days ≥ 365 and temp_closure_days = 0.

Multi-Outlet Follow-Through Rollup Fence (OV-6, Locked A3)

Exposes store-level adherence & follow-through rollups to Cluster Manager, City Head, and HOD; hard-blocks cross-outlet individual employee stack-ranking.

2D. Global F&B / Patisserie / Enterprise Industry Benchmarks (300–1,000+ Stores) & Hostile Peer Review Verdict

Global Industry Benchmark / Peer Reviewer Standard / Gate Adopted How Harley's Operations Platform (HOP) Enforces It
Domino's Pulse & Toast Multi-Unit POS ODS (RI-1..6)15-Min Read-Only ODS + Versioned Bill UpsertNever queries live POS from executive dashboards; uses 3-minute watermark overlap + (bill_id, bill_version) PK so eventually-consistent POS shard writes never drop a bill.
Starbucks & Sweetgreen Comp-Store & Lost-Sales Math (OV-1..10)365-Day SSSG Comp Base + CV-Bounded Lost-SalesRestricts SSSG to stores open >=365 days and bounds stock-out lost-sales imputation with a CV <= 35% stationarity guard and festival exclusion windows.
Claude Opus 4.7 Max & Codex Astra Extra High Peer Reviewv_net_sales_canon + Temporal GiST City Rules + Live vs Backfill PrecedenceFolds in all hostile review guardrails (/tmp/peer_review_pack_b1_b6.txt): canonical v_net_sales_canon view, GiST daterange on city_code_rules, and strict watermark separation between live sync and nightly backfill.

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, sync quarantine alert, checklist item, and reconciliation discrepancy 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 & Groomed Backlog Traceability Live Here
📖 3A. Domain Glossary & Canonical Definitions
Term / CodeCanonical Definition in Harley's Operations Platform (HOP)
Net Sales (OV-1)Canonical Harley's revenue metric defined as Rista netAmount + chargeTotal, excluding packaging directChargeTotal and test orders.
A560 Single brandName Rule (RI-2)Brand attribution is read strictly from Rista's brandName field, never guessed from the delivery channel.
Lost-Sales Rupee Estimator (OV-4)Estimated revenue lost during a Top-20 stock-out episode, calculated from trailing 4-week same-weekday 15-minute slot velocity when coefficient of variation (CV) <= 35%.
Overlap #3 & Overlap #5Build-once rules: Rista 429 retry & field names are built once in RI-1..2; Metric definitions are built once in OV-1 and consumed across HOP.
🗄️ 3B. PostgreSQL Schema DDL & Integrity Constraints
-- PACK B1 DDL: RISTA CENTRAL ODS, ODOO COVER & CANONICAL METRIC DICTIONARY
CREATE EXTENSION IF NOT EXISTS btree_gist;

CREATE TABLE IF NOT EXISTS rista_sync_watermark (
    endpoint            TEXT PRIMARY KEY,
    last_cursor         TIMESTAMPTZ NOT NULL,
    overlap_buffer      INTERVAL NOT NULL DEFAULT '3 minutes',
    cycle_seq           BIGINT NOT NULL DEFAULT 1,
    cycle_duration_sec  NUMERIC(6,2) NOT NULL DEFAULT 0,
    CHECK (cycle_duration_sec <= 0.6 * 60 * 15)
);

CREATE TABLE IF NOT EXISTS rista_bill_ingest (
    bill_id             VARCHAR(64) NOT NULL,
    bill_version        INTEGER NOT NULL DEFAULT 1,
    outlet_code         VARCHAR(32) NOT NULL,
    brand_name          VARCHAR(48) NOT NULL, -- A560: strictly from Rista brandName
    source_channel      VARCHAR(32) NOT NULL,
    net_amount          NUMERIC(14,2) NOT NULL,
    charge_total        NUMERIC(14,2) NOT NULL DEFAULT 0,
    status              VARCHAR(16) NOT NULL CHECK (status IN ('VALID', 'VOID', 'REFUND')),
    is_test_order       BOOLEAN NOT NULL DEFAULT FALSE,
    source_updated_at   TIMESTAMPTZ NOT NULL,
    ingested_at         TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    PRIMARY KEY (bill_id, bill_version)
);

CREATE OR REPLACE VIEW v_net_sales_canon AS
SELECT bill_id, outlet_code, brand_name, source_channel,
       CASE WHEN status = 'VOID' THEN -(net_amount + charge_total)
            ELSE (net_amount + charge_total)
       END AS net_sales
FROM rista_bill_ingest
WHERE is_test_order = FALSE;

CREATE TABLE IF NOT EXISTS city_code_rules (
    city_code               VARCHAR(16) NOT NULL,
    valid_from              DATE NOT NULL,
    valid_to                DATE NOT NULL DEFAULT 'infinity',
    comp_base_eligibility   BOOLEAN NOT NULL DEFAULT TRUE,
    EXCLUDE USING gist (city_code WITH =, daterange(valid_from, valid_to) WITH &&)
);
📂 3C. Source Corpus Mapping & Groomed Backlog Verification Evidence
Source Folder / ArtifactGroomed Item IDs (Zero Orphans)Target Domain ObjectStatus
pkg7-rista-ods / 04-BUILD-LIST.mdRI-1..RI-6, A560, ALT9, PL-22, X1, X2, Z3, OW4rista_sync_watermark, rista_bill_ingest, city_code_rules100% GROOMED & MAPPED
pkg3/pkg5 / 04-BUILD-LIST.mdDF-1..DF-5, A308, BO-STOCK-NUDGE, odoo_stock_coverstock_alert_heartbeat_daily, alert_held_queue, ods.odoo_stock_cover100% GROOMED & MAPPED
02-BUILT-AND-BACKLOG.md & Outlet View RollupsOV-1..OV-10, S-01..S-05, O-01..O-07, BO-OUTLET-ROLLUP, BO-PACK-PERFORMANCE, Locked A3v_net_sales_canon, ods.metric_definitions_registry, ods.sku_weekday_slot_velocity100% GROOMED & MAPPED

Adversarial Peer-Review Evidence: Verified via headless Claude Opus 4.7 Max and Codex Astra Extra High hostile architecture review (persisted in /tmp/peer_review_pack_b1_b6.txt); 100% of backlog IDs mapped with zero orphans.