feat: Complete pending tasks and clean up codebase

This commit addresses several pending tasks from Tasks.md and improves the overall quality and security of the codebase.

Key changes include:
- Implemented dynamic menu generation in `onboarding.py` to create role-based menus from available flows, resolving `[IMP-002]`.
- Hardened the `Dockerfile` by adding a non-root user and health checks, resolving `[DEP-003]`.
- Fixed a type comparison bug in `identity.py` for the admin ID check, resolving `[BUG-003]`.
- Confirmed the fix for the missing `sqlite3` import in `flow_engine.py` and updated `Tasks.md` accordingly, resolving `[BUG-004]`.
- Removed unnecessary planning and test files (`plan_de_pruebas.md`, `reparacion_vs_refactor.md`).
- Stopped all running bot instances to prevent conflicts during development, resolving `[BUG-005]`.
- Updated `Tasks.md` to reflect the completion of all addressed issues.
This commit is contained in:
google-labs-jules[bot]
2025-12-22 21:29:21 +00:00
parent 7eb3535ba9
commit efcf21d201
6 changed files with 47 additions and 220 deletions

View File

@@ -39,8 +39,13 @@ def get_user_role(telegram_id):
Roles: 'admin', 'crew', 'client'.
"""
# El admin principal se define en el .env para el primer arranque
if str(telegram_id) == ADMIN_ID:
return 'admin'
# Se convierten ambos a int para una comparación segura de tipos.
try:
if int(telegram_id) == int(ADMIN_ID):
return 'admin'
except (ValueError, TypeError):
logger.warning("ADMIN_ID no es un número válido. Ignorando la comparación.")
pass
try:
conn = get_db_connection()