{"id":"financial-correctness-combines-locking-with-structural-asymmetry","text":"Financial systems combine domain-appropriate concurrency control (pessimistic locking for wallets, optimistic locking for hotels) with write-read asymmetry (irrevocable ledger entries, reconciling balance derivation) to support end-to-end correctness: concurrency control prevents write-time corruption while structural asymmetry supports read-time consistency — provided the read path does not depend on assumed invariants that are never enforced in code, which would undermine the reconciliation that reads are supposed to perform.","truth_value":"IN","source":"","source_url":"","source_hash":"","justifications":[{"type":"SL","antecedents":["concurrency-safety-strategy-varies-by-financial-risk","write-read-asymmetry-is-end-to-end-correct"],"outlist":[],"label":"domain-specific concurrency strategies and codebase-wide write-read asymmetry are complementary, not redundant"}],"dependents":["architecture-adapts-mechanisms-to-domain-risk","coordination-strategy-adapts-to-correctness-cost","financial-correctness-is-end-to-end"],"metadata":{"last_reviewed":"2026-06-06T06:26:57","review_result":"invalid"},"created_at":"","updated_at":"","reviewed_at":"","verified_at":"","retracted_at":"","explanation":{"steps":[{"node":"financial-correctness-combines-locking-with-structural-asymmetry","truth_value":"IN","reason":"SL justification valid","antecedents":["concurrency-safety-strategy-varies-by-financial-risk","write-read-asymmetry-is-end-to-end-correct"],"label":"domain-specific concurrency strategies and codebase-wide write-read asymmetry are complementary, not redundant"},{"node":"concurrency-safety-strategy-varies-by-financial-risk","truth_value":"IN","reason":"SL justification valid","antecedents":["wallet-transfers-are-safe-under-concurrency","hotel-occ-prevents-overbooking"],"label":"Wallets can't tolerate any conflict window (money at risk); hotels can retry (inventory contention is less costly)"},{"node":"wallet-transfers-are-safe-under-concurrency","truth_value":"IN","reason":"SL justification valid","antecedents":["wallet-deadlock-free-concurrent-transfers"],"label":"sorted lock ordering prevents deadlock and frozen-check prevents TOCTOU, but `create_wallet` silently replacing an existing wallet could reset balance and lose in-flight transaction state for any concurrent transfer holding a lock on that wallet","outlist":["wallet-creation-silently-overwrites"]},{"node":"wallet-deadlock-free-concurrent-transfers","truth_value":"IN","reason":"SL justification valid","antecedents":["wallet-lock-ordering-prevents-deadlock","wallet-frozen-check-inside-lock","wallet-two-tier-locking"],"label":"Three complementary locking disciplines compose into a deadlock-free, race-free concurrency model"},{"node":"wallet-lock-ordering-prevents-deadlock","truth_value":"IN","reason":"premise"},{"node":"wallet-frozen-check-inside-lock","truth_value":"IN","reason":"premise"},{"node":"wallet-two-tier-locking","truth_value":"IN","reason":"premise"},{"node":"hotel-occ-prevents-overbooking","truth_value":"IN","reason":"SL justification valid","antecedents":["hotel-reservation-optimistic-locking","hotel-search-availability-is-bottleneck-date"],"label":"OCC prevents concurrent overbook, but negative inventory from cancel underflow corrupts the availability data that OCC is protecting","outlist":["hotel-cancel-no-underflow-guard"]},{"node":"hotel-reservation-optimistic-locking","truth_value":"IN","reason":"premise"},{"node":"hotel-search-availability-is-bottleneck-date","truth_value":"IN","reason":"premise"},{"node":"write-read-asymmetry-is-end-to-end-correct","truth_value":"IN","reason":"SL justification valid","antecedents":["writes-commit-irrevocably-reads-reconcile","correctness-by-construction-not-validation"],"label":"Writes commit and reads reconcile (depth-4) with structural construction (depth-3), but assumed invariants (depth-2, IN) break the end-to-end guarantee","outlist":["assumed-invariants-are-unenforced"]},{"node":"writes-commit-irrevocably-reads-reconcile","truth_value":"IN","reason":"SL justification valid","antecedents":["writes-are-cheap-reads-pay","forward-only-design-prevents-regression-and-maximizes-progress"],"label":"forward-only semantics explain WHY reads bear the full burden — there is no mechanism to go back"},{"node":"writes-are-cheap-reads-pay","truth_value":"IN","reason":"SL justification valid","antecedents":["write-time-decisions-are-lightweight-but-binding","read-path-absorbs-consistency-and-computation-cost"],"label":"Write-side minimalism and read-side cost absorption are two faces of the same design tradeoff, consistently applied across KV, chat, news feed, autocomplete, and payment"},{"node":"write-time-decisions-are-lightweight-but-binding","truth_value":"IN","reason":"SL justification valid","antecedents":["fan-out-write-pushes-references-not-data","write-time-routing-is-irrevocable"],"label":"Fan-out pushes references (lightweight) and routing decisions are permanent (binding) — the write path optimizes for speed at the cost of flexibility"},{"node":"fan-out-write-pushes-references-not-data","truth_value":"IN","reason":"SL justification valid","antecedents":["chat-fanout-on-write","news-feed-fan-out-write-pushes-ids"],"label":"Reference-based fanout limits write amplification to pointer-sized payloads"},{"node":"chat-fanout-on-write","truth_value":"IN","reason":"premise"},{"node":"news-feed-fan-out-write-pushes-ids","truth_value":"IN","reason":"premise"},{"node":"write-time-routing-is-irrevocable","truth_value":"IN","reason":"SL justification valid","antecedents":["news-feed-celebrity-threshold-at-write-time","chat-fanout-on-write"],"label":"news feed selects fan-out-on-write vs fan-out-on-read based on follower count at publish time; chat routes to inbox or offline queue based on presence at send time — both decisions are baked in at write time and not revisited"},{"node":"news-feed-celebrity-threshold-at-write-time","truth_value":"IN","reason":"premise"},{"node":"read-path-absorbs-consistency-and-computation-cost","truth_value":"IN","reason":"SL justification valid","antecedents":["lazy-read-time-evaluation-trades-write-simplicity-for-read-cost","kv-read-path-is-self-healing"],"label":"lazy eval (autocomplete decay, URL expiration, payment balance) defers computation to reads; KV read repair defers convergence to reads — the combined pattern reveals a systematic bias toward read-path complexity across the repo"},{"node":"lazy-read-time-evaluation-trades-write-simplicity-for-read-cost","truth_value":"IN","reason":"SL justification valid","antecedents":["autocomplete-decay-is-read-time","url-shortener-expiration-lazy","payment-balance-never-cached"],"label":"Three independent systems chose lazy evaluation, suggesting write-simplicity is the dominant concern in pedagogical implementations"},{"node":"autocomplete-decay-is-read-time","truth_value":"IN","reason":"premise"},{"node":"url-shortener-expiration-lazy","truth_value":"IN","reason":"premise"},{"node":"payment-balance-never-cached","truth_value":"IN","reason":"premise"},{"node":"kv-read-path-is-self-healing","truth_value":"IN","reason":"SL justification valid","antecedents":["kv-read-repair-on-get","kv-node-stores-sibling-versions"],"label":"Read repair + sibling detection make the read path an active consistency mechanism, not just a query"},{"node":"kv-read-repair-on-get","truth_value":"IN","reason":"premise"},{"node":"kv-node-stores-sibling-versions","truth_value":"IN","reason":"premise"},{"node":"forward-only-design-prevents-regression-and-maximizes-progress","truth_value":"IN","reason":"SL justification valid","antecedents":["state-ratchets-prevent-regression-across-domains","pipeline-processing-maximizes-forward-progress"],"label":"State ratchets and forward-progress pipelines are complementary mechanisms — ratchets prevent regression in stateful systems, pipelines prevent regression in dataflow systems"},{"node":"state-ratchets-prevent-regression-across-domains","truth_value":"IN","reason":"SL justification valid","antecedents":["chat-monotonic-read-progress","watermark-finalization-is-irreversible"],"label":"chat read cursors are monotonic (never re-mark as unread), aggregation windows follow OPEN→CLOSED→FINALIZED with no reversal — both are state ratchets that make backwards movement structurally impossible"},{"node":"chat-monotonic-read-progress","truth_value":"IN","reason":"SL justification valid","antecedents":["chat-dual-ordering-sequence-and-lamport","chat-read-cursors-monotonic"],"label":"Sequence-number ordering + monotonic cursors create an irreversible read-progress guarantee"},{"node":"chat-dual-ordering-sequence-and-lamport","truth_value":"IN","reason":"premise"},{"node":"chat-read-cursors-monotonic","truth_value":"IN","reason":"premise"},{"node":"watermark-finalization-is-irreversible","truth_value":"IN","reason":"SL justification valid","antecedents":["watermark-drives-finalization","window-lifecycle-one-directional","no-window-merging-or-retraction"],"label":"Three properties compose into hard irreversibility: watermark-only trigger + one-way lifecycle + no retraction"},{"node":"watermark-drives-finalization","truth_value":"IN","reason":"premise"},{"node":"window-lifecycle-one-directional","truth_value":"IN","reason":"premise"},{"node":"no-window-merging-or-retraction","truth_value":"IN","reason":"premise"},{"node":"pipeline-processing-maximizes-forward-progress","truth_value":"IN","reason":"SL justification valid","antecedents":["video-pipeline-maximizes-useful-work-on-failure","watermark-finalization-is-irreversible"],"label":"Video pipeline (branch-independent failure containment) and stream processing (irreversible finalization) both embody the same forward-only processing principle"},{"node":"video-pipeline-maximizes-useful-work-on-failure","truth_value":"IN","reason":"SL justification valid","antecedents":["dag-failure-cascade","youtube-pipeline-dag-structure"],"label":"DAG topology + selective cascade means a thumbnail failure doesn't block a successful transcode"},{"node":"dag-failure-cascade","truth_value":"IN","reason":"premise"},{"node":"youtube-pipeline-dag-structure","truth_value":"IN","reason":"premise"},{"node":"correctness-by-construction-not-validation","truth_value":"IN","reason":"SL justification valid","antecedents":["structural-discipline-prevents-consistency-bugs","state-ratchets-prevent-regression-across-domains"],"label":"Both depth-2 conclusions prevent bugs structurally (immutability/sync vs. monotonic ratchets) rather than via checks, forming a unified construction-over-validation principle"},{"node":"structural-discipline-prevents-consistency-bugs","truth_value":"IN","reason":"SL justification valid","antecedents":["immutable-values-prevent-aliasing-bugs","multi-structure-sync-invariant"],"label":"immutability (KV vector clocks, leaderboard reinsert) prevents mutation aliasing; multi-structure sync (consistent hashing, leaderboard) prevents index divergence — leaderboard uses BOTH, showing these disciplines are complementary"},{"node":"immutable-values-prevent-aliasing-bugs","truth_value":"IN","reason":"SL justification valid","antecedents":["kv-vector-clock-immutable","leaderboard-update-by-remove-reinsert"],"label":"Immutable-value semantics eliminate shared-reference aliasing at the cost of allocation overhead"},{"node":"kv-vector-clock-immutable","truth_value":"IN","reason":"premise"},{"node":"leaderboard-update-by-remove-reinsert","truth_value":"IN","reason":"premise"},{"node":"multi-structure-sync-invariant","truth_value":"IN","reason":"SL justification valid","antecedents":["ch-triple-bookkeeping","leaderboard-dual-index-consistency"],"label":"Multi-structure sync is a recurring correctness burden where the failure mode is silent divergence"},{"node":"ch-triple-bookkeeping","truth_value":"IN","reason":"premise"},{"node":"leaderboard-dual-index-consistency","truth_value":"IN","reason":"premise"}]}}