[L] Change in dart/sdk[main]: [dart:io] Add WebSocket timeline instrumentation(GSoC'26)

0 views
Skip to first unread message

Samuel Rawlins (Gerrit)

unread,
Jun 7, 2026, 10:56:58 PM (4 days ago) Jun 7
to Yash Hosalli, Hangyu Jin, rev...@dartlang.org
Attention needed from Hangyu Jin and Yash Hosalli

Samuel Rawlins added 12 comments

File pkg/vm_service/test/verify_websocket_timeline_test.dart
Line 47, Patchset 1 (Latest):bool containsEvent(
Samuel Rawlins . unresolved

Not a hard requirement, but you could instead define a custom matcher. That would simplify the call sites to not always have `isTrue`, `isTrue`.

https://api.flutter.dev/flutter/package-matcher_matcher/CustomMatcher-class.html

It's not the simplest interface, but it does lead to very nice failure messages, and nice test expectations.

Line 63, Patchset 1 (Latest): final args = event['args'];
Samuel Rawlins . unresolved

Sorry, a variable named `args` and one named `arguments` is too tricky for me to keep straight 😊. Let's name one `expectedArgs` and the other `actualArgs`.

Line 65, Patchset 1 (Latest): continue;
Samuel Rawlins . unresolved

Can we throw an exception instead?

Line 71, Patchset 1 (Latest): matches = false;
Samuel Rawlins . unresolved

I don't know if this matcher helper will get more complicated later, but we can just simplify this now down to `return false` here.

This might also be nicer if you write a CustomMatcher, because we can provide in the failure message which key/value didn't match.

Line 93, Patchset 1 (Latest): expect(traceEvents.isNotEmpty, isTrue);
Samuel Rawlins . unresolved

We can use the isNotEmpty matcher: https://pub.dev/documentation/matcher/latest/matcher/isNotEmpty-constant.html

`expect(traceEvents, isNotEmpty);`

File sdk/lib/_http/websocket_impl.dart
Line 49, Patchset 1 (Latest):// Emits WebSocket timeline events.
Samuel Rawlins . unresolved

This should be a doc-comment, with `///`.

Line 55, Patchset 1 (Latest):// Uses `connectionId` to correlate events for a given WebSocket connection and
Samuel Rawlins . unresolved

With `///` comments, we can reference variables like this with `[]`: `[connectionId]`.

Line 58, Patchset 1 (Latest): final int connectionId;
Samuel Rawlins . unresolved

Can this also be private? Even if you think it will be public later, we can make it private for now.

Line 121, Patchset 1 (Latest): if (direction != null) 'direction': direction,
Samuel Rawlins . unresolved

We can use null-aware elements here: `'direction': ?direction`.

Line 137, Patchset 1 (Latest): switch (opcode) {
Samuel Rawlins . unresolved

This could use a fancy switch expression:

```
return switch (opcode) {
_WebSocketOpcode.TEXT => 'text',
_WebSocketOpcode.BINARY => 'binary',
...
};
```
Line 237, Patchset 1 (Latest): void Function /*Callback for reporting processed WebSocket frame metadata.*/ (
Samuel Rawlins . unresolved

Let's put this comment above the declaration here, before `void`.

Line 1473, Patchset 1 (Latest): // type, direction, size, and close information are recorded.
Samuel Rawlins . unresolved

Let's put the information kinds in quotes: 'type,' 'direction,' etc.

Open in Gerrit

Related details

Attention is currently required from:
  • Hangyu Jin
  • Yash Hosalli
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: Ided1219ff74d9a0bab73d05cb317ac74ff5d8940
Gerrit-Change-Number: 509860
Gerrit-PatchSet: 1
Gerrit-Owner: Yash Hosalli <hosal...@gmail.com>
Gerrit-Reviewer: Hangyu Jin <jinh...@google.com>
Gerrit-Reviewer: Samuel Rawlins <sraw...@google.com>
Gerrit-Attention: Hangyu Jin <jinh...@google.com>
Gerrit-Attention: Yash Hosalli <hosal...@gmail.com>
Gerrit-Comment-Date: Mon, 08 Jun 2026 02:56:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Yash Hosalli (Gerrit)

unread,
Jun 9, 2026, 11:37:12 AM (2 days ago) Jun 9
to dart-...@luci-project-accounts.iam.gserviceaccount.com, Samuel Rawlins, Hangyu Jin, rev...@dartlang.org
Attention needed from Hangyu Jin and Samuel Rawlins

Yash Hosalli added 12 comments

File pkg/vm_service/test/verify_websocket_timeline_test.dart
Line 47, Patchset 1:bool containsEvent(
Samuel Rawlins . resolved

Not a hard requirement, but you could instead define a custom matcher. That would simplify the call sites to not always have `isTrue`, `isTrue`.

https://api.flutter.dev/flutter/package-matcher_matcher/CustomMatcher-class.html

It's not the simplest interface, but it does lead to very nice failure messages, and nice test expectations.

Yash Hosalli

Done

Line 63, Patchset 1: final args = event['args'];
Samuel Rawlins . resolved

Sorry, a variable named `args` and one named `arguments` is too tricky for me to keep straight 😊. Let's name one `expectedArgs` and the other `actualArgs`.

Yash Hosalli

Did it..

Line 65, Patchset 1: continue;
Samuel Rawlins . resolved

Can we throw an exception instead?

Yash Hosalli

Sure..

Line 71, Patchset 1: matches = false;
Samuel Rawlins . resolved

I don't know if this matcher helper will get more complicated later, but we can just simplify this now down to `return false` here.

This might also be nicer if you write a CustomMatcher, because we can provide in the failure message which key/value didn't match.

Yash Hosalli

Sure...

Line 93, Patchset 1: expect(traceEvents.isNotEmpty, isTrue);
Samuel Rawlins . resolved

We can use the isNotEmpty matcher: https://pub.dev/documentation/matcher/latest/matcher/isNotEmpty-constant.html

`expect(traceEvents, isNotEmpty);`

Yash Hosalli

Done..

File sdk/lib/_http/websocket_impl.dart
Line 49, Patchset 1:// Emits WebSocket timeline events.
Samuel Rawlins . resolved

This should be a doc-comment, with `///`.

Yash Hosalli

Ohh...done.

Line 55, Patchset 1:// Uses `connectionId` to correlate events for a given WebSocket connection and
Samuel Rawlins . resolved

With `///` comments, we can reference variables like this with `[]`: `[connectionId]`.

Yash Hosalli

Aha...Thanks for this.

Line 58, Patchset 1: final int connectionId;
Samuel Rawlins . unresolved

Can this also be private? Even if you think it will be public later, we can make it private for now.

Yash Hosalli

if you are pointing towards `_enabled` it is already private..
if you mean anything else... I didn't quite get it.

Line 121, Patchset 1: if (direction != null) 'direction': direction,
Samuel Rawlins . resolved

We can use null-aware elements here: `'direction': ?direction`.

Yash Hosalli

Ya done...

Line 137, Patchset 1: switch (opcode) {
Samuel Rawlins . resolved

This could use a fancy switch expression:

```
return switch (opcode) {
_WebSocketOpcode.TEXT => 'text',
_WebSocketOpcode.BINARY => 'binary',
...
};
```
Yash Hosalli

Sure...

Line 237, Patchset 1: void Function /*Callback for reporting processed WebSocket frame metadata.*/ (
Samuel Rawlins . resolved

Let's put this comment above the declaration here, before `void`.

Yash Hosalli

Sure

Line 1473, Patchset 1: // type, direction, size, and close information are recorded.
Samuel Rawlins . resolved

Let's put the information kinds in quotes: 'type,' 'direction,' etc.

Yash Hosalli

Sure..

Open in Gerrit

Related details

Attention is currently required from:
  • Hangyu Jin
  • Samuel Rawlins
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: Ided1219ff74d9a0bab73d05cb317ac74ff5d8940
Gerrit-Change-Number: 509860
Gerrit-PatchSet: 2
Gerrit-Owner: Yash Hosalli <hosal...@gmail.com>
Gerrit-Reviewer: Hangyu Jin <jinh...@google.com>
Gerrit-Reviewer: Samuel Rawlins <sraw...@google.com>
Gerrit-Attention: Hangyu Jin <jinh...@google.com>
Gerrit-Attention: Samuel Rawlins <sraw...@google.com>
Gerrit-Comment-Date: Tue, 09 Jun 2026 15:37:05 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Samuel Rawlins <sraw...@google.com>
unsatisfied_requirement
open
diffy

Yash Hosalli (Gerrit)

unread,
Jun 9, 2026, 12:07:09 PM (2 days ago) Jun 9
to dart-...@luci-project-accounts.iam.gserviceaccount.com, Samuel Rawlins, Hangyu Jin, rev...@dartlang.org
Attention needed from Hangyu Jin and Samuel Rawlins

Yash Hosalli added 1 comment

File sdk/lib/_http/websocket_impl.dart
Line 58, Patchset 1: final int connectionId;
Samuel Rawlins . resolved

Can this also be private? Even if you think it will be public later, we can make it private for now.

Yash Hosalli

if you are pointing towards `_enabled` it is already private..
if you mean anything else... I didn't quite get it.

Yash Hosalli

Aha.. Sorry,
I realised you were pointing to `connectionId`.

made it private....

Open in Gerrit

Related details

Attention is currently required from:
  • Hangyu Jin
  • Samuel Rawlins
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: Ided1219ff74d9a0bab73d05cb317ac74ff5d8940
Gerrit-Change-Number: 509860
Gerrit-PatchSet: 3
Gerrit-Owner: Yash Hosalli <hosal...@gmail.com>
Gerrit-Reviewer: Hangyu Jin <jinh...@google.com>
Gerrit-Reviewer: Samuel Rawlins <sraw...@google.com>
Gerrit-Attention: Hangyu Jin <jinh...@google.com>
Gerrit-Attention: Samuel Rawlins <sraw...@google.com>
Gerrit-Comment-Date: Tue, 09 Jun 2026 16:07:03 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Samuel Rawlins <sraw...@google.com>
Comment-In-Reply-To: Yash Hosalli <hosal...@gmail.com>
unsatisfied_requirement
open
diffy

Samuel Rawlins (Gerrit)

unread,
Jun 9, 2026, 1:12:22 PM (2 days ago) Jun 9
to Yash Hosalli, Ben Konyi, dart-...@luci-project-accounts.iam.gserviceaccount.com, Hangyu Jin, rev...@dartlang.org
Attention needed from Ben Konyi, Hangyu Jin and Yash Hosalli

Samuel Rawlins voted and added 3 comments

Votes added by Samuel Rawlins

Code-Review+1

3 comments

Patchset-level comments
File-level comment, Patchset 3 (Latest):
Samuel Rawlins . resolved

Adding Ben for final review

File pkg/vm_service/test/verify_websocket_timeline_test.dart
Line 46, Patchset 3 (Latest):// Returns true if the timeline contains an event with the given name
Samuel Rawlins . unresolved

This doc comment probably doesn't apply right to this class, could move it down to `containsTimelineEvent`.

Line 123, Patchset 3 (Latest): containsTimelineEvent(
Samuel Rawlins . resolved

lovely!

Open in Gerrit

Related details

Attention is currently required from:
  • Ben Konyi
  • Hangyu Jin
  • Yash Hosalli
Submit Requirements:
    • requirement is not satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: sdk
    Gerrit-Branch: main
    Gerrit-Change-Id: Ided1219ff74d9a0bab73d05cb317ac74ff5d8940
    Gerrit-Change-Number: 509860
    Gerrit-PatchSet: 3
    Gerrit-Owner: Yash Hosalli <hosal...@gmail.com>
    Gerrit-Reviewer: Ben Konyi <bko...@google.com>
    Gerrit-Reviewer: Hangyu Jin <jinh...@google.com>
    Gerrit-Reviewer: Samuel Rawlins <sraw...@google.com>
    Gerrit-Attention: Hangyu Jin <jinh...@google.com>
    Gerrit-Attention: Ben Konyi <bko...@google.com>
    Gerrit-Attention: Yash Hosalli <hosal...@gmail.com>
    Gerrit-Comment-Date: Tue, 09 Jun 2026 17:12:18 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    Yash Hosalli (Gerrit)

    unread,
    Jun 9, 2026, 1:34:54 PM (2 days ago) Jun 9
    to Samuel Rawlins, Ben Konyi, dart-...@luci-project-accounts.iam.gserviceaccount.com, Hangyu Jin, rev...@dartlang.org
    Attention needed from Ben Konyi, Hangyu Jin and Samuel Rawlins

    Yash Hosalli added 1 comment

    File pkg/vm_service/test/verify_websocket_timeline_test.dart
    Line 46, Patchset 3:// Returns true if the timeline contains an event with the given name
    Samuel Rawlins . resolved

    This doc comment probably doesn't apply right to this class, could move it down to `containsTimelineEvent`.

    Yash Hosalli

    Right..

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ben Konyi
    • Hangyu Jin
    • Samuel Rawlins
    Submit Requirements:
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: sdk
      Gerrit-Branch: main
      Gerrit-Change-Id: Ided1219ff74d9a0bab73d05cb317ac74ff5d8940
      Gerrit-Change-Number: 509860
      Gerrit-PatchSet: 4
      Gerrit-Owner: Yash Hosalli <hosal...@gmail.com>
      Gerrit-Reviewer: Ben Konyi <bko...@google.com>
      Gerrit-Reviewer: Hangyu Jin <jinh...@google.com>
      Gerrit-Reviewer: Samuel Rawlins <sraw...@google.com>
      Gerrit-Attention: Hangyu Jin <jinh...@google.com>
      Gerrit-Attention: Ben Konyi <bko...@google.com>
      Gerrit-Attention: Samuel Rawlins <sraw...@google.com>
      Gerrit-Comment-Date: Tue, 09 Jun 2026 17:34:48 +0000
      unsatisfied_requirement
      open
      diffy

      Kevin Moore (Gerrit)

      unread,
      Jun 9, 2026, 4:02:39 PM (2 days ago) Jun 9
      to Yash Hosalli, Samuel Rawlins, Ben Konyi, dart-...@luci-project-accounts.iam.gserviceaccount.com, Hangyu Jin, rev...@dartlang.org
      Attention needed from Ben Konyi, Hangyu Jin, Samuel Rawlins and Yash Hosalli

      Kevin Moore voted and added 4 comments

      Votes added by Kevin Moore

      Commit-Queue+1

      4 comments

      Patchset-level comments
      File-level comment, Patchset 4 (Latest):
      Kevin Moore . resolved

      I'm not sure if we document these types of changes in our changelog.

      There is no new public API, but it might be nice to know that we have these events. I'd look through the current changelog to see if there is precedent!

      cool to see this work!

      (Note: I'm not an engineer. Please take my comments w/ high skepticism. Except for the spelling mistake. I'm pretty sure about that one!)

      File sdk/lib/_http/websocket_impl.dart
      Line 50, Patchset 4 (Latest):/// [_enabled] checks weather WebSocket timeline logging is currently enabled.
      Kevin Moore . unresolved

      Typo: `weather` should be `whether`.

      Line 938, Patchset 4 (Latest): webSocket._timelineLogger.logSend(opcode, data?.length ?? 0);
      Kevin Moore . unresolved

      If `_deflateHelper` is enabled, `data?.length` here represents the **compressed** payload size.

      However, on the receiving side in `_messageFrameEnd`, the size logged is the **uncompressed** payload size (because `processIncomingMessage` is called before reporting the length).

      This asymmetry could be confusing when analyzing timeline events. Consider logging the same metric (either compressed or uncompressed size) for both `Send` and `Receive` events.

      Line 1397, Patchset 4 (Latest): });
      Kevin Moore . unresolved

      If `openUrl` or `request.close()` fails (e.g., due to a DNS resolution failure or a network error), the `Future` will fail and `connectTimeline?.finish()` will not be called, leaving the timeline event open.

      Consider adding a `catchError` to handle these early connection failures and correctly finish the timeline task:
      ```dart
      }).catchError((Object error, StackTrace stackTrace) {
      connectTimeline?.finish(arguments: {'error': error.toString()});
      return Future<WebSocket>.error(error, stackTrace);
      });
      ```

      or if this was an async function you could use try/finally which I think would be cleaner.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Ben Konyi
      • Hangyu Jin
      • Samuel Rawlins
      • Yash Hosalli
      Submit Requirements:
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: sdk
      Gerrit-Branch: main
      Gerrit-Change-Id: Ided1219ff74d9a0bab73d05cb317ac74ff5d8940
      Gerrit-Change-Number: 509860
      Gerrit-PatchSet: 4
      Gerrit-Owner: Yash Hosalli <hosal...@gmail.com>
      Gerrit-Reviewer: Ben Konyi <bko...@google.com>
      Gerrit-Reviewer: Hangyu Jin <jinh...@google.com>
      Gerrit-Reviewer: Kevin Moore <kev...@google.com>
      Gerrit-Reviewer: Samuel Rawlins <sraw...@google.com>
      Gerrit-Attention: Hangyu Jin <jinh...@google.com>
      Gerrit-Attention: Ben Konyi <bko...@google.com>
      Gerrit-Attention: Samuel Rawlins <sraw...@google.com>
      Gerrit-Attention: Yash Hosalli <hosal...@gmail.com>
      Gerrit-Comment-Date: Tue, 09 Jun 2026 20:02:34 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      unsatisfied_requirement
      open
      diffy

      Yash Hosalli (Gerrit)

      unread,
      Jun 10, 2026, 10:44:20 AM (yesterday) Jun 10
      to Kevin Moore, Samuel Rawlins, Ben Konyi, dart-...@luci-project-accounts.iam.gserviceaccount.com, Hangyu Jin, rev...@dartlang.org
      Attention needed from Ben Konyi, Hangyu Jin, Kevin Moore and Samuel Rawlins

      Yash Hosalli added 3 comments

      File sdk/lib/_http/websocket_impl.dart
      Line 50, Patchset 4:/// [_enabled] checks weather WebSocket timeline logging is currently enabled.
      Kevin Moore . resolved

      Typo: `weather` should be `whether`.

      Yash Hosalli

      Opps...
      corrected it..

      Line 938, Patchset 4: webSocket._timelineLogger.logSend(opcode, data?.length ?? 0);
      Kevin Moore . resolved

      If `_deflateHelper` is enabled, `data?.length` here represents the **compressed** payload size.

      However, on the receiving side in `_messageFrameEnd`, the size logged is the **uncompressed** payload size (because `processIncomingMessage` is called before reporting the length).

      This asymmetry could be confusing when analyzing timeline events. Consider logging the same metric (either compressed or uncompressed size) for both `Send` and `Receive` events.

      Yash Hosalli

      You are right.. I checked,
      The situation becomes like:

      send: compressed size
      Receive: Uncompressed size

      updated the send side instrumentation to record original size...

      Line 1397, Patchset 4: });
      Kevin Moore . resolved

      If `openUrl` or `request.close()` fails (e.g., due to a DNS resolution failure or a network error), the `Future` will fail and `connectTimeline?.finish()` will not be called, leaving the timeline event open.

      Consider adding a `catchError` to handle these early connection failures and correctly finish the timeline task:
      ```dart
      }).catchError((Object error, StackTrace stackTrace) {
      connectTimeline?.finish(arguments: {'error': error.toString()});
      return Future<WebSocket>.error(error, stackTrace);
      });
      ```

      or if this was an async function you could use try/finally which I think would be cleaner.

      Yash Hosalli

      You were right here too..
      As suggested i have added a `catchError...`

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Ben Konyi
      • Hangyu Jin
      • Kevin Moore
      • Samuel Rawlins
      Submit Requirements:
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: sdk
      Gerrit-Branch: main
      Gerrit-Change-Id: Ided1219ff74d9a0bab73d05cb317ac74ff5d8940
      Gerrit-Change-Number: 509860
      Gerrit-PatchSet: 5
      Gerrit-Owner: Yash Hosalli <hosal...@gmail.com>
      Gerrit-Reviewer: Ben Konyi <bko...@google.com>
      Gerrit-Reviewer: Hangyu Jin <jinh...@google.com>
      Gerrit-Reviewer: Kevin Moore <kev...@google.com>
      Gerrit-Reviewer: Samuel Rawlins <sraw...@google.com>
      Gerrit-Attention: Hangyu Jin <jinh...@google.com>
      Gerrit-Attention: Ben Konyi <bko...@google.com>
      Gerrit-Attention: Samuel Rawlins <sraw...@google.com>
      Gerrit-Attention: Kevin Moore <kev...@google.com>
      Gerrit-Comment-Date: Wed, 10 Jun 2026 14:44:14 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Kevin Moore <kev...@google.com>
      unsatisfied_requirement
      open
      diffy

      Yash Hosalli (Gerrit)

      unread,
      Jun 10, 2026, 10:49:26 AM (yesterday) Jun 10
      to Kevin Moore, Samuel Rawlins, Ben Konyi, dart-...@luci-project-accounts.iam.gserviceaccount.com, Hangyu Jin, rev...@dartlang.org
      Attention needed from Ben Konyi, Hangyu Jin, Kevin Moore and Samuel Rawlins

      Yash Hosalli added 1 comment

      Patchset-level comments
      Kevin Moore . resolved

      I'm not sure if we document these types of changes in our changelog.

      There is no new public API, but it might be nice to know that we have these events. I'd look through the current changelog to see if there is precedent!

      cool to see this work!

      (Note: I'm not an engineer. Please take my comments w/ high skepticism. Except for the spelling mistake. I'm pretty sure about that one!)

      Yash Hosalli

      Thanks for the the improvement suggestions...
      I will too check for any precedents available in changelog and circle back here..

      Gerrit-Comment-Date: Wed, 10 Jun 2026 14:49:20 +0000
      unsatisfied_requirement
      open
      diffy

      Ben Konyi (Gerrit)

      unread,
      Jun 10, 2026, 3:28:28 PM (yesterday) Jun 10
      to Yash Hosalli, Kevin Moore, Samuel Rawlins, dart-...@luci-project-accounts.iam.gserviceaccount.com, Hangyu Jin, rev...@dartlang.org
      Attention needed from Hangyu Jin, Kevin Moore, Samuel Rawlins and Yash Hosalli

      Ben Konyi added 8 comments

      Patchset-level comments
      File-level comment, Patchset 5 (Latest):
      Ben Konyi . resolved

      First review pass. Thanks for digging into this! 😊

      File sdk/lib/_http/websocket_impl.dart
      Line 70, Patchset 5 (Latest): 'connectionId': _connectionId,
      Ben Konyi . unresolved

      Nit: I'd create constants for each of these argument keys. In general, if we're using a string literal more than once, we should create an appropriately scoped constant to reduce the likelihood of typos and improve readability.

      Line 91, Patchset 5 (Latest): void logPing(int bytes, String direction) {
      Ben Konyi . unresolved

      Nit: I'd define an enum for the direction

      ```
      enum _WebSocketTrafficDirection {
      in,
      out
      }
      ```

      And then you could just use `direction.name` when building the map.

      Line 137, Patchset 5 (Latest): _WebSocketOpcode.TEXT => 'text',
      Ben Konyi . resolved

      It would be great if we could change `_WebSocketOpcode` to be an `enum` instead. That way, we could associate the opcode directly with the name and not have to pass around integers.

      It'd be as simple as:

      ```dart
      enum _WebSocketOpcode {
      continuation(0),
      text(1),
      binary(2),
      reserved3(3),
      // ...
      reservedF(15);

      /// The integer representation of the op-code.
      final int code;

      const _WebSocketOpcode(this.code);
      }
      ```

      And then you'd be able to get the name from the enum directly, like:

      ```
      _WebSocketOpcode.text.name
      ```

      However, that might be worth doing in a follow up CL since it would involve some minor refactoring in this library.

      Line 1272, Patchset 5 (Latest): TimelineTask? connectTimeline;
      Ben Konyi . unresolved

      I feel like this logic should be added to `_WebSocketTimelineLogger` instead so we can keep all of the timeline object management in a single class.

      Line 1345, Patchset 5 (Latest): if (httpStatusCode != null) 'httpStatusCode': httpStatusCode,
      Ben Konyi . unresolved

      Nit: this can be

      ```dart
      'httpStatusCode': ?httpStatusCode,
      ```

      Line 1479, Patchset 5 (Latest): transformer.onFrame = (opcode, bytes, closeCode, closeReason) {
      Ben Konyi . unresolved

      I'm not sure it makes sense to introduce this indirection here. Is there any reason we can't just inject `_timelineLogger` into the transformer and unconditionally invoke these methods directly? The `log*` methods already have logic to check if the timeline logging is enabled, so using `onFrame != null` to indicate we should log isn't necessary.

      Line 1484, Patchset 5 (Latest): break;
      Ben Konyi . unresolved

      These `break`s aren't necessary.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Hangyu Jin
      • Kevin Moore
      • Samuel Rawlins
      • Yash Hosalli
      Submit Requirements:
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: sdk
      Gerrit-Branch: main
      Gerrit-Change-Id: Ided1219ff74d9a0bab73d05cb317ac74ff5d8940
      Gerrit-Change-Number: 509860
      Gerrit-PatchSet: 5
      Gerrit-Owner: Yash Hosalli <hosal...@gmail.com>
      Gerrit-Reviewer: Ben Konyi <bko...@google.com>
      Gerrit-Reviewer: Hangyu Jin <jinh...@google.com>
      Gerrit-Reviewer: Kevin Moore <kev...@google.com>
      Gerrit-Reviewer: Samuel Rawlins <sraw...@google.com>
      Gerrit-Attention: Hangyu Jin <jinh...@google.com>
      Gerrit-Attention: Samuel Rawlins <sraw...@google.com>
      Gerrit-Attention: Yash Hosalli <hosal...@gmail.com>
      Gerrit-Attention: Kevin Moore <kev...@google.com>
      Gerrit-Comment-Date: Wed, 10 Jun 2026 19:28:24 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      unsatisfied_requirement
      open
      diffy

      Yash Hosalli (Gerrit)

      unread,
      11:17 AM (7 hours ago) 11:17 AM
      to Kevin Moore, Samuel Rawlins, Ben Konyi, dart-...@luci-project-accounts.iam.gserviceaccount.com, Hangyu Jin, rev...@dartlang.org
      Attention needed from Ben Konyi, Hangyu Jin, Kevin Moore and Samuel Rawlins

      Yash Hosalli added 6 comments

      File sdk/lib/_http/websocket_impl.dart
      Line 70, Patchset 5: 'connectionId': _connectionId,
      Ben Konyi . resolved

      Nit: I'd create constants for each of these argument keys. In general, if we're using a string literal more than once, we should create an appropriately scoped constant to reduce the likelihood of typos and improve readability.

      Yash Hosalli

      Sure..

      Line 91, Patchset 5: void logPing(int bytes, String direction) {
      Ben Konyi . resolved

      Nit: I'd define an enum for the direction

      ```
      enum _WebSocketTrafficDirection {
      in,
      out
      }
      ```

      And then you could just use `direction.name` when building the map.

      Yash Hosalli

      Done...

      Line 1272, Patchset 5: TimelineTask? connectTimeline;
      Ben Konyi . resolved

      I feel like this logic should be added to `_WebSocketTimelineLogger` instead so we can keep all of the timeline object management in a single class.

      Yash Hosalli

      I Have migrated it too _WebSocketTimelineLogger..

      Line 1345, Patchset 5: if (httpStatusCode != null) 'httpStatusCode': httpStatusCode,
      Ben Konyi . resolved

      Nit: this can be

      ```dart
      'httpStatusCode': ?httpStatusCode,
      ```

      Yash Hosalli

      Yes....Sure

      Line 1479, Patchset 5: transformer.onFrame = (opcode, bytes, closeCode, closeReason) {
      Ben Konyi . resolved

      I'm not sure it makes sense to introduce this indirection here. Is there any reason we can't just inject `_timelineLogger` into the transformer and unconditionally invoke these methods directly? The `log*` methods already have logic to check if the timeline logging is enabled, so using `onFrame != null` to indicate we should log isn't necessary.

      Yash Hosalli

      Ya correct..

      I've updated the implementation to inject `_timelineLogger` directly into `_WebSocketProtocolTransformer` and removed the `onFrame` callback indirection entirely.

      The transformer now emits timeline events directly via `_timelineLogger`

      Line 1484, Patchset 5: break;
      Ben Konyi . resolved

      These `break`s aren't necessary.

      Yash Hosalli

      Done..
      I have removed them

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Ben Konyi
      • Hangyu Jin
      • Kevin Moore
      • Samuel Rawlins
      Submit Requirements:
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: sdk
      Gerrit-Branch: main
      Gerrit-Change-Id: Ided1219ff74d9a0bab73d05cb317ac74ff5d8940
      Gerrit-Change-Number: 509860
      Gerrit-PatchSet: 6
      Gerrit-Owner: Yash Hosalli <hosal...@gmail.com>
      Gerrit-Reviewer: Ben Konyi <bko...@google.com>
      Gerrit-Reviewer: Hangyu Jin <jinh...@google.com>
      Gerrit-Reviewer: Kevin Moore <kev...@google.com>
      Gerrit-Reviewer: Samuel Rawlins <sraw...@google.com>
      Gerrit-Attention: Hangyu Jin <jinh...@google.com>
      Gerrit-Attention: Ben Konyi <bko...@google.com>
      Gerrit-Attention: Samuel Rawlins <sraw...@google.com>
      Gerrit-Attention: Kevin Moore <kev...@google.com>
      Gerrit-Comment-Date: Thu, 11 Jun 2026 15:17:27 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Ben Konyi <bko...@google.com>
      unsatisfied_requirement
      open
      diffy

      Yash Hosalli (Gerrit)

      unread,
      11:19 AM (7 hours ago) 11:19 AM
      to Kevin Moore, Samuel Rawlins, Ben Konyi, dart-...@luci-project-accounts.iam.gserviceaccount.com, Hangyu Jin, rev...@dartlang.org
      Attention needed from Ben Konyi, Hangyu Jin, Kevin Moore and Samuel Rawlins

      Yash Hosalli added 1 comment

      Patchset-level comments
      Ben Konyi . resolved

      First review pass. Thanks for digging into this! 😊

      Yash Hosalli

      Thanks for the review....😊

      Gerrit-Comment-Date: Thu, 11 Jun 2026 15:19:05 +0000
      unsatisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages