Problem
DownloadService (py_modules/services/downloads.py) performs direct file I/O operations that belong in the adapter layer:
- ZIP extraction (
zipfile.ZipFile, extractall())
- File cleanup (
os.remove(), shutil.rmtree())
- Disk space checks (
shutil.disk_usage())
- M3U file generation (
open(), write)
- File replacement (
os.replace(), os.makedirs())
- Temp file handling
This violates the architecture rule that services should not do I/O directly — I/O belongs in the adapter layer.
Proposed solution
Create a RomFileAdapter (or similar) that handles local ROM file operations:
extract_zip(archive_path, dest_dir) -> list[str]
disk_free(path) -> int
write_m3u(path, entries: list[str])
remove_file(path) / remove_dir(path)
replace_file(src, dest)
Define a Protocol in services/protocols.py. Inject via bootstrap.py.
Priority
Low — architecture hygiene. No functional bugs.
Discovered during
Architecture validation audit during #197 Block 1 (slot deletion).
Problem
DownloadService(py_modules/services/downloads.py) performs direct file I/O operations that belong in the adapter layer:zipfile.ZipFile,extractall())os.remove(),shutil.rmtree())shutil.disk_usage())open(), write)os.replace(),os.makedirs())This violates the architecture rule that services should not do I/O directly — I/O belongs in the adapter layer.
Proposed solution
Create a
RomFileAdapter(or similar) that handles local ROM file operations:extract_zip(archive_path, dest_dir) -> list[str]disk_free(path) -> intwrite_m3u(path, entries: list[str])remove_file(path)/remove_dir(path)replace_file(src, dest)Define a Protocol in
services/protocols.py. Inject viabootstrap.py.Priority
Low — architecture hygiene. No functional bugs.
Discovered during
Architecture validation audit during #197 Block 1 (slot deletion).