feat(recorder): add sequential playback with progress tracking#13
feat(recorder): add sequential playback with progress tracking#13brotoo25 wants to merge 2 commits into
Conversation
Implements a new flutter_fixtures_recorder package that enables recording and sequential playback of fixture selections with visual progress tracking. ## New Package: flutter_fixtures_recorder ### Core Features - **Sequential Playback**: Events play back in recorded order, one per request - **Progress Tracking**: Live display of playback position (e.g., "Progress: 2/5") - **Auto-Stop**: Playback automatically stops when all events are exhausted - **Recording Buffer Visibility**: Real-time counter showing recorded events - **Filtering**: Automatically skips default selections and consecutive repeats ### Components Added **Core Models**: - RecordingEvent: Individual fixture selection event - RecordingSession: Container for recorded events with metadata - RecorderMode: Enum for idle/recording/playback states - SelectionEventNotifier: Interface for extensibility **Recorder Service**: - FixtureRecorder: Main service with ChangeNotifier for reactive UI - Index-based sequential playback (replaces map-based approach) - Exposes playbackIndex, totalEvents, recordingBufferSize getters **Storage**: - SessionStorage: Abstract interface - JsonFileSessionStorage: JSON file implementation with path_provider - Sessions stored in: <app_documents>/flutter_fixtures_sessions/ **Integration**: - RecordableDataQuery: Decorator wrapping any DataQuery - PlaybackDataSelector: Marker class for playback mode - RecorderIntegrationMixin: Convenience mixin for setup **UI Components**: - RecorderOverlayWidget: FAB with mode-dependent behavior - SessionListWidget: Session selection and management dialog - RecordingStatusIndicator: Pulsing status badge ### Testing - 35 comprehensive unit tests covering: - Recording workflow and filtering logic - Sequential playback with auto-stop - Session management (save/load/delete) - JSON serialization - ChangeNotifier integration ### Example App Updates - New RecorderExamplePage with simplified instructions - Single "Make Request" button for clear sequential demo - Live recording buffer counter - Playback progress indicator with LinearProgressIndicator - Fixture identifier display for debugging ### Documentation - Complete package README with usage examples - Updated main README with recorder section - Integration examples for Dio and SQLite - RecorderIntegrationMixin usage guide ## Breaking Changes None - this is a new additive package ## Migration Guide Not applicable - new package Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Greptile SummaryAdds a new
The code quality is high with proper error handling, clear documentation, and consistent patterns throughout. The decorator pattern for Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant RecorderOverlay
participant FixtureRecorder
participant SessionStorage
participant RecordableDataQuery
participant DioDataQuery
Note over User,DioDataQuery: Recording Flow
User->>RecorderOverlay: Tap blue FAB
RecorderOverlay->>RecorderOverlay: Show session dialog
User->>RecorderOverlay: Select "Start Recording"
RecorderOverlay->>FixtureRecorder: startRecording()
FixtureRecorder->>FixtureRecorder: Set mode = recording
User->>DioDataQuery: Make API request
DioDataQuery->>RecordableDataQuery: select()
RecordableDataQuery->>DioDataQuery: delegate.select()
DioDataQuery-->>RecordableDataQuery: selected fixture
RecordableDataQuery->>FixtureRecorder: notifySelection(fixture, selected)
FixtureRecorder->>FixtureRecorder: Filter (skip defaults, duplicates)
FixtureRecorder->>FixtureRecorder: Add to recording buffer
User->>RecorderOverlay: Tap red FAB
RecorderOverlay->>RecorderOverlay: Show save dialog
User->>RecorderOverlay: Enter session name
RecorderOverlay->>FixtureRecorder: stopRecording(name)
FixtureRecorder->>SessionStorage: saveSession(session)
SessionStorage-->>FixtureRecorder: saved
FixtureRecorder->>FixtureRecorder: Set mode = idle
Note over User,DioDataQuery: Playback Flow
User->>RecorderOverlay: Tap blue FAB
RecorderOverlay->>FixtureRecorder: listSessions()
FixtureRecorder->>SessionStorage: listSessions()
SessionStorage-->>FixtureRecorder: session list
RecorderOverlay->>RecorderOverlay: Show session list
User->>RecorderOverlay: Select session
RecorderOverlay->>FixtureRecorder: startPlayback(name)
FixtureRecorder->>SessionStorage: loadSession(name)
SessionStorage-->>FixtureRecorder: session
FixtureRecorder->>FixtureRecorder: Set mode = playback, index = 0
User->>DioDataQuery: Make API request
DioDataQuery->>RecordableDataQuery: select()
RecordableDataQuery->>FixtureRecorder: getRecordedSelection(fixture)
FixtureRecorder->>FixtureRecorder: Get event at playbackIndex
FixtureRecorder->>FixtureRecorder: Increment playbackIndex
FixtureRecorder-->>RecordableDataQuery: recorded fixture
RecordableDataQuery-->>DioDataQuery: recorded fixture
Note over FixtureRecorder: When index >= events.length
FixtureRecorder->>FixtureRecorder: stopPlayback() (auto-stop)
FixtureRecorder->>FixtureRecorder: Set mode = idle
|
Greptile's behavior is changing!From now on, if a review finishes with no comments, we will not post an additional "statistics" comment to confirm that our review found nothing to comment on. However, you can confirm that we reviewed your changes in the status check section. This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR". |
Summary
Implements a new
flutter_fixtures_recorderpackage that enables recording and sequential playback of fixture selections with visual progress tracking.This addresses the original requirement for a recorder that:
New Package: flutter_fixtures_recorder
Key Features
✅ Sequential Playback: Index-based playback ensures events play in recorded order
✅ Progress Tracking: Live UI showing "Progress: 2/5" with LinearProgressIndicator
✅ Auto-Stop: Automatically returns to idle when all events consumed
✅ Recording Buffer Visibility: Real-time counter: "Recorded: 3 events"
✅ Smart Filtering: Skips default selections and consecutive repeats
✅ Extensible: Works with any DataQuery implementation
Components
Core Models:
RecordingEvent- Individual selection event with timestamp and sourceRecordingSession- Session container with metadata (createdAt, lastUsedAt)RecorderMode- Enum: idle/recording/playbackSelectionEventNotifier- Interface for extensibilityRecorder Service:
FixtureRecorder- Main service extending ChangeNotifier_playbackIndex(0, 1, 2...)playbackIndex,totalEvents,recordingBufferSize,hasRemainingEventsStorage:
SessionStorage- Abstract interfaceJsonFileSessionStorage- JSON file implementation using path_provider<app_documents>/flutter_fixtures_sessions/session_<name>.jsonIntegration:
RecordableDataQuery- Decorator for any DataQueryPlaybackDataSelector- Marker for playback modeRecorderIntegrationMixin- Convenience mixinUI Components:
RecorderOverlayWidget- FAB with mode-dependent colors/iconsSessionListWidget- Session selection dialog with play/delete actionsRecordingStatusIndicator- Pulsing status badgeTesting
✅ 35 comprehensive unit tests covering:
Example App
New
RecorderExamplePagewith:Documentation
Technical Implementation
Sequential Playback Logic
Recording Filter Logic
Breaking Changes
None - this is a new additive package.
Migration Guide
Not applicable - new package. To use:
Or use the meta-package:
Test Results
Checklist
Screenshots
(Would be added if running in actual app environment)
Recording Mode: Shows "Recorded: 3 events" counter
Playback Mode: Shows "Progress: 2/5" with progress bar
Response Display: Shows "Fixture: success" identifier
🤖 Generated with Claude Code