RevRec brainstorm · Appendix · Appendix · Current system quarry

Current system behavior (reference)

Not a spec for RevRec Next. Use to understand today’s path and what not to clone.

Sources: ~/work/other/E2E_ARCHITECTURE_INVENTORY.md, HOTGLUE_CHARGEBEE_TRANSFORM_LOGIC.md, WHAT_WE_ACTUALLY_NEED.md, revanu job paths.


1. End-to-end today

Chargebee
  → Hotglue tap (CSV sync-output)
  → Hotglue Python ETL
       ├─ RevRec: snapshots + match_invoices_with_contracts
       │         → OrderDetails, BillingSchedule, Product, Customer, …
       └─ AC:     reshape → AC_* files
  → webhook → revanu /hotglue_hook
  → S3 Original Input → Camunda NEW_SYNC_JOB
  → staging I_* / AC_I_* → drivers → Redis streams
  → warehouse / SO processing → aggregation → posting
  → SingleStore + MSTR (RevRec) / AC subledger

Catalyst / ERP connectors are not on this path.


2. What Hotglue RevRec transform does

Entry: chargebee/chargebee.pypart_processor.processcontracts.match_invoices_with_contracts (~4k LOC in contracts.py).

Typical steps:

  1. Cleanup / partition by customer or subscription
  2. Merge job deltas with historical snapshot CSVs
  3. Build catalog + customers; explode invoices/CNs
  4. Expand subscription closure (reload related history)
  5. Match invoices to contract terms (including merge_asof by date)
  6. Emit internal order lines → OrderDetails sheet
  7. Emit BillingSchedule linked to those orders
  8. Recon sheets; package xlsx/zip to S3

Config flags (e.g. disable_contract_creation) can skip OrderDetails manufacturing and lean on BillingSchedule — still not “dump CB JSON.”

Accounting Premium path skips the contract engine; mostly explode/rename → AC_*. Closer to default mapping.


3. What revanu does with those files

  1. Webhook authenticates Hotglue job completion
  2. Sync job copies into tenant bucket
  3. Camunda process: convert → load staging → InferenceDriver + XL/DB sync drivers
  4. Sales-order style processing via Redis streams into warehouse
  5. Optional acProcessingJob when AC enabled
  6. Aggregation / posting / reporting

Org-wide lock: one active processing job per org (fat tenants hurt everyone).
Governor: admits jobs by weight (row counts).


4. Conceptual mismatch vs ASC 606

ASC 606 idea Today’s stand-in
Contract / PO OrderDetails rows manufactured from billing+subs
Billing / consideration BillingSchedule (and AC_* invoices)
Recognize Downstream warehouse / close processing
Modification policy Branches inside contract ETL + later engine
Source facts Ephemeral CSVs + snapshots, not a clean event log

The product already separates OrderDetails (promises) vs BillingSchedule (invoiced). The Chargebee connector often invents the former from the latter.


5. What to steal vs leave

Steal (quarry) Leave behind
CN reason → accounting treatment ideas merge_asof as architecture
Fixture scenarios (ramps, CN retro, …) as ideas for golden tests Snapshot CSV SoR
Merchant config flags that encode real policy Camunda file spine
Entity list from tap-chargebee Org-wide job mutex
AC_* column meaning for AR fields Dual XL/DB as long-term design

6. Pointers

Doc Path
E2E inventory ~/work/other/E2E_ARCHITECTURE_INVENTORY.md
Transform logic ~/work/other/HOTGLUE_CHARGEBEE_TRANSFORM_LOGIC.md
Need vs Hotglue ~/work/other/WHAT_WE_ACTUALLY_NEED.md
Index README.md