worldhopper/.serena/memories/task_completion_checklist.md
2026-01-27 00:56:46 +01:00

3.9 KiB

Task Completion Checklist

When completing a coding task, ensure the following steps are performed:

1. Code Generation (If Applicable)

  • Run flutter pub run build_runner build --delete-conflicting-outputs after modifying:
    • Models with @freezed annotation
    • Providers with @riverpod annotation
    • Classes with @JsonSerializable annotation
  • Verify all .freezed.dart and .g.dart files are generated
  • Ensure no generation errors occurred
  • Commit generated files to git

2. Code Quality

  • Run flutter analyze to check for lint errors and warnings
  • Fix any issues reported by the analyzer
  • Ensure code follows Flutter/Dart conventions (see code_style_and_conventions memory)
  • Remove any unused imports or variables
  • Remove debug print statements (use debugPrint() only when needed)
  • Check that all public APIs have documentation comments (///)

3. Testing

  • Run flutter test to execute all tests
  • Ensure all tests pass
  • Add new tests if new functionality was added
  • Update existing tests if behavior changed
  • Consider adding widget tests for new UI components

4. Functionality Verification

  • Test the changes manually on target platform(s)
  • Verify hot reload works correctly (if applicable)
  • Check that no runtime errors occur
  • Test with sample OPDS feeds (for OPDS-related changes)
  • Verify database migrations work (if database schema changed)
  • Test authentication flows (if auth-related changes)

5. State Management

  • Verify Riverpod providers are properly disposed
  • Check for unnecessary rebuilds
  • Ensure providers are using appropriate lifecycle
  • Verify state is updated correctly

6. Database Operations

  • If database schema changed, update version in AppConstants
  • Implement migration in DatabaseHelper._onUpgrade
  • Test migration from previous version
  • Verify foreign key constraints work correctly

7. Dependencies

  • If new packages were added, run flutter pub get
  • Update pubspec.yaml with correct version constraints
  • Document any new dependencies if needed
  • Check for version conflicts with flutter pub outdated

8. Code Review

  • Review the changes for clarity and maintainability
  • Ensure proper error handling
  • Check for potential memory leaks (unclosed streams, etc.)
  • Verify proper disposal of controllers and resources
  • Ensure UI is responsive and doesn't block

9. Git

  • Stage relevant files with git add
  • Include generated files (*.freezed.dart, *.g.dart)
  • Write clear, descriptive commit message
  • Follow conventional commit format if used
  • Push changes to remote repository if appropriate

Quick Command Sequence

For Model/Provider Changes

# Generate code
flutter pub run build_runner build --delete-conflicting-outputs

# Verify
flutter analyze
flutter test

# Run and test
flutter run

# Commit
git add .
git commit -m "feat: descriptive message"

For General Changes

# Check code quality
flutter analyze

# Run tests
flutter test

# Manual testing
flutter run

# Commit
git add <files>
git commit -m "type: descriptive message"

Quick Fix Workflow

# If things are broken:
flutter clean
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs
flutter run

Common Pitfalls to Avoid

  • Forgetting code generation after modifying Freezed models or Riverpod providers
  • Not committing generated files (*.freezed.dart, *.g.dart should be in git)
  • Using print() instead of debugPrint() for debug output
  • Not disposing controllers or closing streams
  • Blocking UI thread with synchronous operations
  • Not handling async errors properly
  • Forgetting to update database version after schema changes
  • Not testing authentication flows after auth changes