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: d9839f9b67
ℹ️ 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".
| except OSError: | ||
| fallback = Path("/tmp/gitplant-data") | ||
| fallback.mkdir(parents=True, exist_ok=True) | ||
| return fallback |
There was a problem hiding this comment.
Don't ignore configured DATA_DIR on mkdir errors
If DATA_DIR is explicitly set but path.mkdir(...) fails (for example, the target is a file path or a mounted volume is not writable at startup), this branch silently falls back to /tmp/gitplant-data and continues. That causes the app to write DB/files to ephemeral storage while operators believe the configured persistent path is in use, which can lead to apparent data loss after restarts. Consider failing fast (or at least surfacing an error) when a user-provided DATA_DIR cannot be created, and reserve fallback for implicit defaults.
Useful? React with 👍 / 👎.
Motivation
OSError: [Errno 30] Read-only file systemon serverless platforms (Vercel) by avoiding creating directories inside the deployed code folder.DATA_DIRenv var while defaulting to a writable location when not provided.Description
_ensure_writable_data_dir(path: Path)to attemptmkdirand fall back to"/tmp/gitplant-data"onOSErrorduring import-time initialization._default_data_dir()(which still honorsDATA_DIRand prefixes relative paths with/tmp) together with the new helper to setDEFAULT_DATA_DIR.DEFAULT_STORAGE_DIRandDEFAULT_PLANT_STORAGE_DIRto live under the resolvedDEFAULT_DATA_DIRinstead of the repositorystoragefolder.Testing
python -m compileall backend/app/config.pywhich completed successfully.python - <<'PY' ... from backend.app.config import DEFAULT_DATA_DIR, DEFAULT_STORAGE_DIR, DEFAULT_PLANT_STORAGE_DIR ... PYwhich printed the resolved/tmp-based paths and succeeded.Codex Task