docs(import): record normalizer completion + dry-run results in worklog
Some checks failed
CI / Unit & Component Tests (pull_request) Failing after 1m17s
CI / OCR Service Tests (pull_request) Successful in 19s
CI / Backend Unit Tests (pull_request) Successful in 3m46s
CI / fail2ban Regex (pull_request) Successful in 41s
CI / Semgrep Security Scan (pull_request) Successful in 20s
CI / Compose Bucket Idempotency (pull_request) Successful in 1m1s

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-25 14:56:20 +02:00
parent d314fd9338
commit 7ba3a29592
2 changed files with 49 additions and 1 deletions

View File

@@ -1759,6 +1759,14 @@ def test_write_documents_xlsx_joins_lists(tmp_path):
assert row["receiver_person_ids"] == "a|b"
assert row["needs_review"] == "unparsed_date"
def test_write_documents_xlsx_pins_timestamp(tmp_path):
# determinism (NFR-IDEM-01): workbook created/modified are pinned, not the current time
doc = documents.CanonicalDocument(index="W-0001")
out = tmp_path / "d.xlsx"
writers.write_documents_xlsx([doc], out)
wb = openpyxl.load_workbook(out)
assert (wb.properties.created.year, wb.properties.created.month, wb.properties.created.day) == (2020, 1, 1)
def test_write_review_csv(tmp_path):
out = tmp_path / "r.csv"
writers.write_review_csv(out, ["raw", "count"], [["?", 3], ["x", 1]])
@@ -1835,7 +1843,7 @@ def _join(value):
def _csv_safe(value):
"""Neutralise spreadsheet formula injection (CWE-1236) in human-opened review CSVs."""
s = "" if value is None else str(value)
return "'" + s if s[:1] in ("=", "+", "-", "@", "\t", "\r") else s
return "'" + s if s[:1] in ("=", "+", "-", "@", "\t", "\r", "\n") else s
DOC_COLUMNS = ["index", "box", "folder", "sender_person_id", "sender_name",