Opdater GEMINI.md med teknisk dokumentation af 'Self-Healing Sessions'

This commit is contained in:
Martin Tranberg
2026-03-27 11:58:09 +01:00
parent 6bc4dd8f20
commit 1c3180e037

View File

@@ -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.