Stage A of review fixes: single read snapshot, redacted /health, batched diff

/addresses reads the cursor and data in one session and one snapshot,
/health exposes only time and backup file name of the last restore,
get_changes checks presence in batches instead of per value (6.8 s -> 88 ms
on a 12k-entry journal). Adds the plan for review fixes 5-10.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
ayurishchevandClaude Sonnet 5 committed 2026-09-21 10:06:31 +03:00
1 parent 0155fd3f38
commit d6b69d0842
6 files changed
+103 -33

No files matched your search

+13
View File
@@ -132,3 +132,16 @@ def test_recreated_database_is_withheld(env):
db.settle_recreated(conn)
assert env.get("/addresses").json() == ["1.0.0.0/24"]
assert env.get("/health").json()["db_recreated"] is None
def test_health_hides_internal_paths(env):
save_json_atomic(cc.RESTORE_FILE, {"at": "2026-09-21T10:00:00", "backup": "/data/backups/ripe-20260921T100000Z.db",
"quarantine": "/data/ripe.db.corrupt-1", "error": "file is not a database"})
# Наружу - время и имя файла копии, без каталогов, карантина и текста ошибки
assert env.get("/health").json()["last_restore"] == {"at": "2026-09-21T10:00:00",
"backup": "ripe-20260921T100000Z.db"}
assert json_dump_has_no_paths(env.get("/health").text)
def json_dump_has_no_paths(text):
return "/data" not in text and "corrupt" not in text and "not a database" not in text