From 174e4890dd22b69ef39cfeeaf2421c409e096878 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 6 Mar 2026 10:02:04 +0000
Subject: [PATCH] feat(database): integrate wizard into settings page, improve
accessibility and test coverage
- Add "DB Wizard" link button to settings page header
- Add help_link to database_url SETTING_METADATA pointing to /database-wizard
- Add help_link rendering in settings template for any setting with a help_link
- Fix SQLite whitespace path handling in build_connection_string
- Add dark mode CSS overrides for wizard template
- Add aria-describedby for all form inputs with help text
- Add prefers-reduced-motion media query for smooth scrolling
- Expand test coverage: 106 tests (up from 49)
- db_wizard.py: 100% coverage
- db_wizard view: 100% coverage
- database.py API: 97.37% coverage
- db_migrate.py: 96.60% coverage
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
---
app/utils/db_wizard.py | 4 +-
app/utils/settings_service.py | 4 +-
frontend/templates/db_wizard.html | 30 ++--
frontend/templates/settings.html | 12 ++
tests/test_db_migrate.py | 229 +++++++++++++++++++++++++++++-
tests/test_db_wizard.py | 143 +++++++++++++++++++
tests/test_db_wizard_api.py | 219 ++++++++++++++++++++++++++++
7 files changed, 629 insertions(+), 12 deletions(-)
diff --git a/app/utils/db_wizard.py b/app/utils/db_wizard.py
index c6e83e03..e8d53a89 100644
--- a/app/utils/db_wizard.py
+++ b/app/utils/db_wizard.py
@@ -82,7 +82,9 @@ def build_connection_string(
ValueError: If required fields are missing for the chosen backend.
"""
if backend == "sqlite":
- path = sqlite_path.strip() if sqlite_path else "./app/database.db"
+ path = sqlite_path.strip() if sqlite_path else ""
+ if not path:
+ path = "./app/database.db"
return f"sqlite:///{path}"
# Resolve driver prefix
diff --git a/app/utils/settings_service.py b/app/utils/settings_service.py
index 39f527b6..742a12d6 100644
--- a/app/utils/settings_service.py
+++ b/app/utils/settings_service.py
@@ -23,11 +23,13 @@ SETTING_METADATA = {
# Core Settings
"database_url": {
"category": "Core",
- "description": "Database connection URL (e.g., sqlite:///path/to/db.sqlite)",
+ "description": "Database connection URL (e.g., sqlite:///path/to/db.sqlite). Use the Database Wizard for guided setup.",
"type": "string",
"sensitive": False,
"required": True,
"restart_required": True,
+ "help_link": "/database-wizard",
+ "help_link_label": "Open Database Wizard",
},
"redis_url": {
"category": "Core",
diff --git a/frontend/templates/db_wizard.html b/frontend/templates/db_wizard.html
index 6035f3dd..901f160e 100644
--- a/frontend/templates/db_wizard.html
+++ b/frontend/templates/db_wizard.html
@@ -13,6 +13,14 @@
.migration-table th, .migration-table td { padding: 0.5rem 1rem; text-align: left; }
@keyframes pulse-bar { 0%,100%{opacity:1} 50%{opacity:.5} }
.animate-pulse-bar { animation: pulse-bar 1.5s ease-in-out infinite; }
+ /* Dark mode overrides for db-wizard specific styles */
+ html.dark .from-blue-50 { --tw-gradient-from: #1e3a5f; }
+ html.dark .to-indigo-100 { --tw-gradient-to: #1e1b4b; }
+ html.dark .db-card { background-color: #1f2937; border-color: #374151; }
+ html.dark .db-card:hover { border-color: #818cf8; }
+ html.dark .db-card.selected { border-color: #818cf8; box-shadow: 0 0 0 3px rgba(129,140,248,0.3); }
+ /* Ensure smooth scroll only when user permits */
+ @media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
{% endblock %}
@@ -124,8 +132,9 @@
-
Leave blank to use the default path ./app/database.db.
+ placeholder="./app/database.db"
+ aria-describedby="sqlite_path_help" />
+ Leave blank to use the default path ./app/database.db.
@@ -169,13 +178,14 @@
-
Use require for managed cloud databases (AWS RDS, Supabase, etc.).
+
Use require for managed cloud databases (AWS RDS, Supabase, etc.).
@@ -238,7 +248,7 @@
-