[Audit] Refactor files transfer and campaign-usage complexity hotspots #29

Closed
opened 2026-07-13 20:11:15 +02:00 by zemion · 1 comment
Owner

Xenon flags files backend blocks above the configured complexity threshold.

Source report: /mnt/DATA/git/govoplan/audit-reports/govoplan-full-20260713-1949/xenon.txt

Hotspots include:

  • src/govoplan_files/backend/storage/campaign_usage.py:118 record_campaign_attachment_uses_for_jobs rank F
  • src/govoplan_files/backend/storage/transfers.py:50 transfer_selection rank F
  • src/govoplan_files/backend/storage/transfers.py:425 _rename_selection rank F
  • src/govoplan_files/backend/router.py delta/list response helpers rank D

Acceptance criteria:

  • Extract transfer planning, validation, and execution branches into focused helpers.
  • Preserve connector behavior and existing smoke checks.
  • Keep campaign integration boundaries explicit.
<!-- codex-security-audit-fingerprint:security-audit-20260713-files-complexity --> Xenon flags files backend blocks above the configured complexity threshold. Source report: `/mnt/DATA/git/govoplan/audit-reports/govoplan-full-20260713-1949/xenon.txt` Hotspots include: - `src/govoplan_files/backend/storage/campaign_usage.py:118 record_campaign_attachment_uses_for_jobs` rank F - `src/govoplan_files/backend/storage/transfers.py:50 transfer_selection` rank F - `src/govoplan_files/backend/storage/transfers.py:425 _rename_selection` rank F - `src/govoplan_files/backend/router.py` delta/list response helpers rank D Acceptance criteria: - Extract transfer planning, validation, and execution branches into focused helpers. - Preserve connector behavior and existing smoke checks. - Keep campaign integration boundaries explicit.
Author
Owner

Codex State: done

Summary

  • Refactored files transfer, rename, and campaign attachment usage hotspots into focused phases.

Changed Files

  • transfer_selection now separates target planning, conflict resolution, folder hierarchy creation, asset copy/move, and folder record application; _rename_selection now separates asset collection, folder scope collection, folder/file plan building, validation, plan item creation, and application; record_campaign_attachment_uses_for_jobs now separates attachment partitioning, managed entity loading, managed use recording, and legacy fallback recording.

Verification

  • py_compile for transfers.py and campaign_usage.py; git diff --check for touched files; PYTHONPATH=/mnt/DATA/git/govoplan-files/src:/mnt/DATA/git/govoplan-core/src python -m unittest tests.test_transfer_helpers (4 tests OK); full files unittest discovery (14 tests OK).

Next / Blocked

  • Rerun the full audit battery after rebuild to confirm Xenon ranks; connector smoke was not rerun because connector code was not changed in this slice.
## Codex State: done ### Summary - Refactored files transfer, rename, and campaign attachment usage hotspots into focused phases. ### Changed Files - `transfer_selection now separates target planning, conflict resolution, folder hierarchy creation, asset copy/move, and folder record application; _rename_selection now separates asset collection, folder scope collection, folder/file plan building, validation, plan item creation, and application; record_campaign_attachment_uses_for_jobs now separates attachment partitioning, managed entity loading, managed use recording, and legacy fallback recording.` ### Verification - `py_compile for transfers.py and campaign_usage.py; git diff --check for touched files; PYTHONPATH=/mnt/DATA/git/govoplan-files/src:/mnt/DATA/git/govoplan-core/src python -m unittest tests.test_transfer_helpers (4 tests OK); full files unittest discovery (14 tests OK).` ### Next / Blocked - Rerun the full audit battery after rebuild to confirm Xenon ranks; connector smoke was not rerun because connector code was not changed in this slice.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: add-ideas/govoplan-files#29
No description provided.