fix(setup): flutter overrides analyzer/meta so zfa setup --flutter wires - #280
Conversation
…er resolves Branch DependencyWirer.standardSet() on isFlutter: - Flutter apps: override analyzer ^13.1.0 + meta ^1.19.0 (matches zuraffa_flutter's own dependency_overrides). The Flutter SDK pins meta 1.18.0 while analyzer >=13.1.0 requires meta ^1.18.3, so the previous unconditional analyzer=14.1.0 always failed version solving. - Pure Dart packages: keep override analyzer=14.1.0. Write dependency_overrides before running `pub add` so the resolution that `pub add` triggers already sees them, and surface the added overrides in the pub get failure path. Also fix zorphyGitUrl to the canonical https://github.com/arrrrny/zorphy.git so the git source identity matches the zuraffa root pubspec; a bare-URL variant broke version solving once zuraffa_flutter pulled zuraffa transitively. Fixes #279
📝 WalkthroughWalkthroughChangesThe dependency wirer now uses a Dependency Wiring
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
lib/src/core/dependencies/dependency_wirer.dart (1)
387-395: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winMark final resolution failures in
WireResult.If
pub getfails, this method only prints a message. It then returns a successfulWireResultwhen no earlier operation failed. Add the affected override names, or a resolution failure marker, tofailedbefore returning.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/src/core/dependencies/dependency_wirer.dart` around lines 387 - 395, Update the pub get failure handling in the dependency wiring method to add the affected override names, or an appropriate resolution-failure marker, to the WireResult failed collection before returning. Preserve the existing diagnostic output and ensure a nonzero getResult.exitCode cannot produce a successful WireResult when no earlier operation failed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/src/core/dependencies/dependency_wirer.dart`:
- Around line 325-351: Update dependency override handling in
lib/src/core/dependencies/dependency_wirer.dart lines 325-351 so
addOverrideToPubspec replaces an existing override when its value differs from
the required spec, ensuring stale values such as analyzer: 14.1.0 become ^13.1.0
before pub add. Add a Flutter fixture in
test/core/dependencies/dependency_wirer_test.dart lines 265-296 with the stale
analyzer override and assert wiring detects and updates it.
---
Outside diff comments:
In `@lib/src/core/dependencies/dependency_wirer.dart`:
- Around line 387-395: Update the pub get failure handling in the dependency
wiring method to add the affected override names, or an appropriate
resolution-failure marker, to the WireResult failed collection before returning.
Preserve the existing diagnostic output and ensure a nonzero getResult.exitCode
cannot produce a successful WireResult when no earlier operation failed.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: ae2625d9-9833-4b91-9de2-0a8af0f45c99
📒 Files selected for processing (3)
lib/src/core/dependencies/dependency_wirer.darttest/commands/setup_command_test.darttest/core/dependencies/dependency_wirer_test.dart
| // --- dependency_overrides via direct pubspec edit --- | ||
| // Written BEFORE `pub add` so the version resolution that command | ||
| // triggers already sees the overrides. In Flutter apps the analyzer + | ||
| // meta overrides are what make the transitive graph resolvable in the | ||
| // first place, so they must be in the pubspec before anything resolves. | ||
| if (overrideSpecs.isNotEmpty) { | ||
| var newContent = pubspecFile.readAsStringSync(); | ||
| for (final spec in overrideSpecs) { | ||
| newContent = addOverrideToPubspec( | ||
| newContent, | ||
| spec.name, | ||
| spec.version ?? '', | ||
| ); | ||
| print(' ✅ Added override:${spec.name}=${spec.version}'); | ||
| } | ||
| try { | ||
| await pubspecFile.writeAsString(newContent); | ||
| // Record overrides as added only after the write succeeds. | ||
| added.addAll(overrideSpecs.map((s) => s.name)); | ||
| } catch (e) { | ||
| print( | ||
| ' ⚠️ Failed to write dependency_overrides to pubspec.yaml: $e', | ||
| ); | ||
| failed.addAll(overrideSpecs.map((s) => s.name)); | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Replace stale Flutter override values.
findMissing treats an override key as valid regardless of its value. addOverrideToPubspec also preserves that value. A Flutter project created with the prior analyzer: 14.1.0 override receives only meta, so it does not receive the required analyzer: ^13.1.0 override.
lib/src/core/dependencies/dependency_wirer.dart#L325-L351: detect mismatched override values and replace the stale value beforepub add.test/core/dependencies/dependency_wirer_test.dart#L265-L296: add a Flutter fixture withanalyzer: 14.1.0and assert that wiring identifies and updates it to^13.1.0.
📍 Affects 2 files
lib/src/core/dependencies/dependency_wirer.dart#L325-L351(this comment)test/core/dependencies/dependency_wirer_test.dart#L265-L296
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@lib/src/core/dependencies/dependency_wirer.dart` around lines 325 - 351,
Update dependency override handling in
lib/src/core/dependencies/dependency_wirer.dart lines 325-351 so
addOverrideToPubspec replaces an existing override when its value differs from
the required spec, ensuring stale values such as analyzer: 14.1.0 become ^13.1.0
before pub add. Add a Flutter fixture in
test/core/dependencies/dependency_wirer_test.dart lines 265-296 with the stale
analyzer override and assert wiring detects and updates it.
|
@coderabbitai autofix |
Fixes Applied SuccessfullyFixed 2 file(s) based on 1 unresolved review comment. Files modified:
Commit: The changes have been pushed to the Time taken: |
Fixed 2 file(s) based on 1 unresolved review comment. Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
What
Fixes #279 —
zfa setup --flutterfailed dependency wiring on every Flutter app.Root cause:
DependencyWirer.standardSet()unconditionally addedoverride:analyzer=14.1.0for both Flutter and Dart projects. The Flutter SDK pinsmeta 1.18.0while analyzer >=13.1.0 requiresmeta ^1.18.3, so version solving always failed.Changes
standardSet()branches onisFlutter:override:analyzer=^13.1.0+override:meta=^1.19.0(exactly matcheszuraffa_flutter's owndependency_overrides).override:analyzer=14.1.0(nometaoverlay).wire()writesdependency_overridesbefore runningpub addso the resolutionpub addtriggers already sees the overrides — without this,flutter pub add zuraffa_flutterfails before any override exists, no matter which versions are chosen.pub geterror now namesanalyzer=…, meta=…).zorphyGitUrlfixed to the canonicalhttps://github.com/arrrrny/zorphy.git— the zuraffa root pubspec uses the.git-suffixed URL, and pub only unifies git sources when the URL string matches verbatim. The bare-URL variant broke version solving oncezuraffa_flutterpulledzuraffatransitively (this was masked before becausezuraffa_flutteralways failed first).Verification
DependencyWirer.wire()against a freshflutter createapp — all 6 deps wired,failed=[],flutter pub getresolves under the Flutter SDK.zuraffa+zorphy_annotation+ dev deps wired withanalyzer=14.1.0, resolves.dart test test/core/dependencies/dependency_wirer_test.dart test/commands/setup_command_test.dart— 70/70 pass (extended for the Flutter vs Dart override branches).dart analyzeon all touched files — no issues.Summary by CodeRabbit