Skip to content

chore: upgrade to dart workspaces#560

Merged
1-leo merged 3 commits intomasterfrom
chore/use-dart-workspaces
Apr 23, 2026
Merged

chore: upgrade to dart workspaces#560
1-leo merged 3 commits intomasterfrom
chore/use-dart-workspaces

Conversation

@1-leo
Copy link
Copy Markdown
Contributor

@1-leo 1-leo commented Mar 31, 2026

dart workspaces

https://pub.dev/packages/melos#migrate-to-melos-7xx

run melos clean to delete all pubspec_overrides.yaml entries (no longer needed)

benefits:

Summary by CodeRabbit

  • Chores
    • Updated GitHub Actions to use the latest checkout action and added Flutter testing to CI/CD pipeline
    • Migrated monorepo configuration to workspace-based dependency resolution
    • Raised minimum Dart SDK requirement to version 3.6.0
    • Upgraded melos tooling to version 7.5.0

@1-leo 1-leo requested review from frnandu and nogringo March 31, 2026 13:51
@1-leo 1-leo self-assigned this Mar 31, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 31, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c96fa419-376d-4022-9ddf-2dcc43e78eb9

📥 Commits

Reviewing files that changed from the base of the PR and between c0528cf and 988ed92.

📒 Files selected for processing (6)
  • packages/drift/pubspec.yaml
  • packages/ndk/pubspec.yaml
  • packages/ndk_cache_manager_test_suite/pubspec.yaml
  • packages/ndk_flutter/pubspec.yaml
  • packages/nip07_event_signer/pubspec.yaml
  • packages/objectbox/pubspec.yaml
✅ Files skipped from review due to trivial changes (3)
  • packages/ndk_flutter/pubspec.yaml
  • packages/ndk/pubspec.yaml
  • packages/ndk_cache_manager_test_suite/pubspec.yaml
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/nip07_event_signer/pubspec.yaml
  • packages/drift/pubspec.yaml
  • packages/objectbox/pubspec.yaml

📝 Walkthrough

Walkthrough

The PR transitions the monorepo from a separate melos.yaml configuration file to an embedded workspace approach in the root pubspec.yaml. It updates GitHub Actions to use Flutter (v2), adds resolution: workspace directives to package manifests, and upgrades Dart SDK requirements to 3.6.0+.

Changes

Cohort / File(s) Summary
Workflow Configuration
.github/workflows/tests.yaml
Updated to use actions/checkout@v4, added Flutter installation via subosito/flutter-action@v2 with caching enabled, and set runner architecture to x64 for test jobs.
Monorepo Structure
melos.yaml
Deleted entire configuration file; monorepo setup moved to root pubspec.yaml.
Root Configuration
pubspec.yaml
Introduced workspace-based monorepo configuration with explicit package list, melos scripts for analyze/format/build/test operations, and version hook for build_runner execution. Upgraded Dart SDK to >=3.6.0 <4.0.0 and melos from ^6.2.0 to ^7.5.0. Added publish_to: none and removed version field.
Package Workspace Resolution
packages/bip32_keys/pubspec.yaml, packages/ndk/pubspec.yaml, packages/ndk_flutter/pubspec.yaml, packages/drift/pubspec.yaml, packages/objectbox/pubspec.yaml, packages/nip07_event_signer/pubspec.yaml
Added resolution: workspace directive to enable workspace-based dependency resolution. Removed dependency_overrides from drift.
SDK and Tool Updates
packages/ndk_cache_manager_test_suite/pubspec.yaml, packages/objectbox/pubspec.yaml, packages/nip07_event_signer/pubspec.yaml
Updated Dart SDK constraint from >=3.4.0 to >=3.6.0. Bumped lints dev dependency in nip07_event_signer from ^5.0.0 to ^6.1.0.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • fix: build_runner version #518: Modifies the melos version hook and build_runner execution step for generating packages/ndk/lib/src/version.dart, which is mirrored in this PR's root pubspec.yaml configuration.
  • fix: add changes to pub.dev changelog #559: Updates multiple pubspec.yaml files with dependency constraint changes and version bumps, overlapping with the SDK and dependency modifications across packages in this PR.

Suggested reviewers

  • frnandu

Poem

🐰 Workspace files dance in harmony true,
Melos config bundled in pubspec's new view!
Flutter builds swift on x64's ground,
Monorepo joy—structured and sound! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore: upgrade to dart workspaces' accurately summarizes the main change—migrating the repository to Dart workspaces, as evidenced by the addition of workspace configuration in pubspec.yaml, addition of resolution: workspace directives across all packages, removal of melos.yaml, and updated CI workflows.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/use-dart-workspaces

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.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 31, 2026

Codecov Report

