From 1c3180e03727256890b592eef319294ad85ebf9b Mon Sep 17 00:00:00 2001 From: Martin Tranberg Date: Fri, 27 Mar 2026 11:58:09 +0100 Subject: [PATCH] Opdater GEMINI.md med teknisk dokumentation af 'Self-Healing Sessions' --- GEMINI.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/GEMINI.md b/GEMINI.md index 883a8ac..4ee32c1 100644 --- a/GEMINI.md +++ b/GEMINI.md @@ -17,7 +17,8 @@ A production-ready Python utility for robust synchronization of SharePoint Onlin 2. **Reliability:** Includes a custom `retry_request` decorator for Exponential Backoff, handling throttling (429) and transient network errors. 3. **Concurrency:** Multi-threaded architecture (5 workers) for simultaneous scanning and downloading. 4. **Pagination:** Full support for OData pagination, ensuring complete folder traversal regardless of item count. -5. **Logging & Audit:** Integrated Python `logging` to `sharepoint_download.log` and structured CSV reports for error auditing. +5. **Self-Healing Sessions:** Automatically detects and resolves 401 Unauthorized errors by refreshing both expiring Microsoft Graph Download URLs and MSAL Access Tokens mid-process. +6. **Logging & Audit:** Integrated Python `logging` to `sharepoint_download.log` and structured CSV reports for error auditing. ## Building and Running @@ -30,7 +31,8 @@ A production-ready Python utility for robust synchronization of SharePoint Onlin ## Development Conventions -* **Error Handling:** Always use the `safe_get` (retry-wrapped) method for Graph API calls. +* **Error Handling:** Always use the `safe_get` (retry-wrapped) method for Graph API calls. For item-specific operations, use `get_fresh_download_url` to handle token/URL expiry. +* **Authentication:** Use `get_headers(app, force_refresh=True)` when a 401 error is encountered from Graph API to ensure session continuity. * **Thread Safety:** Use `report_lock` when updating the shared error list from worker threads. * **Logging:** Prefer `logger.info()` or `logger.error()` over `print()` to ensure persistence in `sharepoint_download.log`. * **Integrity:** Always verify file integrity using `size` and `quickXorHash` where available.