The actual request was simple (store exports in R2 like source files, pending a retention-duration decision), but investigating where exports were written surfaced something worse: /api/process built and saved a full workbook to disk on EVERY extraction, and nothing in the frontend ever called /api/download/<filename> to retrieve it (confirmed by grep - no reference anywhere). Every extraction was silently orphaning an .xlsx file for no reason; 91 had already accumulated locally from this session's own testing alone. Removed the dead work entirely: /api/process no longer builds or saves a workbook at all. /api/download/<filename>, file_repository. save_workbook/resolve_output_path, and OUTPUT_FOLDER (env var, volume, directory) are all gone - confirmed nothing else referenced any of them before removing. outputs/ deleted, including its 91 accumulated files. /api/export (the only path actually used - Download Excel/All) now builds the workbook into an in-memory BytesIO and streams it straight from there - never touches disk, not even temporarily. The frontend persists it long-term instead: documentsService.saveExportFile uploads the same Blob the browser download already used to a new exportFile field (pb_migrations/3_add_export_file.js), stored in R2 same as sourceFile. Overwrites the previous export rather than keeping a history - no retention policy has been decided yet, and keeping every version would just relocate the same unbounded-growth problem from the VPS to R2 instead of fixing it. Best-effort from ResultCard.vue - a save failure is reported but never blocks the browser download itself. Verified for real: /api/process's response no longer has `filename` (title still does); /api/export still streams a valid, correctly-typed .xlsx; /app/outputs no longer exists in the rebuilt container; the old /api/download URL now falls through to the ordinary SPA catch-all, not a leftover route. documentsService.saveExportFile run against the REAL bytes /api/export produced, fetched back through the R2-backed URL, confirmed byte-for-byte - and confirmed a second export overwrites rather than creating a second record. measure.py unaffected; npm run build passes. |
||
|---|---|---|
| .. | ||
| .vscode | ||
| public | ||
| src | ||
| .gitignore | ||
| README.md | ||
| index.html | ||
| package-lock.json | ||
| package.json | ||
| vite.config.js | ||
README.md
Vue 3 + Vite
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 <script setup> SFCs, check out the script setup docs to learn more.
Learn more about IDE Support for Vue in the Vue Docs Scaling up Guide.