❌ Patch coverage is 25.00000% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.31%. Comparing base (721b253) to head (c0528cf).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
..._layer/repositories/wallets/wallets_repo_stub.dart 0.00% 8 Missing ⚠️
...ges/ndk/lib/domain_layer/usecases/cashu/cashu.dart 28.57% 5 Missing ⚠️
...ayer/entities/wallet/providers/nwc/nwc_wallet.dart 0.00% 4 Missing ⚠️
...b/domain_layer/entities/cashu/cashu_mint_info.dart 0.00% 3 Missing ⚠️
...ackages/ndk/lib/domain_layer/usecases/nwc/nwc.dart 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #560      +/-   ##
==========================================
- Coverage   74.33%   74.31%   -0.02%     
==========================================
  Files         197      197              
  Lines        9616     9617       +1     
==========================================
- Hits         7148     7147       -1     
- Misses       2468     2470       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

@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

🧹 Nitpick comments (1)
packages/ndk/lib/domain_layer/usecases/cashu/cashu.dart (1)

537-541: Remove duplicate persistence in pending-state transition.

Line 537 already persists via _addAndSavePendingTransaction(...); Line 540 writes the same transaction again.

♻️ Proposed fix
     // update pending transactions
     await _addAndSavePendingTransaction(pendingTransaction);

-    // save pending state to cache
-    await _walletsRepo.saveTransactions([pendingTransaction]);
-
     yield pendingTransaction;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ndk/lib/domain_layer/usecases/cashu/cashu.dart` around lines 537 -
541, The code currently persists the same pending transaction twice: first via
_addAndSavePendingTransaction(pendingTransaction) and then again via
_walletsRepo.saveTransactions([pendingTransaction]); remove the redundant call
to _walletsRepo.saveTransactions so the pending-state transition is only saved
by _addAndSavePendingTransaction, and verify _addAndSavePendingTransaction
handles all required persistence and cache updates (adjust that method if
additional save behavior is needed).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@pubspec.yaml`:
- Around line 70-75: The YAML block defining command.version.hooks is
mis-indented under scripts; move the entire command: block (including version:,
hooks:, preCommit:) up two spaces so that command becomes a direct child of the
melos root (a sibling of scripts) rather than nested under scripts; ensure the
preCommit hook (melos exec ... and git add ...) remains unchanged and still
references the ndk scope and packages/ndk/lib/src/version.dart.

---

Nitpick comments:
In `@packages/ndk/lib/domain_layer/usecases/cashu/cashu.dart`:
- Around line 537-541: The code currently persists the same pending transaction
twice: first via _addAndSavePendingTransaction(pendingTransaction) and then
again via _walletsRepo.saveTransactions([pendingTransaction]); remove the
redundant call to _walletsRepo.saveTransactions so the pending-state transition
is only saved by _addAndSavePendingTransaction, and verify
_addAndSavePendingTransaction handles all required persistence and cache updates
(adjust that method if additional save behavior is needed).
🪄 Autofix (Beta)

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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6f23c454-0d0b-43b5-a523-004072e4a04f

📥 Commits

Reviewing files that changed from the base of the PR and between 721b253 and c0528cf.

⛔ Files ignored due to path filters (4)
  • packages/bip32_keys/pubspec.lock is excluded by !**/*.lock
  • packages/ndk/pubspec.lock is excluded by !**/*.lock
  • packages/ndk_cache_manager_test_suite/pubspec.lock is excluded by !**/*.lock
  • packages/objectbox/pubspec.lock is excluded by !**/*.lock
📒 Files selected for processing (32)
  • .github/workflows/tests.yaml
  • melos.yaml
  • packages/bip32_keys/pubspec.yaml
  • packages/drift/pubspec.yaml
  • packages/ndk/lib/data_layer/repositories/wallets/wallets_repo_stub.dart
  • packages/ndk/lib/domain_layer/entities/cashu/cashu_mint_info.dart
  • packages/ndk/lib/domain_layer/entities/wallet/providers/nwc/nwc_wallet.dart
  • packages/ndk/lib/domain_layer/entities/wallet/wallet_provider.dart
  • packages/ndk/lib/domain_layer/repositories/cashu_key_derivation.dart
  • packages/ndk/lib/domain_layer/repositories/wallets_repo.dart
  • packages/ndk/lib/domain_layer/usecases/cashu/cashu.dart
  • packages/ndk/lib/domain_layer/usecases/nwc/nwc.dart
  • packages/ndk/lib/domain_layer/usecases/relay_sets_engine.dart
  • packages/ndk/lib/presentation_layer/init.dart
  • packages/ndk/pubspec.yaml
  • packages/ndk/test/broadcast/broadcast_test.dart
  • packages/ndk/test/cashu/cashu_fund_test.dart
  • packages/ndk/test/cashu/cashu_receive_test.dart
  • packages/ndk/test/mocks/mock_relay.dart
  • packages/ndk/test/verifiers/rust_event_verifier_test.dart
  • packages/ndk_cache_manager_test_suite/pubspec.yaml
  • packages/ndk_flutter/lib/data_layer/repositories/signers/amber_event_signer.dart
  • packages/ndk_flutter/lib/ndk_method_channel.dart
  • packages/ndk_flutter/lib/widgets/locale_switcher/n_locale_switcher.dart
  • packages/ndk_flutter/lib/widgets/wallets/n_wallet_card.dart
  • packages/ndk_flutter/pubspec.yaml
  • packages/nip07_event_signer/pubspec.yaml
  • packages/objectbox/lib/data_layer/db/object_box/schema/db_metadata.dart
  • packages/objectbox/lib/objectbox.g.dart
  • packages/objectbox/pubspec.yaml
  • packages/objectbox/test/data_layer/cache_manager/objectbox_cache_manager_test.dart
  • pubspec.yaml
