Wrapper health: unused `praisonai/ui/database_config.py` leaves the FORCE_SQLITE escape hatch wired to nothing

オープン
#6,706 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python
領域
backend

調査の方向性

Read src/praisonai/praisonai/ui/database_config.py, its test at src/praisonai/tests/unit/test_database_config.py, and the UI database-selection path. First determine whether FORCE_SQLITE is still intended, then either remove the unused module and smoke script or wire the override into the selection path and add asserting tests. Done means the chosen behavior is connected or the dead code is removed, with tests matching that decision.

索引モデルが issue の本文から書いたものです。

説明

claude origin/outsider

Summary

src/praisonai/praisonai/ui/database_config.py (56 lines) is a self-contained helper module with no production consumers anywhere in the monorepo. Its three functions implement a FORCE_SQLITE environment-variable override for UI database selection, but nothing in praisonai, praisonai-code or praisonai-bot ever calls them — so the FORCE_SQLITE escape hatch is implemented but not connected to any code path.

This is a lightweight wrapper-health cleanup, not a feature cut: either the module is dead code to be removed, or the FORCE_SQLITE override it was meant to provide has regressed and should be re-wired.

Current behaviour

  • src/praisonai/praisonai/ui/database_config.py defines should_force_sqlite(), get_database_url_with_sqlite_override() and get_database_config_for_sqlalchemy() (database_config.py:12, :22, :40).
  • The token FORCE_SQLITE and all three function names appear in exactly two files across src/: this module and its own test src/praisonai/tests/unit/test_database_config.py. There are zero other references (verified by repository-wide grep, including dynamic/string import paths).
  • src/praisonai/tests/unit/test_database_config.py is a print()-based __main__ smoke script with no assertions, so it pins no behaviour (it is not a guard/ratchet test).
  • Context: the FORCE_SQLITE helper appears to originate from the fix for #335 ("Database Conflict When PraisonAI Detects Supabase/Postgres", now closed). In the current tree the override logic is no longer invoked, so a user setting FORCE_SQLITE=true to avoid Supabase/Postgres auto-detection would see no effect from this module.

Why it matters

  • Maintenance / duplication clarity: ~56 lines of public-looking utility (praisonai.ui.database_config) carried with no caller invites confusion and accidental re-use of a dead path.
  • Possible silent capability regression: if the FORCE_SQLITE escape hatch from #335 is still intended, it currently does nothing — worth a maintainer decision rather than leaving it ambiguous.

No import or hot-path cost (the module is never imported at runtime); the concern is purely structural.

Category

Dead code (with a possible regressed-feature angle)

Capability preserved

  • No CLI command, YAML path, or Python API is removed. praisonai.ui.database_config has no live consumers, so removing it (or wiring it in) changes nothing user-facing today.
  • If the maintainer intent is to keep the FORCE_SQLITE behaviour, the fix is to re-wire it into the UI DB-resolution path rather than remove it — preserving the intended #335 escape hatch.

Proposed approach

Pick one, based on whether the FORCE_SQLITE override is still desired:

  • If the override is obsolete: remove ui/database_config.py together with its non-asserting tests/unit/test_database_config.py (nothing else references either).
  • If the override is still wanted: call should_force_sqlite() / get_database_url_with_sqlite_override() from the actual UI database-selection code and replace the print-script with a real asserting unit test.

Either way the change is small and non-breaking.

Resolution sketch

# Option A — remove dead module + its non-test script (no consumers):
#   git rm src/praisonai/praisonai/ui/database_config.py
#   git rm src/praisonai/tests/unit/test_database_config.py

# Option B — if FORCE_SQLITE should stay live, wire it where the UI DB URL is resolved:
from praisonai.ui.database_config import get_database_url_with_sqlite_override

database_url = get_database_url_with_sqlite_override()  # None => fall back to SQLite
# ...and add an asserting test (assert should_force_sqlite() is True when FORCE_SQLITE=true)

Layer placement

  • Primary layer: wrapper (praisonai/ui/)
  • Touches core/tools/plugins: none
  • 3-way surface (CLI + YAML + Python): not applicable — internal utility with no exposed surface; preserved either way

Severity

Low — isolated, zero-consumer module; cleanup or a small re-wire, no blast radius.

Validation

  • Repository-wide grep: FORCE_SQLITE, should_force_sqlite, get_database_url_with_sqlite_override, get_database_config_for_sqlalchemy resolve only to the module and its own test.
  • The test contains no assertions, so it encodes no decision to preserve.
  • Not import-time or hot-path code; no runtime regression from either option.

Keep unchanged

  • praisonai/storage/ adapters (PostgreSQLStorageAdapter, DynamoDBStorageAdapter, etc.) — these are load-bearing: praisonaiagents/storage/backends.py maps them by string to praisonai.storage. Do not treat them as dead.
  • praisonai/persistence/ factory and state adapters — config-gated, lazily imported.
  • All back-compat shims (bots, gateway, deploy, cli/*) and the integration/ (UI host bootstrap + bridges) vs integrations/ (managed-agent/CLI backends) split — distinct concerns, both canonical.
主要言語
Python
スター
9.3k
フォーク
1.5k
平均マージ
1日 5時間
マージ済み PR(30日)
520

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

MervinPraison/PraisonAI のほかの issue

MervinPraison/PraisonAI の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。