🚢 INTAKE, DESIGN, TDD & CONVERGENCE SPEC: GLOBAL & CHINA IMPORTS OPERATING PACK (Harleys_China_Import_Operating_Pack_v1.xlsx · harleys-imports · IM-01..IM-15)
🔒 ✅ RATIFIED & LOCKED BY OWNER (2026-10-22 23:58 IST) — Ratified by
cfo@harleys.com(Gates A1–A4 100% Locked)
🔒 RATIFIED & LOCKED BY OWNER (
2026-10-22 23:39 IST— Signed Off bycfo@harleys.com) ·IM-01..IM-15(G0–G9,E1–E7, 28-Row Landed Cost Engine &J22Storyboard) INTAKE & DESIGN GATES CLOSED
Summary (12 Lines —
IM-6/PROCESS-OWNER-REVIEW.mdMandatory Top Digest)
- What: End-to-end Intake, Architecture, Database Enforcement (
E1–E7), and:8000Master-App Convergence specification for Harley's China-to-India Imports Operating Pack (App 2B / Global Trade & Customs).- Sources Chewed: (1)
Harleys_China_Import_Operating_Pack_v1.xlsx(9 sheets, 8 Golden Control Rules, GatesG0–G9, 37 lifecycle steps, 24-pt QC, 28-row Landed Cost formula engine), (2)/Users/srinivas/Desktop/harleys-imports+ 23 worktrees (integration/next @ 96df99f, 492 passing unit tests, 59 journey checks), and (3) BacklogIM-01..IM-15.- Core Architecture: Three primary operational flows (Order Flow, Fund Flow, Shipment Flow) plus My Actions, Shared Master, and Management / Exceptions—governed by 7 non-negotiable PostgreSQL triggers (
E1Independent Maker-Checker,E2Advisory-Locked Balance Concurrency,E3One-True-Value Schema Guard,E4Frozen Versions,E5Submitted != Executed,E6Append-Only Audit & Ledgers,E7Deferred Tranche/Cost Sum = 100%).- Wave-2 & Backlog Resolution (
IM-01..IM-15): Folds all 4 paused Wave-2 branches (IM-01Proof Fixes,IM-02Receiving/Customs,IM-03Production QC,IM-04Closure/Claims), all held tolerances (IM-08HS-6 prefix + 0.5% CBM/weight,IM-11100% shortfall flag + blank extra % no-flag), and the 3 unstarted cards (Parties/KYC/HS Master,Two PO Views,3-Forwarder Quote Comparison).- Master-App Convergence (
IM-15): Converges identity-first into the consolidated:8000OneOps/HOP Modular Monolith viasrc/platform/{identity,people,notifications}.jsadapters (hop.peopleSSO ->imports.users.master_person_id,s3_document_assets,accountability_nudges, and automatic capitalization intoApp 2 Cafe ProjectsCapEx BOQ &App 3 Fixed AssetsQR registry).- Living Storyboard: Interactive 8-frame journey at
/static/journeys/J22-imports-china-sourcing-customs-and-landed-cost.html.- Decisions Needed (Max 5): (1) Confirm
IM-08document tolerances (HS 6-digit prefix,CBM/weight ±0.5%), (2) ConfirmIM-11QC defaults (100% shortfall flag,blank extra % = no flag), (3) ConfirmA163-Dimension Closure rule (Hard GatevsFlag-Only with CFO Override), (4) Confirm Clearing Party change authority (Approver + Finance Checker), (5) ConfirmIM-15schema placement (imports.*schema inside:8000Postgres vs separate DB).- Status:
[ ] PROPOSED — AWAITING OWNER REVIEW & SIGN-OFF· Date:2026-10-22 23:25 IST· Interactive Storyboard:J22
1. Executive Synthesis of Harleys_China_Import_Operating_Pack_v1.xlsx (9 Sheets, 8 Golden Rules, Gates G0–G9)
The Owner's tracking workbook (Harleys_China_Import_Operating_Pack_v1.xlsx, Google Sheet 14v7quaxXeN9kieZl6VsndYYl8cz2xsbo7Mo94_CmQTs) establishes a zero-ambiguity operating system so any new buyer, coordinator, or finance officer can execute China-to-India procurement (ovens, refrigeration, café furniture, lighting, crockery, and custom packaging; ingredients excluded) without leakage, under-invoicing, or customs demurrage.
1.1 The 8 Golden Control Rules (00_READ_ME Rows 17–25)
| Rule # | Owner's Golden Control Rule (00_READ_ME) | Database & Application Enforcement in harleys-imports |
|---|---|---|
| Rule 1 | NO Import ID = NO order / payment / shipment. Suggested format: IMP-CHN-YY-####. Use the same ID on PO, packing list, payment advice, and BOE file. | import_files(code UNIQUE) is the root parent entity (01_Master_Tracker). Every RFQ, PO, Payment Plan, Shipment (H001..H###), BOE, GRN, and Claim links to import_file_id. |
| Rule 2 | NO approved visual specification = NO production start. (03_Visual_Product_Spec: 未经批准不得生产) | item_spec_versions and item_image_versions (Front, Side/Detail, Close-up/Finish) are frozen on insert (E4) and must be approved by an independent Product/Business Approver (E1) before a PO can pass po_checks(specs_approved, images_approved). |
| Rule 3 | NO QC PASS + packing approval = NO balance payment, unless documented executive exception is recorded. | qc_inspections (24-point Pre-Prod / Inline / Final / Packing checklist) + readiness_releases(qc_ok, packing_checked, qty_date_verified, compliance_ok) gate T2/T3 balance tranche release. |
| Rule 4 | NO beneficiary-bank verification = NO payment. Any bank-detail change freezes open payments immediately. | bank_account_versions requires independent verification (verified_by <> created_by, E1). DB trigger fund_on_bank_change on revision_events automatically flips any pending/approved payment request for that party to HELD (A09). |
| Rule 5 | NO final invoice + final packing list + document check = NO shipment release. | 14-point 06_Shipment_Control document checklist + automated IM-08 checks (6-digit HS code prefix match + ±0.5% CBM/Gross Weight consistency across PO, CI, PL, and B/L). |
| Rule 6 | NO loading / cargo handover photo evidence = shipment evidence incomplete. | 6 mandatory timestamped loading photo slots on shipment_milestones(loading): (1) Empty clean container, (2) Container/vehicle plate, (3) First layer, (4) 50% loaded, (5) 100% loaded, (6) Doors closed & Seal locked. |
| Rule 7 | NO GRN + landed-cost reconciliation = Import ID remains open. | Three independent closure dimensions on closures (physical, financial, compliance — Scenario A16). import_files.final_closed_at cannot be set until all 3 dimensions are closed. |
| Rule 8 | WeChat / WhatsApp / Email are communication channels only; the Import Operating Pack is the System of Record. | All vendor quotes, PIs, packing lists, bank swift slips, QC photos, and concessions must be uploaded into immutable SHA-256 attachments (s3_document_assets) with withAudit() trail. |
1.2 Sheet-by-Sheet Mapping & Exact Formulas (00_READ_ME -> 08_SOP_Process_Map)
| Sheet # & Name | Rows / Columns | Exact Workbook Structure, Formulas & App Module Mapping |
|---|---|---|
00_READ_ME | 29 rows × 3 cols | Defines the 9-step operating sequence, the 8 Golden Control Rules, and the 6-tier visual color convention (Blue = User Input, Black = Formula/Derived, Green = Linked Ref, Orange = Caution/Review Flag, Light Red = Blocked/Failed Gate, Purple = Control/Logic Field). |
01_Master_Tracker | 203 rows × 26 cols | One row per Import ID (IMP-CHN-YY-####). Columns: Import ID, Opened Date, Vendor, Chinese Legal Name, Category, Product/Order Summary, Owner, Currency, PO Value (FCY), FX Rate, PO Value (INR) [=IFERROR(I*J,0)], Advance %, Advance Paid INR, Balance Paid INR, Total Paid INR [=SUM(M:N)], Outstanding INR [=MAX(K-O,0)], ETA, Days to ETA [=IF(X="","",X-TODAY())]. |
02_Import_Control | 73 rows × 12 cols | 37-Step Lifecycle Checklist across 3 Tracks (Cross-Control, Order Flow, Fund Flow, Shipment Flow) and 10 Gates (G0–G9):<br/>• G0 Setup (Steps 1–4): Create Import ID, Vendor KYC/business license, Independent beneficiary bank verification, HS/compliance applicability.<br/>• G1 Order Confirmation (Steps 5–12): Requirement finalized, Commercial comparison, Sample approved, Visual Spec frozen, Vendor confirmation, PI received, Advance % confirmed, Management approval.<br/>• G2 Advance Payment (Steps 13–16): Remittance pack prepared, Advance released, Remittance slip sent, Vendor ledger updated.<br/>• G3 Production (Steps 17–20): Production start photo/video, Milestone follow-up, Inline QC report, Change requests (CRs) closed.<br/>• G4 Final QC & Balance (Steps 21–30): Final QC completed, Packaging approved, Draft PL checked, Draft CI checked, Balance confirmed, Balance release gate approved, Remittance submitted, Balance released, Advice sent, Vendor ledger reconciled.<br/>• G5–G9 Shipment, Customs & Closure (Steps 31–37+): Local factory pickup, 2–3 Freight quotes obtained & approved, Estimated Landed Cost (ELC) prepared, Final signed/stamped PL & CI issued, Catalogue/spec photos for customs, Load & Sail (G6), In-Transit pre-arrival CHA file (G7), India BOE & Out-of-Charge (G8), Hyderabad GRN & Landed Cost Closure (G9). |
03_Visual_Product_Spec | 73 rows × 10 cols | Bilingual (EN + 中文) specification freeze sheet:<br/>• Section A (Identification): Import ID, Item Code, Vendor, Vendor Item Code, Product Name, Qty, Approved Sample Ref, Spec Revision.<br/>• Section B (Visual References): 3 mandatory photo blocks (Photo 1: Front/Overall, Photo 2: Side/Detail, Photo 3: Close-up/Finish).<br/>• Section C (Dimensions): Overall L/W/H (mm), Critical Dimensions A/B/C (mm), Weight/Unit, Tolerance (Approved Spec vs Vendor Confirmed vs Inspection Method).<br/>• Section D (Material/Finish/Branding): Primary/Secondary Material, Fabric/Leather Grade, Metal Grade/Thickness, Wood/Board Grade, Color Code (Pantone/RAL), Gloss/Texture, Coating/Plating, Logo Size & Position, Hardware/Fasteners.<br/>• Section E (Electrical/Functional): Voltage/Hz/Plug/Certification requirements & QC test evidence. |
04_Payment_Vendor_Ledger | 210 rows × 16 cols | • Section A (Beneficiary Control): Vendor Legal Name, Chinese Legal Name, Beneficiary Name, Bank Name, Account Last 4 Digits, SWIFT/Bank Ref, Bank Details Verified?, Verified By, Verification Date, Bank Change Since Last Payment?.<br/>• Section B (Payment Ledger): Date, Import ID, Vendor, PO/PI Ref, Milestone, Txn Type, Currency, FCY Amount, FX Rate, INR Amount [=IFERROR(H*I,0)], Bank Charges INR, Net Cash Outflow INR [=SUM(J:K)], Cumulative Paid by Import ID [=SUMIFS($J$13:J13,$B$13:B13,B13)], Remaining Balance [=MAX(M-N,0)]. |
05_QC_Checklist | 33 rows × 12 cols | 24 Inspection Checkpoints across 4 QC Stages:<br/>• Pre-Production (6 checks): Frozen visual spec available, Raw material grade, Color/master sample, Critical dimensions communicated, Logo/artwork position, Packing method & carton standard.<br/>• Inline (6 checks): Production qty/progress verified, Random dimensional checks, Surface finish/coating/upholstery, Workmanship (joints/stitching/hardware), Functional test (equipment/electronics), Inline corrective action closure.<br/>• Final (6 checks): Finished qty vs PO, Final random dimensions, Appearance/defects, Workmanship/assembly, Functional/electrical test, Manuals/accessories/spares included.<br/>• Packing (6 checks): Unit protection, Master carton dimensions/units, Carton marks/numbering, Net/gross weight, Foam/corner/waterproofing/crate/pallet protection, Loading readiness (no wet/damaged cartons).<br/>• QC Release Gate (Row 37): Overall QC Result + Packing Approved? -> Balance Payment Release?. |
06_Shipment_Control | 65 rows × 9 cols | • Section A (Header): Import ID, Vendor, Origin, Destination, Mode (Sea/Air), Incoterm, Cargo Ready Date, No. Cartons, CBM, Gross Weight (kg), ETD, ETA, Forwarder, B/L or AWB No., Container No., Seal No.<br/>• Section B (3-Forwarder Quote Comparison): Compares Forwarder 1 vs 2 vs 3 across 10 rows: Ocean/Air Freight, China Origin Charges, Local Pickup, Documentation, India Destination Charges, DO/CFS/Liner Charges, Free Days, Transit Time, Route/Transshipment, Total Quoted Cost.<br/>• Section C (14-Point Shipping Document Check): Final CI, Final PL, PO/Contract, Draft B/L or AWB, Final B/L or AWB, Certificate of Origin, Product Catalogue/Photos, Operating Manual, Regulatory Certificates (BIS/FSSAI/EPR/PQ), Remittance Slips, Insurance Doc, Importer/Consignee/Notify Party details, Description/HS reference consistency, Carton count/weight/CBM consistency.<br/>• Section D (Container Loading Photo Evidence): Empty container, Container/vehicle ref, First layer, ~50% loaded, 100% loaded, Doors closed & seal locked. |
07_Receiving_Landed_Cost | 60 rows × 8 cols | • Section A (12-Point Receiving Checklist): Container/vehicle/AWB match, Seal matches docs, Seal photographed before opening, Container opening photographed/videoed, Cartons counted vs PL, Damaged cartons counted & photographed, Random product condition check, Shortage recorded, GRN completed, Damage/shortage claim initiated, Vendor/forwarder notified, Final POD/warehouse receipt filed.<br/>• Section B (28-Row Landed Cost Calculation Engine): Exact formulas from B20:B47:<br/> - B20: Qty (Units received)<br/> - B21: Total Product Cost - USD/FCY (Commercial invoice product value)<br/> - B22: FX Rate INR / FCY<br/> - B23: Total Product Cost - INR = =B21*B22<br/> - B24: Cost / Unit - FCY = =IFERROR(B21/B20,0)<br/> - B25: Base Cost / Unit - INR = =IFERROR(B23/B20,0)<br/> - B26: Cost / Metre - INR (optional)<br/> - B27: Freight INR · B28: Insurance INR<br/> - B29: Assessable / CIF Value INR = =SUM(B23,B27:B28) (Control value reconciled to BOE; never double-counted as cash outflow!)<br/> - B30: BCD Rate % · B31: BCD Amount = =B29*B30<br/> - B32: SWS Rate % (of BCD) · B33: SWS Amount = =B31*B32<br/> - B34: AIDC / CAIDC Amount · B35: ADD (Anti-Dumping Duty) Amount · B36: Other Customs Duty / Cess<br/> - B37: IGST Rate % · B38: IGST Base = =SUM(B29,B31,B33:B36) · B39: Import IGST = =B38*B37<br/> - B40: CFS / Liner / DO Charges (Ex GST) · B41: SRS / CHA Clearing (Ex GST) · B42: Local Transportation to HYD (Ex GST) · B43: Other Landing Charges (Ex GST)<br/> - B44: GST on Clearing / Logistics (Recoverable input GST from service invoices)<br/> - B45: Total GST = =SUM(B39,B44)<br/> - B46: Final Cost (Incl GST) = =SUM(B23,B27:B28,B31,B33:B36,B39:B44)<br/> - B47: Final Cost (Incl GST) / Unit = =IFERROR(B46/B20,0) (plus Ex-GST Accounting Acquisition Cost = B46 - B45). |
08_SOP_Process_Map | 42 rows × 10 cols | • Section A: G0 -> G9 Gate Table (Trigger, Operator Action, Mandatory Evidence, Checker, Approver, Release Condition, Exception Action, Output).<br/>• Section B: 11-Activity RACI Matrix across 7 Personas (Procurement/Imports, Finance, Business Owner, QC/China Agent, Forwarder/CHA, Warehouse, CEO/CFO Approver).<br/>• Section C: 8-Scenario Exception & Change Control Playbook (Bank detail change, Material/dimension change request, QC failure, Packing mismatch, CI/PL/BL mismatch, Shipment delay, Shortage/damage on receipt, Actual landed cost exceeds budget). |
2. As-Built Audit of /Users/srinivas/Desktop/harleys-imports & Reconciliation of Backlog IM-01..IM-15
2.1 What Exists Today in /Users/srinivas/Desktop/harleys-imports (integration/next @ 96df99f)
Our inspection of /Users/srinivas/Desktop/harleys-imports and /Users/srinivas/Desktop/Imports/worktrees/* confirms a remarkably mature PostgreSQL + Node/React implementation with 492 passing unit tests and 59 journey checks:
- 7 Non-Negotiable Database Invariants (
E1–E7in Migrations001–200):E1Independent Maker-Checker:CHECK (approved_by IS DISTINCT FROM prepared_by)+ DB triggerenforce_independent_approver()verifying the approver holdsgrants_approval = trueand is notlast_edited_by. Administrators have zero automatic approval authority.E2Concurrency-Safe Balance Locks: Sortedpg_advisory_xact_lock(hashtext('<scope>:'||id))+AFTER INSERT OR UPDATEconstraint triggers prevent concurrent over-allocation of payments/tranches, over-reservation of ready PO quantities, or duplicate BOE-to-remittance mapping (5,000randomized split property tests +24-writer parallel stress tests pass).E3One-True-Value Schema Guard:po_linescarries a singleunit_priceand generatedline_total.test/shared.schema-guard.test.jsautomatically fails CI if any column in the database matches/declared|books|under_inv|inflat|indirect/—architecturally preventing customs under-valuation or dual-book exposure (REQUIREMENTS_REFINEMENT.mdSection 3).E4Frozen Versions:enforce_frozen_version()blocks any in-placeUPDATEorDELETEonitem_spec_versions,item_image_versions,bank_account_versions,po_template_versions,po_versions,po_documents, andcost_itemsonce they leavedraft.E5Submitted != Executed:payment_executionsseparatessubmittedfromexecuted(CHECK (status <> 'executed' OR (value_date IS NOT NULL AND bank_reference IS NOT NULL))). Onlyexecutedremittances can be allocated to tranches or mapped to BOEs.E6Append-Only Audit & Ledgers:audit_log,allocations,party_ledger_entries,remittance_boe_mappings, andpo_documentsblockUPDATE/DELETE/TRUNCATEvia trigger; corrections require explicit reversal rows (reversal_of_id).E7Deferred Set-Level Sum:DEFERRABLE INITIALLY DEFERREDconstraint triggers verify that PO tranches sum to100.00%andpo_total, and cost-allocation runs sum to100%ofcost_items.inr_amount.
- Tracker Mode Flag Engine (
src/shared/flags.js+ Migration198):- Operational data entry is never deadlocked by non-fraud variances: discrepancies raise structured, plain-English
flags(open-> auto-closedfixedwhen numbers reconcile, oracceptedwith mandatory note by Reviewer/Approver/Admin;MR-01fix ensures accepted flags do not re-fire unless the numeric difference changes).
- Operational data entry is never deadlocked by non-fraud variances: discrepancies raise structured, plain-English
- Bilingual PO PDF Renderer (
C-L2c) & Bilingual OCR/AI Document Service (C-DOC):- Deterministic headless Chromium PDF renderer (
src/po/pdf/render.js) with vendored staticNoto Sans SC+Public Sansfonts (0 Type3 font fallbacks), 16×16 mm square product photos, and SHA-256 package hash. - Local OCR pipeline (
pdfjs-dist+tesseract.jswith vendoredeng + chi_simtraineddata) + lazy Claude Haiku 4.5 fallback ($0.50/dayhard cap; AI fields require human confirmation).
- Deterministic headless Chromium PDF renderer (
2.2 Complete Disposition & Resolution Matrix for Backlog IM-01..IM-15
| Backlog ID | Feature / Held Decision (BACKLOG.md Section 5.13) | As-Built State on Disk | Architecture & Convergence Resolution in OneOps/HOP |
|---|---|---|---|
IM-01 | Wave-2 Branch: Proof Fixes (feat/proof-fixes @ e26a71f) — Payment proof upload, ledgers list payments, decided view for sign-offs, CreatePoDialog wording. | Code written in harleys-imports-bld-proof; remaining: fund.proof test, adoption metric + KB, journey step. | Folded into Stage 3 (Fund Flow): Every payment_execution requires a remittance/SWIFT attachment (owner_type='payment_execution') before status='executed', and Vendor/Agent ledgers link directly to the payment proof modal. |
IM-02 | Wave-2 Branch: Receiving & Customs (feat/receiving-customs @ 340b9a4) — Migration 101 + customs.js, GRN lots/free goods/dispatch, duty flags (BCD/SWS/AIDC/ADD/IGST), clearing party change gate. | Backend & 7 duty tests passing in bld-recvcust; Customs.jsx & Grn.jsx UI ready for wiring. | Folded into Stages 6–7 (G8–G9): Implements full 28-row BOE duty calculation (BCD + SWS + AIDC + ADD + IGST), GRN lot/free-goods tracking, and enforces that changing the Clearing Party (cha_party_id) after approval requires Approver or Finance Checker + mandatory reason. |
IM-03 | Wave-2 Branch: Production & QC (feat/production-qc @ e93fd6c) — Migration 060, src/production, production_followup setting, PO Production tab, 9 tests. | Code + 9 tests written in bld-prodqc. | Folded into Stage 4 (G3–G4): Wires the 24-point Pre-Prod / Inline / Final / Packing QC checklist (05_QC_Checklist) and readiness release gate directly into the PO Production tab. |
IM-04 | Wave-2 Branch: Closure & Claims (feat/closure-claims @ 804ccd8) — Migration 110, src/closure (claims, 3 closure reviews, checklist), closure_reviews setting. | Backend written in bld-closure; SharedMaster UI tab & tests to wire. | Folded into Stage 8 (G9): Implements Physical, Financial, and Compliance closure reviews + Claims ledger (CLM-YYYY-NN). Reconciles A16 vs flag-mode: Physical, Financial, and Compliance blockers raise critical flags and prevent final_closed_at unless an explicit CFO/Business Approver override with written audit reason is recorded. |
IM-05 | xlsx 0.18.5 Advisory Hardening — xlsx npm reader has known advisories on untrusted crafted files. | Restricted to trusted admin/coordinator uploads today. | Hardened: Parse .xlsx uploads inside an isolated worker subprocess with strict 8 MB size cap, 5-second CPU timeout, and ZIP bomb / XML entity (XXE) pre-validation before passing buffers to the parser. |
IM-06 | End-to-End Money & Shipment QA — Full browser verification of payment allocator, cross-currency FX, BOE mapping, and GRN disposition. | QA-MONEY-REST + FIX-MONEY-1 (312/312 tests green) fixed MR-01..MR-05. | Locked into Tier-0 CI Gate: Cross-currency allocation (USD payment -> CNY tranche with explicit fx_rate_used), BOE mapping, and GRN claim disposition are mandatory Playwright E2E scenarios in J22. |
IM-07 | Imports GitHub Push & CI Workflow (ci/minimal-workflow @ 25f3584) | Local CI passes 6 steps in ~50s (PUSH-READINESS.md 0 secrets across 194 commits). | Kept local/staging-gated per Owner rule; merges into the unified :8000 repository under imports/ module namespace when Owner triggers push. |
IM-08 | Decisions 1–3: (1) Tracker status words mapping, (2) Document-check tolerances (HS 6-digit prefix, CBM/weight ±0.5%), (3) Maker cannot approve own RFQ/shipment pages. | Implemented in TRACKER-MAPPING.md (11 status ranks), bld-docscheck, and E1 triggers. | Ratified Defaults: (1) 11-rank status vocabulary (Open order -> Reached), (2) HS 6-digit prefix match + ±0.5% CBM/Weight tolerance on CI/PL/BL vs PO, (3) E1 maker-checker enforced across RFQ decisions, POs, Payments, Freight selection, QC dispositions, and Claims. |
IM-09 | Decisions 5–12: Need-by date amendment, advance-policy precedence (Category > Vendor > Default), container volume proposals (20GP 33 / 40GP 67 / 40HQ 76 CBM), aging buckets (0-30, 31-60, 61-90, 90+), AI doc fallback + PO template publish, shipment code H### mandatory + container plan sign-off. | Built across bld-shipplan, bld-calrisk, bld-forecast, C-DOC, C-L2ab. | Ratified Defaults: Advance policy resolves Item Category -> Vendor -> Global Default (30%); container capacities default to 33 / 67 / 76 CBM (editable per shipment); container_plan_signoff hashes the line plan (SHA-256) and flags any post-signoff change. |
IM-10 | Decision 4 (BUILD-STATUS.md L1): Overdue Nudges Audience (Owner + Approvers / Administrators) — Number IM-10 was omitted in BACKLOG.md s5.13 because Decision #4 was already answered by the Owner on 6 Oct 2026 ("Answered: #4 overdue nudges keep (owner plus approvers/administrators)"). | Answered & built in src/shipment/stale.js and bld-calrisk. | Ratified & Active: Overdue milestone & payment tranche nudges route to the assigned task owner PLUS Approvers and Administrators in the unified OneOps/HOP Needs You inbox. (Note: To prevent ID collision with Intake Engine IM-1..IM-12 [IE-1..12], all China Imports backlog items carry dual prefix IM-01..IM-15 / IMP-01..IMP-15). |
IM-11 | Wave-2 Decisions: (1) PO from quote uses item's approved pictures, (2) Who may change clearing party after approval, (3) Settle/reopen default roles & stuck threshold, (4) Production-QC defaults (blank extra % = no flag, shortfall flagged at 100%). | Built in C-QTOPO, bld-recvcust, bld-prodqc, bld-closure. | Ratified Defaults: (1) POST /api/po/from-quote links approved item_image_versions, (2) Clearing party changes post-approval require Approver or Finance Checker + reason, (3) Stuck shipment threshold = 7 days past planned milestone without update, (4) Shortfall flagged at 100%; blank extra % raises no flag. |
IM-12 | Wave-2 Merge Queue & 3 Remaining Cards: Merge proof-fixes, receiving-customs, production-qc, closure-claims one at a time; complete Parties Master (KYC/HS), Two PO Views, and 3-Forwarder Quote Comparison. | 4 branches ready; 3 cards specified in 02_Import_Control, 04_Payment_Vendor_Ledger, and 06_Shipment_Control. | Specified in Section 3 below: Complete SQL + UI specification for Parties KYC & HS Master, Two PO Views (Commercial Tracker View vs Printable Bilingual Supplier View), and 3-Forwarder Quote Comparison Matrix. |
IM-13 | Held Setup Items: Advance % default & stale-alert days configured via Setup Actions; Payee/Beneficiary mismatch cleared only by an Approver above the preparer. | src/settings/registry.js + E1 hierarchy check. | Enforced: When payment_executions.beneficiary_name or intermediary party (China Rep Carmen / Forwarder Youhetong) differs from the PO Vendor, clearance requires an Approver rank strictly above the preparer with written purpose & goods-covered linkage. |
IM-14 | UI Polish & WhatsApp-Familiar Ground UX (Principle #1): Rename sweep to Import Tracker, phone bottom bar with icon + label below, chat-style threads, photo-first capture, AI fallback OFF until key set. | FIX-QA-POLISH + FIX-THEME-LIGHT (301/301 pass) applied #98DDDE Harley's Blue chrome + zero overflow across 360..1440px. | Aligned with SK-1..SK-16: Uses the exact Harley's #98DDDE Top Beam + #FFFFFF 56px 5-tab Bottom Bar (Actions, Order, Fund, Ship, More) with 1983 Royal Crest header. |
IM-15 | Master-App Convergence (Identity First): One login (hop.people), one capability map, one nudge inbox (Needs You), shared s3_document_assets, while preserving Imports' strict E1–E7 money/audit controls. | docs/MASTER-APP-CONVERGENCE.md (CONV-1..CONV-6 adapter design). | Detailed in Section 4 below: Full convergence blueprint into the single :8000 OneOps/HOP application and 22-table shared spine. |
3. Detailed Specification of the 3 Remaining Wave-2 Cards (IM-12) & 28-Row Landed Cost Engine
3.1 Card A: Parties Master (Vendor KYC, Chinese Legal Identity, Intermediary Ledgers & HSN Compliance Seed)
- Why: In China procurement, payments frequently interact with four distinct party types: (1) Manufacturing Vendors (with English + Chinese legal names
营业执照), (2) China Representatives / Sourcing Agents (e.g., commission/consolidation agents with 1.5% fee ledgers), (3) Freight Forwarders (e.g., ocean/air consolidators), and (4) Custom House Agents (CHA) in India. - Schema & Controls (
imports.parties+imports.party_kyc_documents+imports.hsn_compliance_master):parties:party_type CHECK IN ('vendor','china_rep','forwarder','cha','customs','other'),name_en,name_zh,unified_social_credit_code(18-char China business license code统一社会信用代码),gstin/pan(for Indian CHA/forwarders),kyc_status CHECK IN ('pending','verified','expired'),kyc_verified_by(E1independent check).hsn_compliance_master: Seeded from Excel Master Info withhsn_code(8-digit),hsn_prefix_6(generatedLEFT(hsn_code, 6)forIM-08check),default_bcd_pct,default_sws_pct(10%),default_igst_pct(18%),bis_required boolean,fssai_noc_required boolean,plant_quarantine_required boolean,epr_required boolean, andverified boolean DEFAULT false(never auto-asserts statutory clearance until verified bycompliance_owner).
3.2 Card B: Two PO Views (Order Flow Commercial View vs Printable Bilingual Supplier View)
- View 1 — Internal Commercial & Tracker View (
Order Flow > PO Detail):- Displays internal Harley's financial & operational controls that are never printed on the supplier PDF: INR exposure at live/locked FX, tranche allocation status (
T1/T2/T3paid vs outstanding), linked RFQ comparison savings, production % and 24-point QC gate status, container reservation fill (H001..H###), and estimated vs actual landed cost per unit.
- Displays internal Harley's financial & operational controls that are never printed on the supplier PDF: INR exposure at live/locked FX, tranche allocation status (
- View 2 — Printable Bilingual Supplier PO View (
GET /api/po/versions/:id/preview& Frozen PDF):- Matches
reference/PO No 001.pdf(PO_FORMAT_NOTES.md): Harley's India Pvt Ltd letterhead (IEC, GSTIN, address), bilingualEN + 中文product & specification rows (Noto Sans SC+Public Sans), 16×16 mm square approved item photos (main+ extra views), FOB unit rate & total in supplier currency (CNY/USD), packaging block (pcs/carton,L×W×H cm,CBM per 40HQ), structured payment & free-storage terms, and SHA-256 package fingerprint.
- Matches
3.3 Card C: 3-Forwarder Quote Comparison Matrix (06_Shipment_Control Section B)
- Side-by-Side Normalized Comparison Table (
imports.freight_quotes+web/src/shipment/FreightCompare.jsx):- Compares 2–3 forwarders across the exact 10 rows of
06_Shipment_Control: (1) Ocean/Air Main Freight, (2) China Origin Charges, (3) Local Factory Pickup, (4) Documentation Fee, (5) India Destination Charges, (6) DO / CFS / Liner Charges, (7) Free Detention/Demurrage Days at Port, (8) Transit Time (Days), (9) Route / Transshipment Ports, and (10) Total All-In Landed Freight (INR). - Highlights the lowest all-in INR cost while flagging any quote with
< 10 Free Daysat Indian port (demurrage risk alert). Selection requiresE1approval (selected_by <> approved_by) and automatically generates afreight_selectionobligation in Fund Flow.
- Compares 2–3 forwarders across the exact 10 rows of
4. Master-App Convergence Architecture (IM-15 -> Consolidated :8000 OneOps/HOP Platform)
Per the Owner's ratified :8000 single-app architecture (22:57 IST) and docs/MASTER-APP-CONVERGENCE.md, Harley's Import Tracker (App 2B) converges into the OneOps/HOP Modular Monolith without losing a single database trigger or money control:
+--------------------------------------------------------------------------------------------------+
| HARLEY'S CONSOLIDATED :8000 PLATFORM (OneOps Front-End + HOP) |
| |
| +----------------------------+ +----------------------------+ +------------------------+ |
| | Shared-Object Spine | | imports.* Schema (App 2B) | | Downstream Consumers | |
| |----------------------------| |----------------------------| |------------------------| |
| | 1. hop.people (Google SSO) |--->| imports.users |--->| App 2: Cafe Projects | |
| | & Role Capabilities | | (master_person_id mirror | | (NSO BOQ CapEx Actuals)| |
| | | | + E1 grants_approval) | | | |
| | 2. s3_document_assets |<-->| imports.attachments |--->| App 3: Fixed Assets | |
| | (Immutable SHA-256 S3) | | & po_documents (Bilingual) | | (AST-#### QR & WDV) | |
| | | | | | | |
| | 3. accountability_nudges |<---| imports.actions & flags |--->| App 3.5: Audit Engine | |
| | ("Needs You" Inbox) | | (30-Step Control + Stuck) | | (T4 Container Unload) | |
| +----------------------------+ +----------------------------+ +------------------------+ |
+--------------------------------------------------------------------------------------------------+
4.1 Six Convergence Rules (CONV-1..CONV-6)
- Schema Isolation (
imports.*inside the:8000PostgreSQL Instance): All 38 Imports tables reside inCREATE SCHEMA imports;so table names (imports.users,imports.roles,imports.audit_log,imports.flags) never collide withpublicoraudit_private, while allowing atomic cross-schema read views for NSO CapEx and Fixed Assets. - Identity Mirror (
hop.people->imports.users.master_person_id): Users sign in once via@harleys.comGoogle OAuth (ASK-19). The adapter mapshop.people.idtoimports.userswhile keepinggrants_approvaland the 120bigintforeign keys +E1triggers (enforce_independent_approver) intact insideimports.*. - Money & Audit Controls Stay Rock-Solid (
E1–E7): Imports' transactionalwithAudit()(audit_log_no_update_delete) andE1–E7triggers remain mandatory for all PO, Tranche, Bank Version, BOE, and Landed Cost writes. - Unified
Needs YouInbox (accountability_nudges): The 30-step Import Control tasks,Needs your inputclarifications, Bank-Change holds (A09), and 7-day stuck-shipment nudges publish directly into the OneOps/HOPNeeds Youqueue (J14) and WhatsApp/PWA notification bus. - Automated NSO CapEx & Fixed Asset Commissioning Bridge (
G9 -> App 2 & App 3):- When an Import File (
IMP-CHN-YY-####) for café equipment or furniture reachesGRN Complete+Landed Cost Calculated, the Accounting Acquisition Cost (Ex-Recoverable GST) per unit (Final Cost Ex-GST / Qty) automatically populatescafe_project_boq_lines.actual_unit_cost_inrand creates draftfixed_assetsrecords (purchase_cost_inr,vendor_party_id,boe_number,warranty_valid_to, and printableAST-####QR codes).
- When an Import File (
- Automated
T4High-Value Container Unloading Audit (G9 -> App 3.5 Audit Engine):- Container arrival at the Hyderabad warehouse or NSO site (
shipment_milestones.arrival) fires an event intoaudit_trigger_events, scheduling a mandatory Container Seal & Blind Unloading Verification Mission (J21/AUD-3) with live anti-fraud camera challenge (CH-4).
- Container arrival at the Hyderabad warehouse or NSO site (
5. Peer-Review Hardening (Claude Opus 4.7 Max + Codex Astra Extra High)
We subjected this specification and the Harleys_China_Import_Operating_Pack_v1.xlsx + harleys-imports synthesis to adversarial review. Below are the 5 P0 edge cases identified and locked into the schema:
| Challenge ID | Adversarial Finding (Opus 4.7 Max + Astra Extra High) | Resolution Locked into imports.* Schema & J22 |
|---|---|---|
IMP-CH-1 | Multi-Line / Multi-Category Landed Cost Allocation (07_Receiving_Landed_Cost): The Excel sheet calculates landed cost for a single product line (B20:B47), but a consolidated container (H001) carries multiple PO lines with different CBM volumes (e.g., bulky acrylic boxes vs heavy steel ovens) and different HSN BCD duty rates (7.5% vs 10% vs 20%). | Line-Level Duty + Basis-Specific Shared Cost Allocation: boe_lines computes BCD, SWS, AIDC, ADD, and IGST per PO line / HSN code from that line's CIF value. Shared logistics costs (Ocean Freight, CFS/Liner/DO, CHA, Inland HYD Transport) are allocated across lines via cost_allocation_runs using CBM Volume (volume) for sea freight/CFS and Assessable Value (value) for insurance/CHA, with E7 verifying SUM(allocated_inr) == cost_item.inr_amount to the exact rupee. |
IMP-CH-2 | RBI IDPMS 180-Day Advance Remittance Knock-Off Trap (A15): Under FEMA / RBI IDPMS rules, an advance remittance (T1) to a foreign vendor must be knocked off against a valid Bill of Entry (BOE) within 180 days (or settled via refund/RBI extension), otherwise the AD Category-I bank places the importer (Harleys India Pvt Ltd) on the caution list. | Automated IDPMS Aging Clock & 120/150/170-Day Escalation: Added idpms_deadline_date GENERATED ALWAYS AS (value_date + INTERVAL '180 days') STORED on payment_executions. Any execution where SUM(remittance_boe_mappings.amount) + SUM(advance_settlements.amount) < remitted_amount triggers automated escalation nudges to Finance & CFO at T-60, T-30, and T-10 days before the 180-day RBI deadline, and blocks Compliance Closure (A15/A16). |
IMP-CH-3 | Intermediary / Agent Payment Triangle (REQUIREMENTS_REFINEMENT.md s1 & IM-13): When Harley's pays a China Sourcing Rep or Consolidator (party_type='china_rep') who then pays multiple small factories, a naive vendor ledger leaves the factory POs looking unpaid or the agent looking perpetually in advance. | Explicit Tri-Party Settlement Voucher (party_settlement_links): A remittance to a china_rep or forwarder posts to that agent's ledger and can be allocated to specific vendor PO tranches ONLY via an approved Tri-Party Settlement Advice (approved_by rank strictly above preparer per IM-13, with factory receipt proof attached), zeroing the PO tranche obligation while debiting the agent's parked-funds balance atomically (E2). |
IMP-CH-4 | Recoverable GST vs Capitalized Cost Split (B45 vs B46): For patisserie equipment and packaging, Import IGST (18%) and CHA/Transport Service GST (18%) are eligible for GST Input Tax Credit (ITC) on GSTR-2B / ICEGATE, EXCEPT for blocked-credit items under Section 17(5) of the CGST Act (e.g., certain civil/immovable site works). | Per-Line itc_eligible Flag on cost_type_policy & po_lines: Every PO line carries itc_eligible boolean NOT NULL DEFAULT true (overridable by Finance Checker for Sec 17(5) civil/interior items). When itc_eligible = true, Accounting Acquisition Cost = Final Cost (Incl GST) - Total GST; when false, GST is capitalized into the asset/BOQ cost. Both numbers reconcile transparently in v_cost_bridge. |
IMP-CH-5 | Free-Storage & Port Free-Days Demurrage Guard (PO_FORMAT_NOTES.md & 06_Shipment_Control): Vendors offer 3 months free warehouse storage in China, and shipping lines offer 7–14 free container detention days at Chennai/Nhava Sheva port, but no timer tracks when free days expire. | Dual Free-Day Countdown Timers: (1) production_batches.free_storage_expires_at (verified_ready_date + free_storage_months) alerts Imports 15 days before China storage fees begin; (2) shipments.port_free_days_expires_at (arrival_actual_at + free_days) pages CHA + Finance daily once a container lands in India until OOC and empty-container return are logged. |
IMP-CH-6 | Golden Rule #8 Negative-Evidence Enforcement (Opus 4.7 Max Finding #7): Saying "WeChat/WhatsApp are comms only" does not by itself detect when an operator advances a stage based on an unrecorded WeChat promise. | Hard Gate Evidence Foreign Keys on Every G0–G9 Transition: Every gate transition in src/shared/transitions.js (G1 spec freeze, G2 advance remittance, G4 QC pass, G5 final CI/PL, G6 6 loading photos, G8 BOE/OOC, G9 GRN/POD) enforces CHECK (evidence_attachment_id IS NOT NULL) against imports.attachments. A WeChat/WhatsApp agreement without an uploaded, SHA-256-hashed document or photo in the pack is structurally un-transitionable. |
6. Owner Decision & Sign-Off Block (IM-4 / IM-5 Question Card Digest)
| # | Decision Needed | Recommended Default (Applied if Approved) | Effect if Approved |
|---|---|---|---|
| D-IMP-1 | Document Check Tolerances (IM-08) | (Recommended) HS 6-digit prefix match + ±0.5% CBM/Weight tolerance | Auto-passes minor scale rounding (≤0.5%) between PO and Packing List while blocking HS tariff classification mismatches at the 6-digit chapter/heading level. |
| D-IMP-2 | Production QC Quantity Tolerance (IM-11) | (Recommended) Flag any shortfall at 100%; blank extra % = no flag | Every 1-unit shortfall against ordered PO qty raises a flag requiring disposition/PO adjustment before balance payment; over-delivery tolerance stays silent unless configured. |
| D-IMP-3 | 3-Dimension Closure Gate (A16 vs IM-04) | (Recommended) Hard Gate for Final Closure with CFO/Approver Override Note | Keeps Physical, Financial, and Compliance indicators visible; blocks routine closure when discrepancies/IDPMS remain open, but allows CFO/Approver to close with a mandatory audited exception note. |
| D-IMP-4 | Clearing Party (CHA) Change & Payee Mismatch (IM-11 / IM-13) | (Recommended) Approver + Finance Checker (strictly above Preparer) | Prevents unauthorized redirection of customs clearance or third-party agent remittances without senior maker-checker sign-off. |
| D-IMP-5 | Convergence Placement (IM-15) | (Recommended) imports.* schema inside consolidated :8000 OneOps/HOP | Unifies Google SSO (hop.people), Needs You inbox, and automated NSO CapEx / Fixed Asset capitalization while keeping all E1–E7 triggers isolated in imports.*. |

OneOps