Files
2nd/10_Wiki/Topics/AI_and_ML/Reconciliation.md
T
koriweb d8a80f6272 chore(wiki): dangling 링크 canonical 정규화 (768파일/1200건)
이름만 다른(표기 변형) [[위키링크]]를 대상 문서의 canonical 제목으로 치환해
끊겼던 1,200개 링크를 연결. 제목/파일명 정규화 일치만 적용하고 별칭 매칭은
과병합 위험으로 제외(애매성 가드). 원본은 _link_reconcile_backup/ 에 백업.
도구: Datacollect/scripts/link_reconcile_apply.mjs

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-08 12:24:15 +09:00

5.9 KiB

id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
id title category status canonical_id aliases duplicate_of source_trust_level confidence_score verification_status tags raw_sources last_reinforced github_commit tech_stack
wiki-2026-0508-reconciliation Reconciliation 10_Wiki/Topics verified self
Data Reconciliation
Conflict Resolution
CRDT
none A 0.9 applied
reconciliation
crdt
distributed
finance
sync
2026-05-10 pending
language framework
typescript yjs

Reconciliation

매 한 줄

"매 두 source 의 truth 의 align". Reconciliation 의 financial (ledger ↔ bank statement match), data (master ↔ replica), distributed (CRDT conflict-free merge), AI (multi-agent state sync) 의 cross-domain pattern. 2026 의 local-first software 의 CRDT renaissance.

매 핵심

매 Financial reconciliation

  • 3-way match: PO ↔ receipt ↔ invoice.
  • Bank rec: GL ↔ bank statement 의 daily.
  • Sub-ledger to GL: AR/AP detail 의 control account match.
  • 2026 tools: BlackLine, FloQast, AI-driven (Trullion).

매 Data reconciliation

  • CDC (Change Data Capture): Debezium, source-of-truth log.
  • Lambda architecture: batch + stream — 매 reconcile 의 daily.
  • Idempotency: 매 retry 의 safe — UUID dedup.
  • Checksum: row-count + hash 의 source vs target.

매 CRDT (Conflict-free Replicated Data Type)

  • G-Counter: grow-only counter (sum across replicas).
  • PN-Counter: increment + decrement.
  • OR-Set: observed-remove set — add wins.
  • LWW-Register: last-write-wins by timestamp.
  • RGA / Yjs Y.Text: collaborative text.
  • Automerge: JSON CRDT, local-first.

매 Modern distributed

  • Operational Transform (OT): Google Docs 의 legacy. Server-coord.
  • CRDT: Notion, Linear, Figma (mixed). P2P-friendly.
  • Vector clocks: causal ordering.
  • Hybrid Logical Clock (HLC): physical + logical — CockroachDB.

매 응용

  1. Collaborative editing (Yjs, Automerge).
  2. Offline-first mobile app sync.
  3. Multi-region database (DynamoDB Global, Cosmos DB).
  4. Bank ledger reconciliation.
  5. Multi-agent LLM shared scratchpad.

💻 패턴

Yjs collaborative text (TypeScript)

import * as Y from "yjs";
import { WebsocketProvider } from "y-websocket";

const doc = new Y.Doc();
const provider = new WebsocketProvider("wss://sync.example.com",
                                        "room-1", doc);
const text = doc.getText("content");

text.observe(event => console.log("delta:", event.delta));
text.insert(0, "Hello ");
// 매 다른 client 의 concurrent insert 의 auto-merge

Automerge JSON CRDT

import * as Automerge from "@automerge/automerge";

let doc1 = Automerge.from({ tasks: [] as string[] });
let doc2 = Automerge.clone(doc1);

doc1 = Automerge.change(doc1, d => d.tasks.push("write spec"));
doc2 = Automerge.change(doc2, d => d.tasks.push("review code"));

const merged = Automerge.merge(doc1, doc2);
// merged.tasks == ["write spec", "review code"] — 매 conflict X

G-Counter (CRDT)

class GCounter:
    def __init__(self, node_id: str):
        self.node = node_id
        self.counts: dict[str, int] = {}
    def inc(self, n: int = 1):
        self.counts[self.node] = self.counts.get(self.node, 0) + n
    def value(self) -> int:
        return sum(self.counts.values())
    def merge(self, other: "GCounter"):
        for k, v in other.counts.items():
            self.counts[k] = max(self.counts.get(k, 0), v)

Bank reconciliation pseudo

def reconcile(gl: list[Txn], bank: list[Txn]) -> dict:
    matched, gl_only, bank_only = [], [], []
    bank_idx = {(t.amount, t.date): t for t in bank}
    for g in gl:
        key = (g.amount, g.date)
        if key in bank_idx:
            matched.append((g, bank_idx.pop(key)))
        else:
            gl_only.append(g)
    bank_only = list(bank_idx.values())
    return {"matched": matched, "gl_only": gl_only, "bank_only": bank_only}

Idempotent upsert (Postgres)

INSERT INTO orders (id, amount, status)
VALUES ($1, $2, $3)
ON CONFLICT (id) DO UPDATE SET
  amount = EXCLUDED.amount,
  status = EXCLUDED.status,
  updated_at = NOW();

CDC with Debezium (Kafka Connect)

{
  "name": "pg-source",
  "config": {
    "connector.class": "io.debezium.connector.postgresql.PostgresConnector",
    "database.hostname": "db", "database.dbname": "app",
    "plugin.name": "pgoutput",
    "topic.prefix": "app",
    "table.include.list": "public.orders,public.payments"
  }
}

매 결정 기준

상황 Approach
Real-time collab text Yjs (mature, fast)
Offline-first app Automerge (rich JSON)
Counter across regions PN-Counter / G-Counter
Centralized server OK OT (simpler) or CRDT
Bank/finance Manual + AI-assist (BlackLine)
DB replica sync CDC (Debezium) + idempotency

기본값: Yjs 의 collab text, Automerge 의 structured offline-first, CDC 의 enterprise data sync.

🔗 Graph

🤖 LLM 활용

언제: 매 reconciliation rule 의 fuzzy match (description, amount tolerance), exception explanation, audit trail summary. 언제 X: deterministic match (use SQL JOIN), regulated final attestation (human sign-off).

안티패턴

  • OT 의 P2P 의 force: 매 OT 의 server 의 require — P2P 의 CRDT 의 use.
  • LWW 의 collab text: 매 char-level loss — RGA / Yjs 의 use.
  • No vector clock 의 causal: 매 wall-clock skew → wrong order.
  • No idempotency key: retry 의 duplicate → double charge.
  • Reconcile manually 매 day: automate w/ exception queue.

🧪 검증 / 중복

  • Verified (Yjs docs, Automerge paper, Shapiro CRDT survey 2011, Debezium docs).
  • 신뢰도 A.

🕓 Changelog

날짜 변경
2026-05-08 Phase 1
2026-05-10 Manual cleanup — finance + CRDT + data sync unified