Skip to content

feat(aft): Auto await analysis#6625

Open
cadivus wants to merge 6 commits intomainfrom
feat/aft/auto-await-analysis
Open

feat(aft): Auto await analysis#6625
cadivus wants to merge 6 commits intomainfrom
feat/aft/auto-await-analysis

Conversation

@cadivus
Copy link
Member

@cadivus cadivus commented Feb 16, 2026

Before this change, we had to wait for a package do be analyzed and needed to restart afterwads:

user@machine amplify-flutter % aft publish
Downloading packages... . 
! amplify_lints 3.1.4 from path packages/amplify_lints (overridden)
! aws_common 0.7.12 from path packages/aws_common (overridden)
! aws_signature_v4 0.6.10 from path packages/aws_signature_v4 (overridden)
! git 2.2.1 from git https://github.com/tyllark/git at 5d9934 (overridden)
  grpc 5.0.0 (5.1.0 available)
  protobuf 5.1.0 (6.0.0 available)
! pub_server 0.0.0 from path packages/test/pub_server (overridden)
! smithy 0.7.10 from path packages/smithy/smithy (overridden)
! smithy_aws 0.7.10 from path packages/smithy/smithy_aws (overridden)
! smithy_codegen 0.3.2 from path packages/smithy/smithy_codegen (overridden)
  sqlite3 2.9.4 (3.1.4 available)
No dependencies would change in `/amplify-flutter/packages/aft`.
3 packages have newer versions incompatible with dependency constraints.
Try `dart pub outdated` for more information.
Building package executable... 
Built aft:aft.
Found Dart SDK: 3.10.1
Preparing to publish: 
0.3.10 worker_bee
0.3.9 worker_bee_builder
2.10.0 amplify_core
0.4.16 amplify_db_common_dart
0.4.17 amplify_storage_s3_dart
0.4.16 amplify_db_common
2.10.0 amplify_storage_s3
0.5.10 amplify_secure_storage_dart
0.5.15 amplify_secure_storage
2.10.0 amplify_push_notifications
2.10.0 amplify_flutter
0.4.15 amplify_analytics_pinpoint_dart
0.11.17 amplify_auth_cognito_dart
2.10.0 amplify_analytics_pinpoint
2.10.0 amplify_auth_cognito
2.10.0 amplify_push_notifications_pinpoint
2.5.0 amplify_authenticator
0.5.15 amplify_api_dart
2.10.0 amplify_api
2.10.0 amplify_datastore_plugin_interface
2.10.0 amplify_datastore

The following packages will not be published: 
3.1.4 amplify_lints
0.7.12 aws_common
0.6.10 aws_signature_v4
0.7.10 smithy
0.7.10 smithy_aws
Proceed with publish (y/N)? y
Running pre-publish checks for worker_bee...
Publishing worker_bee...
Running pre-publish checks for worker_bee_builder...
Resolving dependencies...
Because worker_bee_builder depends on worker_bee ^0.3.10 which doesn't match any versions, version solving failed.


You can try the following suggestion to make the pubspec resolve:
* Consider downgrading your constraint on worker_bee: dart pub add worker_bee:^0.3.9
user@machine amplify-flutter % /workspace/await-script/await-pub-dev-analysis.sh worker_bee
# Restart after analysis on pub.dev is done

With this change, it's like:

user@machine amplify-flutter % aft publish
Downloading packages... . 
! amplify_lints 3.1.4 from path packages/amplify_lints (overridden)
! aws_common 0.7.12 from path packages/aws_common (overridden)
! aws_signature_v4 0.6.10 from path packages/aws_signature_v4 (overridden)
! git 2.2.1 from git https://github.com/tyllark/git at 5d9934 (overridden)
  grpc 5.0.0 (5.1.0 available)
  petitparser 7.0.1 (7.0.2 available)
  protobuf 5.1.0 (6.0.0 available)
! pub_server 0.0.0 from path packages/test/pub_server (overridden)
! smithy 0.7.10 from path packages/smithy/smithy (overridden)
! smithy_aws 0.7.10 from path packages/smithy/smithy_aws (overridden)
! smithy_codegen 0.3.2 from path packages/smithy/smithy_codegen (overridden)
  sqlite3 2.9.4 (3.1.6 available)
  yaml_edit 2.2.3 (2.2.4 available)
