Design study
Resilient Loan Decisioning Pipeline
A conceptual design for an invented lender: parallel application checks, versioned decision rules, and failures that refer an application instead of declining it.
An independent conceptual design study. The business, scenarios and architecture are illustrative and do not describe a production system.
- Azure Functions
- Durable Functions
- .NET
- Application Insights
- Serilog
Context
An invented lender takes personal-loan applications online. Before an underwriter sees one, three independent checks run: identity, affordability and documents. The identity and document checks call external providers, each with its own latency and failure modes.
Experience behind it
Professional experience: Azure Functions, asynchronous parallel processing, and observability with Application Insights and Serilog. Durable Functions, the orchestration model and the policy lifecycle are design choices of this study.
Challenge
Run the checks in parallel and tolerate slow or failing providers without losing finished work. Change the decision policy without redeploying, and be able to explain any decision later. A provider outage must never turn into a decline.
Constraints
- External providers are sometimes slow or unavailable.
- Every decision must be reproducible later.
- The decision policy changes more often than the code.
- A missing check result must never decide against an applicant.
Architecture
01 Submit
An application is submitted. The starter passes the active policy version as input and starts an orchestration whose instance ID is the application ID, unless one already exists.
02 Fan out
The orchestrator schedules the identity, affordability and document checks as parallel activities, each with a retry policy and a durable-timer deadline covering all attempts.
03 Call providers
Activities call the external providers. An activity can run more than once, so each call is keyed by application and check, and a repeat reuses the stored result.
04 Fan in
The orchestrator waits for all three. A check that fails, exhausts its retries or misses its deadline is recorded with its reason, and a late result is ignored.
05 Evaluate
An activity evaluates the recorded facts against the pinned policy version: approve, decline or refer. Missing required evidence always means refer.
06 Review
A referred application waits for an underwriter's decision, raised as an external event and raced against a durable-timer deadline. If the deadline passes, it is escalated.
07 Record
The decision is written once, keyed by application ID, with its facts, check outcomes and versions. Orchestrator logs are replay-safe and share one correlation ID.
Key decisions
Durable orchestration with fan-out and fan-in
The starter uses the application ID as the instance ID and checks its status first, so a resubmission doesn't start a second run. The orchestrator fans out one activity per check, then waits for all. Replayed code stays deterministic: context time and IDs, activity-only I/O, durable timers. Activities run at least once, so provider calls are keyed by application and check.
- Trade-off
- Replay rules make orchestrators harder to reason about.
A versioned policy, pinned at the start
Checks produce facts; a rules engine evaluates them against a policy: approve, decline or refer. Policy versions are reviewed in version control, tested against recorded example applications and immutable once published. The active version is passed as orchestration input, so retries and replays use the same version, even if another is activated mid-run.
- Trade-off
- Rules need their own tests and releases, and logic is split between code and configuration.
Refer as a first-class outcome
A check that fails, times out or exhausts its retries is recorded with its reason and never produces a decline on its own. Missing required evidence means refer. The orchestrator then waits for an underwriter's decision as an external event, raced against a durable-timer deadline. If the deadline wins, the application is escalated, never declined.
- Trade-off
- More outcome states, and a review queue to staff and monitor.
Guarantees
- A failed or timed-out check is recorded and never stops the other checks.
- No check failure declines an applicant; missing required evidence always means refer.
- Each decision keeps its facts, check outcomes, and the policy, rules-engine and evaluator versions.
Limits of the design
Limits: a policy that needs a new kind of fact still needs a new check in code, and during a provider outage the review queue becomes the bottleneck. Duplicate-start protection rests on a status check, so the starter must be tested against the chosen storage provider.