Skip to content

[shared_preferences] Add shared preferences devtool #8322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jan 23, 2025

Conversation

adsonpleal
Copy link
Contributor

This PR adds the shared_preferences_tool package. This package uses the devtools_extension tooling to create a tool for shared preferences. The idea of this PR came from @kenzieschmoll on this issue. Initially I've published this tool as a separate package, but this PR aims to bring the functionality to the main shared_preferences package. Once this PR gets merged I'll archive the shared_preferences_tools package.

shared_preferences_tools.mp4

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@adsonpleal
Copy link
Contributor Author

@kenzieschmoll and @stuartmorgan reopening the PR for the reverted changes.

@kenzieschmoll now I'm getting an error on Linux analyze stable step:

image

Also, I don't know why the changes are different, checked every file, but this PR seems to have +7,851 additions and the old one had +5,156. I guess github is counting it wrong 🤷 .

@adsonpleal
Copy link
Contributor Author

adsonpleal commented Dec 17, 2024

Never mind the additions issue! I actually found the offending file. [shared_preferences_tool_eval_test.mocks.dart](https://github.com/flutter/packages/pull/8322/files#diff-569dab15b9971e9d7447872f2ff00405e9c4374ae84a0e3b47a368c085e8c778) is way bigger, since EvalOnDartLibrary and VmService APIs have changed!

I'll remove mockito for this file, 3k+ changes just for the mocks is not reasonable.

@adsonpleal
Copy link
Contributor Author

adsonpleal commented Dec 18, 2024

@kenzieschmoll about the SDK constraint required by the CI, should we reduce the min version on devtools_entensions(by releasing a new version)? Or should I just downgrade it to 0.2.2? The 0.2.2 version was working fine on the CI.

EDIT:

Unfortunately I can't downgrade it either:
image

@kenzieschmoll
Copy link
Member

I think if you upgrade the devtools_app_shared dependency to ^0.3.0 in shared_preferences_tool that should fix your version solving issue.

@adsonpleal
Copy link
Contributor Author

I think if you upgrade the devtools_app_shared dependency to ^0.3.0 in shared_preferences_tool that should fix your version solving issue.

That is the issue, it is already on ^0.3.0, as you can see here. But the CI is failing failing with this error:

============================================================
|| Running for packages/shared_preferences/shared_preferences_tool [@3:06]
============================================================

Running command: "flutter pub get" in /b/s/w/ir/x/w/packages/packages/shared_preferences/shared_preferences_tool
Resolving dependencies...
The current Flutter SDK version is 3.27.0.

Because shared_preferences_tool depends on devtools_extensions >=0.3.0 which requires Flutter SDK version >=3.27.1, version solving failed.


You can try the following suggestion to make the pubspec resolve:
* Try using the Flutter SDK version: 3.27.1. 
Failed to update packages.

[packages/shared_preferences/shared_preferences_tool completed in 0m 2s]

The Linux analyze stable is running flutter 3.27.0 🤔 .

@stuartmorgan do you know if the Linux analyze stable will (or already is) be updated to 3.27.1? This should fix the problem.

@kenzieschmoll
Copy link
Member

@stuartmorgan do you know if the Linux analyze stable will (or already is) be updated to 3.27.1? This should fix the problem.

Agreed this should be our target solution. If this is not possible, I can downgrade the min version to 3.27.0 and do a patch release of devtools_app_shared and devtools_extensions. Will wait for @stuartmorgan to comment.

@tarrinneal
Copy link
Contributor

Because shared_preferences_tool depends on devtools_extensions >=0.3.0 which requires Flutter SDK version >=3.27.1, version solving failed.

seems like you need to resolve this to fix the failing tests

@kenzieschmoll
Copy link
Member

@adsonpleal can you try merging with the main branch again to see if that resolves the pub solve errors we are seeing?

@adsonpleal
Copy link
Contributor Author

Hey @kenzieschmoll I think it worked for master and stable, but it is failing due timeout. I don't have permission to re-run a check.

But it is still failing for legacy, and I think it will aways fail. This is the error:

The current Dart SDK version is 3.5.4.

Because shared_preferences_tool depends on devtools_extensions >=0.3.0-dev.0 which requires SDK version >=3.6.0-149.3.beta <4.0.0, version solving failed.

I wonder if there is a way to disable the legacy checks for shared_preferences_tool? It will never run on legacy SDKs, since it is a self-contained build. It is not intended to be used as a dependency.

@stuartmorgan-g
Copy link
Contributor

I wonder if there is a way to disable the legacy checks for shared_preferences_tool?

Legacy checks run on the versions a package claims to support; this PR claims that the package supports Dart 3.4.0+

If that is incorrect, the solution is to fix the package's support declaration, not to work around the tests.

@adsonpleal
Copy link
Contributor Author

I wonder if there is a way to disable the legacy checks for shared_preferences_tool?

Legacy checks run on the versions a package claims to support; this PR claims that the package supports Dart 3.4.0+

If that is incorrect, the solution is to fix the package's support declaration, not to work around the tests.

Amazing! This is it, it should match devtools_extensions's constraints! Thanks @stuartmorgan, I'll push a fix for it.

@adsonpleal
Copy link
Contributor Author

@kenzieschmoll Now the checks are green. We still have two red ones, but I guess we just need to re-run them.

@kenzieschmoll
Copy link
Member

Everything is green except the tree. I have added the "waiting for tree to go green" label so this should automatically submit once the tree is green

@adsonpleal
Copy link
Contributor Author

@kenzieschmoll Now everything is green, so we just need @tarrinneal's review, right?

Copy link
Contributor

@tarrinneal tarrinneal left a comment

Choose a reason for hiding this comment

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

Thanks for seeing this through again :)

