Lee ChanyangBackend Engineer

Language

← Back to design approaches

Process Evidence · 03

Decide architecture boundaries and invariants

I separated state that must be committed together from asynchronous processing and defined boundaries to absorb retries, duplicates, and partial failures.

After modeling the domain, I distinguished facts to guarantee within a transaction, work to retry after the Outbox, and state to retain independently of external-provider failures.

How I worked

Actual Working Approach

  1. Input

    I examined domain models, state transitions, failure characteristics of external systems such as payment gateways, FCM, queues, and batches, and data operators needed to reconcile together.

  2. Questions to ask

    I asked which states must be committed in the same database transaction, which operations could simply be retried after failure, and which values were authoritative.

  3. Output

    I recorded transaction boundaries, the append-only ledger, Outbox persistence points, provider adapters, notification delivery, and recovery states as architecture decisions.

Source evidence

Classifying architecture evidence by transactions, authoritative state, and failure isolation

When incorporating reflections, code, and documents into the architecture card, I organized them by which states were committed in one transaction and which tasks became retryable follow-up work, rather than listing pattern names.

B2B boundaries
Approval requests, reviewer judgments, approval and rejection history, and updates to current affiliations and roles have distinct responsibilities, so they serve as a sample of boundary decisions.
Pricing and payments
I linked the reflection on freezing policy-calculation evidence in an order rather than trusting client amounts, the pricing-policy ADR, and cart/order server-recalculation documents.
Asynchronous processing and recovery
I grouped Transactional Outbox, Dual Queue Notification, retries of internal finalization after gateway processing, and Outbox · NotificationDelivery recovery reflections as evidence of failure isolation.
Policy and accounting
Policy-based tiers, separation of paid and free assets, the append-only ledger, and the region-pinning strategy ADR support policies that can change without code deployment and invariants concerning monetary value and regional boundaries.
Detailed work example

Establishing state-transition and audit boundaries first in the B2B approval flow

In the private B2B platform analysis, I treated applications, reviews, approvals, rejections, and category reviews as workflows requiring state transitions and audit records, rather than simple administrator actions.

Establishing state-transition and audit boundaries firstMermaid

Rendering the diagram.

Where This Led to Implementation

  • Points Accounting & Rewards System

    I committed monetary state through Ledger and Wallet transactions and separated reward events and notification delivery at Outbox · NotificationDelivery boundaries.

    View domain-event and notification-delivery boundaries
  • Multi-Gateway Subscription Billing System

    I contained gateway-specific return and callback differences within adapters and handlers, and consolidated subscription activation and renewal finalization into processor state transitions.

    View gateway routing and domain-state convergence
Boundaries
I separated current user affiliation and role state from verification requests and approval history because they have different reasons to change.
Invariants
Approval and rejection must do more than change current state: they must leave an explainable record of who changed it and on what basis.
Scope of use
This B2B sample supports analysis, modeling, and contract definition in Steps 01–03 rather than operational reliability; actual recovery evidence is linked to production-service projects.
Verification gaps
The intent to make approval and affiliation/role creation atomic is evident, but evidence for row locking, conditional updates, domain-scope validation, and unique constraints is insufficient to present it as an exactly-once approval case.