[PR #10814] [CLOSED] chore: Improve type safety and add type hints, fix two race conditions #9396

Closed
opened 2025-11-11 18:21:32 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/10814
Author: @tidely
Created: 2/26/2025
Status: Closed

Base: devHead: cleanup


📝 Commits (10+)

  • 101405f Fix search results being possibly unbound
  • 3f455fe Better locals() lookup
  • fcf213d Use logging.getLevelNamesMapping
  • 9aa144a Remove unnecessary str conversion
  • 44f063b Add string conversion to satisfy typehints
  • 6faf744 Fix error prone code
  • 1b83874 Add get_from_env_or_default
  • f9642b2 Improve type hints for process_line
  • 1e15972 Improve config.json migration
  • 46b5b67 Fix type hint for user

📊 Changes

5 files changed (+66 additions, -92 deletions)

View changed files

📝 backend/open_webui/config.py (+6 -8)
📝 backend/open_webui/env.py (+28 -50)
📝 backend/open_webui/functions.py (+9 -9)
📝 backend/open_webui/retrieval/utils.py (+21 -25)
📝 backend/open_webui/retrieval/web/duckduckgo.py (+2 -0)

📄 Description

Changelog Entry

General code improvements
Removed two time-of-check to time-of-use (TOCTOU) race conditions.

Description

The goal of this PR is to implement stricter type checks and add type hints to improve maintainability.
These changes should have minimal functional changes. Additionally some time-of-check to time-of-use (TOCTOU) race conditions have been removed.

Fixed

time-of-check to time-of-use (TOCTOU) race conditions have been removed. These do not have open issues so I can't link any here.

Breaking Changes

This PR should have no breaking changes.


🔄 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/open-webui/open-webui/pull/10814 **Author:** [@tidely](https://github.com/tidely) **Created:** 2/26/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `cleanup` --- ### 📝 Commits (10+) - [`101405f`](https://github.com/open-webui/open-webui/commit/101405f92a85b8e2238ca74e7f6eb8272f1b2602) Fix search results being possibly unbound - [`3f455fe`](https://github.com/open-webui/open-webui/commit/3f455feb7cb20327b450ba838242c8697860cd9f) Better locals() lookup - [`fcf213d`](https://github.com/open-webui/open-webui/commit/fcf213dbcce8c8f8246eb3f0c49df67c2ea7cf84) Use logging.getLevelNamesMapping - [`9aa144a`](https://github.com/open-webui/open-webui/commit/9aa144a47267fa6f0f8dd2e1fd9c0603b2ae84b3) Remove unnecessary str conversion - [`44f063b`](https://github.com/open-webui/open-webui/commit/44f063b32686c09e8789f6678e68cf77b8f23120) Add string conversion to satisfy typehints - [`6faf744`](https://github.com/open-webui/open-webui/commit/6faf744379fba0ce7fe275b3045a025ef1f3a5fe) Fix error prone code - [`1b83874`](https://github.com/open-webui/open-webui/commit/1b838746d9ea18b800c71fdabfeb2113e797a080) Add get_from_env_or_default - [`f9642b2`](https://github.com/open-webui/open-webui/commit/f9642b2bc6e5361b21d1ac497831a6e7d825d40c) Improve type hints for process_line - [`1e15972`](https://github.com/open-webui/open-webui/commit/1e15972f4a77c4067e713587df102dff4865065f) Improve config.json migration - [`46b5b67`](https://github.com/open-webui/open-webui/commit/46b5b67f3c78b11b6ca3f6cca7cdd96d90f261af) Fix type hint for user ### 📊 Changes **5 files changed** (+66 additions, -92 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/config.py` (+6 -8) 📝 `backend/open_webui/env.py` (+28 -50) 📝 `backend/open_webui/functions.py` (+9 -9) 📝 `backend/open_webui/retrieval/utils.py` (+21 -25) 📝 `backend/open_webui/retrieval/web/duckduckgo.py` (+2 -0) </details> ### 📄 Description # Changelog Entry General code improvements Removed two time-of-check to time-of-use (TOCTOU) race conditions. ### Description The goal of this PR is to implement stricter type checks and add type hints to improve maintainability. These changes should have minimal functional changes. Additionally some time-of-check to time-of-use (TOCTOU) race conditions have been removed. ### Fixed time-of-check to time-of-use (TOCTOU) race conditions have been removed. These do not have open issues so I can't link any here. ### Breaking Changes This PR should have no breaking changes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-11 18:21:32 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#9396