Skip to content

Conversation

@felix-barz-brickmakers
Copy link

@felix-barz-brickmakers felix-barz-brickmakers commented Dec 5, 2025

With build_config 1.2.0, a new mechanism has been added to optimize build speed - the triggers. See https://pub.dev/packages/build_config#triggers for an explanation of this feature.

This PR adds the corresponding configration to enable triggers for the freezed builder.

Summary by CodeRabbit

  • Chores
    • Build configuration updated so code generation runs only when explicitly triggered by relevant annotations, reducing unnecessary runs and improving build performance.
    • Internal build tooling dependency constraint was bumped; no changes to public APIs or generator behavior beyond the targeted trigger behavior.

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

@coderabbitai
Copy link

coderabbitai bot commented Dec 5, 2025

Walkthrough

Updated packages/freezed/build.yaml to make the freezed builder run only when triggered by specific annotations; bumped build_config dependency in packages/freezed/pubspec.yaml from ^1.1.0 to ^1.2.0.

Changes

Cohort / File(s) Change Summary
Build configuration
packages/freezed/build.yaml
Added run_only_if_triggered: true for the freezed builder and introduced a triggers entry (freezed:freezed) listing annotations Freezed, freezed, and unfreezed.
Dependency update
packages/freezed/pubspec.yaml
Bumped build_config dependency constraint from ^1.1.0 to ^1.2.0. No other dependency or config changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Review YAML syntax and indentation in build.yaml.
  • Confirm trigger keys and annotation names match builder expectations.
  • Verify build_config version bump is compatible with CI and other package constraints.

Poem

I nibble code beneath a starlit hood,
Builders slumber till annotations say they should,
A tiny bump, a trigger's gentle call,
We wake, we build—then quiet falls. 🐰✨

Pre-merge checks and finishing touches

✅ 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 'Add build_config triggers' directly and accurately summarizes the main change: adding build_config triggers configuration to the freezed builder for performance optimization.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 548f897 and fc0bf7f.

📒 Files selected for processing (1)
  • packages/freezed/pubspec.yaml (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: lishaduck
Repo: rrousselGit/freezed PR: 1147
File: packages/freezed_lint/pubspec.yaml:12-12
Timestamp: 2025-01-07T20:51:22.701Z
Learning: The analyzer version update to >=7.0.0 in freezed_lint package is blocked by invertase/dart_custom_lint#300, preventing alignment with freezed package's analyzer requirements.
Learnt from: lishaduck
Repo: rrousselGit/freezed PR: 1147
File: packages/freezed_lint/pubspec.yaml:12-12
Timestamp: 2025-01-07T20:51:22.701Z
Learning: The analyzer version upgrade in freezed_lint is blocked by invertase/dart_custom_lint#300 which handles the broader upgrade of analyzer, analyzer_plugin, and source_gen dependencies in custom_lint.
📚 Learning: 2025-01-07T20:51:22.701Z
Learnt from: lishaduck
Repo: rrousselGit/freezed PR: 1147
File: packages/freezed_lint/pubspec.yaml:12-12
Timestamp: 2025-01-07T20:51:22.701Z
Learning: The analyzer version update to >=7.0.0 in freezed_lint package is blocked by invertase/dart_custom_lint#300, preventing alignment with freezed package's analyzer requirements.

Applied to files:

  • packages/freezed/pubspec.yaml
📚 Learning: 2025-01-07T20:51:22.701Z
Learnt from: lishaduck
Repo: rrousselGit/freezed PR: 1147
File: packages/freezed_lint/pubspec.yaml:12-12
Timestamp: 2025-01-07T20:51:22.701Z
Learning: The analyzer version upgrade in freezed_lint is blocked by invertase/dart_custom_lint#300 which handles the broader upgrade of analyzer, analyzer_plugin, and source_gen dependencies in custom_lint.

Applied to files:

  • packages/freezed/pubspec.yaml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: freezed (packages/freezed, stable, get)
🔇 Additional comments (1)
packages/freezed/pubspec.yaml (1)

15-15: Dependency bump is necessary and properly constrained.

Triggers are a performance heuristic that allow builders to quickly decide not to run. A builder runs only if triggered if the option run_only_if_triggered is true. The caret constraint ^1.2.0 is appropriate as it permits patch-level updates within the 1.2.x range while preventing incompatible major-version upgrades.

Verify that the related build.yaml changes align with this version requirement. The configuration should define triggers and set run_only_if_triggered: true for the freezed builder to leverage the performance optimization in build_config 1.2.0.


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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 43dc5c5 and 548f897.

📒 Files selected for processing (1)
  • packages/freezed/build.yaml (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: freezed (packages/freezed, stable, get)
🔇 Additional comments (2)
packages/freezed/build.yaml (2)

15-15: Confirm the optimization change doesn't impact existing test coverage or CI workflows.

This change optimizes build speed by restricting the freezed builder to run only when the specified annotations are present. While this is intentional, ensure that:

  1. Existing CI/CD pipelines don't rely on unconditional builder execution
  2. Test fixtures or generated code paths that depend on the builder running are covered by the trigger annotations
  3. Documentation or migration notes are updated if this is a significant change for users

Also applies to: 30-34


30-34: The review comment is incorrect—no triggers section is needed in build.yaml.

The freezed builder uses GeneratorForAnnotation<Freezed> from the source_gen package, which automatically discovers and processes classes annotated with the Freezed type. The three public annotations (@Freezed, @freezed, @unfreezed) are all instances of the same Freezed class defined in the freezed_annotation package, and source_gen handles their detection without requiring explicit trigger configuration in build.yaml. The current build.yaml is correctly configured and does not need a triggers section.

Likely an incorrect or invalid review comment.

@felix-barz-brickmakers felix-barz-brickmakers marked this pull request as draft December 5, 2025 10:07
@felix-barz-brickmakers felix-barz-brickmakers marked this pull request as ready for review December 5, 2025 11:12
@felix-barz-brickmakers
Copy link
Author

I checked the tests, and they seem to be broken on master as well. No new tests have failed with this change, so it should be fine.

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.

1 participant