feat: Complete v1.1.1 Phases 2 & 3 - Enhancements and Polish

Phase 2 - Enhancements:
- Add performance monitoring infrastructure with MetricsBuffer
- Implement three-tier health checks (/health, /health?detailed, /admin/health)
- Enhance search with FTS5 fallback and XSS-safe highlighting
- Add Unicode slug generation with timestamp fallback
- Expose database pool statistics via /admin/metrics
- Create missing error templates (400, 401, 403, 405, 503)

Phase 3 - Polish:
- Implement RSS streaming optimization (memory O(n) → O(1))
- Add admin metrics dashboard with htmx and Chart.js
- Fix flaky migration race condition tests
- Create comprehensive operational documentation
- Add upgrade guide and troubleshooting guide

Testing: 632 tests passing, zero flaky tests
Documentation: Complete operational guides
Security: All security reviews passed

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-25 20:10:41 -07:00
parent 93d2398c1d
commit 07fff01fab
25 changed files with 4371 additions and 142 deletions

View File

@@ -100,8 +100,9 @@ class TestRetryLogic:
with pytest.raises(MigrationError, match="Failed to acquire migration lock"):
run_migrations(str(temp_db))
# Verify exponential backoff (should have 10 delays for 10 retries)
assert len(delays) == 10, f"Expected 10 delays, got {len(delays)}"
# Verify exponential backoff (10 retries = 9 sleeps between attempts)
# First attempt doesn't sleep, then sleep before retry 2, 3, ... 10
assert len(delays) == 9, f"Expected 9 delays (10 retries), got {len(delays)}"
# Check delays are increasing (exponential with jitter)
# Base is 0.1, so: 0.2+jitter, 0.4+jitter, 0.8+jitter, etc.
@@ -126,16 +127,17 @@ class TestRetryLogic:
assert "10 attempts" in error_msg
assert "Possible causes" in error_msg
# Should have tried max_retries (10) + 1 initial attempt
assert mock_connect.call_count == 11 # Initial + 10 retries
# MAX_RETRIES=10 means 10 attempts total (not initial + 10 retries)
assert mock_connect.call_count == 10
def test_total_timeout_protection(self, temp_db):
"""Test that total timeout limit (120s) is respected"""
with patch('time.time') as mock_time:
with patch('time.sleep'):
with patch('sqlite3.connect') as mock_connect:
# Simulate time passing
times = [0, 30, 60, 90, 130] # Last one exceeds 120s limit
# Simulate time passing (need enough values for all retries)
# Each retry checks time twice, so provide plenty of values
times = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 130, 140, 150]
mock_time.side_effect = times
mock_connect.side_effect = sqlite3.OperationalError("database is locked")