Skip to content
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

Sort agent IDs naturally #392

Merged
merged 4 commits into from
Aug 28, 2019
Merged

Sort agent IDs naturally #392

merged 4 commits into from
Aug 28, 2019

Conversation

jmagman
Copy link
Member

@jmagman jmagman commented Aug 27, 2019

@jmagman jmagman requested a review from tvolkert August 27, 2019 20:27
@jmagman jmagman self-assigned this Aug 27, 2019
@jmagman
Copy link
Member Author

jmagman commented Aug 27, 2019

@tvolkert I more followed my heart than actually tested this. How do I locally run app_dart? Are there tests for this somewhere I missed?

@tvolkert
Copy link
Contributor

https://github.com/flutter/cocoon/blob/master/app_dart/README.md#running-a-local-development-instance for how to run locally, but that also requires a local project clone...

FYI, we can't deploy a new version of app_dart until https://github.com/flutter/cocoon/issues/393 is fixed (or we temporarily null out those handlers to force them to proxy to the old backend).

Copy link
Contributor

@tvolkert tvolkert left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -4,6 +4,7 @@

import 'dart:async';

import 'package:collection/collection.dart';
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be added to our dependencies in pubspec.yaml

@jmagman jmagman changed the title Sort agent IDs naturally WIP Sort agent IDs naturally Aug 27, 2019
@jmagman
Copy link
Member Author

jmagman commented Aug 27, 2019

Holding, want to write tests.

@jmagman jmagman changed the title WIP Sort agent IDs naturally Sort agent IDs naturally Aug 28, 2019
Future<Map<String, dynamic>> decodeHandlerBody() async {
final Body body = await handler.get();
final List<Uint8List> bytes = await body.serialize().toList();
final String decodedBody =
Copy link
Member Author

Choose a reason for hiding this comment

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

@tvolkert I messed with this for awhile. If there's a better way deserialize JSON from a Body I'm all ears.

Copy link
Contributor

Choose a reason for hiding this comment

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

The streams API leaves something to be desired... this will do the same thing with less code:

final String decodedBody = await utf8.decoder.bind(body.serialize()).join();

Or even:

return utf8.decoder.bind(body.serialize()).transform(json.decoder).single;

Copy link
Contributor

Choose a reason for hiding this comment

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

Note to the reader: normally I'd have suggested:

return body.serialize().transform(utf8.decoder).transform(json.decoder).single;

That looks much cleaner. But given my recent experience with dart-lang/sdk#36900, I've been shell-shocked into the code above.


setUp(() {
config = FakeConfig();
buildStatusProvider =
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: dartfmt -l 100

Copy link
Contributor

@tvolkert tvolkert left a comment

Choose a reason for hiding this comment

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

LGTM

@jmagman jmagman merged commit 2722fcd into flutter:master Aug 28, 2019
@jmagman jmagman deleted the sort branch August 28, 2019 22:32
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.

Agents should be naturally sorted in agent status table
2 participants