No dependencies would change in `/amplify-flutter/packages/aft`.
5 packages have newer versions incompatible with dependency constraints.
Try `dart pub outdated` for more information.
Building package executable... (3.7s)
Built aft:aft.
Found Dart SDK: 3.10.1
Preparing to publish: 
0.3.10 worker_bee
0.3.9 worker_bee_builder
2.10.0 amplify_core
0.4.16 amplify_db_common_dart
0.4.17 amplify_storage_s3_dart
0.4.16 amplify_db_common
2.10.0 amplify_storage_s3
0.5.10 amplify_secure_storage_dart
0.5.15 amplify_secure_storage
2.10.0 amplify_push_notifications
2.10.0 amplify_flutter
0.4.15 amplify_analytics_pinpoint_dart
0.11.17 amplify_auth_cognito_dart
2.10.0 amplify_analytics_pinpoint
2.10.0 amplify_auth_cognito
2.10.0 amplify_push_notifications_pinpoint
2.5.0 amplify_authenticator
0.5.15 amplify_api_dart
2.10.0 amplify_api
2.10.0 amplify_datastore_plugin_interface
2.10.0 amplify_datastore

The following packages will not be published: 
3.1.4 amplify_lints
0.7.12 aws_common
0.6.10 aws_signature_v4
0.7.10 smithy
0.7.10 smithy_aws

Publish queue (ready to publish):
 - worker_bee (0.3.10)
 - amplify_core (2.10.0)
Running pre-publish checks for worker_bee...
Publishing worker_bee...

Publish queue (ready to publish):
 - amplify_core (2.10.0)
Running pre-publish checks for amplify_core...
Publishing amplify_core...

Queue empty – waiting for one of these analyses to finish..
 - worker_bee (0.3.10)
 - amplify_core (2.10.0)
[2026-02-16T17:05:15] Still waiting for analyses to finish..

Publish queue (ready to publish):
 - amplify_db_common_dart (0.4.16)
 - amplify_api_dart (0.5.15)
 - amplify_datastore_plugin_interface (2.10.0)
Running pre-publish checks for amplify_db_common_dart...
Publishing amplify_db_common_dart...

@cadivus cadivus marked this pull request as ready for review February 16, 2026 16:31
@cadivus cadivus requested a review from a team as a code owner February 16, 2026 16:31
@cadivus cadivus requested a review from jvh-aws February 16, 2026 16:37
@cadivus cadivus force-pushed the feat/aft/auto-await-analysis branch from 181b750 to 5553c59 Compare February 16, 2026 17:03
@cadivus cadivus force-pushed the feat/aft/auto-await-analysis branch 2 times, most recently from 76a7e4f to d0c333b Compare February 16, 2026 18:29
/// Returns `true` if the package page contains `[pending analysis]`,
/// `false` otherwise.
Future<bool> isPendingAnalysis(String package) async {
final uri = Uri.parse('https://pub.dev/packages/$package');
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to make this a constant?

Copy link
Member Author

Choose a reason for hiding this comment

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

You mean final instead of const?
Or moving https://pub.dev/packages/ to a const?
If second, I think it's okay to do it as for other urls in this file.

// ANSI escape codes for terminal colors.
const _yellow = '\x1B[33m';
const _green = '\x1B[32m';
const _reset = '\x1B[0m';
Copy link
Contributor

Choose a reason for hiding this comment

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

Do those help in CI/CD or can we simplify the code?

Copy link
Member Author

Choose a reason for hiding this comment

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

It looks nicer in CI/CD too (it supports colors too, see e.g. https://github.com/aws-amplify/amplify-flutter/actions/runs/21951396667/job/63402913611?pr=6613). For me, it makes it easier to scan the output.


final stopwatch = Stopwatch()..start();

while (await isPendingAnalysis(package)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

How does the loop break if isPendingAnalysis does not return true due to an issue with the underlying API?

Copy link
Member Author

Choose a reason for hiding this comment

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

The exception gets to the main thread and the process crashes. So we would have to do manual handling.

final request = AWSHttpRequest.get(uri);
final resp = await httpClient.send(request).response;
final body = await resp.decodeBody();
return body.contains('[pending analysis]');
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this stable enough for our use-case? It could happen, that the presented HTML changes. Shouldn't we use the API, e.g. this call?

Copy link
Member Author

Choose a reason for hiding this comment

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

I want to change this in the next step. I'd like to get some more data for that while we run this version.

@cadivus cadivus force-pushed the feat/aft/auto-await-analysis branch from d0c333b to d6c4e9e Compare February 16, 2026 23:15
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.

2 participants