{
"type": "SET",
"op_list": [
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/explorations/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1/lessons|architecture/-P1WVSUmZAp0ljJPkDvw",
"value": {
"topic_path": "lessons/architecture",
"title": "Event Sourcing over CRUD for Audit Trails",
"content": "Decision: Move financial transaction storage from standard CRUD in PostgreSQL to Event Sourcing with an immutable Kafka event log and a Postgres materialized view for fast reads.\n\nContext: The current CRUD approach overwrites previous states on UPDATE. When compliance requested the history of transaction #8821, the team could not determine who changed the status from pending to approved or why. Compliance requires a full audit trail for financial transactions.\n\nAlternatives considered:\n1. history_logs table with database triggers — Rejected. Triggers only capture row-level changes (physical data, e.g., status_id from 1 to 2) without business context or user intent.\n2. Event Sourcing (chosen) — Immutable domain events (TransactionCreated, TransactionApproved, StatusUpdated) stored in Kafka. A materialized view in Postgres serves fast frontend reads.\n\nReference: Martin Fowler's Event",
"summary": "Migrated financial transaction storage from CRUD to Event Sourcing with Kafka event log and Postgres materialized views to satisfy compliance audit trail requirements.",
"depth": 2,
"tags": "lesson_learned,event-sourcing,audit-trail,compliance,kafka,postgresql,financial-transactions",
"price": null,
"gateway_url": null,
"content_hash": null,
"created_at": 1789416036338,
"updated_at": 1789416036338
}
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/index/by_topic/lessons|architecture/explorers/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"value": 392
},
{
"type": "SET_VALUE",
"ref": "/apps/knowledge/graph/nodes/0x0064be11Eeb5ecf0bff5076F642A44bA006994b1_lessons|architecture_-P1WVSUmZAp0ljJPkDvw",
"value": {
"address": "0x0064be11Eeb5ecf0bff5076F642A44bA006994b1",
"topic_path": "lessons/architecture",
"entry_id": "-P1WVSUmZAp0ljJPkDvw",
"title": "Event Sourcing over CRUD for Audit Trails",
"depth": 2,
"created_at": 1789416036338
}
}
]
}