fix: purge all old staging path references — full code review cleanup

Bugs found and fixed:
- converter.py: STAGING_IN.iterdir() → extract_base.iterdir()
  (checked wrong dir when source was in session subdir)
- vm-bench.service: TMPDIR=/mnt/converter/in → /mnt/converter/tmp
  (old path poisoned all temp file writes)
- backend/app.py: removed unused STAGING_IN constant
- converter.py: removed unused STAGING_OUT constant
- install.sh: removed creation of old /in and /out dirs
This commit is contained in:
Claus Lohmar 2026-07-23 10:36:03 +00:00
parent 1b145adea7
commit 6617aca341
4 changed files with 2 additions and 6 deletions

View file

@ -54,7 +54,6 @@ logger.info("Backend starting — log file: %s", LOG_DIR / "vm-bench-backend.log
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Constants # Constants
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
STAGING_IN = "/mnt/converter/in"
API_PREFIX = "/api/v1" API_PREFIX = "/api/v1"
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------

View file

@ -17,7 +17,6 @@ from typing import Optional
STAGING_ROOT = Path("/mnt/converter/tmp") STAGING_ROOT = Path("/mnt/converter/tmp")
STAGING_IN = STAGING_ROOT / "in" STAGING_IN = STAGING_ROOT / "in"
STAGING_OUT = STAGING_ROOT / "out"
logger = logging.getLogger("backend.converter") logger = logging.getLogger("backend.converter")
@ -108,7 +107,7 @@ def extract_if_needed(filename: str) -> Path:
raise RuntimeError(f"{tool} failed: {result.stderr.strip()[:500]}") raise RuntimeError(f"{tool} failed: {result.stderr.strip()[:500]}")
# Determine what was created # Determine what was created
after = set(STAGING_IN.iterdir()) after = set(extract_base.iterdir())
new_items = after - before new_items = after - before
# If the archive had a single top-level directory matching the stem, use it # If the archive had a single top-level directory matching the stem, use it

View file

@ -58,8 +58,6 @@ echo "[1/6] Creating directory structure..."
for d in \ for d in \
"$CONVERTER_ROOT" \ "$CONVERTER_ROOT" \
"$CONVERTER_ROOT/in" \
"$CONVERTER_ROOT/out" \
"$CONVERTER_ROOT/logs" \ "$CONVERTER_ROOT/logs" \
"$CONVERTER_ROOT/tmp" \ "$CONVERTER_ROOT/tmp" \
"$CONVERTER_ROOT/backend" \ "$CONVERTER_ROOT/backend" \

View file

@ -8,7 +8,7 @@ User=root
WorkingDirectory=/mnt/converter/frontend WorkingDirectory=/mnt/converter/frontend
Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Environment=BACKEND_URL=http://10.2.0.2:9000 Environment=BACKEND_URL=http://10.2.0.2:9000
Environment=TMPDIR=/mnt/converter/in Environment=TMPDIR=/mnt/converter/tmp
ExecStart=/usr/bin/python3 -m uvicorn app:app --host 0.0.0.0 --port 5000 --timeout-keep-alive 300 ExecStart=/usr/bin/python3 -m uvicorn app:app --host 0.0.0.0 --port 5000 --timeout-keep-alive 300
Restart=always Restart=always
RestartSec=3 RestartSec=3