@kenzieschmoll
Copy link
Member

Looks like the release action failed for this PR: https://github.com/flutter/packages/actions/runs/12919330644/job/36032316281

Mac_arm64 macos_platform_tests stable - packages: completed (failure)

I'm trying a re-run now to ensure this wasn't a flake.

@stuartmorgan-g
Copy link
Contributor

It looks like it was video_player flake. This PR triggers tests in every package due to the script/configs change.

@adsonpleal
Copy link
Contributor Author

@stuartmorgan and @kenzieschmoll the run failed again. It seems that it is failing due to the flutter version.

The workflow is set to run on flutter 3.27.0.

Resolving dependencies...
The current Flutter SDK version is 3.27.0.

Because shared_preferences_tool depends on devtools_extensions >=0.3.0 which requires Flutter SDK version >=3.27.1, version solving failed.

@stuartmorgan-g
Copy link
Contributor

Ah, this generally doesn't happen because we don't usually have tight version constraints on the release flow.

The easiest thing to do here would be to revert this, and the re-land it with an added change to bump this line.

@adsonpleal
Copy link
Contributor Author

adsonpleal commented Jan 23, 2025

Got it. So, should I create the revert PR or you'll do it? @stuartmorgan

Edit: I don't think I have permissions to create a revert PR.

@stuartmorgan-g
Copy link
Contributor

I've created a revert.

auto-submit bot pushed a commit that referenced this pull request Jan 23, 2025
Reverts #8322

See discussion in the PR; it needs to be re-landed with a bump to the `release` step's Flutter version to successfully publish.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 24, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 24, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 24, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 27, 2025
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Jan 27, 2025
flutter/packages@3d3ab7b...258f6dc

2025-01-24 [email protected] [shared_preferences] Add shared
preferences devtool (flutter/packages#8494)
2025-01-24 [email protected] [shared_preferences] update List<String>
encode/decode (flutter/packages#8335)
2025-01-24 [email protected] Manual roll Flutter from
c1561a4 to c1ffaa9 (21 revisions) (flutter/packages#8498)
2025-01-24 [email protected] [ios_platform_images] Switch to
`loadImage` (flutter/packages#8216)
2025-01-24 [email protected] [camera] Remove OCMock from
CameraExposureTests and CameraFocusTests (flutter/packages#8351)
2025-01-24 [email protected] [shared_preferences] Tool for migrating
from legacy shared_preferences to shared_preferences_async
(flutter/packages#8229)
2025-01-23 [email protected] Revert "[shared_preferences] Add
shared preferences devtool" (flutter/packages#8493)
2025-01-23 [email protected] [go_router] Fix
return type of current state getter to be non-nullable
(flutter/packages#8173)
2025-01-23 [email protected] Manual roll Flutter from
b2f515f to c1561a4 (18 revisions) (flutter/packages#8491)
2025-01-23 [email protected] [pigeon] fixes event channel dart
instance name usage and adds test (flutter/packages#8483)
2025-01-23 [email protected] [go
_route] fragment parameter added (flutter/packages#8232)
2025-01-23 [email protected] [in_app_purchase] Update
in_app_purchase_android version in in_app_purchase
(flutter/packages#8463)
2025-01-23 [email protected] [image_picker] Reference alternate
macOS implementations (flutter/packages#8487)
2025-01-23 [email protected] [rfw]
Activate leak testing (flutter/packages#8370)
2025-01-23 [email protected]
[video_player] Activate leak testing (flutter/packages#8379)
2025-01-23 [email protected] Manual roll Flutter from
b9e86a5 to b2f515f (42 revisions) (flutter/packages#8482)
2025-01-23 [email protected] [camera] Add API support query for
image streaming (app-facing) (flutter/packages#8422)
2025-01-23 [email protected] Manual roll Flutter from
b9e86a5 to eb6af3d (13 revisions) (flutter/packages#8473)
2025-01-23 [email protected] [shared_preferences] Add shared
preferences devtool (flutter/packages#8322)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants