{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-OwL1nddOwUCuHX-dFwz",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Financial Transaction Audit Trails",
"content": "DECISION: Adopt Event Sourcing over standard PostgreSQL CRUD for the financial transaction audit trail to satisfy compliance audit requirements.\n\nWHY: The current CRUD approach overwrites previous row states, making it impossible to retrieve historical changes. When compliance requested the history of transaction #8821, the team could not determine who changed the status from pending to approved.\n\nALTERNATIVES CONSIDERED AND REJECTED:\n1. Database triggers + history_logs table: Rejected because triggers only see raw row changes (e.g., status changed from 1 to 2) and lose all business context — they cannot capture *why* a change happened or the user intent behind it.\n\nAPPROACH: Store a sequence of immutable domain events (e.g., TransactionCreated, TransactionApproved, StatusUpdated) as the source of truth, using Kafka for the immutable event log. A materialized view in PostgreSQL is then built for fast reads on the frontend.\n\nFILES/ATTACHES:\n- src/services/transactionService.ts — event producers\n- src/events/eventStore.ts — consumer/store logic\n\nREFERENCE: Martin Fowler's 'Event Sourcing Pattern' article — the architecture follows this reference exactly.\n\nCONSENSUS: Led by Alice (Lead); Bob (Eng) will implement the event producers in transactionService.ts and the consumer/store in eventStore.ts; Charlie (Security) raised the reference-architecture question.",
"summary": "Replaced PostgreSQL CRUD with Event Sourcing (Kafka immutable event log + materialized Postgres read view) for financial transaction audit trails to satisfy compliance, following Martin Fowler's Event Sourcing Pattern.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,compliance,kafka,postgres,fowler",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1782781262441,
"updated_at": 1782781262441
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 26
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-OwL1nddOwUCuHX-dFwz",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-OwL1nddOwUCuHX-dFwz",
"title": "Event Sourcing over CRUD for Financial Transaction Audit Trails",
"depth": 2,
"created_at": 1782781262441
}
}
]
}