Skip to content

Conversation

@Catrya
Copy link
Member

@Catrya Catrya commented Jan 22, 2026

There was an inconsistency in how we handled generated files:

  • CLAUDE.md documented "Generated files should never be committed"
  • CI workflows already regenerate *.g.dart and *.mocks.dart files (since fix: add missing build_runner step to flutter.yml workflow #375)
  • BUT these files were still tracked in git and committed in PRs
  • This caused: noisy PRs, merge conflicts, and difficult code reviews

Example: A change to Settings class generates +30 lines in mocks.mocks.dart that pollute the PR diff.

This PR completes the work from #375 by adding generated files to .gitignore:

Before:

  • Generated files committed to repo
  • CI regenerates them (redundant)
  • PRs show hundreds of lines of generated code

After:

  • Generated files in .gitignore (not committed)
  • CI regenerates them automatically
  • PRs only show actual source code changes
  • Developers generate locally with dart run build_runner build -d

This aligns with Flutter ecosystem standards (Flutter SDK, Riverpod, Provider all do this).

⚠️ Action Required

After pulling this PR, all developers must run:

dart run build_runner build -d                                                                                      

Git will delete the generated files from your workspace (since they're now untracked). This command regenerates them locally so the app compiles.

You only need to do this once after pulling this PR. The README and CONTRIBUTING.md now document this as a mandatory setup step for new contributors.

Summary by CodeRabbit

  • Documentation

    • Enhanced setup instructions with emphasis on required code generation step
    • Added detailed guidance on generated files workflow and best practices
    • Updated contributor guidelines to clarify development setup process
  • Chores

    • Configured git to ignore auto-generated files
    • Removed generated provider files for regeneration in CI/CD pipeline

✏️ Tip: You can customize this high-level summary in your review settings.

  - Add *.g.dart and *.mocks.dart to .gitignore
  - Remove previously tracked generated files from repository
  - Update README.md with mandatory setup instructions
  - Enhance CONTRIBUTING.md with generated files workflow
  - Update CLAUDE.md with complete CI/CD documentation
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 22, 2026

Walkthrough

This PR enforces a code generation workflow by adding generated file types to .gitignore, removing previously committed generated Riverpod providers, and updating documentation to clearly establish that generated files must be regenerated locally and in CI/CD rather than committed to the repository.

Changes

Cohort / File(s) Summary
Configuration & Documentation
.gitignore, CLAUDE.md, README.md, docs/CONTRIBUTING.md
Updated .gitignore to exclude *.g.dart and *.mocks.dart files. Expanded CLAUDE.md, README.md, and CONTRIBUTING.md with comprehensive guidance on generated file handling, CI/CD workflows, and regeneration requirements. Reorganized CONTRIBUTING.md steps to prioritize code generation and added dedicated "Generated Files & Git Workflow" section.
Generated Riverpod Provider Removals
lib/features/order/providers/order_notifier_provider.g.dart, lib/services/event_bus.g.dart, lib/shared/providers/mostro_service_provider.g.dart
Removed committed generated Riverpod provider declarations, hash functions, and associated typedefs. Specifically: removed orderTypeNotifierProvider, eventBusProvider, eventStorageProvider, and mostroServiceProvider along with their ref typedefs and hash functions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • grunch

Poem

🐰 Generated files, no more in git's sight,
Rebuild them fresh with each pull and write,
Clean diffs ahead, no conflicts in the way,
CI keeps us honest, hooray, hooray! 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the primary change: adding auto-generated files to .gitignore to prevent them from being committed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants