Lockin-Breaker-Studio
EXACT DECIMAL ARITHMETIC · ZERO IEEE-754 FLOAT DRIFT

Decimal Currency Preservation During SaaS & Billing Migrations

Standard CSV-to-SQL scripts parse currency columns with float(), turning $19.99 into 19.989999999999998 and breaking ledger reconciliation by pennies across thousands of deals and invoices. Lockin-Breaker-Studio enforces strict Python decimal.Decimal parsing across every currency field, accounting negative, and European decimal format—then locks exact string-canonicalized values into SHA-256 parity proofs.

Float Precision Loss
0.0000
100% decimal.Decimal pipeline
Formats Normalized
US / EU / Acct
$1,250.50 · 1.250,50 EUR · ($49.00)
ISO-4217 Support
0 / 2 / 3 Dec
JPY (0), USD/EUR (2), KWD (3)
Ledger Audit Delta
$0.00
Exact bit-for-bit parity verification

3-Year TCO & Migration Economics Breakdown

Cost Component (36-Month Horizon) SaaS Lock-In Spend Self-Hosted + Studio Engineering Impact
Manual Finance Reconciliation of Cent Drift (50 hrs)$9,000.00$0.00Zero binary float coercion anywhere
Payment Gateway Webhook Rejection Debugging$4,800.00$0.00Exact integer minor-unit / NUMERIC output
Custom ETL Currency Normalizer Maintenance$7,200.00$0.00Built into stdlib Stage 2 compiler
Lockin-Breaker-Studio Single Escape Pack$0.00$149.00One-time flat fee · $0 on parity fail
Total Currency Integrity Cost$21,000.00$149.00Saves $20,851.00 (99.3%)

Export Failure Modes & Deterministic Remedies

SaaS Export Trap Why Standard Importers Fail Lockin-Breaker-Studio Deterministic Fix
IEEE-754 binary floating-point drift float("0.10") + float("0.20") produces 0.30000000000000004, causing 1-cent invoice and tax reconciliation failures. Parses monetary strings directly into Python decimal.Decimal without ever passing through binary float.
Accounting parenthesis negatives ($1,250.50) Standard numeric parsers reject parenthesized credits as strings, silently turning refunds into NULL or TEXT. Detects accounting parentheses deterministically and converts ($1,250.50) to exact Decimal("-1250.50").
European vs US decimal & thousands separators 1.250,50 (EUR) vs 1,250.50 (USD) invert by 100x when parsed with naive comma stripping. Inspects trailing separator width and column-level locale consistency before Decimal normalization.
Trailing zero stripping breaking SHA-256 hashes Serializing 19.00 as 19 causes false checksum mismatches between source CSV and target SQL. Canonicalizes Decimal values to fixed scale before computing per-row SHA-256 parity digests.

Exact Decimal Normalization & Canonical Parity Proof

# Input CSV values -> Exact Decimal Normalization -> Canonical SHA-256 Token
# "$1,250.50"  -> Decimal("1250.50")  -> SQL NUMERIC(18, 2) | hash token "dec:1250.50"
# "($49.00)"   -> Decimal("-49.00")   -> SQL NUMERIC(18, 2) | hash token "dec:-49.00"
# "1.250,50"   -> Decimal("1250.50")  -> SQL NUMERIC(18, 2) | hash token "dec:1250.50"
# "¥15,000"    -> Decimal("15000")    -> SQL NUMERIC(18, 0) | hash token "dec:15000" 

Step-by-Step Escape Workflow

  1. Detect Monetary Columns Automatically: Run POST /v1/escape/dry-run to identify currency prefixes, accounting negatives, and EU/US separators.
  2. Emit Exact NUMERIC DDL & Decimal JSONL: Call POST /v1/escape/migrate to write lossless NUMERIC/TEXT Decimal columns into SQLite and PostgreSQL DDL.
  3. Verify Canonical Decimal Parity: Execute POST /v1/escape/verify-parity to prove zero penny drift across every row.

Audit Currency Parsing via Stage 2 Dry-Run

curl -sS -X POST https://escape.fastmesh.dev/v1/escape/dry-run \
  -H "Content-Type: application/json" \
  -d '{
    "platform": "shopify",
    "table_name": "billing_ledger",
    "source_data": "invoice_id,currency,gross_amount,credit_memo\nINV-01,USD,"$1,250.50","($49.00)"\nINV-02,EUR,"€1.250,50","€0,00""
  }'

Every migration runs strictly in memory or ephemeral request-scoped storage (zero customer database retention, zero resale, zero model training). Any empty/corrupt export, dropped row, or 1-byte SHA-256 parity mismatch triggers atomic rollback with billable_usd: "0.00" and charge_micros: 0.

Frequently Asked Questions

How does SQLite store Decimal currency without float drift?

SQLite stores exact fixed-scale Decimal strings (or integer minor units) alongside NUMERIC affinity, avoiding REAL/float precision loss while remaining directly sortable and verifiable.

Does Stage 1 TCO calculation also use decimal.Decimal?

Yes. Every 3-year SaaS TCO calculation, monthly add-on total, and savings percentage is computed with exact Python decimal.Decimal.

What if a currency column contains an unparseable string like 'TBD'?

Dry-run surfaces the exact row index in mixed_type_conflicts[] instead of silently coercing it to 0.00.

Break Free in 5 Seconds — Zero Signup Required
Paste your export into the live Try-Now Studio or connect via POST /mcp. One-time flat-fee packs: $149 Single Escape · $399 Multi-App · $999 Enterprise Studio.