🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
docs(agents): warn against is_deleted filter on ClickHouse reads (#13965)
Niklas Semmler55b28e57c802
diff --git a/.agents/skills/backend-dev-guidelines/references/database-patterns.md b/.agents/skills/backend-dev-guidelines/references/database-patterns.mdindex 10a995c81c..18abe06da3 100644--- a/.agents/skills/backend-dev-guidelines/references/database-patterns.md+++ b/.agents/skills/backend-dev-guidelines/references/database-patterns.md@@ -358,6 +358,34 @@ const query = ``;```+**`is_deleted` on `traces`, `observations`, and `scores` is dormant — avoid new filters.**++These three tables are declared as+`ReplacingMergeTree(event_ts, is_deleted)`, but no production+code writes `is_deleted = 1` for them — all deletes use+ClickHouse's lightweight `DELETE FROM` mutation (e.g.+`deleteObservationsByTraceIds`,+`deleteObservationsByProjectId`,+`deleteObservationsOlderThanDays`), which marks rows via the+engine-managed `_row_exists` column. `_row_exists` is handled+transparently by the read path; no special query handling is+needed.++What this means for query authors:++- **`WHERE is_deleted = 0` filters on these three tables are+ dead weight in practice.** A few legacy reads still carry+ them (e.g. `web/src/features/score-analytics/server/`); new+ code should not add them unless soft-delete writes have+ actually been introduced.++**Separate case: `blob_storage_file_log`.** This table is also+a `ReplacingMergeTree` but **does** use soft-delete+intentionally — `ingestionFileDeletion.ts` writes+`is_deleted: "1"`, `batch-project-blob-cleaner` reads with+`countIf(is_deleted = 1)`. The guidance above does not apply+to it.+**3. Use time-based filtering for performance:**```typescript