Soft-delete + source-count diagnostics; thesis v4 (0.1.0:47)

- DELETE handlers soft-delete (set deleted_at) + cascade contact -> opps/comms/lp
  instead of hard-deleting (guardrail #3); list queries filter deleted rows.
- ingest: chunking excludes soft-deleted records; qdrant delete-by-source-id;
  sync prunes soft-deleted records' vectors incrementally.
- /api/system/status returns raw source-record counts for sanity-checking.
- docs/thesis-seed-v4.md (no "bet" language, scarcity-forward, freedom-tech as
  a banner option, tightened pillars, reworked segments + edge).

Soft-delete verified via the running HTTP server (delete -> hidden + row kept).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Keysat
2026-06-05 12:20:38 -05:00
parent bdf9bec4ff
commit 3c31b1e8a5
8 changed files with 144 additions and 17 deletions
+13
View File
@@ -48,3 +48,16 @@ def upsert(points):
def count():
status, data = _req("POST", f"/collections/{COL}/points/count", {"exact": True})
return (data or {}).get("result", {}).get("count")
def delete_by_source_ids(source_ids):
"""Delete all chunks belonging to the given CRM source records (by payload
source_id) — used to prune soft-deleted records from the index."""
ids = list(source_ids)
if not ids:
return None
status, data = _req("POST", f"/collections/{COL}/points/delete?wait=true",
{"filter": {"must": [{"key": "source_id", "match": {"any": ids}}]}})
if status not in (200, 201):
raise RuntimeError(f"delete points -> {status}: {data}")
return data