From dd0a34a138269d6526f969a26fff93315c9b0f58 Mon Sep 17 00:00:00 2001 From: Auto Date: Mon, 26 Jan 2026 16:30:59 +0200 Subject: [PATCH] fix: address PR #93 review issues - Remove translate-x/translate-y CSS selectors that broke layout utilities (AssistantPanel slide animation, DebugLogViewer resize handle) - Add browser validation to get_playwright_browser() with warning for invalid values (matches get_playwright_headless() behavior) - Remove phantom SQLite documentation from CUSTOM_UPDATES.md that described features not present in PR #93 - Update checklist and revert instructions to match actual changes Co-Authored-By: Claude Opus 4.5 --- CUSTOM_UPDATES.md | 110 ++------------------------------- client.py | 12 +++- ui/src/styles/custom-theme.css | 5 +- 3 files changed, 18 insertions(+), 109 deletions(-) diff --git a/CUSTOM_UPDATES.md b/CUSTOM_UPDATES.md index 9a3bd4e..f211696 100644 --- a/CUSTOM_UPDATES.md +++ b/CUSTOM_UPDATES.md @@ -8,8 +8,7 @@ This document tracks all customizations made to AutoCoder that deviate from the 1. [UI Theme Customization](#1-ui-theme-customization) 2. [Playwright Browser Configuration](#2-playwright-browser-configuration) -3. [SQLite Robust Connection Handling](#3-sqlite-robust-connection-handling) -4. [Update Checklist](#update-checklist) +3. [Update Checklist](#update-checklist) --- @@ -175,95 +174,7 @@ playwright_args = [ --- -## 3. SQLite Robust Connection Handling - -### Overview - -Added robust SQLite connection handling to prevent database corruption from concurrent access (MCP server, FastAPI server, progress tracking). - -**Features Added:** -- WAL mode for better concurrency -- Busy timeout (30 seconds) -- Retry logic with exponential backoff -- Database health check endpoint - -### Modified Files - -#### `api/database.py` - -**New functions added:** - -```python -def get_robust_connection(db_path: str) -> sqlite3.Connection: - """ - Create a SQLite connection with robust settings: - - WAL mode for concurrent access - - 30 second busy timeout - - Foreign keys enabled - """ - -@contextmanager -def robust_db_connection(db_path: str): - """Context manager for robust database connections.""" - -def execute_with_retry(conn, sql, params=None, max_retries=3): - """Execute SQL with exponential backoff retry for transient errors.""" - -def check_database_health(db_path: str) -> dict: - """ - Check database integrity and return health status. - Returns: {healthy: bool, message: str, details: dict} - """ -``` - ---- - -#### `progress.py` - -**Changed from raw sqlite3 to robust connections:** - -```python -# BEFORE: -conn = sqlite3.connect(db_path) - -# AFTER: -from api.database import robust_db_connection, execute_with_retry - -with robust_db_connection(db_path) as conn: - execute_with_retry(conn, sql, params) -``` - ---- - -#### `server/routers/projects.py` - -**New endpoint added:** - -```python -@router.get("/{project_name}/db-health") -async def get_database_health(project_name: str) -> DatabaseHealth: - """ - Check the health of the project's features database. - Useful for diagnosing corruption issues. - """ -``` - ---- - -#### `server/schemas.py` - -**New schema added:** - -```python -class DatabaseHealth(BaseModel): - healthy: bool - message: str - details: dict = {} -``` - ---- - -## Update Checklist +## 3. Update Checklist When updating AutoCoder from upstream, verify these items: @@ -276,13 +187,8 @@ When updating AutoCoder from upstream, verify these items: ### Backend Changes - [ ] `client.py` - Playwright browser/headless defaults preserved - [ ] `.env.example` - Documentation updates preserved -- [ ] `api/database.py` - Robust connection functions preserved -- [ ] `progress.py` - Uses robust_db_connection -- [ ] `server/routers/projects.py` - db-health endpoint preserved -- [ ] `server/schemas.py` - DatabaseHealth schema preserved ### General -- [ ] Test database operations under concurrent load - [ ] Verify Playwright uses Firefox by default - [ ] Check that browser runs headless by default @@ -299,8 +205,7 @@ cd ui && npm run build ### Backend Only ```bash -git checkout client.py .env.example api/database.py progress.py -git checkout server/routers/projects.py server/schemas.py +git checkout client.py .env.example ``` --- @@ -311,18 +216,13 @@ git checkout server/routers/projects.py server/schemas.py |------|------|-------------------| | `ui/src/styles/custom-theme.css` | UI | Twitter-style theme | | `ui/src/components/KanbanColumn.tsx` | UI | Themeable kanban columns | +| `ui/src/main.tsx` | UI | Imports custom theme | | `client.py` | Backend | Firefox + headless defaults | | `.env.example` | Config | Updated documentation | -| `api/database.py` | Backend | Robust SQLite connections | -| `progress.py` | Backend | Uses robust connections | -| `server/routers/projects.py` | Backend | db-health endpoint | -| `server/schemas.py` | Backend | DatabaseHealth schema | --- ## Last Updated **Date:** January 2026 -**Commits:** -- `1910b96` - SQLite robust connection handling -- `e014b04` - Custom theme override system +**PR:** #93 - Twitter-style UI theme with custom theme override system diff --git a/client.py b/client.py index 80573a9..7ea04a5 100644 --- a/client.py +++ b/client.py @@ -59,6 +59,10 @@ def get_playwright_headless() -> bool: return value in truthy +# Valid browsers supported by Playwright MCP +VALID_PLAYWRIGHT_BROWSERS = {"chrome", "firefox", "webkit", "msedge"} + + def get_playwright_browser() -> str: """ Get the browser to use for Playwright. @@ -67,7 +71,13 @@ def get_playwright_browser() -> str: Options: chrome, firefox, webkit, msedge Firefox is recommended for lower CPU usage. """ - return os.getenv("PLAYWRIGHT_BROWSER", DEFAULT_PLAYWRIGHT_BROWSER).lower() + value = os.getenv("PLAYWRIGHT_BROWSER", DEFAULT_PLAYWRIGHT_BROWSER).strip().lower() + if value not in VALID_PLAYWRIGHT_BROWSERS: + print(f" - Warning: Invalid PLAYWRIGHT_BROWSER='{value}', " + f"valid options: {', '.join(sorted(VALID_PLAYWRIGHT_BROWSERS))}. " + f"Defaulting to {DEFAULT_PLAYWRIGHT_BROWSER}") + return DEFAULT_PLAYWRIGHT_BROWSER + return value # Feature MCP tools for feature/test management diff --git a/ui/src/styles/custom-theme.css b/ui/src/styles/custom-theme.css index 1d7a032..7a673b8 100644 --- a/ui/src/styles/custom-theme.css +++ b/ui/src/styles/custom-theme.css @@ -298,10 +298,9 @@ a:focus-visible, box-shadow: none !important; } +/* Only disable hover transforms, not layout utilities like -translate-x-1/2 */ [class*="hover:translate"], -[class*="hover:-translate"], -[class*="translate-x"], -[class*="translate-y"] { +[class*="hover:-translate"] { transform: none !important; }