💤 Files with no reviewable changes (6)
  • packages/ndk/lib/domain_layer/repositories/cashu_key_derivation.dart
  • packages/objectbox/test/data_layer/cache_manager/objectbox_cache_manager_test.dart
  • packages/ndk_flutter/lib/widgets/locale_switcher/n_locale_switcher.dart
  • packages/ndk/test/cashu/cashu_receive_test.dart
  • packages/ndk/lib/domain_layer/entities/wallet/wallet_provider.dart
  • melos.yaml

Comment thread pubspec.yaml
Comment on lines +70 to +75
command:
version:
hooks:
preCommit: |
melos exec --fail-fast --scope="ndk" -- "dart run build_runner build --delete-conflicting-outputs"
git add packages/ndk/lib/src/version.dart
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

In Melos 7, when configuring via pubspec.yaml, should command.version.hooks.preCommitbe nested undermelos(as a sibling ofscripts) or under melos.scripts?

💡 Result:

In Melos 7, when configuring via pubspec.yaml, command.version.hooks.preCommit should be nested under melos as a sibling of scripts, specifically under melos.command.version.hooks.preCommit. This structure follows the pattern shown consistently in official Melos documentation for command-specific configurations: melos: scripts: # custom scripts here command: version: hooks: preCommit: | # script content The command key is a direct child of melos, parallel to scripts. Within command.version.hooks, preCommit is defined for the version command's lifecycle hook that runs before the version commit is created. This is confirmed by multiple official sources including the Version Command documentation (explicit YAML example), Publish Command (similar command.publish.hooks structure), Configuration Overview (shows melos.command.version), and Automated Releases guide (references command/version/hooks/preCommit).

Citations:


🏁 Script executed:

# Find and read the pubspec.yaml file around lines 70-75
git ls-files | grep -E "pubspec\.yaml$"

Repository: relaystr/ndk

Length of output: 1875


command.version.hooks is mis-indented under scripts.

In Melos 7, command must be a direct sibling of scripts under melos, not nested within it. As currently configured, the version hook will not be applied. Move command to align with scripts (reduce indentation by 2 spaces).

🛠️ Proposed fix
 melos:
   scripts:
@@
-    command:
-      version:
-        hooks:
-          preCommit: |
-            melos exec --fail-fast --scope="ndk" -- "dart run build_runner build --delete-conflicting-outputs"
-            git add packages/ndk/lib/src/version.dart
+  command:
+    version:
+      hooks:
+        preCommit: |
+          melos exec --fail-fast --scope="ndk" -- "dart run build_runner build --delete-conflicting-outputs"
+          git add packages/ndk/lib/src/version.dart
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
command:
version:
hooks:
preCommit: |
melos exec --fail-fast --scope="ndk" -- "dart run build_runner build --delete-conflicting-outputs"
git add packages/ndk/lib/src/version.dart
command:
version:
hooks:
preCommit: |
melos exec --fail-fast --scope="ndk" -- "dart run build_runner build --delete-conflicting-outputs"
git add packages/ndk/lib/src/version.dart
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pubspec.yaml` around lines 70 - 75, The YAML block defining
command.version.hooks is mis-indented under scripts; move the entire command:
block (including version:, hooks:, preCommit:) up two spaces so that command
becomes a direct child of the melos root (a sibling of scripts) rather than
nested under scripts; ensure the preCommit hook (melos exec ... and git add ...)
remains unchanged and still references the ndk scope and
packages/ndk/lib/src/version.dart.

@1-leo 1-leo merged commit 4f03de0 into master Apr 23, 2026
5 checks passed
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.

3 participants