Skip to content

fix(setup): flutter overrides analyzer/meta so zfa setup --flutter wires - #280

Merged
arrrrny merged 2 commits into
developmentfrom
fix/setup-flutter-meta-279
Aug 9, 2026
Merged

fix(setup): flutter overrides analyzer/meta so zfa setup --flutter wires#280
arrrrny merged 2 commits into
developmentfrom
fix/setup-flutter-meta-279

Conversation

@arrrrny

@arrrrny arrrrny commented Aug 9, 2026

Copy link
Copy Markdown
Owner

What

Fixes #279zfa setup --flutter failed dependency wiring on every Flutter app.

Root cause: DependencyWirer.standardSet() unconditionally added override:analyzer=14.1.0 for both Flutter and Dart projects. The Flutter SDK pins meta 1.18.0 while analyzer >=13.1.0 requires meta ^1.18.3, so version solving always failed.

Changes

  • standardSet() branches on isFlutter:
    • Flutter apps → override:analyzer=^13.1.0 + override:meta=^1.19.0 (exactly matches zuraffa_flutter's own dependency_overrides).
    • Pure Dart packages → keep override:analyzer=14.1.0 (no meta overlay).
  • wire() writes dependency_overrides before running pub add so the resolution pub add triggers already sees the overrides — without this, flutter pub add zuraffa_flutter fails before any override exists, no matter which versions are chosen.
  • Failure path surfaces the added overrides (pub get error now names analyzer=…, meta=…).
  • zorphyGitUrl fixed to the canonical https://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 once zuraffa_flutter pulled zuraffa transitively (this was masked before because zuraffa_flutter always failed first).

Verification

  • End-to-end: ran the real DependencyWirer.wire() against a fresh flutter create app — all 6 deps wired, failed=[], flutter pub get resolves under the Flutter SDK.
  • End-to-end Dart branch: zuraffa + zorphy_annotation + dev deps wired with analyzer=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 analyze on all touched files — no issues.

Summary by CodeRabbit

  • New Features
    • Improved dependency setup for Flutter projects with compatible Analyzer and Meta package overrides.
    • Preserved tailored Analyzer dependency handling for Dart-only projects.
    • Updated Zorphy package sourcing for more reliable retrieval.
  • Bug Fixes
    • Dependency resolution now applies overrides before package installation and performs a final resolution.
    • Improved resolution diagnostics to show the override versions involved.
  • Tests
    • Expanded coverage for Flutter and Dart dependency configurations, including missing dependencies and version overrides.

…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
@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

The dependency wirer now uses a .git Zorphy URL and applies Flutter-specific analyzer and meta overrides. Pure Dart projects retain the analyzer override. Override writes occur before dependency processing, with final resolution diagnostics listing override versions.

Dependency Wiring

Layer / File(s) Summary
Override selection
lib/src/core/dependencies/dependency_wirer.dart
Adds Flutter analyzer and meta override constants. Keeps the Dart analyzer override and updates the Zorphy Git URL.
Wiring and resolution
lib/src/core/dependencies/dependency_wirer.dart
Writes overrides before regular and development dependencies, then performs final resolution with detailed override diagnostics.
Override validation
test/core/dependencies/dependency_wirer_test.dart, test/commands/setup_command_test.dart
Tests the URL, Flutter and Dart override sets, updated fixtures, and missing-override detection.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related issues

Possibly related PRs

  • arrrrny/zuraffa#277 — Introduced the dependency-wiring implementation extended by this change.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The .git-suffixed zorphyGitUrl change is not required by linked issue [#279]. Move the zorphyGitUrl update to a separate pull request or link an issue that requires canonical Git URL normalization.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the Flutter analyzer and meta override fix for zfa setup --flutter.
Linked Issues check ✅ Passed The changes implement the required Flutter overrides, preserve the Dart analyzer override, and support successful dependency resolution for issue [#279].
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 win

Mark final resolution failures in WireResult.

If pub get fails, this method only prints a message. It then returns a successful WireResult when no earlier operation failed. Add the affected override names, or a resolution failure marker, to failed before 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

📥 Commits

Reviewing files that changed from the base of the PR and between 4fa61b5 and 56f9ab6.

📒 Files selected for processing (3)
  • lib/src/core/dependencies/dependency_wirer.dart
  • test/commands/setup_command_test.dart
  • test/core/dependencies/dependency_wirer_test.dart

Comment on lines +325 to +351
// --- 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));
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 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 before pub add.
  • test/core/dependencies/dependency_wirer_test.dart#L265-L296: add a Flutter fixture with analyzer: 14.1.0 and 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.

@arrrrny

arrrrny commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai autofix

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Fixes Applied Successfully

Fixed 2 file(s) based on 1 unresolved review comment.

Files modified:

  • lib/src/core/dependencies/dependency_wirer.dart
  • test/core/dependencies/dependency_wirer_test.dart

Commit: 4ba2ce0aae7061e3518cc9f40045cfd28b01a461

The changes have been pushed to the fix/setup-flutter-meta-279 branch.

Time taken: 3m 49s

Fixed 2 file(s) based on 1 unresolved review comment.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
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