Verhindere fehlende Anlagen im Übergabepaket und benenne sie nach Titel.
Deploy Development / deploy (push) Successful in 30s
Test Suite / pytest-backend (push) Failing after 1m40s
Test Suite / smoke-dev (push) Successful in 0s
Test Suite / frontend-build (push) Successful in 8s

Anlagen erscheinen unter dem Anzeigenamen statt nur technischem Dateinamen; fehlende Freigabe, Auswahl oder Ausgabe wird in der Prüfung gemeldet statt still wegzulassen.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-10-18 14:43:48 +02:00
1 parent 8b74e63417
commit ea28c4f246
3 files changed
+167 -6

No files matched your search

+94 -2
View File
@@ -235,7 +235,9 @@ def _plan(conn, actor, matter_id, context, selected, assignments, media_root) ->
if isinstance(result, MailPayload):
notices.extend(_retention_notices(node, result, hashes))
notices.extend(_bundle_notices(root, chosen))
notices.extend(_correspondence_export_notices(root, chosen))
issues.extend(_reference_issues(conn, actor, page, leaves))
issues.extend(_attachment_load_issues(root, chosen, loaded))
generated = dump_dt(utcnow()) or ""
if issues:
entries = [
@@ -244,6 +246,21 @@ def _plan(conn, actor, matter_id, context, selected, assignments, media_root) ->
]
return ExportPlan(matter["title"], generated, False, issues, notices, entries, [], root)
files, entries = _layout(root, chosen, loaded, notices, generated)
emit_issues = _attachment_emit_issues(root, chosen, loaded, entries)
if emit_issues:
return ExportPlan(
matter["title"],
generated,
False,
emit_issues,
notices,
[
Entry(node.id, node.title, _label(node), None, [], node.dates or {}, node.direction, node.summary, None, [], _recorded(node))
for node in leaves
],
[],
root,
)
_attach_replies(conn, actor, page, entries, leaves)
_stitch_replies(files, entries)
files = _with_overview(matter["title"], generated, entries, files)
@@ -684,8 +701,83 @@ def _emit_one(node, prefix, add, entries, loaded, notice_for, generated: str) ->
entries.append(_entry(node, reading, [("Gesicherter Text", path), ("Lesefassung", reading)], notice or None))
return
if isinstance(payload, FilePayload):
path = add(prefix + [payload.filename], payload.data)
entries.append(_entry(node, path, [(payload.filename, path)], notice or None))
name = _handover_filename(node, payload.filename)
path = add(prefix + [name], payload.data)
entries.append(_entry(node, path, [(name, path)], notice or None))
def _correspondence_export_notices(root: ExportNode, chosen: set[str]) -> list[Notice]:
notices: list[Notice] = []
for node in _walk(root):
if node.kind != "binding":
continue
attachments = [child for child in node.children if child.kind == "attachment"]
if not attachments:
continue
blocked = [child for child in attachments if not child.exportable]
if blocked:
sample = blocked[0]
count = len(blocked)
word = "Anlage ist" if count == 1 else f"{count} Anlagen sind"
notices.append(
Notice(
sample.id,
f"{word} dem Schreiben zugeordnet, aber für die Übergabe nicht freigegeben. "
"Sie erscheinen in der Auswahl nicht und fehlen im Paket.",
)
)
if node.id not in chosen:
continue
missing = [child for child in attachments if child.exportable and child.id not in chosen]
if missing:
sample = missing[0]
count = len(missing)
word = "Anlage ist" if count == 1 else f"{count} Anlagen sind"
notices.append(
Notice(
sample.id,
f"{word} dem Schreiben zugeordnet, aber nicht ausgewählt. Die Ausgabe ist unvollständig.",
)
)
return notices
def _attachment_load_issues(root: ExportNode, chosen: set[str], loaded: dict) -> list[Issue]:
issues: list[Issue] = []
for node in _walk(root):
if node.kind != "attachment" or node.id not in chosen or not node.exportable:
continue
if node.id not in loaded:
issues.append(
Issue(
node.id,
node.title,
"missing",
"Die zugeordnete Anlage konnte nicht für die Ausgabe geladen werden.",
)
)
return issues
def _attachment_emit_issues(root: ExportNode, chosen: set[str], loaded: dict, entries: list[Entry]) -> list[Issue]:
emitted = {entry.node_id for entry in entries}
issues: list[Issue] = []
for node in _walk(root):
if node.kind != "attachment" or node.id not in chosen or not node.exportable:
continue
if node.id not in loaded:
continue
if node.id in emitted:
continue
issues.append(
Issue(
node.id,
node.title,
"missing",
"Die ausgewählte Anlage fehlt in der erzeugten Paketstruktur.",
)
)
return issues
def _json_note(data: bytes) -> str: