[Product Homepage Design] Implementation#137
Open
yetone wants to merge 20 commits into
Open
Conversation
added 20 commits
April 21, 2026 03:31
- Add /api/metrics endpoint returning JSON with memory, disk, keys, connections stats - Create MetricsState for thread-safe metric tracking - Add metrics accessor methods to DataManager (get_sstable_level_counts, etc.) - Add approx_memory_usage methods to Memtable and MemtableList - Create web module structure with types and handlers - Add comprehensive tests for metrics response format and performance - Fix macro trailing semicolons for Rust 2024 compatibility - Allow dangerous_implicit_autorefs lint in skip-list
Implement Scenario 2: Homepage Static Content Serving - Add web module with Axum HTTP server routes - Implement embedded static file serving using rust-embed - Add static_files handler with proper Content-Type headers - Set Cache-Control headers (1 hour for static assets per NFR-4) - Create homepage HTML with MirDB branding - Add CSS with dark/light theme support via CSS variables - Add JavaScript for metrics polling and form handling - Add integration tests covering all test cases: - GET / returns HTML with MirDB branding - GET /static/style.css with cache headers >= 3600s - GET /static/main.js with correct content-type - GET /nonexistent-file.css returns 404 - Homepage performance within 2 seconds Also fixes compatibility issues with newer Rust: - Fix trailing semicolon in macro expressions - Fix implicit autoref on raw pointers in skip-list
Implements Scenario 4: Configuration API Endpoint - Add config.rs handler with ConfigState for read-only config access - Expose server configuration values via GET /api/config: - listen_addr, max_lsm_levels, work_dir - sstable_max_size, memtable_max_size, block_size - Return HTTP 405 Method Not Allowed for POST/PUT/DELETE/PATCH - Add 26 tests covering default values, custom config, and method restrictions
Merges origin/feature/product-homepage-design-febi-2f2282c and adds: - config.rs handler for /api/config endpoint (Scenario 4) - ConfigResponse type for configuration JSON serialization - Integration tests for config API endpoint - GET returns server configuration, other methods return 405
- Add Axum-based HTTP server coexisting with Memcached protocol server - Both servers share the same Tokio async runtime - HTTP server defaults to port 8080, configurable via web_port setting - Implement port conflict detection between HTTP and Memcached ports - Upgrade all dependencies to modern versions (tokio 1.x, bytes 1.x, etc.) - Fix API compatibility issues across skip-list, sstable, and mirdb crates - Add Default trait bounds required by modern Rust for uninitialized memory - Add integration tests for HTTP server startup and configuration This implements Scenario 1: HTTP Server Startup and Coexistence
Implements the DELETE endpoint for key-value operations via the web API:
- Add delete_kv handler in kv.rs that removes keys from the Store
- Returns {success: true, message: "DELETED"} on successful deletion
- Returns {success: false, error: "NOT_FOUND"} when key doesn't exist
- Add comprehensive tests covering all DELETE scenarios
- Export slice, request, response modules for test accessibility
Add complete HTTP handler implementation for /api/config: - GET returns current configuration as JSON with success wrapper - POST/PUT/DELETE/PATCH return 405 Method Not Allowed (read-only) - Add ConfigState to AppState for route access - Add integration tests for all test cases Test cases covered: - GET /api/config returns default config values - GET /api/config reflects custom configuration - POST /api/config returns HTTP 405 (config is read-only)
Add e2e tests verifying homepage UI requirements: - MirDB logo and product name in header (REQ-1) - Hero section tagline with key phrases (REQ-1) - Features section with core features (REQ-2) - GitHub link presence and attributes (REQ-9) - Page structure and accessibility checks
Implements Scenario 8 - Health Check Endpoint per PRD REQ-7. The health endpoint provides: - status: "healthy" or "unhealthy" based on server state - server_running: boolean indicating server availability - compaction_status: "idle" or "running" to track compaction state Features: - Fast response time (< 100ms) suitable for load balancer health checks - Thread-safe HealthState with atomic operations for concurrent access - Integration with existing web server infrastructure via Axum Test coverage includes: - Unit tests for HealthState operations - Integration tests for API response structure - Performance tests verifying < 100ms response time
- Add configuration panel to dashboard section showing Listen Addr, Work Dir, Max Level, and SST Max Size values - Add fetchConfig() and updateConfigPanel() JavaScript functions to fetch and display server configuration on page load - Add CSS styling for configuration panel with responsive grid layout - Add comprehensive E2E tests verifying metric cards, polling interval, key count updates, and configuration panel display Addresses REQ-3 (real-time metrics) and REQ-4 (configuration display) with NFR-2 compliant 5-second polling interval.
Add comprehensive e2e tests for Scenario 12 - Memcached Protocol Reference Section: - test_protocol_reference_section_visible: Verifies section exists with proper heading and ARIA labels - test_set_command_documentation: Verifies SET command syntax documentation - test_get_command_documentation: Verifies GET command syntax documentation - test_delete_command_documentation: Verifies DELETE command syntax - test_protocol_commands_structure: Verifies proper HTML structure for commands Tests validate REQ-6: Quick reference section for Memcached protocol commands.
Add comprehensive E2E tests for theme toggle functionality (Scenario 13): - Theme toggle button presence and accessibility tests - localStorage persistence verification - System preference detection tests - WCAG 2.1 AA contrast compliance tests - CSS variable and transition tests All 23 tests pass, verifying REQ-10 requirements.
- Add validateForm() function for client-side validation before submit - Show 'STORED' message on successful SET operation - Show 'NOT_FOUND' message for missing keys in GET - Show 'DELETED' message on successful DELETE - Add comprehensive E2E tests for all form operations - Tests verify form structure, validation, JS handlers, and result display
- Add responsive breakpoints for desktop (1200px+), tablet (768-1023px), mobile landscape (480-767px), and mobile portrait (< 479px) - Implement touch-friendly tap targets (44-48px) for mobile forms - Add 16px font-size on mobile inputs to prevent iOS zoom - Stack metric cards vertically on mobile with flex row layout - Make Try It Out forms full-width and usable on small screens - Handle overflow and word-break for long content - Add print media query for documentation printing test(e2e): add responsive design E2E tests (10 test cases) - Test desktop viewport layout with horizontal metric cards - Test mobile viewport with vertical stacking - Test Try It Out section mobile usability - Verify responsive CSS techniques (grid, flexbox, media queries)
- Add skip link for keyboard navigation - Add proper ARIA roles and labels to all landmarks - Add aria-hidden to decorative icons - Add aria-live regions for dynamic content (metrics, results) - Add proper form labeling with labels and aria-required - Enhance focus states with 3px outline and box-shadow - Add focus-visible styles for keyboard-only focus indicators - Add comprehensive accessibility tests (18 tests)
- Add skip navigation link for keyboard users - Enhance semantic HTML structure with ARIA landmarks and roles - Add proper focus states with 3px outline for visibility - Include high contrast and reduced motion media query support - Add descriptive ARIA labels for emoji icons and form elements - Use description list (dl/dt/dd) for configuration panel - Create comprehensive accessibility e2e test suite - Update existing tests for accessibility-enhanced markup
Add comprehensive concurrency tests verifying NFR-3: Handle 50+ concurrent visitors. Tests include: - 50 concurrent GET / requests - 50 concurrent GET /api/metrics requests (NFR-7: <500ms response) - Mixed load: 25 homepage + 25 API requests - Sustained load test (150 requests across 3 iterations) - Resource exhaustion test (5 batches of 20 requests) - Response consistency validation under load
…ttern The tests were checking for aria-label="Key" but the HTML implementation uses the better accessibility pattern of proper <label> elements with sr-only class for visual hiding. Updated tests to check for: - aria-required="true" attribute - Screen reader accessible labels using <label> + sr-only class
- Add 404 Not Found fallback handler for invalid endpoints - Add 405 Method Not Allowed for wrong HTTP methods on homepage - Add body size limit (1MB) to prevent 413 Payload Too Large issues - Add comprehensive error handling tests with 14 test cases - Update routes.rs with homepage_route functions and not_found_handler Test coverage includes: - Invalid endpoint returns 404 with JSON error body - Invalid JSON returns 400 Bad Request - Wrong HTTP method returns 405 Method Not Allowed - Long URL handling (414 URI Too Long) - Large payload handling (413 Payload Too Large) - Empty body handling - Unsupported HTTP method handling
Add comprehensive tests verifying all API endpoints return consistent JSON response format: - Metrics endpoint returns valid JSON with all required fields - KV operations return success/error responses with proper structure - ApiResponse wrapper provides consistent format with success flag and data - ApiError provides consistent error format with success, error, and code fields Tests verify: - Response type serialization produces correct JSON structure - Optional fields are properly omitted when None - Numeric and boolean fields serialize correctly - All response types can round-trip through JSON serialization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements the requirements for Product Homepage Design.
Generated by Something