This is the build plan for this decision record, bite by bite, as it was grilled and built. It’s copied from our repository unedited, apart from customer, partner and bank names, which read [redacted]. It was written for the people and agents building the product, so expect internal shorthand, and the mistakes are left in.
ADR-837 — Implementation Plan
Findings for the ADR
- F1 — the reader’s record is a supporting type the ADR never named.
## Contractssays the reader answers “amount, reserved, usage by account and frozen flag”; a signature needs a record for that.FacilityExposureSnapshotis declared under## Interfaces— a bag of fields, no decision. The ADR’s call to rename. - F2 — the three symbols need a resolver in Accounts. Decision 3 says “Accounts derives the
three symbols”; nothing names the type.
FacilitySymbols(a record of the three decimals) andFacilitySymbolResolver(reads the integration, calls the reader, computes) are declared below. Shape only. - F3 — the ADR-836 lane and this lane both edit the retail
AccountTypesSettings.yaml. ADR-836 addscardPurchase/cardRefundto the fundable types;CurrentAccount(D1) must carry them too. Whichever lands second adds the two entries toCurrentAccount. Landing note. - F4 — the GL legs are ruled (phase A): the debit accruals Dr a new Overdraft — accrued interest receivable (balance sheet), Cr Interest Income; the fee Dr the deposit liability, Cr a new Fee income — unarranged overdraft. Folded into Decision 7.
- F5 — Decision 1’s conformance test is struck (phase A Q4): the corporate and retail rows
never shared transaction names (
Deposit/CashDeposit,InterestCapitalized/InterestCapitalised), so “one shape” is positions and operations, asserted by nothing. The retail row speaks the retail library. Aholderrole row joins the retail vocabulary (Q1). - F6 — bites 2 and 3 swap (Q5): nothing but the guard can take a current account below zero before ADR-836 lands, so the symbols and the guards ship before the Limits usage reading, and the withdrawal is the act that draws the overdraft in every later scenario.
- F7 — the retail template wires the facility only (Q9): a wired credit limit refuses every payout into the overdraft for a customer who holds none. The direction exists on both integrations; the wire is a tenant’s choice. Folded into Decision 2.
- F8 —
Facility.SetUsagefloors an account’s usage at zero (Q6): a facility granted to an account already at −800 would otherwise read −800 used after the repaying deposit. Folded into Decision 2; a Limits domain change. - F9 —
OverdraftDtoships in bite 5 (Q19): bite 5’s scenario reads the excess, so the read model carries it; bite 6 is the viewer, the sample data, the guide and the register. - F10 — bites 4 and 5 wait for ADR-836 (Q20): the clearing post into an account is ADR-836’s. Land batches say so.
- F11 — the payout gate short-circuits on
delta <= 0(Q8):PayoutLimitCheck.DrawsOnAWiredPositionand bothEnsure*CarriesThePayoutchecks inPayoutLimitGateread “raise” as a positive delta, which a withdrawal never is. All three ask throughAskedwith the direction; a new scenario covers the refused payout.transfer-outcarries the availability guard only, so the gate is the refusal a tester sees (plan grill, point 9). - F12 — usage is set from the balance, not the delta (plan grill, point 6): under
BelowZerothe handler sends the position’s negative part as the account’s absolute usage and the facility works out the change against what it has recorded. A facility granted at −800 reads 800 at the next movement; a cancelled forward-dated debit’s phantom usage clears itself. F8’s floor is superseded. Decision 2 changed. - F13 —
Excessis computed live, not carried (point 2):FacilitySymbolscarriesFacilityLimitandFacilityAvailableonly; every context computesExcess = max(0, −Current − FacilityLimit)from the ledgerCurrentit binds, so the fee’s own posting moves it within the walk. - F14 — the reader takes the tenant (point 3):
ForAsynccarriestenantSlugasIArrearsReaderdoes, so a day-end step passes its session’s tenant and no untenanted session is opened at handler entry (ADR-302 D7). - F15 — a back-dated reversal takes the fee with it (point 4): revaluation re-walks the days and diffs every scheduled transaction, the fee included; “the fee stands” contradicted the platform’s value dating. Decision 7 changed; the scenario is rewritten.
- F16 — bites 4 and 5 start after ADR-836 lands (point 10): ADR-836 lands whole, so
AccountAvailability.FacilityAvailablemoves to bite 4 and the card integrations to bite 5. - F17 —
FacilitySymbolsis a required parameter of the guard context builder (point 11), as ADR-836’s reductions are; the two lanes rebase the same five callers, plusRegulatoryLimitEnforcementandProvisionRecomputeStep. - F18 — the rates are named rate types, and the day count is the calendar’s (phase B, bite 1;
corrected after bites 1, 2 and 5 each read it differently):
depositRateis a banded card by term and amount, which a current account has no term for, andAccountTypehas no day-count member. The current account accrues as the call deposit does —rate('Call', valueDate)reads a named rate type from the country × packageRateSettings.yamlcell — so credit interest readsCall, and two rate types join that cell:Overdraft(0.18) andUnarrangedOverdraft(0.28), in the za and gb retail cells. No rate property sits on the type; a negotiated per-account rate is a later ADR.daysInYear(valueDate)is the calendrical built-in the call deposit uses: the actual days in the year, 365 in the scenarios’ year. - F19 —
CurrentAccountcarries the call deposit’s required properties (bite 1):servicingUnit,taxReportingRegime(IT3(b) — a current account paying credit interest is reportable) andinterestPayment, besideregulatoryRegime. - F20 — the outbound recurring act is the standing order (bite 2): on this platform a debit
order is the bank collecting into the account (
ProcessDebitOrderPaymentCommandis inbound); a third-party collection presented against the account is whatstandingOrderruns. ThedebitOrderwire stays the call deposit’s (a credit);standingOrdernames a workflow that debitsCurrentunder the withdraw guard. The scenario is renamed. - F21 — bite 2 proves the day-walk (bite 2, R3): a day-end on an account at −1 000 with a 2 000 overdraft accrues arranged debit interest and no excess interest, on a non-default tenant, so the resolver’s tenant handover is proven before bite 5.
- F22 — the limit formula clamps and caps (bite 2):
FacilityLimit = min(Amount, max(0, Amount − Σ max(0, usage[other accounts]))), so a negative recorded usage on a sibling (possible until bite 3) never lifts this account’s limit above the facility. A joint account reads the owner’s facility only (OwnerCounterpartyId, as Limits keys it); the second holder’s overdraft never lends. - F23 — the asked allocation, the missing facility, the message, the owner change (bite 3):
asks land on the lines that cross zero, netting in order as
Raisenets; a payout past zero with no facility isFACILITY_REQUIRED_FOR_PAYOUTas today; the breach message names the dip (“needs 2 100 of overdraft, 2 000 available”), not the amount typed; an owner change of an account at −800 asks 800 of the new owner’s overdraft (ADR-794 D12 moves usage with the account). - F24 — a hold never reserves on the facility (bite 4): it is an external reduction on the
account (ADR-836); two cards on two accounts sharing one facility can both be held into it, a
consequence of D9. The guard bag binds
Currentafter claims and external reductions (ADR-836 reads them at every available-balance site), so the screen, the teller guard and the oracle read one figure; a parity scenario in bite 5 ties the three. - F25 — the account detail shows a frozen facility as frozen (bite 6):
OverdraftDtogainsFrozen;Limitis the facility’s amount even when frozen or shared (two accounts on one 2 000 facility each show 2 000),AvailableandExcessfollow the symbols (0 headroom, the whole draw in excess). The detail test moves to bite 5, where the DTO ships; bite 6’s own test is the viewer’s tiles. A wired type with no facility shows limit 0 and the balance as available; an unwired type shows no overdraft. - F26 — the revaluation seam excludes the closed day (bite 5):
PostTransactionandReverseTransactioncascadeRevalueAccountonly when the value date is strictly beforeLastProcessedDate, andExternalSourceDispatchernever cascades it. A line or reversal dated the day just closed re-walks nothing — which also breaks ADR-836’s “a live post is back-valued a day and accrues from it”. Bite 5 makes the boundary inclusive and cascades from the dispatcher; filed as F-1791 (P1, owned by this bite), and ADR-836’s lane is told through its chip. - F27 — paths corrected (bites 2, 3, 5, 6): the facility helper is
LedgerTM.Tests.Component/Limits/Facilities/FacilityTestHelper.cs;CurrentAccountExcessTestsneeds the cards context and sits underCards/; the detail route is/api/accounts/{id}/detail. - F28 — wording (bites 2, 5): the ADR’s Context said the availability guard refuses a
withdrawal — at execution it is the
guard; D7’s “no code knows the words” is softened to “no aggregate or handler branches on a product word”; the grill section’s “fee stands” bullet is superseded by F15.
Files touched
Bite 1 — contracts and configuration
src/LedgerTM.Contracts/Accounts/LimitIntegrations.cs—LimitDirectionenum;DirectiononFacilityIntegrationandCreditLimitIntegration(defaultRaise)src/LedgerTM.Accounts/Yaml/LimitIntegrationsYamlConverter.cs— reads and emitsdirection:(it throws on an unknown key today)LedgerTM.Tests.Architecture/ShapeGate/stored-shapes.tsv— theDirectionfield on the two stored shapes (default:Raise;Raise = 0)LedgerTM.Tests.Unit/Accounts/Yaml/LimitIntegrationsYamlTests.cs—directionround-trips;WriteYamlemits it only forBelowZerosrc/LedgerTM.Contracts/Limits/IFacilityAvailabilityReader.cs— new;IFacilityAvailabilityReader,FacilityExposureSnapshot(F1)src/LedgerTM.Contracts/Accounts/IAccountPayoutLimitGate.cs—PayoutLimitContext.PositionsBeforesrc/LedgerTM.Accounts/Application/Settings/LimitIntegrationsValidator.cs—BelowZeroonly on a declared position of aLiabilitytype; aBelowZerocredit-limit wire needs the facility wire beside itsrc/LedgerTM.Accounts/Application/Settings/ScriptSymbolValidator.cs—FacilityLimit,FacilityAvailable,Excessjoin the context variablessrc/LedgerTM.Accounts/Application/Operations/AccountGuardContextBuilder.cs— a requiredFacilitySymbolsparameter (F17); binds the two facility symbols and computesExcessfrom ledgerCurrent; every caller passesFacilitySymbols.Noneuntil bite 2src/LedgerTM.Accounts/Application/Limits/RegulatoryLimitEnforcement.cs,src/LedgerTM.Accounts/Application/DayEnd/ProvisionRecomputeStep.cs— passFacilitySymbols.None(F17)src/LedgerTM.Accounts/Domain/Valuation/AccountValuation.cs— aFacilitySymbolsconstructor value,Nonefrom every caller until bite 2;BuildContextbindsFacilityLimitand computesExcesssrc/LedgerTM.Seeding.Provisioning/tenant-templates/packages/retail-bank/AccountTypesSettings.yaml—CurrentAccountrow: positionsCurrent,Accrued,DebitAccrued; transaction types from the retail library plusDebitInterestAccrued,ExcessInterestAccrued,DebitInterestCapitalised,UnarrangedOverdraftFeeChargedwith sequence numbers andcostOfCreditCategoryon every one, no transaction-type guard on any; operationsreceive-deposit,cash-deposit,withdraw(the two guards,guardFailureMessage),transfer-out(availability guard only,limitCheck: true, payout), thestandingOrderworkflow debitingCurrentunder the withdrawguard(F20),close; scheduled transactions (D7); propertiesregulatoryRegime,servicingUnit,taxReportingRegime,interestPayment(F19);accountRoles: holder; the call deposit’s external integrations;limitIntegrations.facility { position: Current, facilityType: Overdraft, direction: BelowZero, activationCheck: false }src/LedgerTM.Seeding.Provisioning/tenant-templates/packages/retail-bank/AccountRoleTypesSettings.yaml—holderrowsrc/LedgerTM.Seeding.Provisioning/tenant-templates/packages/retail-bank/LookupTypesSettings.yaml—facility-typegainsOverdraftsrc/LedgerTM.Seeding.Provisioning/tenant-templates/countries/za/retail-bank/RateSettings.yaml,countries/gb/retail-bank/RateSettings.yaml— rate typesOverdraft(0.18) andUnarrangedOverdraft(0.28) besideCall(F18)src/LedgerTM.Seeding.Provisioning/tenant-templates/packages/retail-bank/PriceSettings.yaml—unarranged-overdraft-feeprice type and its price-list row (50)src/LedgerTM.Seeding.Provisioning/tenant-templates/packages/retail-bank/PostingSettings.yaml— two GL accounts (F4); aCurrentAccountposting group with a rule per transaction typesrc/LedgerTM.Seeding.Provisioning/tenant-templates/packages/retail-bank/AccountViewsSettings.yaml,BalanceGroupsSettings.yaml— the rows the other deposit types carry, forCurrentAccountLedgerTM.Tests.Component/Accounts/CurrentAccountTests.cs— new
Bite 2 — Accounts reads the facility
src/LedgerTM.Limits/Facilities/Application/Projections/FacilityReadModel.cs—UsageByAccount, maintained fromFacilityUsageSet(sign from the change inNewUtilisation); a projection rebuild in an environment we do not wipeLedgerTM.Tests.Architecture/ShapeGate/stored-shapes.tsv—FacilityReadModel.UsageByAccountsrc/LedgerTM.Limits/Facilities/Application/Queries/FacilityAvailabilityReader.cs— new; implementsIFacilityAvailabilityReaderfromFacilityReadModelsrc/LedgerTM.Limits/Bootstrapper.cs— registers the readersrc/LedgerTM.Accounts/Application/Operations/FacilitySymbolResolver.cs— new;FacilitySymbols,FacilitySymbolResolver(F2)src/LedgerTM.Accounts/Application/Operations/AccountGuardContextBuilder.cs— the callers pass the resolvedFacilitySymbolssrc/LedgerTM.Accounts/Application/Operations/OperationAvailabilityEndpoint.cs,OperationInterpreter.cs,ApplyAccountOperation.cs— resolve the symbols before building the contextsrc/LedgerTM.Accounts/Application/Commands/ProcessExternalSourcePaymentHandlers.cs—ExternalSourceDispatcherresolves the symbols for the operation’sguard(the debit-order scenario coversBuildEvaluationContext, uncovered today)src/LedgerTM.Accounts/Application/Workflows/WorkflowInterpreter.cs—RefreshAggregateStatekeeps the two facility symbols and recomputesExcesssrc/LedgerTM.Accounts/Application/Commands/OpenTradingDay.cs,ProcessDayEnd.cs,ProcessToDate.cs,RevalueAccount.cs,ForecastAccount.cs,Services/InstalmentRecalculator.cs— resolve the symbols once per account, with the session’s tenant, and pass themsrc/LedgerTM.Accounts/Bootstrapper.cs— registers the resolverLedgerTM.Tests.Component/Limits/Facilities/FacilityTestHelper.cs,LedgerTM.Tests.Unit/Limits/Facilities/FacilityTestHelper.cs—Overdraftlookup value;SeedFacilityAsynctakes the owner (F27)LedgerTM.Tests.Component/Accounts/CurrentAccountOverdraftTests.cs— new; a standing order through the dispatcher and a day-end on a non-default tenant are among its scenarios (F20, F21)
Bite 3 — Limits reads below zero
src/LedgerTM.Limits/LimitExposure.cs—Asked(lines, position, direction, balanceBefore); the two-argument overload goes, its three callers followsrc/LedgerTM.Limits/Facilities/Domain/Facility.cs—SetUsageTo(account, utilisation, …): the account’s absolute usage, the change worked out against what is recorded, emitted asFacilityUsageSet(F12)src/LedgerTM.Limits/Facilities/Application/Commands/SetFacilityUsage.cs—SetFacilityUsageCommand.AbsoluteUtilisation(nullable); the handler callsSetUsageTowhen it is setsrc/LedgerTM.Limits/Application/Subscribers/UpdateLimitsOnPositionChanged.cs— underBelowZerosendsmax(0, −NewBalance)as the account’s absolute usage (D2 table), both wiressrc/LedgerTM.Limits/Application/Subscribers/PayoutLimitGate.cs,LimitsActivationGate.cs,OwnerChangeLimitGate.cs— pass the direction andPositionsBeforetoAsked; bothEnsure*CarriesThePayoutchecks ask throughAsked(F11)src/LedgerTM.Accounts/Application/Operations/PayoutLimitCheck.cs,Commands/ActivateAccount.cs— supplyPositionsBefore;DrawsOnAWiredPositionreads the direction (F11)LedgerTM.Tests.Unit/Limits/LimitExposureTests.cs— below-zeroAskedcases (net growth across the lines, allocated in order);SetUsageToagainst recorded usageLedgerTM.Tests.Component/Limits/OverdraftFacilityUsageTests.cs— new
Bite 4 — the oracle’s available
src/LedgerTM.Contracts/Accounts/IAccountAvailabilityReader.cs—AccountAvailability.FacilityAvailable(ADR-836’s file, landed; F16)src/LedgerTM.Accounts/Application/Queries/AccountAvailabilityReader.cs— addsFacilityAvailabletoAvailable(ADR-836’s file, landed)LedgerTM.Tests.Component/Cards/CardsComponentFixture.cs— aCurrentAccounttype from the composed template, a card type that admits it, a current account and an overdraft for the demo customerLedgerTM.Tests.Component/Cards/CardAuthorisationOverdraftTests.cs— new
Bite 5 — the post past the limit, priced and shown
src/LedgerTM.Seeding.Provisioning/tenant-templates/packages/retail-bank/AccountTypesSettings.yaml—cardPurchase/cardRefundonCurrentAccount(F3)src/LedgerTM.Accounts/Application/Queries/GetAccountDetail.cs—AccountDetailDto.Overdraft(OverdraftDto:Limit,Available,Excess) for a type wiredBelowZero(F9)src/LedgerTM.Accounts/Application/Commands/PostTransaction.cs,ReverseTransactionCommandHandler.cs— the revaluation cascade fires for a value date on or beforeLastProcessedDate(F26)src/LedgerTM.Accounts/Application/Commands/ProcessExternalSourcePaymentHandlers.cs— a back-dated external posting cascadesRevalueAccountas a posted transaction does (F26)LedgerTM.Tests.Component/Cards/CurrentAccountExcessTests.cs— new; the clearing post past the limit, day-end pricing, the unhappy paths including the back-dated reversal through revaluation, the parity of the three available figures, GL legs on the composed template (F27)LedgerTM.Tests.Component/Accounts/CurrentAccountViewerTests.cs— new; the detail’s overdraft figures (F25)
Bite 6 — the viewer, the sample data, the guide, the probe, the register
src/ui-apps/shared/src/generated/api-types.ts— regeneratedsrc/ui-apps/bank/src/features/accounts/generic/generic-account-viewer.tsx— the overdraft tiles in the hero slot: limit, available including overdraft, in excess bysrc/LedgerTM.Seeding.ZaRetail.Samples/Steps/SampleData/SeedSampleAccountsAndLimits.cs— the demo customer’s ZARCurrentAccount(opening 4 200) andOverdraftfacility 2 000src/LedgerTM.Seeding.ZaRetail.Samples/Steps/SampleData/SeedSampleCards.cs— funding rule current, then call depositsrc/LedgerTM.Seeding.Provisioning/tenant-templates/packages/retail-bank/CardTypesSettings.yaml—CurrentAccountjoins the fundable typessrc/ui-apps/bank/ui-review/adr-uat/flows/adr-837-server-probe.ts— newdocs/guide/features/current-accounts-and-overdrafts.md— new;docs/guide/features/facilities.md— theOverdrafttype and below-zero usagedocs/standards/README.md— NCA §8(3) row (D8); ADR frontmatterstandards:in the same commitsrc/ui-apps/bank/src/__tests__/generic-account-viewer.overdraft.test.tsx— new; the tiles render from a fixture detail (F25)
Prior art
Nothing changed since the grill. Supporting types the signatures needed — FacilityExposureSnapshot
(F1), FacilitySymbols / FacilitySymbolResolver (F2), OverdraftDto (D11) — carry no decision;
PayoutLimitContext gains PositionsBefore (an extension of an ADR-760 type) and FacilityReadModel
gains UsageByAccount (an ADR-050 read model). All are in the ADR’s table through the names they serve.
Interfaces
// src/LedgerTM.Contracts/Accounts/LimitIntegrations.cs — changed (D2)
public enum LimitDirection { Raise, BelowZero }
public sealed class CreditLimitIntegration { public string Position { get; init; } = ""; public bool ActivationCheck { get; init; } public LimitDirection Direction { get; init; } = LimitDirection.Raise; }
public sealed class FacilityIntegration { public string Position { get; init; } = ""; public LookupValueId FacilityTypeId { get; init; } public bool ActivationCheck { get; init; } public LimitDirection Direction { get; init; } = LimitDirection.Raise; }
// Validator (load time): BelowZero needs a declared position on a Liability-nature type; a BelowZero credit-limit wire needs a facility wire too.
// src/LedgerTM.Contracts/Limits/IFacilityAvailabilityReader.cs — new (D3); Limits implements, Accounts reads
public sealed record FacilityExposureSnapshot(decimal Amount, decimal Reserved, bool IsFrozen, IReadOnlyDictionary<AccountId, decimal> UsageByAccount); // F1; no FacilityId — it lives in Limits, and Accounts needs none
public interface IFacilityAvailabilityReader
{
Task<FacilityExposureSnapshot?> ForAsync(CounterpartyId counterparty, CurrencyId currency, LookupValueId facilityType, string tenantSlug, CancellationToken ct = default); // null: none granted; tenantSlug as IArrearsReader (F14)
}
// src/LedgerTM.Contracts/Accounts/IAccountAvailabilityReader.cs — changed (D4; ADR-836's type; bite 4, after ADR-836 lands)
public sealed record AccountAvailability(AccountId Account, CurrencyId Currency, decimal Available, decimal Ledger, decimal Claims, decimal ExternalReductions, decimal FacilityAvailable);
// Available = max(0, Ledger − Claims − ExternalReductions + FacilityAvailable); FacilityAvailable is the D3 account symbol (own usage added back). A card hold is an ExternalReduction (ADR-836).
// src/LedgerTM.Contracts/Accounts/IAccountPayoutLimitGate.cs — changed (bite 1 declares, bite 3 reads)
public sealed record PayoutLimitContext(AccountId AccountId, CounterpartyId OwnerCounterpartyId, CurrencyId CurrencyId, LimitIntegrations Integrations,
IReadOnlyDictionary<string, decimal> PositionDeltas, IReadOnlyList<ExposureLine> Lines, IReadOnlyDictionary<string, decimal> PositionsBefore);
// src/LedgerTM.Limits/LimitExposure.cs — changed (D2); the two-argument overload is removed
public static IReadOnlyList<(TransactionId TransactionId, decimal Amount)> Asked(IEnumerable<ExposureLine> lines, string position, LimitDirection direction, decimal balanceBefore);
// Raise: as today. BelowZero: the asked total is max(0, −after all lines) − max(0, −balanceBefore); the balance and every credit net against the lowering lines in order, so the ask lands on the lines that cross zero (F23): from 500, −300/−400/−600 ask 0/200/600.
// src/LedgerTM.Limits/Facilities/Domain/Facility.cs — changed (D2, F12)
public void SetUsageTo(AccountId accountId, decimal utilisation, DateOnly tradingDate, TransactionId? sourceTransactionId = null);
// Emits FacilityUsageSet with TransactionAmount = |utilisation − recorded for the account| and NewUtilisation = Utilisation + that change; nothing when equal; dedups on the source id as SetUsage does.
// src/LedgerTM.Limits/Facilities/Application/Commands/SetFacilityUsage.cs — SetFacilityUsageCommand gains decimal? AbsoluteUtilisation; set → SetUsageTo, else SetUsage as today.
// src/LedgerTM.Limits/Facilities/Application/Projections/FacilityReadModel.cs — changed: public Dictionary<AccountId, decimal> UsageByAccount (from FacilityUsageSet; sign = NewUtilisation − previous)
// src/LedgerTM.Accounts/Application/Operations/FacilitySymbolResolver.cs — new (D3, F2)
public sealed record FacilitySymbols(decimal FacilityLimit, decimal FacilityAvailable) { public static readonly FacilitySymbols None = new(0m, 0m); } // F13: Excess is computed where Current is bound
public sealed class FacilitySymbolResolver(IFacilityAvailabilityReader reader)
{
public Task<FacilitySymbols> ForAsync(Account account, AccountType accountType, string tenantSlug, CancellationToken ct = default);
// No BelowZero facility wire, no facility, or frozen → None. Else:
// FacilityLimit = min(Amount, max(0, Amount − Σ max(0, UsageByAccount[other accounts]))) (F22; the owner's facility only)
// FacilityAvailable = max(0, FacilityLimit − Reserved) (every reservation on the facility, at rest)
// Every context binds Excess = max(0, −ledger Current − FacilityLimit) and recomputes it after each posting in a walk.
// Evaluated before an operation's own reservation, so a payout never counts against itself.
}
// src/LedgerTM.Accounts/Application/Operations/AccountGuardContextBuilder.cs — changed: Build(..., FacilitySymbols facility) — required (F17); bite 1's callers pass None, bite 2's the resolved value
// src/LedgerTM.Accounts/Domain/Valuation/AccountValuation.cs — changed: ctor gains FacilitySymbols facility (caller-resolved, ADR-329 D6 shape); BuildContext binds FacilityLimit and computes Excess from the ledger Current it binds
// src/LedgerTM.Accounts/Application/Settings/ScriptSymbolValidator.cs — changed: the three names join ContextVariables
// src/LedgerTM.Accounts/Application/Queries/GetAccountDetail.cs — changed (D11, F9; bite 5)
public record OverdraftDto(decimal Limit, decimal Available, decimal Excess, bool Frozen); // computed at read time; Limit = the facility's amount (frozen included); Available = max(0, Current + FacilityAvailable), Current as the guard bag binds it (after claims and external reductions); Excess from the ledger Current
// AccountDetailDto gains OverdraftDto? Overdraft — null when the type has no BelowZero wire; wired with no facility: Limit 0, Available = the balance floored, Excess as computed, Frozen false
// Configuration (D1, D7) — src/LedgerTM.Seeding.Provisioning/tenant-templates/packages/retail-bank/AccountTypesSettings.yaml, CurrentAccount:
// nature: Liability; accountRoles: holder (min 1, servicing); positionTypes: Current, Accrued, DebitAccrued
// transactionTypes (every one with costOfCreditCategory, none with a guard): CashDeposit, CashWithdrawal, TransferIn, TransferOut,
// InterestAccrued (Cr Accrued, maximumPrecision), InterestCapitalised (Dr Accrued, Cr Current),
// DebitInterestAccrued (Dr DebitAccrued, maximumPrecision, sequenceNumber 1), ExcessInterestAccrued (Dr DebitAccrued, maximumPrecision, sequenceNumber 2),
// DebitInterestCapitalised (Cr DebitAccrued, Dr Current), UnarrangedOverdraftFeeCharged (Dr Current, sequenceNumber 9); CardPurchase, CardRefund arrive in bite 5 (F3, F16)
// operations: withdraw → a teller cash withdrawal: one `amount` input, one postTransaction CashWithdrawal step, no payout, no destination;
// availabilityGuard: Current + FacilityAvailable > 0; guard: Current + FacilityAvailable >= $amount;
// guardFailureMessage: 'Insufficient funds: the withdrawal exceeds the balance and the overdraft available.' (refused as OPERATION_GUARD_FAILED, as every operation guard is)
// transfer-out → availabilityGuard only (the facility gate refuses at execution, ADR-794 D10), limitCheck: true, a payout step
// the standingOrder workflow → debits Current under guard: Current + FacilityAvailable >= $amount (honoured into the overdraft, refused past it: WORKFLOW_GUARD_FAILED); debitOrder stays the call deposit's inbound credit (F20)
// scheduledTransactions: Decision 7's table, all EndOfDay; capitalisations monthly StartOfDay with conditionExpression Accrued > 0 / DebitAccrued < 0 and amount Accrued / 0 - DebitAccrued
// properties: regulatoryRegime (Lookup, required), servicingUnit, taxReportingRegime, interestPayment — as the call deposit; no rate properties (F18)
// rates: rate('Call', valueDate) for credit interest, rate('Overdraft', valueDate), rate('UnarrangedOverdraft', valueDate) — named rate types in the country × package RateSettings cell; daysInYear(valueDate) is the calendrical built-in
// limitIntegrations: facility { position: Current, facilityType: Overdraft, direction: BelowZero, activationCheck: false }
// The sign of DebitAccrued follows the liability nature: a Debit operation drives it negative; a test reads −0.99 on the position for 0.99 of debit interest.
Bite 6 — no contracts of its own. The sample data uses GrantFacilityCommand and the
account-creation command unchanged; the viewer reads OverdraftDto.
Bites
| Bite | Description | Acceptance criterion | Status |
|---|---|---|---|
| 1 | Contracts and configuration: LimitDirection on both integrations and its YAML, IFacilityAvailabilityReader, AccountAvailability.FacilityAvailable, PayoutLimitContext.PositionsBefore; the three symbols bound to zero; the Overdraft lookup value and the holder role; CurrentAccount on the retail template with positions, transaction types, operations, scheduled transactions, properties, rates, prices and GL |
a current account opens and pays out within its balance; the current account type is classified and its postings are unguarded | Pending |
| 2 | Accounts reads the facility: the reader in Limits and its read model’s usage by account, the symbol resolver, the three symbols in the guard bag and the day-walk, the withdraw guards | a withdrawal into the arranged overdraft; a withdrawal past the limit is refused; no facility declines at zero; a standing order is honoured into the overdraft and refused past it; an overdrawn account may draw the rest of its overdraft and no further; a frozen overdraft declines a withdrawal at zero; a facility that is not the customer’s overdraft in the account’s currency lends nothing; a sibling account in overdraft never lifts this account’s limit above the facility; day-end prices an arranged overdraft with no excess | Pending |
| 3 | Limits reads below zero: usage set from the balance, the asked amount for the gates, the payout gate’s direction | the facility shows the overdraft drawn; repaying releases it; a transfer out past the facility is refused; a transfer out that dips into the overdraft asks only for the dip; money moving above zero never touches the facility; a facility granted to an overdrawn account reads its usage at the next movement; two accounts on one overdraft each set only their own share; a transfer past zero without an overdraft is refused | Shrunk |
| 4 | The oracle: facility available in AccountAvailability; the funding walk approves into the overdraft |
a tap is approved against the overdraft | Pending |
| 5 | The post past the limit; excess interest, debit interest and the daily fee at day-end; the revaluation seam includes the closed day; GL; the overdraft on the account detail | a clearing line past the limit posts and shows the excess; day-end prices the overdraft and the excess; with no facility the whole shortfall is excess; a frozen facility makes the whole draw excess; a back-dated reversal takes the fee with it; the account detail carries the overdraft figures; the screen, the guard and the oracle read one available | Pending |
| 6 | The account viewer’s overdraft tiles; sample data and the probe; the guide article; the standards row | an operator sees the overdraft on the account; the probe prints the scenario ids; the guide article passes the guide tests | Pending |
Scenarios
Feature: a current account with an overdraft funds a card and prices what the card draws
# Bite 1
Scenario: a current account opens and pays out within its balance
Given a retail tenant whose template declares a current account type
And a customer opens a current account with 4 200 in it
When a clerk withdraws 1 000
Then the account's current balance is 3 200
# Seen at: route:/accounts/{id}
# Bite 1
Scenario: the current account type is classified and its postings are unguarded
Given a retail tenant whose template declares a current account type
When the template is read
Then the type asks for a regulatory regime on every account
And every transaction type on it carries a cost-of-credit category
And no transaction type on it carries a posting guard
# Seen at: none
# Bite 2
Scenario: a withdrawal into the arranged overdraft
Given a current account holding 500 whose customer holds an overdraft facility of 2 000
When a clerk withdraws 1 500
Then the withdrawal posts and the current balance is -1 000
# Seen at: route:/accounts/{id}
# Bite 2
Scenario: a withdrawal past the limit is refused
Given a current account holding 500 whose customer holds an overdraft facility of 2 000
When a clerk tries to withdraw 2 600
Then the withdrawal is refused with the insufficient-funds message the type configures
And the current balance is still 500
# Seen at: route:/accounts/{id}
# Bite 2
Scenario: no facility declines at zero
Given a current account holding 500 whose customer holds no overdraft facility
When a clerk withdraws 500 and then tries to withdraw 1
Then the second withdrawal is refused
And the withdraw action reads as unavailable with the reason the type configures
# Seen at: route:/accounts/{id}
# Bite 2
Scenario: a standing order is honoured into the overdraft and refused past it
Given a current account holding 500 whose customer holds an overdraft facility of 2 000
When a standing order of 1 500 runs and then a standing order of 1 100
Then the first posts and the current balance is -1 000
And the second is refused and the current balance is still -1 000
# Seen at: route:/accounts/{id}
# Bite 2
Scenario: an overdrawn account may draw the rest of its overdraft and no further
Given a current account holding 500 whose customer holds an overdraft facility of 2 000
When a clerk withdraws 1 500 and then 1 000
Then both post and the current balance is -2 000
And the withdraw action reads as unavailable with the reason the type configures
And a withdrawal of 0.01 is refused
# Seen at: route:/accounts/{id}
# Bite 2
Scenario: a frozen overdraft declines a withdrawal at zero
Given a current account holding 500 whose customer's overdraft facility of 2 000 is frozen
When a clerk tries to withdraw 600
Then the withdrawal is refused and the current balance is still 500
# Seen at: route:/accounts/{id}
# Bite 2
Scenario Outline: a facility that is not the customer's overdraft in the account's currency lends nothing
Given a current account holding 500 and a 2 000 facility <facility>
When a clerk tries to withdraw 600
Then the withdrawal is refused and the current balance is still 500
# Seen at: route:/accounts/{id}
Examples:
| facility |
| in another currency |
| of another type |
| held by another customer |
| held by the account's second holder |
# Bite 2
Scenario: a sibling account in overdraft never lifts this account's limit above the facility
Given two current accounts of one customer on one overdraft facility of 2 000, the second drawn to -1 500
When a clerk tries to withdraw 2 600 from the first, holding 500
Then the withdrawal is refused and the current balance is still 500
# Seen at: route:/accounts/{id}
# Bite 2
Scenario: day-end prices an arranged overdraft with no excess
Given a current account at -1 000 whose customer holds an overdraft facility of 2 000, on a tenant that is not the default
When day-end runs for one day
Then debit interest accrues on 1 000 at the overdraft rate
And no excess interest and no excess fee are charged
# Seen at: route:/accounts/{id}
# Bite 3
Scenario: the facility shows the overdraft drawn
Given a customer with a current account holding 4 200 and an overdraft facility of 2 000
When a clerk withdraws 5 000
Then the current balance is -800
And the facility shows 800 used and 1 200 available
# Seen at: panel:facilities
# Bite 3
Scenario: repaying releases it
Given a current account at -800 whose overdraft facility shows 800 used
When a deposit of 1 000 posts
Then the facility shows nothing used and 2 000 available
# Seen at: panel:facilities
# Bite 3
Scenario: a transfer out past the facility is refused
Given a current account holding 500 whose customer holds an overdraft facility of 2 000
When a clerk transfers 2 600 out to an external account
Then the transfer is refused as a facility breach naming the 2 100 of overdraft it needed
And the facility shows nothing reserved and nothing used
# Seen at: panel:facilities
# Bite 3
Scenario: a transfer out that dips into the overdraft asks only for the dip
Given a current account holding 4 200 whose customer holds an overdraft facility of 2 000
When a clerk transfers 5 000 out to the customer's own account
Then the transfer posts and the current balance is -800
And the facility shows 800 used, nothing reserved and 1 200 available
# Seen at: panel:facilities
# Bite 3
Scenario: money moving above zero never touches the facility
Given a customer whose overdraft facility of 2 000 is granted before any money moves
When a deposit of 4 200 posts and a clerk withdraws 1 000
Then the facility shows nothing used and records no usage change
# Seen at: panel:facilities
# Bite 3
Scenario: a facility granted to an overdrawn account reads its usage at the next movement
Given a current account already at -800 when its overdraft facility of 2 000 is granted
When a deposit of 100 posts
Then the facility shows 700 used and 1 300 available
# Seen at: panel:facilities
# Bite 3
Scenario: two accounts on one overdraft each set only their own share
Given two current accounts of one customer at -800 and -500 on one overdraft facility of 2 000
When a deposit of 1 000 posts to the first
Then the facility shows 500 used
# Seen at: panel:facilities
# Bite 3
Scenario: a transfer past zero without an overdraft is refused
Given a current account holding 500 whose customer holds no overdraft facility
When a clerk transfers 600 out
Then the transfer is refused as a missing facility and the balance is still 500
# Seen at: route:/accounts/{id}
# Bite 4
Scenario: a tap is approved against the overdraft
Given a card funded first from a current account holding 4 200 whose customer holds an overdraft facility of 2 000
When a merchant asks to authorise 5 000
Then the authorisation is approved
And a hold of 5 000 sits on the card against the current account
And the current account's available reads 1 200
# Seen at: route:/cards/{id}
# Bite 5
Scenario: a clearing line past the limit posts and shows the excess
Given a current account at -800 whose customer holds an overdraft facility of 2 000
When a card clearing line of 2 300 with no matching authorisation is posted at day-end
Then the purchase posts and the current balance is -3 100
And the facility shows 3 100 used and nothing available
And the account shows an excess of 1 100
# Seen at: route:/accounts/{id}
# Bite 5
Scenario: day-end prices the overdraft and the excess
Given a current account at -3 100 with an overdraft facility of 2 000, an overdraft rate of 18%, an unarranged rate of 28% and a daily excess fee of 50
When day-end runs for one day
Then debit interest of 0.99 to the cent accrues on the arranged 2 000
And excess interest of 0.84 to the cent accrues on the 1 100 excess
And a fee of 50 posts to the current balance after the interest
And no credit interest accrues
# Seen at: route:/accounts/{id}
# Bite 5
Scenario: with no facility the whole shortfall is excess
Given a current account holding 500 whose customer holds no overdraft facility
When a card clearing line of 1 500 with no matching authorisation is posted at day-end
Then the purchase posts and the current balance is -1 000
And the account shows an excess of 1 000
And the next day-end accrues excess interest on 1 000 and no arranged debit interest
# Seen at: route:/accounts/{id}
# Bite 5
Scenario: a frozen facility makes the whole draw excess
Given a current account at -800 whose customer holds an overdraft facility of 2 000
When the facility is frozen
Then the account shows an excess of 800 and a frozen limit of 2 000
And the next day-end accrues excess interest on 800, no arranged debit interest, and the excess fee
# Seen at: route:/accounts/{id}
# Bite 5
Scenario: a back-dated reversal takes the fee with it
Given a current account that was in excess at day-end and was charged the daily fee
When the purchase that caused the excess is reversed with that day's value date, the day after it closed
Then the account is revalued and the fee is reversed with the excess that caused it
And the interest accrued on the excess is reversed too
# Seen at: route:/accounts/{id}
# Bite 5
Scenario: the account detail carries the overdraft figures
Given a current account at -3 150 whose customer holds an overdraft facility of 2 000
When the account's detail is read
Then it carries an overdraft limit of 2 000, nothing available and an excess of 1 150
And a current account whose customer holds no facility carries a limit of zero and its balance as available
And a call deposit carries no overdraft figures at all
# Seen at: route:/accounts/{id}
# Bite 5
Scenario: the screen, the guard and the oracle read one available
Given a card funded from a current account holding 4 200 whose customer holds an overdraft facility of 2 000
And a merchant's authorisation of 5 000 holds against the account
When the account's detail, its withdraw action and the card's funding walk are each asked what is available
Then every one of them answers 1 200
# Seen at: route:/accounts/{id}
# Bite 6
Scenario: an operator sees the overdraft on the account
Given a current account at -3 150 whose customer holds an overdraft facility of 2 000
When an operator opens the account
Then the header shows an overdraft limit of 2 000, nothing available and an excess of 1 150
# Seen at: route:/accounts/{id}
Scenario → test
| Scenario | Bite | Project | Class | Method | Probe |
|---|---|---|---|---|---|
| a current account opens and pays out within its balance | 1 | LedgerTM.Tests.Component |
CurrentAccountTests |
a_current_account_opens_and_pays_out_within_its_balance |
adr-837-server-probe.ts |
| the current account type is classified and its postings are unguarded | 1 | LedgerTM.Tests.Component |
CurrentAccountTests |
the_type_is_classified_and_its_postings_are_unguarded |
— configuration |
| a withdrawal into the arranged overdraft | 2 | LedgerTM.Tests.Component |
CurrentAccountOverdraftTests |
a_withdrawal_into_the_arranged_overdraft_posts |
adr-837-server-probe.ts |
| a withdrawal past the limit is refused | 2 | LedgerTM.Tests.Component |
CurrentAccountOverdraftTests |
a_withdrawal_past_the_limit_is_refused |
— refusal, shares the row above |
| a standing order is honoured into the overdraft and refused past it | 2 | LedgerTM.Tests.Component |
CurrentAccountOverdraftTests |
a_standing_order_is_honoured_into_the_overdraft_and_refused_past_it |
— |
| an overdrawn account may draw the rest of its overdraft and no further | 2 | LedgerTM.Tests.Component |
CurrentAccountOverdraftTests |
an_overdrawn_account_may_draw_the_rest_of_its_overdraft_and_no_further |
— |
| a frozen overdraft declines a withdrawal at zero | 2 | LedgerTM.Tests.Component |
CurrentAccountOverdraftTests |
a_frozen_overdraft_declines_a_withdrawal_at_zero |
— |
| day-end prices an arranged overdraft with no excess | 2 | LedgerTM.Tests.Component |
CurrentAccountOverdraftTests |
day_end_prices_an_arranged_overdraft_with_no_excess |
— |
| a facility that is not the customer’s overdraft … — “in another currency” | 2 | LedgerTM.Tests.Component |
CurrentAccountOverdraftTests |
a_facility_that_is_not_the_customers_overdraft_in_the_accounts_currency_lends_nothing |
— refusal |
| a facility that is not the customer’s overdraft … — “of another type” | 2 | LedgerTM.Tests.Component |
CurrentAccountOverdraftTests |
the same [Theory] |
— refusal |
| a facility that is not the customer’s overdraft … — “held by another customer” | 2 | LedgerTM.Tests.Component |
CurrentAccountOverdraftTests |
the same [Theory] |
— refusal |
| a facility that is not the customer’s overdraft … — “held by the account’s second holder” | 2 | LedgerTM.Tests.Component |
CurrentAccountOverdraftTests |
the same [Theory] |
— refusal |
| a sibling account in overdraft never lifts this account’s limit above the facility | 2 | LedgerTM.Tests.Component |
CurrentAccountOverdraftTests |
a_sibling_account_in_overdraft_never_lifts_this_accounts_limit_above_the_facility |
— refusal |
| no facility declines at zero | 2 | LedgerTM.Tests.Component |
CurrentAccountOverdraftTests |
without_a_facility_a_withdrawal_declines_at_zero |
— refusal |
| the facility shows the overdraft drawn | 3 | LedgerTM.Tests.Component |
OverdraftFacilityUsageTests |
a_balance_below_zero_is_facility_usage |
adr-837-server-probe.ts |
| repaying releases it | 3 | LedgerTM.Tests.Component |
OverdraftFacilityUsageTests |
a_deposit_that_returns_the_balance_above_zero_releases_the_usage |
adr-837-server-probe.ts |
| a transfer out past the facility is refused | 3 | LedgerTM.Tests.Component |
OverdraftFacilityUsageTests |
a_transfer_out_past_the_facility_is_refused_and_reserves_nothing |
— refusal |
| a transfer out that dips into the overdraft asks only for the dip | 3 | LedgerTM.Tests.Component |
OverdraftFacilityUsageTests |
a_transfer_out_that_dips_into_the_facility_asks_only_for_the_dip |
— |
| money moving above zero never touches the facility | 3 | LedgerTM.Tests.Component |
OverdraftFacilityUsageTests |
money_moving_above_zero_never_touches_the_facility |
— |
| a facility granted to an overdrawn account reads its usage at the next movement | 3 | LedgerTM.Tests.Component |
OverdraftFacilityUsageTests |
a_facility_granted_to_an_overdrawn_account_reads_its_usage_at_the_next_movement |
— |
| two accounts on one overdraft each set only their own share | 3 | LedgerTM.Tests.Component |
OverdraftFacilityUsageTests |
two_accounts_on_one_overdraft_each_set_only_their_own_share |
— |
| a transfer past zero without an overdraft is refused | 3 | LedgerTM.Tests.Component |
OverdraftFacilityUsageTests |
a_transfer_out_past_zero_without_a_facility_is_refused |
— refusal |
| below-zero asked — net growth across the lines, allocated in order | 3 | LedgerTM.Tests.Unit |
LimitExposureTests |
a_below_zero_wire_asks_for_the_growth_of_the_negative_part |
— unit |
| usage set from the balance — the D2 table, a late grant, a phantom cleared | 3 | LedgerTM.Tests.Unit |
LimitExposureTests |
setting_usage_to_the_balance_corrects_what_is_recorded |
— unit |
| a tap is approved against the overdraft | 4 | LedgerTM.Tests.Component |
CardAuthorisationOverdraftTests |
a_tap_is_approved_against_the_overdraft |
adr-837-server-probe.ts |
| a clearing line past the limit posts and shows the excess | 5 | LedgerTM.Tests.Component |
CurrentAccountExcessTests |
a_clearing_line_past_the_limit_posts_and_shows_the_excess |
adr-837-server-probe.ts |
| day-end prices the overdraft and the excess | 5 | LedgerTM.Tests.Component |
CurrentAccountExcessTests |
day_end_prices_the_arranged_overdraft_and_the_excess |
adr-837-server-probe.ts |
| with no facility the whole shortfall is excess | 5 | LedgerTM.Tests.Component |
CurrentAccountExcessTests |
without_a_facility_the_whole_shortfall_is_excess |
— |
| a frozen facility makes the whole draw excess | 5 | LedgerTM.Tests.Component |
CurrentAccountExcessTests |
a_frozen_facility_makes_the_whole_draw_excess |
— |
| a back-dated reversal takes the fee with it | 5 | LedgerTM.Tests.Component |
CurrentAccountExcessTests |
a_back_dated_reversal_takes_the_fee_with_it |
— |
| the account detail carries the overdraft figures | 5 | LedgerTM.Tests.Component |
CurrentAccountViewerTests |
the_account_detail_carries_the_overdraft_figures |
adr-837-server-probe.ts |
| the screen, the guard and the oracle read one available | 5 | LedgerTM.Tests.Component |
CurrentAccountExcessTests |
the_screen_the_guard_and_the_oracle_read_one_available |
adr-837-server-probe.ts |
| an operator sees the overdraft on the account | 6 | src/ui-apps/bank (vitest) |
generic-account-viewer.overdraft.test.tsx |
renders the overdraft tiles from the detail |
adr-837-server-probe.ts |
UI-surface sweep
Swept src/ui-apps/bank/src for limitIntegrations, facilityType, CurrentAccount,
CorporateCurrentAccount, HeldExternally, PositionDto, availabilityGuard, requiresFacility:
src/ui-apps/bank/src/lib/api.ts:1658,1673—facilityTypeIdon the facility DTOs; unchanged (one more lookup value)src/ui-apps/bank/src/lib/api.ts:7421,7464—AccountDetailDto.positions,PositionDto;AccountDetailDtogainsoverdraft(regenerated)src/ui-apps/bank/src/features/accounts/generic/generic-account-viewer.tsx:131-165— the hero positions slot; gains the overdraft tiles (bite 6)src/ui-apps/bank/src/features/accounts/generic/panels/details-panel.tsx:1060— renders positions by declared type;DebitAccruedrenders as an accrual position with no changesrc/ui-apps/bank/src/features/counterparties/persons/panels/person-facilities-panel.tsx:30-79— names the facility type from the lookup;Overdraftappears with no changesrc/ui-apps/bank/src/hooks/use-config-demanded-features.ts:42—requiresFacilityisActivationCheck;CurrentAccountsets it false, so the facilities feature is demanded by the loan types as today- No permission or feature key changes: no new command, query or endpoint.
permissions.generated.tsis untouched. - No settings-UI form edits
limitIntegrationstoday;directionis YAML-only until the account-types settings page grows a limits section.
Changed during the plan grill
Phase A (27 questions) and the plan grill (14 press points) ran 2026-10-02; the operator’s standing
instruction was to take the recommendations. F5–F17 record what moved: bites 2 and 3 swapped; the
retail template wires the facility only; usage is set from the balance, not added by delta, and the
usage floor is superseded; Excess is computed live where Current is bound; the reader carries the
tenant; FacilitySymbols is a required parameter; a back-dated reversal takes the fee with it;
transfer-out carries the availability guard only; bites 4 and 5 start after ADR-836 lands; six
files the signatures reach joined ## Files touched (ProcessDayEnd, RevalueAccount,
ForecastAccount, RegulatoryLimitEnforcement, ProvisionRecomputeStep, LimitIntegrationsYamlTests).
Held: the symbols’ names, the two-field reader snapshot, the sequence-number ordering (verified at
AccountValuation.cs:313), the six-project footprint.
Phase B (six authors, 2026-10-02): F18–F28. The day count moves to the rate rows; the current
account carries the call deposit’s required properties; the outbound act is the standing order;
bite 2 proves the day-walk on a non-default tenant; the limit formula clamps and caps; asks land
on the lines that cross zero; a hold never reserves on the facility and the three available
figures are tied by a parity scenario; OverdraftDto gains Frozen and the detail test moves to
bite 5; the revaluation seam gains the closed day and the dispatcher cascade (a finding against
ADR-836); sixteen scenarios the authors wrote as unhappy paths join bites 2, 3 and 5. The rates
are named rate types in the country × package cell, not properties (F18, corrected twice).
Footprint
Feature projects touched: 6 — LedgerTM.Accounts, LedgerTM.Contracts, LedgerTM.Limits, LedgerTM.Seeding.Provisioning, LedgerTM.Seeding.ZaRetail.Samples, ui-apps
LedgerTM.Accounts— 17 changed, 0 newLedgerTM.Contracts— 4 changed, 0 newLedgerTM.Limits— 8 changed, 0 newLedgerTM.Seeding.Provisioning— 8 changed, 0 newLedgerTM.Seeding.ZaRetail.Samples— 2 changed, 0 newui-apps— 4 changed, 0 new Files: 77 named, 57 code, 10 config
Contracts types: 22 named, 15 changed by this ADR
AccountTypeId— fan-in 23, referenced (LedgerTM.Accounts, LedgerTM.Audit, LedgerTM.BankStatements, LedgerTM.Books, LedgerTM.Cards, LedgerTM.Collections, LedgerTM.Contracts, LedgerTM.DocumentTemplates, LedgerTM.Operations, LedgerTM.Payments, LedgerTM.Pricing, LedgerTM.[redacted], LedgerTM.Regulatory, LedgerTM.Seeding.Corporate.Samples, LedgerTM.Seeding.Provisioning, LedgerTM.Seeding.[redacted].Conversion, LedgerTM.Seeding.[redacted].Samples, LedgerTM.Seeding.ZaRetail.Samples, LedgerTM.Statements, LedgerTM.Suspense, LedgerTM.Warehouse, _creditplus, ui-apps)LookupValueId— fan-in 15, referenced (LedgerTM.Accounts, LedgerTM.Authorisation, LedgerTM.Contracts, LedgerTM.Correspondence, LedgerTM.DocumentTemplates, LedgerTM.Identifications, LedgerTM.Limits, LedgerTM.Lookups, LedgerTM.[redacted], LedgerTM.Seeding.Provisioning, LedgerTM.Seeding.[redacted].Conversion, LedgerTM.Seeding.[redacted].Samples, LedgerTM.Seeding.ZaRetail.Samples, LedgerTM.Structures, ui-apps)Facility— fan-in 6, changed (LedgerTM.Accounts, LedgerTM.Compliance, LedgerTM.Contracts, LedgerTM.Limits, LedgerTM.Seeding.Provisioning, ui-apps)GrantFacilityCommand— fan-in 4, referenced (LedgerTM.Hosting, LedgerTM.Limits, LedgerTM.Seeding.ZaRetail.Samples, ui-apps)PositionChangedTrigger— fan-in 4, referenced (LedgerTM.Accounts, LedgerTM.Collections, LedgerTM.Contracts, LedgerTM.Limits)ExposureLine— fan-in 3, referenced (LedgerTM.Accounts, LedgerTM.Contracts, LedgerTM.Limits)FacilityIntegration— fan-in 3, changed (LedgerTM.Accounts, LedgerTM.Contracts, LedgerTM.Limits)IAccountPayoutLimitGate— fan-in 3, changed (LedgerTM.Accounts, LedgerTM.Contracts, LedgerTM.Limits)ILimitIntegrationResolver— fan-in 3, referenced (LedgerTM.Accounts, LedgerTM.Contracts, LedgerTM.Limits)PayoutLimitContext— fan-in 3, changed (LedgerTM.Accounts, LedgerTM.Contracts, LedgerTM.Limits)CreditLimitIntegration— fan-in 2, changed (LedgerTM.Accounts, LedgerTM.Contracts)FacilityReadModel— fan-in 2, changed (LedgerTM.Limits, ui-apps)FacilityUsageSet— fan-in 2, referenced (LedgerTM.Hosting, LedgerTM.Limits)LimitIntegrations— fan-in 2, changed (LedgerTM.Accounts, LedgerTM.Contracts)SetFacilityUsageCommand— fan-in 1, changed (LedgerTM.Limits)AccountAvailability— fan-in 0, changedFacilityExposureSnapshot— fan-in 0, changedFacilitySymbolResolver— fan-in 0, changedFacilitySymbols— fan-in 0, changedIFacilityAvailabilityReader— fan-in 0, changedLimitDirection— fan-in 0, changedOverdraftDto— fan-in 0, changed
Files reading each changed type: 15 types
AccountAvailability— 0 filesCreditLimitIntegration— 4 filesLedgerTM.Tests.Unit/Accounts/OperationLimitCheckValidatorTests.csLedgerTM.Tests.Unit/Infrastructure/Features/FeatureDemandGuardTests.cssrc/LedgerTM.Accounts/Yaml/LimitIntegrationsYamlConverter.cssrc/LedgerTM.Contracts/Accounts/LimitIntegrations.cs
Facility— 78 filesLedgerTM.Testing.Builders/DocumentTemplatesTestSeeding.csLedgerTM.Testing.Infrastructure/AppFixture.csLedgerTM.Testing.Infrastructure/Stubs/AccountServiceStubs.csLedgerTM.Tests.Architecture/ReviewabilityTests.ReaderRegistrations.csLedgerTM.Tests.Architecture/ShapeGate/stored-shapes.tsvLedgerTM.Tests.Component/Accounts/AccountListStructureReferenceTests.csLedgerTM.Tests.Component/Authorisation/ApproverEffectTests.csLedgerTM.Tests.Component/Authorisation/FacilityApplierRolloutTests.csLedgerTM.Tests.Component/Authorisation/NoEnvironmentBypassTests.csLedgerTM.Tests.Component/Authorisation/RecordedChangeAtomicityTests.csLedgerTM.Tests.Component/Authorisation/RootlessCaptureTests.csLedgerTM.Tests.Component/Authorisation/Tier1ReaderTests.csLedgerTM.Tests.Component/Authorisation/ZeroQuorumTests.csLedgerTM.Tests.Component/Infrastructure/InfraAggregateEventsQueryTests.csLedgerTM.Tests.Component/Limits/Facilities/DecreaseFacilityTests.csLedgerTM.Tests.Component/Limits/Facilities/FacilityTestHelper.csLedgerTM.Tests.Component/Limits/Facilities/FreezeFacilityTests.csLedgerTM.Tests.Component/Limits/Facilities/GrantFacilityTests.csLedgerTM.Tests.Component/Limits/Facilities/IncreaseFacilityTests.csLedgerTM.Tests.Component/Limits/Facilities/SetFacilityUsageTests.csLedgerTM.Tests.Component/Limits/Facilities/UnfreezeFacilityTests.csLedgerTM.Tests.Component/Limits/FacilityActivationLimitTests.csLedgerTM.Tests.Component/Limits/OwnerChangeLimitTests.csLedgerTM.Tests.Unit/Accounts/LimitIntegrationsValidatorTests.csLedgerTM.Tests.Unit/Accounts/OperationLimitCheckValidatorTests.csLedgerTM.Tests.Unit/Accounts/Yaml/LimitIntegrationsYamlTests.csLedgerTM.Tests.Unit/Authorisation/ApproverViewFieldsTests.csLedgerTM.Tests.Unit/Infrastructure/Features/FeatureDemandGuardTests.csLedgerTM.Tests.Unit/Limits/Facilities/FacilityTestHelper.csLedgerTM.Tests.Unit/Limits/LimitExposureTests.csLedgerTM.Tests.Unit/Tasks/RateResetTaskTests.csLedgerTM.Tests/Integration.AccountLifecycle/CallDepositLifecycleFixture.csLedgerTM.Tests/Integration.AccountLifecycle/PersonalLoanActivationLimitsFixture.csLedgerTM.Tests/Integration.AccountLifecycle/PersonalLoanActivationLimitsTests.csLedgerTM.Tests/Integration.AccountLifecycle/PersonalLoanLifecycleFixture.csLedgerTM.Tests/Seeding/CountersignPostureTests.cssrc/LedgerTM.Accounts/Application/Commands/ActivateAccount.cssrc/LedgerTM.Accounts/Application/Features/LimitDemandProbes.cssrc/LedgerTM.Accounts/Application/Operations/PayoutLimitCheck.cssrc/LedgerTM.Accounts/Application/Settings/GetAccountTypes.cssrc/LedgerTM.Accounts/Application/Settings/LimitIntegrationsValidator.cssrc/LedgerTM.Accounts/Yaml/LimitIntegrationsYamlConverter.cssrc/LedgerTM.Compliance/SuspicionReports/Domain/SuspicionReportId.cssrc/LedgerTM.Contracts/Accounts/IAccountOwnerChangeLimitGate.cssrc/LedgerTM.Contracts/Accounts/LimitIntegrations.cssrc/LedgerTM.Limits/Application/LimitsWolverineConfiguration.cssrc/LedgerTM.Limits/Application/Queries/GetAccountLimitUsage.cssrc/LedgerTM.Limits/Application/Subscribers/LimitsActivationGate.cssrc/LedgerTM.Limits/Application/Subscribers/MoveLimitUsageOnOwnerChangeHandler.cssrc/LedgerTM.Limits/Application/Subscribers/OwnerChangeLimitGate.cssrc/LedgerTM.Limits/Application/Subscribers/PayoutLimitGate.cssrc/LedgerTM.Limits/Application/Subscribers/ReleaseLimitReservationsOnCancelHandler.cssrc/LedgerTM.Limits/Application/Subscribers/UpdateLimitsOnPositionChanged.cssrc/LedgerTM.Limits/Bootstrapper.cssrc/LedgerTM.Limits/Facilities/Application/Commands/AssumeFacilityReservation.cssrc/LedgerTM.Limits/Facilities/Application/Commands/DecreaseFacility.cssrc/LedgerTM.Limits/Facilities/Application/Commands/FreezeFacility.cssrc/LedgerTM.Limits/Facilities/Application/Commands/GrantFacility.cssrc/LedgerTM.Limits/Facilities/Application/Commands/IncreaseFacility.cssrc/LedgerTM.Limits/Facilities/Application/Commands/ReleaseFacilityReservation.cssrc/LedgerTM.Limits/Facilities/Application/Commands/SetFacilityUsage.cssrc/LedgerTM.Limits/Facilities/Application/Commands/UnfreezeFacility.cssrc/LedgerTM.Limits/Facilities/Application/EventLabels/FacilityEventLabelResolver.cssrc/LedgerTM.Limits/Facilities/Application/FacilityMembershipResolver.cssrc/LedgerTM.Limits/Facilities/Domain/Facility.Exceptions.cssrc/LedgerTM.Limits/Facilities/Domain/Facility.cssrc/LedgerTM.Seeding.Provisioning/tenant-templates/packages/investment-house/LookupTypesSettings.yamlsrc/LedgerTM.Seeding.Provisioning/tenant-templates/packages/microlender/LookupTypesSettings.yamlsrc/LedgerTM.Seeding.Provisioning/tenant-templates/packages/personal-lender/LookupTypesSettings.yamlsrc/LedgerTM.Seeding.Provisioning/tenant-templates/packages/retail-bank/LookupTypesSettings.yamlsrc/ui-apps/bank/src/__tests__/features/counterparties/persons/panels/person-facilities-panel.test.tsxsrc/ui-apps/bank/src/components/charts/utilisation-trend-chart.tsxsrc/ui-apps/bank/src/features/counterparties/persons/panels/person-facilities-panel.tsxsrc/ui-apps/bank/src/features/counterparties/shared/dialogs/change-facility-amount-dialog.tsxsrc/ui-apps/bank/src/features/counterparties/shared/dialogs/freeze-facility-dialog.tsxsrc/ui-apps/bank/src/features/counterparties/shared/dialogs/grant-facility-dialog.tsxsrc/ui-apps/bank/src/features/counterparties/shared/dialogs/unfreeze-facility-dialog.tsxsrc/ui-apps/bank/src/lib/api.ts
FacilityExposureSnapshot— 0 filesFacilityIntegration— 8 filesLedgerTM.Tests.Unit/Accounts/OperationLimitCheckValidatorTests.csLedgerTM.Tests.Unit/Infrastructure/Features/FeatureDemandGuardTests.cssrc/LedgerTM.Accounts/Yaml/LimitIntegrationsYamlConverter.cssrc/LedgerTM.Contracts/Accounts/LimitIntegrations.cssrc/LedgerTM.Limits/Application/Subscribers/LimitsActivationGate.cssrc/LedgerTM.Limits/Application/Subscribers/MoveLimitUsageOnOwnerChangeHandler.cssrc/LedgerTM.Limits/Application/Subscribers/OwnerChangeLimitGate.cssrc/LedgerTM.Limits/Application/Subscribers/PayoutLimitGate.cs
FacilityReadModel— 48 filesLedgerTM.Tests.Architecture/ShapeGate/stored-shapes.tsvLedgerTM.Tests.Architecture/StreamApplierGuardParityTests.Criterion.csLedgerTM.Tests.Component/Authorisation/CrossAggregateChangeSetOracleTests.csLedgerTM.Tests.Component/Authorisation/FacilityApplierRolloutTests.csLedgerTM.Tests.Component/Authorisation/NoEnvironmentBypassTests.csLedgerTM.Tests.Component/Authorisation/RootlessCaptureTests.Bite18.csLedgerTM.Tests.Component/Authorisation/RootlessCaptureTests.csLedgerTM.Tests.Component/Infrastructure/InfraAggregateEventsQueryTests.csLedgerTM.Tests.Component/Limits/ConfigDemandedLimitCaptureTests.csLedgerTM.Tests.Component/Limits/Facilities/DecreaseFacilityTests.csLedgerTM.Tests.Component/Limits/Facilities/FreezeFacilityTests.csLedgerTM.Tests.Component/Limits/Facilities/GrantFacilityTests.csLedgerTM.Tests.Component/Limits/Facilities/IncreaseFacilityTests.csLedgerTM.Tests.Component/Limits/Facilities/SetFacilityUsageTests.csLedgerTM.Tests.Component/Limits/Facilities/UnfreezeFacilityTests.csLedgerTM.Tests.Component/Limits/FacilityActivationLimitTests.csLedgerTM.Tests.Component/Limits/FacilityReadModelRefreshTests.csLedgerTM.Tests.Component/Limits/LimitReservationCommandTests.csLedgerTM.Tests.Component/Limits/LimitReservationReleaseTests.csLedgerTM.Tests.Component/Limits/OwnerChangeLimitTests.csLedgerTM.Tests.Component/Limits/PayoutLimitApprovalTests.csLedgerTM.Tests.Component/Limits/PayoutLimitGateTests.Reservations.csLedgerTM.Tests.Component/Limits/PayoutLimitGateTests.csLedgerTM.Tests.Component/Seeding/ZaRetailSamplesTests.csLedgerTM.Tests/Integration.AccountLifecycle/PersonalLoanActivationLimitsTests.csLedgerTM.Tests/Seeding/CountersignPostureTests.cssrc/LedgerTM.Limits/Application/Queries/GetAccountLimitUsage.cssrc/LedgerTM.Limits/Application/Subscribers/LimitsActivationGate.cssrc/LedgerTM.Limits/Application/Subscribers/MoveLimitUsageOnOwnerChangeHandler.cssrc/LedgerTM.Limits/Application/Subscribers/OwnerChangeLimitGate.cssrc/LedgerTM.Limits/Application/Subscribers/PayoutLimitGate.cssrc/LedgerTM.Limits/Application/Subscribers/ReleaseLimitReservationsOnCancelHandler.cssrc/LedgerTM.Limits/Application/Subscribers/UpdateLimitsOnPositionChanged.cssrc/LedgerTM.Limits/Bootstrapper.cssrc/LedgerTM.Limits/Facilities/Application/Commands/DecreaseFacility.cssrc/LedgerTM.Limits/Facilities/Application/Commands/FreezeFacility.cssrc/LedgerTM.Limits/Facilities/Application/Commands/GrantFacility.cssrc/LedgerTM.Limits/Facilities/Application/Commands/IncreaseFacility.cssrc/LedgerTM.Limits/Facilities/Application/Commands/UnfreezeFacility.cssrc/LedgerTM.Limits/Facilities/Application/EventLabels/FacilityEventLabelResolver.cssrc/LedgerTM.Limits/Facilities/Application/EventLabels/FacilityRelatedStreamProvider.cssrc/LedgerTM.Limits/Facilities/Application/FacilityMembershipResolver.cssrc/LedgerTM.Limits/Facilities/Application/Projections/FacilityReadModel.cssrc/LedgerTM.Limits/Facilities/Application/Projections/FacilityReadModelHandler.cssrc/LedgerTM.Limits/Facilities/Application/Queries/FacilityCheck.cssrc/LedgerTM.Limits/Facilities/Application/Queries/ListFacilitiesForContact.cssrc/ui-apps/bank/src/__tests__/features/counterparties/persons/panels/person-facilities-panel.test.tsxsrc/ui-apps/bank/src/lib/api.ts
FacilitySymbolResolver— 0 filesFacilitySymbols— 0 filesIAccountPayoutLimitGate— 14 filesLedgerTM.Tests.Component/Accounts/Operations/AccountOperationApplierParityTests.csLedgerTM.Tests.Component/Accounts/Operations/SandboxBatchCommitTests.csLedgerTM.Tests.Component/Limits/PayoutLimitGateTests.csLedgerTM.Tests.Component/Limits/PayoutLimitRequestTests.csLedgerTM.Tests/Integration.CreditPlus/Application/Features/InvestFromInternalAccountTests.cssrc/LedgerTM.Accounts/Application/Operations/AccountOperationResolver.cssrc/LedgerTM.Accounts/Application/Operations/ApplyAccountOperation.cssrc/LedgerTM.Accounts/Application/Operations/ExecuteOperationEndpoint.cssrc/LedgerTM.Accounts/Application/Operations/ExecuteOperationHandler.cssrc/LedgerTM.Accounts/Application/Operations/PayoutLimitCheck.cssrc/LedgerTM.Accounts/Application/Operations/SandboxPreview.cssrc/LedgerTM.Contracts/Accounts/IAccountPayoutLimitGate.cssrc/LedgerTM.Limits/Application/Subscribers/PayoutLimitGate.cssrc/LedgerTM.Limits/Bootstrapper.cs
IFacilityAvailabilityReader— 0 filesLimitDirection— 0 filesLimitIntegrations— 21 filesLedgerTM.Tests.Architecture/ShapeGate/stored-shapes.tsvLedgerTM.Tests.Component/Limits/PayoutLimitGateTests.csLedgerTM.Tests.Unit/Accounts/LimitIntegrationsValidatorTests.csLedgerTM.Tests.Unit/Accounts/OperationLimitCheckValidatorTests.csLedgerTM.Tests.Unit/Accounts/Yaml/LimitIntegrationsYamlTests.csLedgerTM.Tests.Unit/Infrastructure/Features/FeatureDemandGuardTests.cssrc/LedgerTM.Accounts/Application/Commands/ActivateAccount.cssrc/LedgerTM.Accounts/Application/Features/LimitDemandProbes.cssrc/LedgerTM.Accounts/Application/LimitIntegrationResolver.cssrc/LedgerTM.Accounts/Application/Operations/PayoutLimitCheck.cssrc/LedgerTM.Accounts/Application/Settings/GetAccountTypes.cssrc/LedgerTM.Accounts/Application/Settings/LimitIntegrationsValidator.cssrc/LedgerTM.Accounts/Application/Settings/OperationLimitCheckValidator.cssrc/LedgerTM.Accounts/Domain/Configuration/AccountType.cssrc/LedgerTM.Accounts/LedgerTM.Accounts.csprojsrc/LedgerTM.Accounts/Yaml/LimitIntegrationsYamlConverter.cssrc/LedgerTM.Contracts/Accounts/IAccountActivationLimitGate.cssrc/LedgerTM.Contracts/Accounts/IAccountOwnerChangeLimitGate.cssrc/LedgerTM.Contracts/Accounts/IAccountPayoutLimitGate.cssrc/LedgerTM.Contracts/Accounts/LimitIntegrations.cssrc/LedgerTM.Contracts/Limits/ILimitIntegrationResolver.cs
OverdraftDto— 0 filesPayoutLimitContext— 7 filesLedgerTM.Tests.Component/Limits/PayoutLimitApprovalTests.csLedgerTM.Tests.Component/Limits/PayoutLimitGateTests.Reservations.cssrc/LedgerTM.Accounts/Application/Operations/AccountOperationResolver.cssrc/LedgerTM.Accounts/Application/Operations/ApplyAccountOperation.cssrc/LedgerTM.Accounts/Application/Operations/PayoutLimitCheck.cssrc/LedgerTM.Contracts/Accounts/IAccountPayoutLimitGate.cssrc/LedgerTM.Limits/Application/Subscribers/PayoutLimitGate.cs
SetFacilityUsageCommand— 11 filesLedgerTM.Tests.Architecture/MessageRoutingCatalogTests.csLedgerTM.Tests.Component/Limits/Facilities/ListFacilitiesForContactTests.csLedgerTM.Tests.Component/Limits/Facilities/SetFacilityUsageTests.csLedgerTM.Tests.Component/Limits/Facilities/UnfreezeFacilityTests.csLedgerTM.Tests.WorkerHost/SequentialQueueRoutingDiagnosticTests.csLedgerTM.Tests/Integration.AccountLifecycle/PersonalLoanActivationLimitsTests.csLedgerTM.Tests/Integration/Hosts/ApiHostTaxRoutingDiagnosticTests.cssrc/LedgerTM.Limits/Application/LimitsWolverineConfiguration.cssrc/LedgerTM.Limits/Application/Subscribers/MoveLimitUsageOnOwnerChangeHandler.cssrc/LedgerTM.Limits/Application/Subscribers/UpdateLimitsOnPositionChanged.cssrc/LedgerTM.Limits/Facilities/Application/Commands/SetFacilityUsage.csImplementations of changed types: 6
Facility— 4:FacilityDecreaseExceedsAmountException(src/LedgerTM.Limits/Facilities/Domain/Facility.Exceptions.cs),FacilityExistsException(src/LedgerTM.Limits/Facilities/Domain/Facility.Exceptions.cs),InsufficientFacilityException(src/LedgerTM.Limits/Facilities/Domain/Facility.Exceptions.cs),NoFacilityException(src/LedgerTM.Limits/Facilities/Domain/Facility.Exceptions.cs)IAccountPayoutLimitGate— 1:PayoutLimitGate(src/LedgerTM.Limits/Application/Subscribers/PayoutLimitGate.cs)SetFacilityUsageCommand— 1:SetFacilityUsageCommandValidator(src/LedgerTM.Limits/Facilities/Application/Commands/SetFacilityUsage.cs) Files reading a touched file by path: 6BalanceGroupsSettings.yaml—LedgerTM.Tests.Component/Accounts/Balance/MicroloanArrearsEndToEndTests.cs,LedgerTM.Tests.Unit/Accounts/ArrearsPositionResolverTests.cs,LedgerTM.Tests.Unit/Accounts/BalanceGroupRoleValidatorTests.cs,LedgerTM.Tests.Unit/Regulatory/DepositInsuranceConfigurationTests.cs,LedgerTM.Tests.Unit/Seeding/preset-snapshots.txt,src/LedgerTM.Seeding.Provisioning/PackageExporter.cs,src/LedgerTM.Seeding.Provisioning/PackageImporter.csForecastAccount.cs—src/_creditplus/docs/superpowers/plans/2026-03-18-ui-phase2-account-config-counterparties.mdProcessDayEnd.cs—src/LedgerTM.Accounts/Application/Commands/ProcessToDate.cs,src/_creditplus/docs/archive/options/option-1/architecture.md,src/_creditplus/docs/superpowers/plans/2026-03-14-rook-phase1-foundation.mdRevalueAccount.cs—src/_creditplus/docs/archive/options/option-1/architecture.mddocs/standards/README.md—LedgerTM.Tests.Component/Seeding/StandardsRegisterPinTests.cs,LedgerTM.Tests.Unit/Payments/ExternalAccounts/ExternalAccountProxyTests.cs,src/LedgerTM.Payments/ExternalAccounts/Domain/ProxyKinds.cs,src/LedgerTM.Payments/Submissions/Channels/Bacs/Format/BacsAdviceFileFormat.cs,src/LedgerTM.Payments/Submissions/Channels/Bacs/Format/Standard18FileFormat.cs,src/LedgerTM.Payments/Submissions/Channels/Bacs/README.md,src/LedgerTM.Payments/Submissions/Channels/BankservAfrica/BankservAfricaReturnReasons.cs,src/LedgerTM.Payments/Submissions/Channels/BankservAfrica/Format/BankservAfricaReturnFileFormat.cssrc/LedgerTM.Accounts/Domain/Valuation/AccountValuation.cs—LedgerTM.Tests.Architecture/EvaluationContextConstructionSiteTests.cs
Domain events touched: 1 — FacilityUsageSet Aggregates touched: 1
Facility—src/LedgerTM.Limits/Facilities/Domain/Facility.cs
Methods at CRAP 30+ in changed files: 9 (unit coverage, cached at main 56b33d240)
LedgerTM.Accounts.Domain.Valuation.AccountValuation.Brent— CRAP 812, complexity 28, 0% covered —src/LedgerTM.Accounts/Domain/Valuation/AccountValuation.csLedgerTM.Accounts.Application.Commands.ExternalSourceDispatcher.BuildEvaluationContext— CRAP 506, complexity 22, 0% covered —src/LedgerTM.Accounts/Application/Commands/ProcessExternalSourcePaymentHandlers.csExternalSourceDispatcher.DispatchAsync— CRAP 420, complexity 20, 0% covered —src/LedgerTM.Accounts/Application/Commands/ProcessExternalSourcePaymentHandlers.csLedgerTM.Accounts.Yaml.LimitIntegrationsYamlConverter.ParseBool— CRAP 265, complexity 52, 57% covered —src/LedgerTM.Accounts/Yaml/LimitIntegrationsYamlConverter.csLedgerTM.Accounts.Yaml.LimitIntegrationsYamlConverter.WriteYaml— CRAP 110, complexity 10, 0% covered —src/LedgerTM.Accounts/Yaml/LimitIntegrationsYamlConverter.csLedgerTM.Accounts.Domain.Valuation.AccountValuation.RunSecant— CRAP 57, complexity 56, 95% covered —src/LedgerTM.Accounts/Domain/Valuation/AccountValuation.csLedgerTM.Accounts.Domain.Valuation.AccountValuation.BuildContext— CRAP 46, complexity 46, 94% covered —src/LedgerTM.Accounts/Domain/Valuation/AccountValuation.csLedgerTM.Accounts.Domain.Valuation.AccountValuation.SolveInstalment— CRAP 45, complexity 24, 67% covered —src/LedgerTM.Accounts/Domain/Valuation/AccountValuation.csLedgerTM.Accounts.Domain.Valuation.AccountValuation.ProcessScheduledTransactions— CRAP 32, complexity 32, 100% covered —src/LedgerTM.Accounts/Domain/Valuation/AccountValuation.csPermission keys to add: 2 — grant-facility, i-facility-availability-reader
Warnings
Facilityis changed and read by 6 projects — name the seam in the ADR.PayoutLimitContextis changed and read by 3 projects — name the seam in the ADR.FacilityIntegrationis changed and read by 3 projects — name the seam in the ADR.IAccountPayoutLimitGateis changed and read by 3 projects — name the seam in the ADR.- A domain event is touched — set
reseed: trueand say so in the plan. LedgerTM.Accounts.Domain.Valuation.AccountValuation.Brentis at CRAP 812 (and 4 more in that file) — write its test before the bite edits it, and name the test in the plan.LedgerTM.Accounts.Application.Commands.ExternalSourceDispatcher.BuildEvaluationContextis at CRAP 506 (and 1 more in that file) — write its test before the bite edits it, and name the test in the plan.LedgerTM.Accounts.Yaml.LimitIntegrationsYamlConverter.ParseBoolis at CRAP 265 (and 1 more in that file) — write its test before the bite edits it, and name the test in the plan.- 6 feature projects touched — say why this is not two ADRs.
Land batches
One land, the whole ADR; reseed: true. Bites 4 and 5 start after ADR-836 has landed (F16):
the lane builds 1–3 and 6 first and takes 4 and 5 after a bite-boundary merge, or partition puts
the two ADRs in one lane with ADR-836’s bites first.
Notes
- The act that draws the overdraft is the withdraw operation with bite 2’s guard; bite 3’s scenarios use it. Before bite 2 nothing can take a current account below zero in a test.
- Waiting for usage. Facility usage arrives by the forwarded-event cascade; the sanctioned
wait is the one
FacilityActivationLimitTestsuses. - Refusals. A guard refusal is
OPERATION_GUARD_FAILEDwith the type’sguardFailureMessage, surfaced as every operation guard refusal is today; the operations list returns the operation disabled with that message as its reason. A facility breach on a payout isFACILITY_BREACH_ON_PAYOUT(ADR-794). - The sign of
DebitAccrued. On a liability-nature type a Debit operation drives a position negative. The capitalisation row reads0 - DebitAccruedwithconditionExpression: DebitAccrued < 0; the viewer shows the accrual position as it showsAccrued. - Order within the day. The walk runs a timing bucket’s scheduled transactions by the generated
type’s
sequenceNumber; the accruals carry 1 and 2, the fee 9, allEndOfDay. Askedneeds the balance before the lines.ExposureLinecarries deltas only, soPayoutLimitContextgainsPositionsBefore; the activation gate reads opening balances as zero.- Revaluation re-walks the days (
RevalueAccount) and diffs every scheduled transaction, so a back-dated change re-prices the overdraft and the fee for every day it touches, on today’s facility limit — the facility’s own history is not read. Recorded for the ADR (D7). - Capitalised interest can tip an account into excess at start of day, and the same day’s end-of-day run prices the excess. Accepted as the configured behaviour: excess is a balance fact; a tenant that wants grace adds a condition to the row.
DirectionandUsageByAccountare stored shapes:Directiondefaults toRaise(no migration);UsageByAccountis empty in an environment we do not wipe until the facility projection is rebuilt — a land-time note, not a bite.- The day-walk resolves the facility once per account per day, at the step.
ProcessToDatewalks several days with one account load; it resolves the symbols once at the start, which is the ADR’s “as it stands when the step runs” for a catch-up walk. - Fixtures. The cards fixture’s accounts carry no posting group (ADR-836 note); bite 5 proves
the GL legs against the composed template as ADR-836 does. A test’s
CurrentAccountis loaded from the composed za-retail template with its rate structures, prices and thefacility-typelookup, the patternMicroloanArrearsEndToEndTestsuses. - The guide article names NCA §8(3) and its register row, the
BelowZeroconvention in every worked example, and lifts its numbers fromCurrentAccountExcessTests. - Between bites 2 and 3 the shipped
Raisereading records a current account’s credits as usage on the overdraft. Harmless because the guards ignore the account’s own usage and the two bites land together; no bite-2 test reads the facility. - Absolute usage is eventually consistent: two position-change messages for one account delivered out of order leave the older balance recorded until the next movement. Accepted; a stream version on the trigger would close it and is not this ADR’s.
- The fee in the scenarios is
UnarrangedOverdraftFeeChargedat 50; the rates are the rate typesCall(0.0625),Overdraft(0.18) andUnarrangedOverdraft(0.28) from the za retailRateSettingscell, seeded into a test tenant asCallis today; the clearing batches a test stores carry distinct business dates because ADR-836’s store overwrites a same-day batch.
Landing notes
- F3: whichever of ADR-836 and ADR-837 lands second adds
cardPurchase/cardRefundto the retailCurrentAccountrow, andCurrentAccounttoCardTypesSettings.yaml’s fundable types. AccountAvailabilityandAccountAvailabilityReaderare ADR-836’s files; bite 4 edits them after ADR-836 lands (F16).AccountGuardContextBuilder.Buildgains a required parameter in both ADR-836 (the reductions) and ADR-837 (FacilitySymbols), across the same callers; the second lane to land rebases.- ADR-838 F17:
RegulatoryLimitEnforcementevaluates every counted scheduled row in a guard context with noratelookup, and itsTryEvaluatecatches onlyScriptException; the current account’s accrual rows readrate('Overdraft', …), so activation throws until the context binds the lookup and the catch widens. This lane meets it first, at bite 1. - ADR-838 (F15) returns the account detail’s facility figure for a
Raisewire too; this lane givesOverdraftDtoa nature-neutral name (for exampleFacilityHeadroomDto) so the viewer can label it “Overdraft” on a liability type and “Credit limit” on an asset type. - Decided:
FacilitySymbolslives inAccounts.Domain.Valuation(the domain valuation binds it), withFacilitySymbolResolverto come in Application (bite 2) · rests on: F2, ADR-329 D6’s caller-resolved shape · wrong if: the domain ever reads a facility itself. - Decided:
AccountValuationtakesFacilitySymbols? facility = null(optional), not a required parameter, since 198 call sites construct it; the guard context’s parameter is required as F17 says · rests on: F17’s intent (bite 2 resolves it where it matters) · wrong if: a day-end accrual on an overdrawn current account prices withFacilityLimit0. - Decided:
LimitExposure.Asked(…, direction, balanceBefore)andFacility.SetUsageToland in bite 1 beside the contracts (pure domain); bite 3 removes the two-argument overload and wires the callers · rests on: the bite 3 unit tests compile against them · wrong if: bite 3’s measure shows those unit tests behaviour-green and the bite is not shrunk. - Decided:
withdrawis the teller cash withdrawal and the cash-withdrawal integration names it;standing-order-paymentpostsTransferOutunder the same guard;transfer-outis the payout withlimitCheck· rests on: plan Interfaces · wrong if: a standing order on a current account raises an instruction rather than posting. Overdraftjoinsfacility-typein every retail-family package (PackageConformanceTests);holderjoins the retail role vocabulary.- Open: ADR-838 F17 (activation evaluating
rate('Overdraft', …)with no rate lookup) is not exercised by bite 1’s event-seeded tests; an account opened through the create command may meet it. - Bite 4’s authored test needed
using LedgerTM.Infrastructure.Configuration;; the operator added it on main (a6fc5a34b). It arrived after its code (the WIP oracle); a probe dropping the overdraft fromAvailablereddened 7 of its 12 tests. - Shrunk: bite 3’s two unit scenarios (below-zero asked; usage set from the balance) are behaviour green from bite 1 — probes on
LimitExposure.Asked’s cover andFacility.SetUsageTo’s change reddened them. Its component scenarios stand. - Decided: the facility reader aggregates the
Facilitystream for usage by account, asGetAccountLimitUsagedoes, rather than addingUsageByAccounttoFacilityReadModel· rests on: the aggregate already holds it, and a second copy would be a second writer · wrong if: the reader’s per-call stream replay shows up in the day-end profile. - Decided:
ProcessToDateresolves the facility asProcessDayEnddoes; the forecast walk does not yet · wrong if: the forecast panel is expected to show debit interest on an overdrawn current account. - Bite 2’s seven refusal criteria passed before the bite once their arrange was fixed — the facility read zero, so a refusal held vacuously. They stand as regressions now that the draw criteria are green.
- Decided:
CurrentAccountdeclares an optionalpriceList(PriceListReference);price()resolves only through a pricing plan, which an account gets only when opened with a price list · rests on: ADR-704’s price provider · wrong if: a current account opened with no price list is expected to charge the unarranged fee. - Found and fixed: the re-walk replayed a reversed external transaction and its reversal as two movements (the reversal carries the original’s type and sign), so any back-dated reversal moved the balance twice.
ReconstructExternalInputsnow drops the pair. - Found and fixed: revaluation adjustments carried no position updates, so the fan-out raised no
PositionChangedTriggerand a wired limit never saw a re-walk.RevalueAccountstamps each adjustment’s effect, walked from the account’s positions; the operation’s inline revaluation does not yet. - Decided: the reversal seam re-walks only when the reversed transaction is an external movement · rests on: a re-walk regenerates a system posting instead of honouring its reversal, so with the inclusive boundary a reversed capitalisation dated the closed day was restored (
PairedLegReversalOnRehydratedAccountTests) · wrong if: a reversed system fee is expected to re-price the days after it. - Ruled:
OverdraftDto.Limitis the account’sFacilityLimit(its share, D9), and the facility’s whole amount only while frozen (the Interfaces’ “frozen included”) · rests on: bite 5’s “may draw what the other account has left it” · wrong if: the header should show the customer’s whole facility on every account. Bite 6’s viewer test reads 2 000 and is re-dispatched with this ruling. - The re-walk binds the facility in
RevalueAccountand the operation’s inline recompute; the sandbox preview, instalment plan, consequence and parity recomputes do not · wrong if: the parity check runs over overdrawn current accounts. - Land-time: the NCA §8(3) row in
docs/standards/README.mdand the ADR’sstandards:frontmatter (D8) are not written by the lane, which edits nodocs/beyond its landing notes and guide articles. The guide article names the Act without a register link until the row exists. - Bite 6: the overdraft tiles are their own component (
OverdraftTiles), tested from a fixture; the plan’s test path became__tests__/features/accounts/generic/overdraft-tiles.test.tsx. The sandbox’s staged lens shows no overdraft yet. - Bite 6 amended ADR-835’s authored
SampleCardsSeedTeststhrough its author: D10 funds the demo card current account first, then the call deposit. Bite 1’s template change also moved two UI characterizations (the za-retail product count, the account rails snapshot); both re-pinned here. - The bite 4 oracle was built ahead of its blocked test, as a
WIPcommit, because bite 5’s one-available scenario reads it. - Re-dispatched: bite 2’s arrange activates under a placeholder operating entity and meets
BOOKS_NOT_OPEN; bite 5’s arrange funds throughreceive-deposit, which every retail type marks system-only (kept). - Decided:
CurrentAccountcarriesbtcFamily: LDAS/NTDP, as the call deposit does · rests on:BtcCodeValidatorneeds a family for sub-family codes (INTR, FEES) · wrong if: a statement export reads a current account as a notice deposit.