Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8e66a4aec7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| # Vercel serverless functions run on a read-only filesystem except for /tmp. | ||
| DEFAULT_DATA_DIR = _ensure_writable_data_dir(_default_data_dir()) | ||
| DEFAULT_DATA_DIR = get_data_dir() |
There was a problem hiding this comment.
Keep writable fallback when deriving DEFAULT_DATABASE_URL
Assigning DEFAULT_DATA_DIR = get_data_dir() removes the previous writability fallback at config load, so when DATA_DIR points to a read-only or non-creatable path (e.g. serverless filesystems outside /tmp), settings.database_url is built with that unwritable location and startup now fails in init_db() when creating the SQLite parent directory. This is a regression from the prior behavior that transparently fell back to /tmp/gitplant-data; the default DB path should still be derived from a writable directory.
Useful? React with 👍 / 👎.
Motivation
/tmp.DATA_DIRenvironment variable or falling back to/tmp/gitplant-data.Description
_default_data_dir()with a pure resolverget_data_dir()and addensure_data_dir()to performmkdir()only at runtime. (backend/app/config.py)DEFAULT_DATA_DIRat import time by assigning it toget_data_dir()instead of invoking a mkdir helper. (backend/app/config.py)ensure_existsoption toget_document_storage_path()andget_plant_storage_path()so callers can resolve paths without causing writes, and make these helpers create directories only when requested. (backend/app/config.py)init_db()so importingapp.dbno longer writes to disk. (backend/app/db.py)mkdir()inprojectsrouter and introduceensure_working_storage_dir()that is called only at upload time. (backend/app/routers/projects.py)documentsrouter to avoid import-time directory creation by usingget_document_storage_path(ensure_exists=False)at module level and callingget_document_storage_path()at write time. (backend/app/routers/documents.py)Testing
cd backend && pytest -q, which completed successfully with18 passed.cd backend && python -c "import app.config, app.db, app.routers.documents, app.routers.projects; print('import-ok')", which printedimport-ok.Codex Task