[PR #337] [MERGED] Reduce path sensitivity in file-storage logging #305

Closed
opened 2026-03-02 23:35:03 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/AJaySi/ALwrity/pull/337
Author: @AJaySi
Created: 2/10/2026
Status: Merged
Merged: 2/11/2026
Merged by: @AJaySi

Base: mainHead: codex/reduce-path-sensitivity-in-file-storage-logging


📝 Commits (1)

  • 2124f38 Reduce path sensitivity in file storage logs

📊 Changes

1 file changed (+55 additions, -8 deletions)

View changed files

📝 backend/utils/file_storage.py (+55 -8)

📄 Description

Motivation

  • Avoid exposing absolute host-specific paths in logs while preserving useful debugging metadata such as operation context and byte/char sizes.

Description

  • Added module logging policy to the docstring that mandates workspace-relative or filename-only logging and keeping operation/size metadata.
  • Introduced _resolve_workspace_root() and _safe_log_path() helpers that resolve a workspace root from ALWRITY_WORKSPACE_ROOT or WORKSPACE_ROOT (falling back to Path.cwd()) and return a workspace-relative path or filename-only fallback.
  • Replaced full-path messages in ensure_directory_exists(), save_file_safely(), and save_text_file_safely() with safe representations via _safe_log_path() and preserved bytes, chars, and operation context in structured log messages.
  • Adjusted returned error messages for directory creation and save failures to use the safe path representation instead of absolute paths.

Testing

  • Ran python -m py_compile backend/utils/file_storage.py to verify syntax and it succeeded.

Codex Task


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/AJaySi/ALwrity/pull/337 **Author:** [@AJaySi](https://github.com/AJaySi) **Created:** 2/10/2026 **Status:** ✅ Merged **Merged:** 2/11/2026 **Merged by:** [@AJaySi](https://github.com/AJaySi) **Base:** `main` ← **Head:** `codex/reduce-path-sensitivity-in-file-storage-logging` --- ### 📝 Commits (1) - [`2124f38`](https://github.com/AJaySi/ALwrity/commit/2124f386f7a41b5b832c64cff1a6cada47bedeb6) Reduce path sensitivity in file storage logs ### 📊 Changes **1 file changed** (+55 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `backend/utils/file_storage.py` (+55 -8) </details> ### 📄 Description ### Motivation - Avoid exposing absolute host-specific paths in logs while preserving useful debugging metadata such as operation context and byte/char sizes. ### Description - Added module logging policy to the docstring that mandates workspace-relative or filename-only logging and keeping operation/size metadata. - Introduced `_resolve_workspace_root()` and `_safe_log_path()` helpers that resolve a workspace root from `ALWRITY_WORKSPACE_ROOT` or `WORKSPACE_ROOT` (falling back to `Path.cwd()`) and return a workspace-relative path or filename-only fallback. - Replaced full-path messages in `ensure_directory_exists()`, `save_file_safely()`, and `save_text_file_safely()` with safe representations via `_safe_log_path()` and preserved `bytes`, `chars`, and `operation` context in structured log messages. - Adjusted returned error messages for directory creation and save failures to use the safe path representation instead of absolute paths. ### Testing - Ran `python -m py_compile backend/utils/file_storage.py` to verify syntax and it succeeded. ------ [Codex Task](https://chatgpt.com/codex/tasks/task_e_698b46095ee88328854841ac8fdb9d82) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 23:35:03 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ALwrity#305
No description provided.