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

Abierto
#6,706 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Refactorización
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
python
Área
backend

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
Lenguaje dominante
Python
Estrellas
9.3k
Forks
1.5k
Merge medio
1 d 5 h
PR fusionados (30 d)
520

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de MervinPraison/PraisonAI

Todos los issues de MervinPraison/PraisonAI

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.