Feature 026: UI Resilience & Error Boundaries#30
Merged
Conversation
Implemented comprehensive resilience for all API clients using Microsoft.Extensions.Http.Resilience: - Retry Policy: 3 attempts with exponential backoff (1s, 2s, 4s) - Retries on: 5xx errors, timeouts, network errors - No retry on: 4xx client errors (fail fast) - Circuit Breaker: Opens after 5 consecutive failures, breaks for 30s - Timeouts: 30s per attempt, 2min total including retries - Built-in logging for all resilience events Applied to all 9 API clients (Breeding, Horse, Stats, User, Race, RaceRun, Track, Trainings, Feedings). Tests: - 6 integration tests covering retry, circuit breaker, and backoff behavior - All tests passing Files created: - TripleDerby.Web/Resilience/HttpResilienceExtensions.cs - TripleDerby.Tests.Unit/Web/Resilience/PollyPoliciesTests.cs - docs/features/026-ui-resilience-error-boundaries.md - docs/implementation/026-ui-resilience-error-boundaries-implementation-plan.md Files modified: - TripleDerby.Web/Program.cs - Applied resilience to HttpClient registrations - TripleDerby.Web/TripleDerby.Web.csproj - Added resilience package - TripleDerby.Tests.Unit/TripleDerby.Tests.Unit.csproj - Added resilience package Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Created ErrorWidget component for consistent error display across the application: Features: - Uses FluentUI Blazor components (FluentMessageBar, FluentButton) - Conditional retry button (only shows when OnRetry callback provided) - Optional technical details section (collapsible, for development) - Full accessibility with ARIA labels (role="alert", aria-live="assertive") - Scoped CSS with dark mode support - Responsive design with FluentUI design tokens Demo Page: - Added ErrorWidgetDemo.razor with 5 scenarios - Simulated API failures with realistic error codes - Shows all ErrorWidget features and usage patterns - Navigation link (Development mode only) Files created: - TripleDerby.Web/Components/Shared/ErrorWidget.razor - TripleDerby.Web/Components/Shared/ErrorWidget.razor.css - TripleDerby.Web/Components/Pages/ErrorWidgetDemo.razor Files modified: - TripleDerby.Web/Components/Layout/NavMenu.razor - Added demo link Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Created two new reusable widgets to eliminate code duplication: HorseFlipCard widget: - Extracted from Breeding.razor (eliminated ~50 lines of duplication) - Displays horse info with flip card animation - Front: emoji, name, earnings - Back: race stats (starts, wins, place, show, sire, dam) - Configurable height, width, minimal style RaceDetailsHeader widget: - Extracted from RaceRuns.razor - Displays race metadata (name, track, distance, surface, class, purse) - Responsive layout with flexbox - Scoped CSS styling Updated pages: - Breeding.razor: Now uses HorseFlipCard component (2 instances) - RaceRuns.razor: Now uses RaceDetailsHeader component All components follow FluentUI Blazor patterns and build successfully. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Added comprehensive error handling to all dashboard statistics widgets: HorseGenderStats, HorseColorStats, HorseLegTypeStats: - Added ILogger injection for structured error logging - Added error state with ErrorWidget display - Updated LoadAsync with null/empty validation - Catches and logs exceptions with context - Added HandleRetryAsync for recovery without page reload - User-friendly error messages Home.razor ErrorBoundary isolation: - Wrapped each stats widget in ErrorBoundary - Widgets fail independently without affecting others - Custom error messages per widget type - Page remains functional when widgets fail Error handling features: - API response validation (null/empty check) - Exception catching with logging - Retry functionality on all widgets - Loading state clears errors on retry - Warning logs for null/empty data - Error logs for exceptions Observable behavior: - Failed widgets show ErrorWidget with retry button - Other widgets continue functioning normally - Unhandled exceptions caught by ErrorBoundary - Error isolation prevents cascading failures Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Added comprehensive error handling to all data grid pages: Horses.razor, Races.razor, RaceRuns.razor: - Added ILogger injection for structured error logging - Added errorMessage and hasError state fields - Updated RefreshItemsAsync with try/catch error handling - Validates API response is not null - Catches and logs exceptions with context - Sets user-friendly error messages - Clears grid data and pagination on error - Added HandleRetryAsync for retry functionality - ErrorWidget displays above grid with retry button Error handling features: - API response null validation - Exception catching with structured logging (RaceId context for RaceRuns) - Retry functionality via dataGrid.RefreshDataAsync() - Empty grid state on error (prevents stale data display) - Loading state management (clears error on retry) Observable behavior: - Failed grid loads show ErrorWidget with retry button - Grid pagination/sorting remain functional after error - Retry button successfully reloads grid data - Error messages are user-friendly and actionable Build: Succeeded with 3 warnings (unused hasError field - acceptable for future extensibility) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Added a mandatory pre-flight checklist at the top of CLAUDE.md to ensure git operations follow project standards. The checklist enforces: no AI attribution in commits, no automated signatures in PRs, and requiring explicit approval before any git operations. Also expanded the PR guidelines section to explicitly forbid automated tool signatures in pull request descriptions.
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
Implements comprehensive error handling and resilience patterns across the TripleDerby Web application (Phases 1-6 of Feature 026).
What's Included
Phase 1: HTTP Resilience Infrastructure
Phase 2: Reusable Error UI Components
ErrorWidgetcomponent with FluentUI MessageBar for consistent error display/error-widget-demo(Development mode only)Phase 3: Widget Extraction
HorseFlipCard: Extracted from Breeding page, eliminated ~50 lines of duplicationRaceDetailsHeader: Extracted race metadata display from RaceRuns pagePhase 5: Dashboard Widgets Error Handling
HorseGenderStats,HorseColorStats,HorseLegTypeStatsErrorBoundaryfor isolationPhase 6: Data Grid Pages Error Handling
Multi-Layered Error Handling
Files Changed
/docsFuture Work
Phase 7 (deferred): Enhance error handling in complex polling workflows (Breeding, TrainHorse pages)
Test Plan
/error-widget-demoto see ErrorWidget examplesRelated Documentation
docs/features/026-ui-resilience-error-boundaries.mddocs/implementation/026-ui-resilience-error-boundaries-implementation-plan.md