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.py → part_processor.process → contracts.match_invoices_with_contracts (~4k LOC in contracts.py).
Typical steps:
- Cleanup / partition by customer or subscription
- Merge job deltas with historical snapshot CSVs
- Build catalog + customers; explode invoices/CNs
- Expand subscription closure (reload related history)
- Match invoices to contract terms (including
merge_asofby date) - Emit internal order lines → OrderDetails sheet
- Emit BillingSchedule linked to those orders
- 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
- Webhook authenticates Hotglue job completion
- Sync job copies into tenant bucket
- Camunda process: convert → load staging → InferenceDriver + XL/DB sync drivers
- Sales-order style processing via Redis streams into warehouse
- Optional
acProcessingJobwhen AC enabled - 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 |