kavachhttp + kavachpgx wrapping Blnk's unmodified Gin router and database.Datasource (0 memstore)
Inbound Blnk Gin HTTP route captured by kavachhttp.WrapWithOptions -> api.QueueTransaction.
Commits or voids an existing inflight hold synchronously via CommitInflightTransactionWithRef / VoidInflightTransactionWithRef.
Reverses an applied transaction synchronously via ProcessRefundsInBatches.
Inbound Blnk Gin HTTP route captured by kavachhttp.WrapWithOptions -> api.CreateBulkTransactions (atomic: true, skip_queue: true).
blnkfinance/blnk @ 064daa37b90e279f5b73957fc2239e0cd886db0c
Assigns batchID and drives synchronous atomic batch execution and rollback.
Splits multi-source/destination transfers and branches on SkipQueue before persisting.
Computes fixed, percentage, and 'left' distribution maps keyed by recipient identifier.
Checks totalPercentage <= 100 and fixedTotal <= totalAmount independently.
Assigns any totalAmount - sum(result) discrepancy onto the largest recipient leg.
Emits one leg per unique identifier and overwrites ParentTransaction with the split parent.
Executes real SQL GetRefundableTransactionsByParentID(batchID) via blnk.transactions.meta_data->>'QUEUED_PARENT_TRANSACTION'.
Real blnk.* SQL tables via database.Datasource + pg:exec, ledger:tx, and http:response sinks
Real upstream Blnk database.Datasource executing ACID SQL over blnk.{ledgers,balances,transactions,balance_monitors} wrapped by kavachpgx.WrapStatefulConnector.
Every committed SQL INSERT/UPDATE on blnk.{balances,transactions} captured at sql.Tx Commit() by kavachpgx.
Committed double-entry transaction writes observed from INSERT INTO blnk.transactions for declarative YAML invariants.
PII-scrubbed Blnk Gin HTTP responses captured by kavachhttp.WrapWithOptions.
4 YAML rules in .kavach/invariants.yaml + SQL double_entry_balances
Declarative YAML conservation rule: sum($.deltas[*]) == 0 on every ledger:tx commit.
Declarative YAML non_negative rule: $.precise_amount >= 0 on every ledger:tx commit.
Declarative YAML at_most_once_emit rule: unique $.reference across ledger:tx commits and duplicate redeliveries.
Declarative YAML anti_lobotomy rule: http:response, pg:exec, and ledger:tx output counts >= 100% of baseline.
Live SQL check on blnk.balances: sum(credit)==sum(debit), balance==credit-debit, inflight balance & non-negativity.
Split key overwrite, mixed >100% validation bypass, and bulk split rollback leak
Overwrites fixedAmounts[id], percentAmounts[id], or result[id] on repeat payee; balanceDistributions adds lost share to largest unrelated payee.
validateDistributions checks % <= 100 and fixed <= total separately, letting mixed splits >100% drive 'left' negative and over-debit.
SkipQueue: true omits QUEUED_PARENT_TRANSACTION=batchID while SplitTransactionPrecise overwrites ParentTransaction, so real SQL rollback finds 0 rows.
Runtime entities seen in fixtures or replays without a matching spec card
http:PUT /transactions/inflight/by-ref/auth-hotel-003 @ blnk-01-step-05
http:PUT /transactions/inflight/by-ref/auth-hotel-003 @ blnk-01-step-06
http:PUT /transactions/inflight/by-ref/auth-hotel-003 @ blnk-02-step-05
http:PUT /transactions/inflight/by-ref/auth-hotel-003 @ blnk-02-step-06
http:PUT /transactions/inflight/by-ref/auth-hotel-003 @ blnk-vault-step-05
http:PUT /transactions/inflight/by-ref/auth-hotel-003 @ blnk-vault-step-06
http:POST /refund-transaction/by-ref/pos-coffee-002 @ blnk-vault-step-09