spanification: automatically spanify .../tracing/perfetto/privacy_filtering_check.cc etc. [chromium/src : main]

4 views
Skip to first unread message

Daniel Angulo (Gerrit)

unread,
Feb 13, 2026, 5:02:44 PMFeb 13
to Stephen Nusko, Arthur Sonzogni, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
Attention needed from Arthur Sonzogni and Stephen Nusko

Daniel Angulo voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Arthur Sonzogni
  • Stephen Nusko
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • 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: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
Gerrit-Change-Number: 7571428
Gerrit-PatchSet: 6
Gerrit-Owner: Daniel Angulo <angd...@google.com>
Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
Gerrit-Attention: Arthur Sonzogni <arthurs...@chromium.org>
Gerrit-Comment-Date: Fri, 13 Feb 2026 22:02:38 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Stephen Nusko (Gerrit)

unread,
Feb 15, 2026, 10:51:05 PMFeb 15
to Daniel Angulo, Arthur Sonzogni, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
Attention needed from Arthur Sonzogni and Daniel Angulo

Stephen Nusko added 10 comments

File services/tracing/perfetto/privacy_filtering_check.cc
Line 56, Patchset 6 (Latest):size_t acceptedFieldIdSize(const int* accepted_field_ids) {
size_t size = 0;
while (UNSAFE_TODO(accepted_field_ids[size]) != -1) {
size++;
}
return size;
}
Stephen Nusko . unresolved

This is highly performance sensitive code, I think we shouldn't be computing the size. As I said I think we should keep this as unsafe until we update the generator to use bounds checked objects.

Line 80, Patchset 6 (Latest): // SAFETY: proto is a pointer to the serialized trace proto which is a
// kProtoZeroMessageSet, which is a repeated field of
// TracePacket. TracePacket has a maximum size of 256 MiB - far below the
// threshold where we would need to use unsafe buffers.
Stephen Nusko . unresolved

What does this mean about "far below the threshold"? This comment doesn't explain why this is safe? I think the fact is ProtoDecoder is a span like type, and it doesn't do bounds checking, at the moment it has 1 unsafe constructor and 2 safe-ish constructors, we can't claim UNSAFE_BUFFERS here and wash our hands of it. Lets leave it as UNSAFE_TODO.

Line 84, Patchset 6 (Latest): auto proto_span = UNSAFE_BUFFERS(base::span(
Stephen Nusko . unresolved

Also this type is non-obvious type so auto hides the information.

```
base::span<uint8_t> proto_span = UNSAFE_TODO(base:span(proto->begin(), proto->bytes_left()));
```

Line 85, Patchset 6 (Latest): proto->begin(), static_cast<size_t>(proto->end() - proto->begin())));
Stephen Nusko . unresolved

use bytes_left()

Line 93, Patchset 6 (Latest): // SAFETY: MessageInfo states that the accepted_field_id is terminated by
Stephen Nusko . unresolved

Can you link to this?

Line 97, Patchset 6 (Latest): root->accepted_field_ids,
Stephen Nusko . unresolved

It feels like we should spanify this, but this is coming from generated code see (go/how-do-i-chrometto), so for now this needs to remain UNSAFE_TODO.

Line 119, Patchset 6 (Latest): output.append(proto_span.subspan(current_field_start).data(),
proto_span.subspan(next_field_start).data());
Stephen Nusko . unresolved

This doesn't look great (also two subspans being created)

```
const std::string_view msg_data =
base::as_string_view(proto_span.subspan(current_field_start, next_field_start - current_field_start));
output.append(msg_data.begin(), msg_data.end());
```

Perhaps?

Actually thinking about this a bit more we are just looping over `proto` and reading one by one, we can instead of creating a bunch of subspans just use SpanReader?

I.E.

```
base::SpanReader reader (proto_span);
size_t current_field_start = 0;
size_t next_field_start = 0;
for (auto f = proto->ReadField(); f.valid();
f = proto->ReadField(), current_field_start = next_field_start) {
next_field_start = proto->read_offset();
CHECK_EQ(reader.num_read(), current_field_start);
...
maybe_data = reader.Read(next_field_start - current_field_start);
output.append(maybe_data->begin(), maybe_data->end());
```
Line 157, Patchset 6 (Latest): .copy_from(base::as_byte_span(output).subspan(out_msg_start_offset,
Stephen Nusko . resolved

note: this has to remain copy_from (since it is potentially overlapping).

Line 163, Patchset 6 (Latest): .copy_from(base::span(field_id_buf).first(field_id_length));
Stephen Nusko . unresolved

copy_from_nonoverlapping

Line 167, Patchset 6 (Latest): .copy_from(base::span(payload_size_buf).first(payload_size_length));
Stephen Nusko . unresolved

copy_from_nonoverlapping

Open in Gerrit

Related details

Attention is currently required from:
  • Arthur Sonzogni
  • Daniel Angulo
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • 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: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
    Gerrit-Change-Number: 7571428
    Gerrit-PatchSet: 6
    Gerrit-Owner: Daniel Angulo <angd...@google.com>
    Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
    Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
    Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
    Gerrit-Attention: Daniel Angulo <angd...@google.com>
    Gerrit-Attention: Arthur Sonzogni <arthurs...@chromium.org>
    Gerrit-Comment-Date: Mon, 16 Feb 2026 03:50:33 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Arthur Sonzogni (Gerrit)

    unread,
    Feb 18, 2026, 8:34:11 AMFeb 18
    to Daniel Angulo, Stephen Nusko, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
    Attention needed from Daniel Angulo

    Arthur Sonzogni added 1 comment

    File services/tracing/perfetto/privacy_filtering_check.cc
    Line 163, Patchset 6: .copy_from(base::span(field_id_buf).first(field_id_length));
    Stephen Nusko . unresolved

    copy_from_nonoverlapping

    Arthur Sonzogni

    Hi @nus...@chromium.org, I have a different opinion about `copy_from`/`copy_from_nonoverlapping`. I don't really believe there are meaningful performance difference and we should use the short/safe version by default.

    I added some arguments below:
    https://chromium-review.googlesource.com/c/chromium/src/+/7541348/comment/7892b7db_f5eb5c23/

    WDYT?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Daniel Angulo
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • 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: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
    Gerrit-Change-Number: 7571428
    Gerrit-PatchSet: 8
    Gerrit-Owner: Daniel Angulo <angd...@google.com>
    Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
    Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
    Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
    Gerrit-Attention: Daniel Angulo <angd...@google.com>
    Gerrit-Comment-Date: Wed, 18 Feb 2026 13:33:54 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Stephen Nusko <nus...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Daniel Angulo (Gerrit)

    unread,
    Feb 24, 2026, 5:12:07 PMFeb 24
    to Stephen Nusko, Arthur Sonzogni, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
    Attention needed from Stephen Nusko

    Daniel Angulo added 8 comments

    File services/tracing/perfetto/privacy_filtering_check.cc
    Line 56, Patchset 6:size_t acceptedFieldIdSize(const int* accepted_field_ids) {

    size_t size = 0;
    while (UNSAFE_TODO(accepted_field_ids[size]) != -1) {
    size++;
    }
    return size;
    }
    Stephen Nusko . resolved

    This is highly performance sensitive code, I think we shouldn't be computing the size. As I said I think we should keep this as unsafe until we update the generator to use bounds checked objects.

    Daniel Angulo

    Done

    Line 80, Patchset 6: // SAFETY: proto is a pointer to the serialized trace proto which is a

    // kProtoZeroMessageSet, which is a repeated field of
    // TracePacket. TracePacket has a maximum size of 256 MiB - far below the
    // threshold where we would need to use unsafe buffers.
    Stephen Nusko . resolved

    What does this mean about "far below the threshold"? This comment doesn't explain why this is safe? I think the fact is ProtoDecoder is a span like type, and it doesn't do bounds checking, at the moment it has 1 unsafe constructor and 2 safe-ish constructors, we can't claim UNSAFE_BUFFERS here and wash our hands of it. Lets leave it as UNSAFE_TODO.

    Daniel Angulo

    I leave it as UNSAFE_TODO for now.

    Line 84, Patchset 6: auto proto_span = UNSAFE_BUFFERS(base::span(
    Stephen Nusko . resolved

    Also this type is non-obvious type so auto hides the information.

    ```
    base::span<uint8_t> proto_span = UNSAFE_TODO(base:span(proto->begin(), proto->bytes_left()));
    ```

    Daniel Angulo

    Done

    Line 85, Patchset 6: proto->begin(), static_cast<size_t>(proto->end() - proto->begin())));
    Stephen Nusko . resolved

    use bytes_left()

    Daniel Angulo

    Done

    Line 93, Patchset 6: // SAFETY: MessageInfo states that the accepted_field_id is terminated by
    Stephen Nusko . resolved

    Can you link to this?

    Daniel Angulo

    Done

    Line 97, Patchset 6: root->accepted_field_ids,
    Stephen Nusko . resolved

    It feels like we should spanify this, but this is coming from generated code see (go/how-do-i-chrometto), so for now this needs to remain UNSAFE_TODO.

    Daniel Angulo

    Done

    Line 119, Patchset 6: output.append(proto_span.subspan(current_field_start).data(),
    proto_span.subspan(next_field_start).data());
    Stephen Nusko . resolved

    This doesn't look great (also two subspans being created)

    ```
    const std::string_view msg_data =
    base::as_string_view(proto_span.subspan(current_field_start, next_field_start - current_field_start));
    output.append(msg_data.begin(), msg_data.end());
    ```

    Perhaps?

    Actually thinking about this a bit more we are just looping over `proto` and reading one by one, we can instead of creating a bunch of subspans just use SpanReader?

    I.E.

    ```
    base::SpanReader reader (proto_span);
    size_t current_field_start = 0;
    size_t next_field_start = 0;
    for (auto f = proto->ReadField(); f.valid();
    f = proto->ReadField(), current_field_start = next_field_start) {
    next_field_start = proto->read_offset();
    CHECK_EQ(reader.num_read(), current_field_start);
    ...
    maybe_data = reader.Read(next_field_start - current_field_start);
    output.append(maybe_data->begin(), maybe_data->end());
    ```
    Daniel Angulo

    Done

    Line 167, Patchset 6: .copy_from(base::span(payload_size_buf).first(payload_size_length));
    Stephen Nusko . resolved

    copy_from_nonoverlapping

    Daniel Angulo

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Stephen Nusko
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • 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: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
    Gerrit-Change-Number: 7571428
    Gerrit-PatchSet: 8
    Gerrit-Owner: Daniel Angulo <angd...@google.com>
    Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
    Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
    Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
    Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
    Gerrit-Comment-Date: Tue, 24 Feb 2026 22:12:01 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Stephen Nusko (Gerrit)

    unread,
    Feb 24, 2026, 8:32:59 PMFeb 24
    to Daniel Angulo, Arthur Sonzogni, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
    Attention needed from Daniel Angulo

    Stephen Nusko added 2 comments

    Patchset-level comments
    File-level comment, Patchset 8 (Latest):
    Stephen Nusko . resolved

    Let me know when the tests are passing.

    File services/tracing/perfetto/privacy_filtering_check.cc
    Line 163, Patchset 6: .copy_from(base::span(field_id_buf).first(field_id_length));
    Stephen Nusko . resolved

    copy_from_nonoverlapping

    Arthur Sonzogni

    Hi @nus...@chromium.org, I have a different opinion about `copy_from`/`copy_from_nonoverlapping`. I don't really believe there are meaningful performance difference and we should use the short/safe version by default.

    I added some arguments below:
    https://chromium-review.googlesource.com/c/chromium/src/+/7541348/comment/7892b7db_f5eb5c23/

    WDYT?

    Stephen Nusko

    Interesting let me reply there, I'm happy to go with copy_from as a default, I had been operating as a clearly different buffers should be done with non_overlapping to ensure maximum performance to avoid impact due to our rewrites.

    In this code we're finishing a trace which isn't super performance critical happy to go with the safe versions here.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Daniel Angulo
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • 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: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
      Gerrit-Change-Number: 7571428
      Gerrit-PatchSet: 8
      Gerrit-Owner: Daniel Angulo <angd...@google.com>
      Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
      Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
      Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
      Gerrit-Attention: Daniel Angulo <angd...@google.com>
      Gerrit-Comment-Date: Wed, 25 Feb 2026 01:32:29 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Stephen Nusko <nus...@chromium.org>
      Comment-In-Reply-To: Arthur Sonzogni <arthurs...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Daniel Angulo (Gerrit)

      unread,
      Mar 4, 2026, 9:59:23 AMMar 4
      to Stephen Nusko, Arthur Sonzogni, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
      Attention needed from Stephen Nusko

      Daniel Angulo added 1 comment

      Patchset-level comments
      Stephen Nusko . resolved

      Let me know when the tests are passing.

      Daniel Angulo

      tests are passing now

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Stephen Nusko
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • 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: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
      Gerrit-Change-Number: 7571428
      Gerrit-PatchSet: 9
      Gerrit-Owner: Daniel Angulo <angd...@google.com>
      Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
      Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
      Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
      Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
      Gerrit-Comment-Date: Wed, 04 Mar 2026 14:59:16 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Stephen Nusko (Gerrit)

      unread,
      Mar 5, 2026, 1:53:17 AMMar 5
      to Daniel Angulo, Arthur Sonzogni, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
      Attention needed from Arthur Sonzogni and Daniel Angulo

      Stephen Nusko added 3 comments

      File services/tracing/perfetto/privacy_filtering_check.cc
      Line 78, Patchset 9 (Latest): proto->begin(), static_cast<size_t>(proto->end() - proto->begin())));
      Stephen Nusko . unresolved

      we don't need to use the size do we? Can't we just do `base::span(proto->begin(), proto->end())` I think it reads clearer?

      Update the safety comment similarly.

      Line 106, Patchset 9 (Latest): auto data = proto_span.subspan(current_field_start, field_size);
      output.append(reinterpret_cast<const char*>(data.data()), data.size());
      Stephen Nusko . unresolved

      if the only time we use data is as a char should we make `proto_span` be a char array?

      I.E.

      ```
      auto proto_span = base::as_chars(UNSAFE_BUFFERS(base::span(proto->begin(), proto->end())));
      ```

      Then we don't need the cast?

      Line 142, Patchset 9 (Latest): base::as_writable_byte_span(output)
      Stephen Nusko . unresolved

      We use output as a bytes_span repeatedly can we factor it out

      ```
      auto output_bytes = base::as_writable_byte_span(output);

      output_bytes.subspan(..., ...).copy_from(output_bytes.subspan(..., ...));
      ```

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Arthur Sonzogni
      • Daniel Angulo
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • 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: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
        Gerrit-Change-Number: 7571428
        Gerrit-PatchSet: 9
        Gerrit-Owner: Daniel Angulo <angd...@google.com>
        Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
        Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
        Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
        Gerrit-Attention: Daniel Angulo <angd...@google.com>
        Gerrit-Attention: Arthur Sonzogni <arthurs...@chromium.org>
        Gerrit-Comment-Date: Thu, 05 Mar 2026 06:52:48 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Arthur Sonzogni (Gerrit)

        unread,
        Mar 5, 2026, 5:40:54 AMMar 5
        to Daniel Angulo, Stephen Nusko, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
        Attention needed from Daniel Angulo

        Arthur Sonzogni added 5 comments

        Commit Message
        Line 18, Patchset 9 (Latest):BUG=439964610


        Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
        Arthur Sonzogni . unresolved

        nit: Ideally, the git footer line aren't separated by an empty line.
        Moreover the syntax is "Bug: 439964610"

        Right now we have:
        ```
        cat description | git footers
        Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
        ```

        If you remove the new line and update the format, you get:
        ```
        cat description | git footers
        Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
        Bug: 439964610
        ```

        File services/tracing/perfetto/privacy_filtering_check.cc
        Line 15, Patchset 9 (Latest):#include "base/containers/span_reader.h"
        Arthur Sonzogni . unresolved

        Is this used?

        Line 78, Patchset 9 (Latest): proto->begin(), static_cast<size_t>(proto->end() - proto->begin())));
        Stephen Nusko . unresolved

        we don't need to use the size do we? Can't we just do `base::span(proto->begin(), proto->end())` I think it reads clearer?

        Update the safety comment similarly.

        Arthur Sonzogni

        I think span has a constructor from a pair of iterator.
        ```
        auto proto_span = base::span(proto)
        ```

        This allows not having a SAFETY/UNSAFE_BUFFERS

        Line 106, Patchset 9 (Latest): auto data = proto_span.subspan(current_field_start, field_size);
        output.append(reinterpret_cast<const char*>(data.data()), data.size());
        Stephen Nusko . unresolved

        if the only time we use data is as a char should we make `proto_span` be a char array?

        I.E.

        ```
        auto proto_span = base::as_chars(UNSAFE_BUFFERS(base::span(proto->begin(), proto->end())));
        ```

        Then we don't need the cast?

        Arthur Sonzogni

        Or:
        ```
        output.append(base::as_string_view(data));
        ```

        Line 150, Patchset 9 (Latest): .copy_from_nonoverlapping(
        Arthur Sonzogni . unresolved

        `copy_from` ? (That is the safer variant, and I don't believe it is slower)

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Daniel Angulo
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • 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: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
        Gerrit-Change-Number: 7571428
        Gerrit-PatchSet: 9
        Gerrit-Owner: Daniel Angulo <angd...@google.com>
        Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
        Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
        Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
        Gerrit-Attention: Daniel Angulo <angd...@google.com>
        Gerrit-Comment-Date: Thu, 05 Mar 2026 10:40:42 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Stephen Nusko <nus...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Daniel Angulo (Gerrit)

        unread,
        Mar 6, 2026, 9:51:17 AMMar 6
        to Stephen Nusko, Arthur Sonzogni, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
        Attention needed from Arthur Sonzogni and Stephen Nusko

        Daniel Angulo added 6 comments

        Commit Message
        Line 18, Patchset 9:BUG=439964610


        Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
        Arthur Sonzogni . resolved

        nit: Ideally, the git footer line aren't separated by an empty line.
        Moreover the syntax is "Bug: 439964610"

        Right now we have:
        ```
        cat description | git footers
        Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
        ```

        If you remove the new line and update the format, you get:
        ```
        cat description | git footers
        Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
        Bug: 439964610
        ```

        Daniel Angulo

        Done

        File services/tracing/perfetto/privacy_filtering_check.cc
        Line 15, Patchset 9:#include "base/containers/span_reader.h"
        Arthur Sonzogni . resolved

        Is this used?

        Daniel Angulo

        Done

        Line 78, Patchset 9: proto->begin(), static_cast<size_t>(proto->end() - proto->begin())));
        Stephen Nusko . resolved

        we don't need to use the size do we? Can't we just do `base::span(proto->begin(), proto->end())` I think it reads clearer?

        Update the safety comment similarly.

        Arthur Sonzogni

        I think span has a constructor from a pair of iterator.
        ```
        auto proto_span = base::span(proto)
        ```

        This allows not having a SAFETY/UNSAFE_BUFFERS

        Daniel Angulo

        converting directly proto to span leads to this error: no viable constructor or deduction guide for deduction of template arguments of 'base::span'

        using begin() and end() requires UNSAFE_BUFFERS

        Line 106, Patchset 9: auto data = proto_span.subspan(current_field_start, field_size);

        output.append(reinterpret_cast<const char*>(data.data()), data.size());
        Stephen Nusko . resolved

        if the only time we use data is as a char should we make `proto_span` be a char array?

        I.E.

        ```
        auto proto_span = base::as_chars(UNSAFE_BUFFERS(base::span(proto->begin(), proto->end())));
        ```

        Then we don't need the cast?

        Arthur Sonzogni

        Or:
        ```
        output.append(base::as_string_view(data));
        ```

        Daniel Angulo

        output.append(base::as_string_view(data));

        looks nicer

        Line 142, Patchset 9: base::as_writable_byte_span(output)
        Stephen Nusko . resolved

        We use output as a bytes_span repeatedly can we factor it out

        ```
        auto output_bytes = base::as_writable_byte_span(output);

        output_bytes.subspan(..., ...).copy_from(output_bytes.subspan(..., ...));
        ```

        Daniel Angulo

        Done

        Line 150, Patchset 9: .copy_from_nonoverlapping(
        Arthur Sonzogni . resolved

        `copy_from` ? (That is the safer variant, and I don't believe it is slower)

        Daniel Angulo

        Done

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Arthur Sonzogni
        • Stephen Nusko
        Submit Requirements:
          • requirement satisfiedCode-Coverage
          • 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: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
          Gerrit-Change-Number: 7571428
          Gerrit-PatchSet: 12
          Gerrit-Owner: Daniel Angulo <angd...@google.com>
          Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
          Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
          Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
          Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
          Gerrit-Attention: Arthur Sonzogni <arthurs...@chromium.org>
          Gerrit-Comment-Date: Fri, 06 Mar 2026 14:51:05 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          Comment-In-Reply-To: Stephen Nusko <nus...@chromium.org>
          Comment-In-Reply-To: Arthur Sonzogni <arthurs...@chromium.org>
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Stephen Nusko (Gerrit)

          unread,
          Mar 9, 2026, 4:44:21 AMMar 9
          to Daniel Angulo, Arthur Sonzogni, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
          Attention needed from Arthur Sonzogni and Daniel Angulo

          Stephen Nusko added 3 comments

          File services/tracing/perfetto/privacy_filtering_check.cc
          Line 78, Patchset 9: proto->begin(), static_cast<size_t>(proto->end() - proto->begin())));
          Stephen Nusko . unresolved

          we don't need to use the size do we? Can't we just do `base::span(proto->begin(), proto->end())` I think it reads clearer?

          Update the safety comment similarly.

          Arthur Sonzogni

          I think span has a constructor from a pair of iterator.
          ```
          auto proto_span = base::span(proto)
          ```

          This allows not having a SAFETY/UNSAFE_BUFFERS

          Daniel Angulo

          converting directly proto to span leads to this error: no viable constructor or deduction guide for deduction of template arguments of 'base::span'

          using begin() and end() requires UNSAFE_BUFFERS

          Stephen Nusko

          deduction is a guide to what type should the template values take, you can override it. Can you try

          ```
          base::span<uint8_t>(proto)
          ```

          ?

          Line 80, Patchset 6: // SAFETY: proto is a pointer to the serialized trace proto which is a
          // kProtoZeroMessageSet, which is a repeated field of
          // TracePacket. TracePacket has a maximum size of 256 MiB - far below the
          // threshold where we would need to use unsafe buffers.
          Stephen Nusko . unresolved

          What does this mean about "far below the threshold"? This comment doesn't explain why this is safe? I think the fact is ProtoDecoder is a span like type, and it doesn't do bounds checking, at the moment it has 1 unsafe constructor and 2 safe-ish constructors, we can't claim UNSAFE_BUFFERS here and wash our hands of it. Lets leave it as UNSAFE_TODO.

          Daniel Angulo

          I leave it as UNSAFE_TODO for now.

          Stephen Nusko

          Also this looks to still be a UNSAFE_BUFFERS not UNSAFE_TODO as requested since `proto` isn't hardened if we keep the constructor that needs to be wrapped it should be UNSAFE_TODO (if the other comment manages to remove this UNSAFE_TODO I guess that is fine).

          Line 143, Patchset 12 (Latest): .copy_from(base::as_byte_span(output).subspan(out_msg_start_offset,
          Stephen Nusko . unresolved

          Isn't this just

          `output_bytes`

          ?

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Arthur Sonzogni
          • Daniel Angulo
          Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement is not satisfiedCode-Owners
            • requirement is not satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • 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: chromium/src
            Gerrit-Branch: main
            Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
            Gerrit-Change-Number: 7571428
            Gerrit-PatchSet: 12
            Gerrit-Owner: Daniel Angulo <angd...@google.com>
            Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
            Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
            Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
            Gerrit-Attention: Daniel Angulo <angd...@google.com>
            Gerrit-Attention: Arthur Sonzogni <arthurs...@chromium.org>
            Gerrit-Comment-Date: Mon, 09 Mar 2026 08:43:51 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            Comment-In-Reply-To: Stephen Nusko <nus...@chromium.org>
            Comment-In-Reply-To: Daniel Angulo <angd...@google.com>
            Comment-In-Reply-To: Arthur Sonzogni <arthurs...@chromium.org>
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Arthur Sonzogni (Gerrit)

            unread,
            Mar 9, 2026, 12:29:38 PMMar 9
            to Daniel Angulo, Stephen Nusko, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
            Attention needed from Daniel Angulo

            Arthur Sonzogni added 3 comments

            Patchset-level comments
            File-level comment, Patchset 12 (Latest):
            Arthur Sonzogni . resolved

            Thanks!

            File services/tracing/perfetto/privacy_filtering_check.cc
            Line 78, Patchset 9: proto->begin(), static_cast<size_t>(proto->end() - proto->begin())));
            Stephen Nusko . unresolved

            we don't need to use the size do we? Can't we just do `base::span(proto->begin(), proto->end())` I think it reads clearer?

            Update the safety comment similarly.

            Arthur Sonzogni

            I think span has a constructor from a pair of iterator.
            ```
            auto proto_span = base::span(proto)
            ```

            This allows not having a SAFETY/UNSAFE_BUFFERS

            Daniel Angulo

            converting directly proto to span leads to this error: no viable constructor or deduction guide for deduction of template arguments of 'base::span'

            using begin() and end() requires UNSAFE_BUFFERS

            Stephen Nusko

            deduction is a guide to what type should the template values take, you can override it. Can you try

            ```
            base::span<uint8_t>(proto)
            ```

            ?

            Arthur Sonzogni

            I tried. This work:
            ```
            base::span<uint8_t>(*proto)
            ```

            Line 155, Patchset 12 (Latest):}
            Arthur Sonzogni . unresolved

            A nice thing about `base::span` is that we can "peel" them using `split_at` or `take_first`. When there are disjoint union, we can name the separate parts and we don't need to repeat the different offset?

            I have generated this example using Gemini:
            ```
            // Recursively copies the |proto|'s accepted field IDs including all sub
            // messages, over to |output|. Keeps track of |parent_ids| - field id in parent
            // message, in order of most recent child last.
            bool FilterProtoRecursively(const MessageInfo* root,
            ProtoDecoder* proto,
            std::vector<uint32_t>* parent_ids,
            std::string& output) {
            // Write any allowed fields of the message (the message's "payload") into
            // |output| at the |out_msg_start_offset|. This will not include the field ID
            // or size of the current message yet. We add those back below once we know
            // the final message size. Emitting the message payload into |output| saves
            // allocations for extra buffer, but will still require a memmove below. Other
            // alternative is to just use the max length bytes like protozero does.
            bool has_blocked_fields = false;
            const size_t out_msg_start_offset = output.size();
              proto->Reset();
            base::span<const uint8_t> remaining_proto = base::span(*proto);
            for (auto f = proto->ReadField(); f.valid(); f = proto->ReadField()) {
            // ReadField() advanced the internal decoder pointer. The field we just read
            // is the difference between the previous remaining bytes and the current.
            base::span<const uint8_t> field_span = remaining_proto.take_first(
            remaining_proto.size() - proto->bytes_left());
                // If the field is not available in the accepted fields, then skip copying.
            int index = FindIndexOfValue(root->accepted_field_ids, f.id());
            if (index == -1) {
            #if DCHECK_IS_ON()
            LogDisallowedField(parent_ids, f.id());
            #endif
            has_blocked_fields = true;
            continue;
            }
                // If the field is allowed, then either the field is a nested message, or a
            // POD. If it's a nested message, then the message description will be
            // part of |sub_messages| list. If the message description is nullptr, then
            // assume it is POD.
            if (!root->sub_messages ||
            UNSAFE_TODO(root->sub_messages[index]) == nullptr) {
            // PODs can just be copied over to output. Packed fields can be treated
            // just like primitive fields, by just copying over the full data. Note
            // that there cannot be packed nested messages. Note that we cannot use
            // |f.data()| here since it does not include the preamble (field id and
            // possibly length), so we need to use |field_span|.
            output.append(base::as_string_view(field_span));
            } else {
            // Make recursive call to filter the nested message.
            ProtoDecoder decoder(f.data(), f.size());
            parent_ids->push_back(f.id());
            has_blocked_fields |= FilterProtoRecursively(
            UNSAFE_TODO(root->sub_messages[index]), &decoder, parent_ids, output);
            parent_ids->pop_back();
            }
            }
              const uint32_t payload_size = output.size() - out_msg_start_offset;
              // The format is <field id><payload size><message data>.
            // This function wrote the payload of the current message starting from the
            // end of output. We need to insert the preamble (<field id><payload size>),
            // after moving the payload by the size of the preamble.
            const uint32_t field_id =
            protozero::proto_utils::MakeTagLengthDelimited(parent_ids->back());
            std::array<uint8_t, protozero::proto_utils::kMaxTagEncodedSize> field_id_buf =
            {};
            std::array<uint8_t, protozero::proto_utils::kMessageLengthFieldSize>
            payload_size_buf = {};
              uint8_t* field_id_end =
            protozero::proto_utils::WriteVarInt(field_id, field_id_buf.data());
            const size_t field_id_length = field_id_end - field_id_buf.data();
              uint8_t* payload_size_end = protozero::proto_utils::WriteVarInt(
            payload_size, payload_size_buf.data());
            const size_t payload_size_length = payload_size_end - payload_size_buf.data();
            const size_t preamble_length = field_id_length + payload_size_length;
            output.append(preamble_length, 0);
              auto message_span = base::as_writable_byte_span(output);
            message_span.take_first(out_msg_start_offset);
              if (payload_size != 0) {
            // Move the payload to make room for the preamble at the beginning.
            // message_span is [original_payload][empty_space]
            // destination is [empty_space][final_payload_position]
            message_span.subspan(preamble_length).copy_from(
            message_span.first(payload_size));
            }
              base::span field_id_span = message_span.take_first(field_id_length);
            base::span payload_size_span = message_span.take_first(payload_size_length);
              field_id_span.copy_from(base::span(field_id_buf).first(field_id_length));
            payload_size_span.copy_from(base::span(payload_size_buf).first(payload_size_length));
              return has_blocked_fields;
            }
            ```
            (I only verified it compile and pass the PrivacyFilteringTest, no general guarantee)


            WDYT? Maybe we can try to use `take_first` more to me the code more idiomatic?

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Daniel Angulo
            Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement is not satisfiedCode-Owners
            • requirement is not satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • 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: chromium/src
            Gerrit-Branch: main
            Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
            Gerrit-Change-Number: 7571428
            Gerrit-PatchSet: 12
            Gerrit-Owner: Daniel Angulo <angd...@google.com>
            Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
            Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
            Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
            Gerrit-Attention: Daniel Angulo <angd...@google.com>
            Gerrit-Comment-Date: Mon, 09 Mar 2026 16:29:23 +0000
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Daniel Angulo (Gerrit)

            unread,
            Mar 9, 2026, 12:56:47 PMMar 9
            to Arthur Sonzogni, Stephen Nusko, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
            Attention needed from Arthur Sonzogni and Stephen Nusko

            Daniel Angulo added 3 comments

            File services/tracing/perfetto/privacy_filtering_check.cc
            Line 78, Patchset 9: proto->begin(), static_cast<size_t>(proto->end() - proto->begin())));
            Stephen Nusko . resolved

            we don't need to use the size do we? Can't we just do `base::span(proto->begin(), proto->end())` I think it reads clearer?

            Update the safety comment similarly.

            Arthur Sonzogni

            I think span has a constructor from a pair of iterator.
            ```
            auto proto_span = base::span(proto)
            ```

            This allows not having a SAFETY/UNSAFE_BUFFERS

            Daniel Angulo

            converting directly proto to span leads to this error: no viable constructor or deduction guide for deduction of template arguments of 'base::span'

            using begin() and end() requires UNSAFE_BUFFERS

            Stephen Nusko

            deduction is a guide to what type should the template values take, you can override it. Can you try

            ```
            base::span<uint8_t>(proto)
            ```

            ?

            Arthur Sonzogni

            I tried. This work:
            ```
            base::span<uint8_t>(*proto)
            ```

            Daniel Angulo
            it didn't work for me, I got error: services/tracing/perfetto/privacy_filtering_check.cc:77:21: error: no matching conversion for functional-style cast from 'ProtoDecoder' to 'base::span<uint8_t>' (aka 'base::span<unsigned char>')
            77 | auto proto_span = base::span<uint8_t>(*proto);

            but figured out that needs to be const uint8_t
            `auto proto_span = base::span<const uint8_t>(*proto);`

            Line 80, Patchset 6: // SAFETY: proto is a pointer to the serialized trace proto which is a
            // kProtoZeroMessageSet, which is a repeated field of
            // TracePacket. TracePacket has a maximum size of 256 MiB - far below the
            // threshold where we would need to use unsafe buffers.
            Stephen Nusko . resolved

            What does this mean about "far below the threshold"? This comment doesn't explain why this is safe? I think the fact is ProtoDecoder is a span like type, and it doesn't do bounds checking, at the moment it has 1 unsafe constructor and 2 safe-ish constructors, we can't claim UNSAFE_BUFFERS here and wash our hands of it. Lets leave it as UNSAFE_TODO.

            Daniel Angulo

            I leave it as UNSAFE_TODO for now.

            Stephen Nusko

            Also this looks to still be a UNSAFE_BUFFERS not UNSAFE_TODO as requested since `proto` isn't hardened if we keep the constructor that needs to be wrapped it should be UNSAFE_TODO (if the other comment manages to remove this UNSAFE_TODO I guess that is fine).

            Daniel Angulo

            Done

            Line 143, Patchset 12: .copy_from(base::as_byte_span(output).subspan(out_msg_start_offset,
            Stephen Nusko . resolved

            Isn't this just

            `output_bytes`

            ?

            Daniel Angulo

            right

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Arthur Sonzogni
            • Stephen Nusko
            Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement is not satisfiedCode-Owners
            • requirement is not satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • 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: chromium/src
            Gerrit-Branch: main
            Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
            Gerrit-Change-Number: 7571428
            Gerrit-PatchSet: 13
            Gerrit-Owner: Daniel Angulo <angd...@google.com>
            Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
            Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
            Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
            Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
            Gerrit-Attention: Arthur Sonzogni <arthurs...@chromium.org>
            Gerrit-Comment-Date: Mon, 09 Mar 2026 16:56:36 +0000
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Stephen Nusko (Gerrit)

            unread,
            Mar 9, 2026, 10:40:09 PMMar 9
            to Daniel Angulo, Arthur Sonzogni, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
            Attention needed from Arthur Sonzogni and Daniel Angulo

            Stephen Nusko added 2 comments

            File services/tracing/perfetto/privacy_filtering_check.cc
            Line 75, Patchset 13 (Latest): // SAFETY: proto is a pointer to a buffer which is guaranteed to have at least
            // end() - begin() bytes, which is the size of the proto.
            // auto proto_span = UNSAFE_TODO(base::span(proto->begin(), proto->end()));
            Stephen Nusko . unresolved

            nit: looks like this safety comment isn't needed anymore?

            Stephen Nusko

            I like it in general, naming the parts rather than a bunch of offsets seems pretty nice, but I do have some comments especially once I see it fully diffed.

            For example could we merge the two arrays into one and create a split span for the two locations, then we could .first from them to get the spans of the real data, making it a bit clearer.

            ```
            std::array<uint8_t, protozero::proto_utils::kMaxTagEncodedSize + protozero::proto_utils::kMessageLengthFieldSize> storage =
            {};
            auto [field_id_buf, payload_size_buf] = base::span(storage).split_at<protozero::proto_utils::kMaxTagEncodedSize>();
            uint8_t* const field_id_end =
            protozero::proto_utils::WriteVarInt(field_id, field_id_buf.data());
            field_id_buf = field_id_buf.first(field_id_end - field_id_buf.data());

            uint8_t* const payload_size_end = protozero::proto_utils::WriteVarInt(
            payload_size, payload_size_buf.data());
            payload_size_buf = payload_size_buf.first(payload_size_end - payload_size_buf.data());
            const size_t preamble_size = payload_size_buf.size() + field_id_buf.size();
            ....
               message_span.take_first(field_id_buf.size()).copy_from(field_id_buf);
            message_span.take_first(payload_size_buf.size()).copy_from(payload_size_buf);
            ```

            Also

            ```

            auto message_span = base::as_writable_byte_span(output);
            message_span.take_first(out_msg_start_offset);
            ```

            is just

            ```
            auto message_span = base::as_writable_byte_span(output).subspan(out_msg_start_offset);
            ```

            So please take a look for other optimizations and readability if you go this route.

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Arthur Sonzogni
            • Daniel Angulo
            Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement is not satisfiedCode-Owners
            • requirement is not satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • 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: chromium/src
            Gerrit-Branch: main
            Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
            Gerrit-Change-Number: 7571428
            Gerrit-PatchSet: 13
            Gerrit-Owner: Daniel Angulo <angd...@google.com>
            Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
            Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
            Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
            Gerrit-Attention: Daniel Angulo <angd...@google.com>
            Gerrit-Attention: Arthur Sonzogni <arthurs...@chromium.org>
            Gerrit-Comment-Date: Tue, 10 Mar 2026 02:39:40 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            Comment-In-Reply-To: Arthur Sonzogni <arthurs...@chromium.org>
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Daniel Angulo (Gerrit)

            unread,
            Mar 11, 2026, 6:19:25 PMMar 11
            to Arthur Sonzogni, Stephen Nusko, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
            Attention needed from Arthur Sonzogni and Stephen Nusko

            Daniel Angulo added 2 comments

            File services/tracing/perfetto/privacy_filtering_check.cc
            Line 75, Patchset 13: // SAFETY: proto is a pointer to a buffer which is guaranteed to have at least

            // end() - begin() bytes, which is the size of the proto.
            // auto proto_span = UNSAFE_TODO(base::span(proto->begin(), proto->end()));
            Stephen Nusko . resolved

            nit: looks like this safety comment isn't needed anymore?

            Daniel Angulo

            Done

            Daniel Angulo

            for the first snippet, where could it be placed? I don't see obvious substituition

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Arthur Sonzogni
            • Stephen Nusko
            Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement is not satisfiedCode-Owners
            • requirement is not satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • 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: chromium/src
            Gerrit-Branch: main
            Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
            Gerrit-Change-Number: 7571428
            Gerrit-PatchSet: 14
            Gerrit-Owner: Daniel Angulo <angd...@google.com>
            Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
            Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
            Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
            Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
            Gerrit-Attention: Arthur Sonzogni <arthurs...@chromium.org>
            Gerrit-Comment-Date: Wed, 11 Mar 2026 22:19:19 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Stephen Nusko (Gerrit)

            unread,
            Mar 12, 2026, 1:10:10 AMMar 12
            to Daniel Angulo, Arthur Sonzogni, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
            Attention needed from Arthur Sonzogni and Daniel Angulo

            Stephen Nusko added 1 comment

            File services/tracing/perfetto/privacy_filtering_check.cc
            Stephen Nusko

            The first snippet from arthur or from me? for Arthur his snippet is just the whole `FilterProtoRecursively` for me my snippet replaced

            ```

            // The format is <field id><payload size><message data>.
            // This function wrote the payload of the current message starting from the
            // end of output. We need to insert the preamble (<field id><payload size>),
            // after moving the payload by the size of the preamble.
            const uint32_t field_id =
            protozero::proto_utils::MakeTagLengthDelimited(parent_ids->back());
            std::array<uint8_t, protozero::proto_utils::kMaxTagEncodedSize> field_id_buf =
            {};
            std::array<uint8_t, protozero::proto_utils::kMessageLengthFieldSize>
            payload_size_buf = {};
              uint8_t* field_id_end =
            protozero::proto_utils::WriteVarInt(field_id, field_id_buf.data());
            const size_t field_id_length = field_id_end - field_id_buf.data();
              uint8_t* payload_size_end = protozero::proto_utils::WriteVarInt(
            payload_size, payload_size_buf.data());
            const size_t payload_size_length = payload_size_end - payload_size_buf.data();
            const size_t preamble_length = field_id_length + payload_size_length;
            output.append(preamble_length, 0);
            ```

            from Arthur's.

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Arthur Sonzogni
            • Daniel Angulo
            Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement is not satisfiedCode-Owners
            • requirement is not satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • 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: chromium/src
            Gerrit-Branch: main
            Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
            Gerrit-Change-Number: 7571428
            Gerrit-PatchSet: 14
            Gerrit-Owner: Daniel Angulo <angd...@google.com>
            Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
            Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
            Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
            Gerrit-Attention: Daniel Angulo <angd...@google.com>
            Gerrit-Attention: Arthur Sonzogni <arthurs...@chromium.org>
            Gerrit-Comment-Date: Thu, 12 Mar 2026 05:09:32 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            Comment-In-Reply-To: Stephen Nusko <nus...@chromium.org>
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Daniel Angulo (Gerrit)

            unread,
            Mar 13, 2026, 1:18:03 PMMar 13
            to Arthur Sonzogni, Stephen Nusko, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
            Attention needed from Arthur Sonzogni and Stephen Nusko

            Daniel Angulo voted and added 1 comment

            Votes added by Daniel Angulo

            Auto-Submit+1

            1 comment

            File services/tracing/perfetto/privacy_filtering_check.cc
            Daniel Angulo

            yeah I was talking about the snippet you first commented, thanks for the clarification. I've made the substituition but tests are not passing, it was throwing a lot of compile errors because undefined variables, I renamed the variables to their corresponding equivalent, but now a lot of tests just crash. I'll keep previous version if you don't mind.

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Arthur Sonzogni
            • Stephen Nusko
            Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement is not satisfiedCode-Owners
            • requirement is not satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • 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: chromium/src
            Gerrit-Branch: main
            Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
            Gerrit-Change-Number: 7571428
            Gerrit-PatchSet: 15
            Gerrit-Owner: Daniel Angulo <angd...@google.com>
            Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
            Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
            Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
            Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
            Gerrit-Attention: Arthur Sonzogni <arthurs...@chromium.org>
            Gerrit-Comment-Date: Fri, 13 Mar 2026 17:17:49 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: Yes
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Stephen Nusko (Gerrit)

            unread,
            Mar 16, 2026, 3:48:13 AMMar 16
            to Daniel Angulo, Arthur Sonzogni, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
            Attention needed from Arthur Sonzogni and Daniel Angulo

            Stephen Nusko added 1 comment

            File services/tracing/perfetto/privacy_filtering_check.cc
            Stephen Nusko

            Which tests and why do they crash? It should be functionally the same? if it isn't then it likely is just a typo or something minor? It is good if you give concrete examples in situations like this so I can understand if there is a fundamental issue I didn't think about or if a minor tweak would make it work.

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Arthur Sonzogni
            • Daniel Angulo
            Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement is not satisfiedCode-Owners
            • requirement is not satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • 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: chromium/src
            Gerrit-Branch: main
            Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
            Gerrit-Change-Number: 7571428
            Gerrit-PatchSet: 15
            Gerrit-Owner: Daniel Angulo <angd...@google.com>
            Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
            Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
            Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
            Gerrit-Attention: Daniel Angulo <angd...@google.com>
            Gerrit-Attention: Arthur Sonzogni <arthurs...@chromium.org>
            Gerrit-Comment-Date: Mon, 16 Mar 2026 07:47:42 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Daniel Angulo (Gerrit)

            unread,
            Mar 17, 2026, 2:20:38 PMMar 17
            to Arthur Sonzogni, Stephen Nusko, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
            Attention needed from Arthur Sonzogni and Stephen Nusko

            Daniel Angulo added 1 comment

            File services/tracing/perfetto/privacy_filtering_check.cc
            Daniel Angulo

            check patchset 16, there is the substituited code (I commented original subsstituited code for clear comparison, will delete once new code is working).

            I had to add field_id_buf_first and payload_size_buf_first variables because split don't allow reasign. Also renaming preamble_length to preamble_size.

            this patchset fails with

            8 tests crashed:
            PrivacyFilteringTest.NestedSafeAndUnsafeFields (../../services/tracing/perfetto/privacy_filtering_check_unittest.cc:123)
            PrivacyFilteringTest.RepeatedFields (../../services/tracing/perfetto/privacy_filtering_check_unittest.cc:57)
            PrivacyFilteringTest.SafeAndUnsafeFields (../../services/tracing/perfetto/privacy_filtering_check_unittest.cc:97)
            PrivacyFilteringTest.SafeAndUnsafePackets (../../services/tracing/perfetto/privacy_filtering_check_unittest.cc:110)
            PrivacyFilteringTest.SafeMessageWithOnlyUnsafeFields (../../services/tracing/perfetto/privacy_filtering_check_unittest.cc:83)
            PrivacyFilteringTest.SafeToplevelField (../../services/tracing/perfetto/privacy_filtering_check_unittest.cc:39)
            PrivacyFilteringTest.SafeToplevelMessageField (../../services/tracing/perfetto/privacy_filtering_check_unittest.cc:48)
            PrivacyFilteringTest.UnsafeToplevelField (../../services/tracing/perfetto/privacy_filtering_check_unittest.cc:75)

            Reasons:

            Check failed: size_type{count} <= size().
            and
            Check failed: size() == other.size().

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Arthur Sonzogni
            • Stephen Nusko
            Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement is not satisfiedCode-Owners
            • requirement is not satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • 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: chromium/src
            Gerrit-Branch: main
            Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
            Gerrit-Change-Number: 7571428
            Gerrit-PatchSet: 16
            Gerrit-Owner: Daniel Angulo <angd...@google.com>
            Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
            Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
            Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
            Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
            Gerrit-Attention: Arthur Sonzogni <arthurs...@chromium.org>
            Gerrit-Comment-Date: Tue, 17 Mar 2026 18:20:31 +0000
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Stephen Nusko (Gerrit)

            unread,
            Mar 18, 2026, 3:29:27 AMMar 18
            to Daniel Angulo, Arthur Sonzogni, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
            Attention needed from Arthur Sonzogni and Daniel Angulo

            Stephen Nusko added 1 comment

            File services/tracing/perfetto/privacy_filtering_check.cc
            Stephen Nusko

            Isn't the crash because you made `field_id_buf_first` but did the `copy_from` using `field_id_buf` which isn't the right size? and similarly for `payload_size_buf`?

            It is hard to tell because you don't have the full crash stacks but that seems like the issue?

            For the `payload_size_buf_first` issue can you use `payload_size_buf.take_first(payload_size)`?

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Arthur Sonzogni
            • Daniel Angulo
            Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement is not satisfiedCode-Owners
            • requirement is not satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • 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: chromium/src
            Gerrit-Branch: main
            Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
            Gerrit-Change-Number: 7571428
            Gerrit-PatchSet: 16
            Gerrit-Owner: Daniel Angulo <angd...@google.com>
            Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
            Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
            Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
            Gerrit-Attention: Daniel Angulo <angd...@google.com>
            Gerrit-Attention: Arthur Sonzogni <arthurs...@chromium.org>
            Gerrit-Comment-Date: Wed, 18 Mar 2026 07:28:49 +0000
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Daniel Angulo (Gerrit)

            unread,
            Mar 18, 2026, 2:04:34 PMMar 18
            to Arthur Sonzogni, Stephen Nusko, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
            Attention needed from Stephen Nusko

            Daniel Angulo voted and added 1 comment

            Votes added by Daniel Angulo

            Auto-Submit+1

            1 comment

            File services/tracing/perfetto/privacy_filtering_check.cc
            Daniel Angulo

            thanks for pointing that out. I've made the changes but still crashing, now without obvious reason.


            [0318/174659.488245:INFO:base/test/launcher/test_launcher.cc:1209] Starting [PrivacyFilteringTest.RepeatedFields, PrivacyFilteringTest.UnsafeToplevelField, Priva
            cyFilteringTest.SafeMessageWithOnlyUnsafeFields, PrivacyFilteringTest.SafeAndUnsafeFields, PrivacyFilteringTest.SafeAndUnsafePackets, PrivacyFilteringTest.Nested
            SafeAndUnsafeFields, AdaptPerfettoConfigForChromeTest.PrivacyFiltering, CookieSettingsTestP.IsPrivacyModeEnabled/GrantSource_0_BlockSource_0, CookieSettingsTestP
            .IsPrivacyModeEnabled/GrantSource_0_BlockSource_1, CookieSettingsTestP.IsPrivacyModeEnabled/GrantSource_1_BlockSource_0]
            [0318/174659.488265:INFO:base/test/launcher/test_launcher.cc:1209] Starting [CookieSettingsTestP.IsPrivacyModeEnabled/GrantSource_1_BlockSource_1, CookieSettings
            TestP.IsPrivacyModeEnabled/GrantSource_2_BlockSource_0, CookieSettingsTestP.IsPrivacyModeEnabled/GrantSource_2_BlockSource_1, CookieSettingsTestP.IsPrivacyModeEn
            abled/GrantSource_3_BlockSource_0, CookieSettingsTestP.IsPrivacyModeEnabled/GrantSource_3_BlockSource_1]
            [0318/174659.488251:INFO:base/test/launcher/test_launcher.cc:1209] Starting [NetworkContextTest.PrivacyModeDisabledByDefault, NetworkContextTest.PrivacyModeEnabl
            edIfCookiesBlocked, NetworkContextTest.PrivacyModeDisabledIfCookiesAllowed, NetworkContextTest.PrivacyModeDisabledIfCookiesSettingForOtherURL, NetworkContextTest
            .PrivacyModeEnabledIfThirdPartyCookiesBlocked, TracingConsumerTest.PrivacyFilterConfig, TracingConsumerTest.NoPrivacyFilterWithJsonConversion, PrivacyFilteringTe
            st.EmptyTrace, PrivacyFilteringTest.SafeToplevelField, PrivacyFilteringTest.SafeToplevelMessageField]
            [1/25] CookieSettingsTestP.IsPrivacyModeEnabled/GrantSource_1_BlockSource_1 (0 ms)
            [2/25] CookieSettingsTestP.IsPrivacyModeEnabled/GrantSource_2_BlockSource_0 (0 ms)
            [3/25] CookieSettingsTestP.IsPrivacyModeEnabled/GrantSource_2_BlockSource_1 (0 ms)
            [4/25] CookieSettingsTestP.IsPrivacyModeEnabled/GrantSource_3_BlockSource_0 (0 ms)
            [5/25] CookieSettingsTestP.IsPrivacyModeEnabled/GrantSource_3_BlockSource_1 (0 ms)
            [0318/174701.064017:ERROR:base/test/launcher/test_launcher.cc:1313] no test result for PrivacyFilteringTest.UnsafeToplevelField
            [0318/174701.064073:ERROR:base/test/launcher/test_launcher.cc:1313] no test result for PrivacyFilteringTest.SafeMessageWithOnlyUnsafeFields
            [0318/174701.064081:ERROR:base/test/launcher/test_launcher.cc:1313] no test result for PrivacyFilteringTest.SafeAndUnsafeFields
            [0318/174701.064088:ERROR:base/test/launcher/test_launcher.cc:1313] no test result for PrivacyFilteringTest.SafeAndUnsafePackets
            [0318/174701.064109:ERROR:base/test/launcher/test_launcher.cc:1313] no test result for PrivacyFilteringTest.NestedSafeAndUnsafeFields
            [0318/174701.064118:ERROR:base/test/launcher/test_launcher.cc:1313] no test result for AdaptPerfettoConfigForChromeTest.PrivacyFiltering
            [0318/174701.064130:ERROR:base/test/launcher/test_launcher.cc:1313] no test result for CookieSettingsTestP.IsPrivacyModeEnabled/GrantSource_0_BlockSource_0
            [0318/174701.064137:ERROR:base/test/launcher/test_launcher.cc:1313] no test result for CookieSettingsTestP.IsPrivacyModeEnabled/GrantSource_0_BlockSource_1
            [0318/174701.064144:ERROR:base/test/launcher/test_launcher.cc:1313] no test result for CookieSettingsTestP.IsPrivacyModeEnabled/GrantSource_1_BlockSource_0
            [ RUN ] PrivacyFilteringTest.RepeatedFields
            [6/25] PrivacyFilteringTest.RepeatedFields (CRASHED)
            [7/25] PrivacyFilteringTest.UnsafeToplevelField (SKIPPED)
            [8/25] PrivacyFilteringTest.SafeMessageWithOnlyUnsafeFields (SKIPPED)
            [9/25] PrivacyFilteringTest.SafeAndUnsafeFields (SKIPPED)
            [10/25] PrivacyFilteringTest.SafeAndUnsafePackets (SKIPPED)
            [11/25] PrivacyFilteringTest.NestedSafeAndUnsafeFields (SKIPPED)
            [12/25] AdaptPerfettoConfigForChromeTest.PrivacyFiltering (SKIPPED)
            [13/25] CookieSettingsTestP.IsPrivacyModeEnabled/GrantSource_0_BlockSource_0 (SKIPPED)
            [14/25] CookieSettingsTestP.IsPrivacyModeEnabled/GrantSource_0_BlockSource_1 (SKIPPED)
            [15/25] CookieSettingsTestP.IsPrivacyModeEnabled/GrantSource_1_BlockSource_0 (SKIPPED)
            [0318/174701.064789:ERROR:base/test/launcher/test_launcher.cc:1313] no test result for PrivacyFilteringTest.SafeToplevelMessageField
            [16/25] NetworkContextTest.PrivacyModeDisabledByDefault (4 ms)
            [17/25] NetworkContextTest.PrivacyModeEnabledIfCookiesBlocked (3 ms)
            [18/25] NetworkContextTest.PrivacyModeDisabledIfCookiesAllowed (3 ms)
            [19/25] NetworkContextTest.PrivacyModeDisabledIfCookiesSettingForOtherURL (3 ms)
            [20/25] NetworkContextTest.PrivacyModeEnabledIfThirdPartyCookiesBlocked (3 ms)
            [21/25] TracingConsumerTest.PrivacyFilterConfig (2 ms)
            [22/25] TracingConsumerTest.NoPrivacyFilterWithJsonConversion (1 ms)
            [23/25] PrivacyFilteringTest.EmptyTrace (0 ms)
            [ RUN ] PrivacyFilteringTest.SafeToplevelField
            [24/25] PrivacyFilteringTest.SafeToplevelField (CRASHED)
            [25/25] PrivacyFilteringTest.SafeToplevelMessageField (SKIPPED)
            Retrying 12 tests (retry #0)
            [0318/174701.066809:INFO:base/test/launcher/test_launcher.cc:1209] Starting [PrivacyFilteringTest.SafeToplevelField]
            [ RUN ] PrivacyFilteringTest.SafeToplevelField
            [26/37] PrivacyFilteringTest.SafeToplevelField (CRASHED)
            [21/25] TracingConsumerTest.PrivacyFilterConfig (2 ms)
            [22/25] TracingConsumerTest.NoPrivacyFilterWithJsonConversion (1 ms)
            [23/25] PrivacyFilteringTest.EmptyTrace (0 ms)
            [ RUN ] PrivacyFilteringTest.SafeToplevelField
            [24/25] PrivacyFilteringTest.SafeToplevelField (CRASHED)
            [25/25] PrivacyFilteringTest.SafeToplevelMessageField (SKIPPED)
            Retrying 12 tests (retry #0)
            [0318/174701.066809:INFO:base/test/launcher/test_launcher.cc:1209] Starting [PrivacyFilteringTest
            [ RUN ] PrivacyFilteringTest.SafeToplevelField
            [26/37] PrivacyFilteringTest.SafeToplevelField (CRASHED)
            [0318/174702.899558:INFO:base/test/launcher/test_launcher.cc:1209] Starting [PrivacyFilteringTest
            [ RUN ] PrivacyFilteringTest.SafeToplevelMessageField
            [0318/174704.470050:INFO:base/test/launcher/test_launcher.cc:1209] Starting [PrivacyFilteringTest
            [27/37] PrivacyFilteringTest.SafeToplevelMessageField (CRASHED)
            [31/37] PrivacyFilteringTest.SafeAndUnsafeFields (CRASHED)
            [0318/174712.325657:INFO:base/test/launcher/test_launcher.cc:1209] Starting [PrivacyFilteringTest
            .SafeAndUnsafePackets]
            [ RUN ] PrivacyFilteringTest.SafeAndUnsafePackets
            [32/37] PrivacyFilteringTest.SafeAndUnsafePackets (CRASHED)
            [0318/174713.896112:INFO:base/test/launcher/test_launcher.cc:1209] Starting [PrivacyFilteringTest
            .NestedSafeAndUnsafeFields]
            [ RUN ] PrivacyFilteringTest.NestedSafeAndUnsafeFields
            [0318/174715.466556:INFO:base/test/launcher/test_launcher.cc:1209] Starting [AdaptPerfettoConfigF
            orChromeTest.PrivacyFiltering]
            [33/37] PrivacyFilteringTest.NestedSafeAndUnsafeFields (CRASHED)
            [34/37] AdaptPerfettoConfigForChromeTest.PrivacyFiltering (6 ms)
            [0318/174715.527858:INFO:base/test/launcher/test_launcher.cc:1209] Starting [CookieSettingsTestP.
            IsPrivacyModeEnabled/GrantSource_0_BlockSource_0]
            [35/37] CookieSettingsTestP.IsPrivacyModeEnabled/GrantSource_0_BlockSource_0 (0 ms)
            [0318/174715.580932:INFO:base/test/launcher/test_launcher.cc:1209] Starting [CookieSettingsTestP.
            IsPrivacyModeEnabled/GrantSource_0_BlockSource_1]
            [0318/174715.633840:INFO:base/test/launcher/test_launcher.cc:1209] Starting [CookieSettingsTestP.
            IsPrivacyModeEnabled/GrantSource_1_BlockSource_0]
            [36/37] CookieSettingsTestP.IsPrivacyModeEnabled/GrantSource_0_BlockSource_1 (0 ms)
            [37/37] CookieSettingsTestP.IsPrivacyModeEnabled/GrantSource_1_BlockSource_0 (0 ms)
            8 tests crashed:
            PrivacyFilteringTest.NestedSafeAndUnsafeFields (../../services/tracing/perfetto/privacy_filte
            ring_check_unittest.cc:123)
            PrivacyFilteringTest.RepeatedFields (../../services/tracing/perfetto/privacy_filtering_check_
            unittest.cc:57)
            PrivacyFilteringTest.SafeAndUnsafeFields (../../services/tracing/perfetto/privacy_filtering_c
            heck_unittest.cc:97)
            PrivacyFilteringTest.SafeAndUnsafePackets (../../services/tracing/perfetto/privacy_filtering_
            check_unittest.cc:110)
            PrivacyFilteringTest.SafeMessageWithOnlyUnsafeFields (../../services/tracing/perfetto/privacy
            _filtering_check_unittest.cc:83)
            PrivacyFilteringTest.SafeToplevelField (../../services/tracing/perfetto/privacy_filtering_che
            ck_unittest.cc:39)
            PrivacyFilteringTest.SafeToplevelMessageField (../../services/tracing/perfetto/privacy_filter
            ing_check_unittest.cc:48)
            PrivacyFilteringTest.UnsafeToplevelField (../../services/tracing/perfetto/privacy_filtering_c
            heck_unittest.cc:75)
            Tests took 16 seconds.
            (II) Server terminated successfully (0). Closing log file.
            a
            Open in Gerrit

            Related details

            Attention is currently required from:
            • Stephen Nusko
            Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement is not satisfiedCode-Owners
            • requirement is not satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • 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: chromium/src
            Gerrit-Branch: main
            Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
            Gerrit-Change-Number: 7571428
            Gerrit-PatchSet: 17
            Gerrit-Owner: Daniel Angulo <angd...@google.com>
            Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
            Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
            Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
            Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
            Gerrit-Comment-Date: Wed, 18 Mar 2026 18:04:25 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: Yes
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Stephen Nusko (Gerrit)

            unread,
            Mar 18, 2026, 9:23:46 PMMar 18
            to Daniel Angulo, Arthur Sonzogni, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
            Attention needed from Daniel Angulo

            Stephen Nusko added 4 comments

            File services/tracing/perfetto/privacy_filtering_check.cc
            Line 138, Patchset 17 (Latest):output.append(preamble_length, 0);
            Stephen Nusko . unresolved

            You've deleted this line in the substitution, but it was supposed to remain the same.

            `output.append(preamble_length, 0);`

            Stephen Nusko

            Replied elsewhere, there was a line you deleted that is likely causing it to immediately OOBs. Also you should have stack traces in the logs if you build with debug.

            Line 154, Patchset 17 (Latest): auto field_id_buf_first = field_id_buf.first(
            static_cast<size_t>(field_id_end - field_id_buf.data()));
            Stephen Nusko . unresolved

            rather than `first` and assigning to a new variable can you use `field_id_buf.take_first()`?

            Line 183, Patchset 17 (Latest): message_span.take_first(field_id_buf_first.size())
            .copy_from(field_id_buf_first);
            message_span.take_first(payload_size_buf_first.size())
            .copy_from(payload_size_buf_first);
            Stephen Nusko . unresolved

            better

            ```
            auto [field_id_dest, payload_size_dest] = message_span.first_first(preamble_size).split_at(field_id_buf.size());
            field_id_dest.copy_from(field_id_buf);
            payload_size_dest.copy_from(payload_size_buf);
            ```

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Daniel Angulo
            Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement is not satisfiedCode-Owners
            • requirement is not satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • 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: chromium/src
            Gerrit-Branch: main
            Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
            Gerrit-Change-Number: 7571428
            Gerrit-PatchSet: 17
            Gerrit-Owner: Daniel Angulo <angd...@google.com>
            Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
            Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
            Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
            Gerrit-Attention: Daniel Angulo <angd...@google.com>
            Gerrit-Comment-Date: Thu, 19 Mar 2026 01:23:22 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Stephen Nusko (Gerrit)

            unread,
            Mar 18, 2026, 10:47:51 PMMar 18
            to Daniel Angulo, Arthur Sonzogni, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
            Attention needed from Daniel Angulo

            Stephen Nusko added 1 comment

            File services/tracing/perfetto/privacy_filtering_check.cc
            Line 154, Patchset 17 (Latest): auto field_id_buf_first = field_id_buf.first(
            static_cast<size_t>(field_id_end - field_id_buf.data()));
            Stephen Nusko . unresolved

            rather than `first` and assigning to a new variable can you use `field_id_buf.take_first()`?

            Stephen Nusko

            Ah sorry this won't work because it removes the first part. We'd need a `take_last` to modify it in place.

            You would need to do the following I think

            ```
            base::span<uint8_t> field_id_buf, payload_size_buf;
            std::tie(field_id_buf, payload_size_buf) = base::span(storage).split_at<protozero::proto_utils::kMaxTagEncodedSize>
            ```

            Then you could do

            ```


            field_id_buf = field_id_buf.first(field_id_end - field_id_buf.data());

            ```

            But I think it is fine to leave it as a new variable if you name it a bit better. I.E.
            ```
            auto [field_id_max_storage, payload_size_max_storage] = ...;
            auto field_id_buf = field_id_max_storage.first(...);
            ```

            Any of these I think is fine.

            Or maybe actually I like this the best:

            ```
            auto storage_span = base::span(storage);

            uint8_t* const field_id_end =
            protozero::proto_utils::WriteVarInt(field_id, field_id_buf.data());
              auto field_id_buf = storage_span.take_first(field_id_end - storage_span.size());

            uint8_t* const payload_size_end = protozero::proto_utils::WriteVarInt(
            payload_size, payload_size_buf.data());
              auto payload_size_buf = storage_span.take_first(payload_size_end - storage_span.size());
            ```

            Then we don't need the split, but this is fine since we are just writing into it and then taking the data as long as the backing storage is large enough this will work.

            Gerrit-Comment-Date: Thu, 19 Mar 2026 02:47:21 +0000
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Daniel Angulo (Gerrit)

            unread,
            Mar 25, 2026, 10:58:25 AM (8 days ago) Mar 25
            to Arthur Sonzogni, Stephen Nusko, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
            Attention needed from Stephen Nusko

            Daniel Angulo added 4 comments

            File services/tracing/perfetto/privacy_filtering_check.cc
            Line 138, Patchset 17 (Latest):output.append(preamble_length, 0);
            Stephen Nusko . resolved

            You've deleted this line in the substitution, but it was supposed to remain the same.

            `output.append(preamble_length, 0);`

            Daniel Angulo

            Done

            Line 155, Patchset 12:}
            Arthur Sonzogni . resolved
              uint8_t* field_id_end =
            protozero::proto_utils::WriteVarInt(field_id, field_id_buf.data());

            const size_t field_id_length = field_id_end - field_id_buf.data();
              uint8_t* payload_size_end = protozero::proto_utils::WriteVarInt(
            payload_size, payload_size_buf.data());

            const size_t payload_size_length = payload_size_end - payload_size_buf.data();
            const size_t preamble_length = field_id_length + payload_size_length;
            output.append(preamble_length, 0);
              auto message_span = base::as_writable_byte_span(output);
            message_span.take_first(out_msg_start_offset);
              if (payload_size != 0) {
            // Move the payload to make room for the preamble at the beginning.
            // message_span is [original_payload][empty_space]
            // destination is [empty_space][final_payload_position]
            message_span.subspan(preamble_length).copy_from(
            message_span.first(payload_size));
            }
              base::span field_id_span = message_span.take_first(field_id_length);
            base::span payload_size_span = message_span.take_first(payload_size_length);
              field_id_span.copy_from(base::span(field_id_buf).first(field_id_length));
            payload_size_span.copy_from(base::span(payload_size_buf).first(payload_size_length));
              return has_blocked_fields;
            }
            ```
            (I only verified it compile and pass the PrivacyFilteringTest, no general guarantee)


            WDYT? Maybe we can try to use `take_first` more to me the code more idiomatic?

            Stephen Nusko

            I like it in general, naming the parts rather than a bunch of offsets seems pretty nice, but I do have some comments especially once I see it fully diffed.

            For example could we merge the two arrays into one and create a split span for the two locations, then we could .first from them to get the spans of the real data, making it a bit clearer.

            ```
            std::array<uint8_t, protozero::proto_utils::kMaxTagEncodedSize + protozero::proto_utils::kMessageLengthFieldSize> storage =
            {};
              auto [field_id_buf, payload_size_buf] = base::span(storage).split_at<protozero::proto_utils::kMaxTagEncodedSize>();

            uint8_t* const field_id_end =
            protozero::proto_utils::WriteVarInt(field_id, field_id_buf.data());
               field_id_buf = field_id_buf.first(field_id_end - field_id_buf.data());

               uint8_t* const payload_size_end = protozero::proto_utils::WriteVarInt(
            payload_size, payload_size_buf.data());
               payload_size_buf = payload_size_buf.first(payload_size_end - payload_size_buf.data());
            const size_t preamble_size = payload_size_buf.size() + field_id_buf.size();
            ....
               message_span.take_first(field_id_buf.size()).copy_from(field_id_buf);
            message_span.take_first(payload_size_buf.size()).copy_from(payload_size_buf);
            ```

            Also

            ```
            auto message_span = base::as_writable_byte_span(output);
            message_span.take_first(out_msg_start_offset);
            ```

            is just

            ```
            auto message_span = base::as_writable_byte_span(output).subspan(out_msg_start_offset);
            ```

            So please take a look for other optimizations and readability if you go this route.

            Daniel Angulo

            for the first snippet, where could it be placed? I don't see obvious substituition

            Stephen Nusko

            The first snippet from arthur or from me? for Arthur his snippet is just the whole `FilterProtoRecursively` for me my snippet replaced

            ```
            // The format is <field id><payload size><message data>.
            // This function wrote the payload of the current message starting from the
            // end of output. We need to insert the preamble (<field id><payload size>),
            // after moving the payload by the size of the preamble.
            const uint32_t field_id =
            protozero::proto_utils::MakeTagLengthDelimited(parent_ids->back());
            std::array<uint8_t, protozero::proto_utils::kMaxTagEncodedSize> field_id_buf =
            {};
            std::array<uint8_t, protozero::proto_utils::kMessageLengthFieldSize>
            payload_size_buf = {};
              uint8_t* field_id_end =
            protozero::proto_utils::WriteVarInt(field_id, field_id_buf.data());

            const size_t field_id_length = field_id_end - field_id_buf.data();
              uint8_t* payload_size_end = protozero::proto_utils::WriteVarInt(
            payload_size, payload_size_buf.data());

            from Arthur's.

            Daniel Angulo

            Done

            Line 154, Patchset 17 (Latest): auto field_id_buf_first = field_id_buf.first(
            static_cast<size_t>(field_id_end - field_id_buf.data()));
            Stephen Nusko . resolved

            rather than `first` and assigning to a new variable can you use `field_id_buf.take_first()`?

            Stephen Nusko

            Ah sorry this won't work because it removes the first part. We'd need a `take_last` to modify it in place.

            You would need to do the following I think

            ```
            base::span<uint8_t> field_id_buf, payload_size_buf;
            std::tie(field_id_buf, payload_size_buf) = base::span(storage).split_at<protozero::proto_utils::kMaxTagEncodedSize>
            ```

            Then you could do

            ```
            field_id_buf = field_id_buf.first(field_id_end - field_id_buf.data());
            ```

            But I think it is fine to leave it as a new variable if you name it a bit better. I.E.
            ```
            auto [field_id_max_storage, payload_size_max_storage] = ...;
            auto field_id_buf = field_id_max_storage.first(...);
            ```

            Any of these I think is fine.

            Or maybe actually I like this the best:

            ```
            auto storage_span = base::span(storage);
            uint8_t* const field_id_end =
            protozero::proto_utils::WriteVarInt(field_id, field_id_buf.data());
            auto field_id_buf = storage_span.take_first(field_id_end - storage_span.size());
            uint8_t* const payload_size_end = protozero::proto_utils::WriteVarInt(
            payload_size, payload_size_buf.data());
            auto payload_size_buf = storage_span.take_first(payload_size_end - storage_span.size());
            ```

            Then we don't need the split, but this is fine since we are just writing into it and then taking the data as long as the backing storage is large enough this will work.

            Daniel Angulo

            Done

            Line 183, Patchset 17 (Latest): message_span.take_first(field_id_buf_first.size())
            .copy_from(field_id_buf_first);
            message_span.take_first(payload_size_buf_first.size())
            .copy_from(payload_size_buf_first);
            Stephen Nusko . resolved

            better

            ```
            auto [field_id_dest, payload_size_dest] = message_span.first_first(preamble_size).split_at(field_id_buf.size());
            field_id_dest.copy_from(field_id_buf);
            payload_size_dest.copy_from(payload_size_buf);
            ```

            Daniel Angulo

            Done

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Stephen Nusko
            Submit Requirements:
              • requirement satisfiedCode-Coverage
              • 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: chromium/src
              Gerrit-Branch: main
              Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
              Gerrit-Change-Number: 7571428
              Gerrit-PatchSet: 17
              Gerrit-Owner: Daniel Angulo <angd...@google.com>
              Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
              Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
              Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
              Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
              Gerrit-Comment-Date: Wed, 25 Mar 2026 14:58:06 +0000
              Gerrit-HasComments: Yes
              Gerrit-Has-Labels: No
              Comment-In-Reply-To: Stephen Nusko <nus...@chromium.org>
              satisfied_requirement
              unsatisfied_requirement
              open
              diffy

              Stephen Nusko (Gerrit)

              unread,
              Mar 26, 2026, 1:03:57 AM (8 days ago) Mar 26
              to Daniel Angulo, Arthur Sonzogni, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
              Attention needed from Daniel Angulo

              Stephen Nusko added 4 comments

              File services/tracing/perfetto/privacy_filtering_check.cc
              Line 123, Patchset 17 (Latest): /// START SUBSTITUTION
              /*

              std::array<uint8_t, protozero::proto_utils::kMaxTagEncodedSize> field_id_buf =
              {};
              std::array<uint8_t, protozero::proto_utils::kMessageLengthFieldSize>
              payload_size_buf = {};

              uint8_t* field_id_end =
              protozero::proto_utils::WriteVarInt(field_id, field_id_buf.data());
              const size_t field_id_length = field_id_end - field_id_buf.data();

              uint8_t* payload_size_end = protozero::proto_utils::WriteVarInt(
              payload_size, payload_size_buf.data());
              const size_t payload_size_length = payload_size_end - payload_size_buf.data();
              const size_t preamble_length = field_id_length + payload_size_length;
              output.append(preamble_length, 0);
              */

              // END SUBSTITUTION

              // uint8_t* field_id_end =
              // protozero::proto_utils::WriteVarInt(field_id, field_id_buf.data());
              Stephen Nusko . unresolved

              Delete this once done.

              Line 154, Patchset 17 (Latest): auto field_id_buf_first = field_id_buf.first(
              static_cast<size_t>(field_id_end - field_id_buf.data()));
              Stephen Nusko . unresolved

              rather than `first` and assigning to a new variable can you use `field_id_buf.take_first()`?

              Stephen Nusko

              Ah sorry this won't work because it removes the first part. We'd need a `take_last` to modify it in place.

              You would need to do the following I think

              ```
              base::span<uint8_t> field_id_buf, payload_size_buf;
              std::tie(field_id_buf, payload_size_buf) = base::span(storage).split_at<protozero::proto_utils::kMaxTagEncodedSize>
              ```

              Then you could do

              ```
              field_id_buf = field_id_buf.first(field_id_end - field_id_buf.data());
              ```

              But I think it is fine to leave it as a new variable if you name it a bit better. I.E.
              ```
              auto [field_id_max_storage, payload_size_max_storage] = ...;
              auto field_id_buf = field_id_max_storage.first(...);
              ```

              Any of these I think is fine.

              Or maybe actually I like this the best:

              ```
              auto storage_span = base::span(storage);
              uint8_t* const field_id_end =
              protozero::proto_utils::WriteVarInt(field_id, field_id_buf.data());
              auto field_id_buf = storage_span.take_first(field_id_end - storage_span.size());
              uint8_t* const payload_size_end = protozero::proto_utils::WriteVarInt(
              payload_size, payload_size_buf.data());
              auto payload_size_buf = storage_span.take_first(payload_size_end - storage_span.size());
              ```

              Then we don't need the split, but this is fine since we are just writing into it and then taking the data as long as the backing storage is large enough this will work.

              Daniel Angulo

              Done

              Stephen Nusko

              In this sort of scenario where multiple options were mentioned it is helpful to say which you did.

              Because to me it looks like you did none of them? Perhaps it didn't upload given the other one also doesn't look done?

              Line 175, Patchset 17 (Latest): // START SUBSTITUTION
              /*
              field_id_span.copy_from(base::span(field_id_buf).first(field_id_length));
              payload_size_span.copy_from(
              base::span(payload_size_buf).first(payload_size_length));
              */
              // END SUBSTITUTION
              Stephen Nusko . unresolved

              Remove this.

              Line 183, Patchset 17 (Latest): message_span.take_first(field_id_buf_first.size())
              .copy_from(field_id_buf_first);
              message_span.take_first(payload_size_buf_first.size())
              .copy_from(payload_size_buf_first);
              Stephen Nusko . unresolved

              better

              ```
              auto [field_id_dest, payload_size_dest] = message_span.first_first(preamble_size).split_at(field_id_buf.size());
              field_id_dest.copy_from(field_id_buf);
              payload_size_dest.copy_from(payload_size_buf);
              ```

              Daniel Angulo

              Done

              Stephen Nusko

              This doesn't appear to be done. Did you miss a upload?

              Open in Gerrit

              Related details

              Attention is currently required from:
              • Daniel Angulo
              Submit Requirements:
                • requirement satisfiedCode-Coverage
                • requirement is not satisfiedCode-Owners
                • requirement is not satisfiedCode-Review
                • requirement is not satisfiedNo-Unresolved-Comments
                • 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: chromium/src
                Gerrit-Branch: main
                Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
                Gerrit-Change-Number: 7571428
                Gerrit-PatchSet: 17
                Gerrit-Owner: Daniel Angulo <angd...@google.com>
                Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
                Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
                Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
                Gerrit-Attention: Daniel Angulo <angd...@google.com>
                Gerrit-Comment-Date: Thu, 26 Mar 2026 05:03:48 +0000
                satisfied_requirement
                unsatisfied_requirement
                open
                diffy

                Daniel Angulo (Gerrit)

                unread,
                Mar 26, 2026, 2:15:40 PM (7 days ago) Mar 26
                to Arthur Sonzogni, Stephen Nusko, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
                Attention needed from Stephen Nusko

                Daniel Angulo added 4 comments

                File services/tracing/perfetto/privacy_filtering_check.cc
                Line 123, Patchset 17: /// START SUBSTITUTION

                /*
                std::array<uint8_t, protozero::proto_utils::kMaxTagEncodedSize> field_id_buf =
                {};
                std::array<uint8_t, protozero::proto_utils::kMessageLengthFieldSize>
                payload_size_buf = {};

                uint8_t* field_id_end =
                protozero::proto_utils::WriteVarInt(field_id, field_id_buf.data());
                const size_t field_id_length = field_id_end - field_id_buf.data();

                uint8_t* payload_size_end = protozero::proto_utils::WriteVarInt(
                payload_size, payload_size_buf.data());
                const size_t payload_size_length = payload_size_end - payload_size_buf.data();
                const size_t preamble_length = field_id_length + payload_size_length;
                output.append(preamble_length, 0);
                */

                // END SUBSTITUTION

                // uint8_t* field_id_end =
                // protozero::proto_utils::WriteVarInt(field_id, field_id_buf.data());
                Stephen Nusko . resolved

                Delete this once done.

                Daniel Angulo

                Done

                Line 154, Patchset 17: auto field_id_buf_first = field_id_buf.first(

                static_cast<size_t>(field_id_end - field_id_buf.data()));
                Stephen Nusko . resolved
                Daniel Angulo

                sorry, my changes didn't upload last time, I end up renaming the variables. FYI: I also tried to do the third option, but field_id_buf was used before declared, not 100% sure what was the intent, maybe use storage_span instead?

                Line 175, Patchset 17: // START SUBSTITUTION

                /*
                field_id_span.copy_from(base::span(field_id_buf).first(field_id_length));
                payload_size_span.copy_from(
                base::span(payload_size_buf).first(payload_size_length));
                */
                // END SUBSTITUTION
                Stephen Nusko . resolved

                Remove this.

                Daniel Angulo

                Done

                Line 183, Patchset 17: message_span.take_first(field_id_buf_first.size())
                .copy_from(field_id_buf_first);
                message_span.take_first(payload_size_buf_first.size())
                .copy_from(payload_size_buf_first);
                Stephen Nusko . resolved

                better

                ```
                auto [field_id_dest, payload_size_dest] = message_span.first_first(preamble_size).split_at(field_id_buf.size());
                field_id_dest.copy_from(field_id_buf);
                payload_size_dest.copy_from(payload_size_buf);
                ```

                Daniel Angulo

                Done

                Stephen Nusko

                This doesn't appear to be done. Did you miss a upload?

                Daniel Angulo

                yes, sorry, didn't uploaded correctly

                Open in Gerrit

                Related details

                Attention is currently required from:
                • Stephen Nusko
                Submit Requirements:
                  • requirement satisfiedCode-Coverage
                  • 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: chromium/src
                  Gerrit-Branch: main
                  Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
                  Gerrit-Change-Number: 7571428
                  Gerrit-PatchSet: 18
                  Gerrit-Owner: Daniel Angulo <angd...@google.com>
                  Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
                  Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
                  Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
                  Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
                  Gerrit-Comment-Date: Thu, 26 Mar 2026 18:15:34 +0000
                  satisfied_requirement
                  unsatisfied_requirement
                  open
                  diffy

                  Stephen Nusko (Gerrit)

                  unread,
                  Mar 26, 2026, 10:51:12 PM (7 days ago) Mar 26
                  to Daniel Angulo, Arthur Sonzogni, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
                  Attention needed from Daniel Angulo

                  Stephen Nusko voted and added 1 comment

                  Votes added by Stephen Nusko

                  Code-Review+1

                  1 comment

                  File services/tracing/perfetto/privacy_filtering_check.cc
                  Stephen Nusko

                  I mean it is just the pointer to the first element (conceptually), so yes `storage.data()` or `storage_span.data()` would have worked.

                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Daniel Angulo
                  Submit Requirements:
                  • requirement satisfiedCode-Coverage
                  • requirement satisfiedCode-Owners
                  • requirement is not satisfiedCode-Review
                  • requirement satisfiedReview-Enforcement
                  Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                  Gerrit-MessageType: comment
                  Gerrit-Project: chromium/src
                  Gerrit-Branch: main
                  Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
                  Gerrit-Change-Number: 7571428
                  Gerrit-PatchSet: 18
                  Gerrit-Owner: Daniel Angulo <angd...@google.com>
                  Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
                  Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
                  Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
                  Gerrit-Attention: Daniel Angulo <angd...@google.com>
                  Gerrit-Comment-Date: Fri, 27 Mar 2026 02:50:34 +0000
                  Gerrit-HasComments: Yes
                  Gerrit-Has-Labels: Yes
                  satisfied_requirement
                  unsatisfied_requirement
                  open
                  diffy

                  Arthur Sonzogni (Gerrit)

                  unread,
                  Mar 27, 2026, 2:28:41 PM (6 days ago) Mar 27
                  to Daniel Angulo, Stephen Nusko, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
                  Attention needed from Daniel Angulo

                  Arthur Sonzogni voted and added 2 comments

                  Votes added by Arthur Sonzogni

                  Code-Review+1

                  2 comments

                  Patchset-level comments
                  File-level comment, Patchset 18 (Latest):
                  Arthur Sonzogni . resolved

                  THanks!

                  File services/tracing/perfetto/privacy_filtering_check.cc
                  Line 122, Patchset 18 (Latest): std::array<uint8_t, protozero::proto_utils::kMaxTagEncodedSize +

                  protozero::proto_utils::kMessageLengthFieldSize>
                  storage = {};
                  auto [field_id_max_storage, payload_size_max_storage] =
                  base::span(storage)
                  .split_at<protozero::proto_utils::kMaxTagEncodedSize>();

                  uint8_t* const field_id_end = protozero::proto_utils::WriteVarInt(
                  field_id, field_id_max_storage.data());
                  auto field_id_buf = field_id_max_storage.first(
                  static_cast<size_t>(field_id_end - field_id_max_storage.data()));


                  uint8_t* const payload_size_end = protozero::proto_utils::WriteVarInt(
                  payload_size, payload_size_max_storage.data());
                  auto payload_size_buf = payload_size_max_storage.first(
                  static_cast<size_t>(payload_size_end - payload_size_max_storage.data()));

                  const size_t preamble_size = payload_size_buf.size() + field_id_buf.size();
                  output.append(preamble_size, 0);
                  auto message_span =
                  base::as_writable_byte_span(output).subspan(out_msg_start_offset);


                  if (payload_size != 0) {
                  // Move the payload to make room for the preamble at the beginning.
                  // message_span is [original_payload][empty_space]
                  // destination is [empty_space][final_payload_position]
                  message_span.subspan(preamble_size)
                  .copy_from(message_span.first(payload_size));
                  }

                  auto [field_id_dest, payload_size_dest] =
                  message_span.take_first(preamble_size).split_at(field_id_buf.size());
                  field_id_dest.copy_from(field_id_buf);
                  payload_size_dest.copy_from(payload_size_buf);

                  return has_blocked_fields;
                  }
                  Arthur Sonzogni . unresolved

                  That's quite difficult to understand (previous code included).

                  I don't have a good suggestion, but maybe the owner will ;-)

                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Daniel Angulo
                  Submit Requirements:
                    • requirement satisfiedCode-Coverage
                    • requirement satisfiedCode-Owners
                    • requirement satisfiedCode-Review
                    • requirement is not satisfiedNo-Unresolved-Comments
                    • requirement satisfiedReview-Enforcement
                    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                    Gerrit-MessageType: comment
                    Gerrit-Project: chromium/src
                    Gerrit-Branch: main
                    Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
                    Gerrit-Change-Number: 7571428
                    Gerrit-PatchSet: 18
                    Gerrit-Owner: Daniel Angulo <angd...@google.com>
                    Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
                    Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
                    Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
                    Gerrit-Attention: Daniel Angulo <angd...@google.com>
                    Gerrit-Comment-Date: Fri, 27 Mar 2026 18:28:21 +0000
                    Gerrit-HasComments: Yes
                    Gerrit-Has-Labels: Yes
                    satisfied_requirement
                    unsatisfied_requirement
                    open
                    diffy

                    Daniel Angulo (Gerrit)

                    unread,
                    Mar 27, 2026, 3:26:12 PM (6 days ago) Mar 27
                    to Arthur Sonzogni, Stephen Nusko, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org

                    Daniel Angulo voted and added 1 comment

                    Votes added by Daniel Angulo

                    Auto-Submit+1

                    1 comment

                    File services/tracing/perfetto/privacy_filtering_check.cc
                    Arthur Sonzogni . resolved

                    That's quite difficult to understand (previous code included).

                    I don't have a good suggestion, but maybe the owner will ;-)

                    Daniel Angulo

                    Done

                    Open in Gerrit

                    Related details

                    Attention set is empty
                    Submit Requirements:
                      • requirement satisfiedCode-Coverage
                      • requirement satisfiedCode-Owners
                      • requirement satisfiedCode-Review
                      • requirement satisfiedReview-Enforcement
                      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                      Gerrit-MessageType: comment
                      Gerrit-Project: chromium/src
                      Gerrit-Branch: main
                      Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
                      Gerrit-Change-Number: 7571428
                      Gerrit-PatchSet: 18
                      Gerrit-Owner: Daniel Angulo <angd...@google.com>
                      Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
                      Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
                      Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
                      Gerrit-Comment-Date: Fri, 27 Mar 2026 19:26:02 +0000
                      Gerrit-HasComments: Yes
                      Gerrit-Has-Labels: Yes
                      Comment-In-Reply-To: Arthur Sonzogni <arthurs...@chromium.org>
                      satisfied_requirement
                      open
                      diffy

                      Daniel Angulo (Gerrit)

                      unread,
                      Mar 27, 2026, 3:27:14 PM (6 days ago) Mar 27
                      to Arthur Sonzogni, Stephen Nusko, Chromium LUCI CQ, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org

                      Daniel Angulo voted Commit-Queue+2

                      Commit-Queue+2
                      Open in Gerrit

                      Related details

                      Attention set is empty
                      Submit Requirements:
                      • requirement satisfiedCode-Coverage
                      • requirement satisfiedCode-Owners
                      • requirement satisfiedCode-Review
                      • requirement satisfiedReview-Enforcement
                      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                      Gerrit-MessageType: comment
                      Gerrit-Project: chromium/src
                      Gerrit-Branch: main
                      Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
                      Gerrit-Change-Number: 7571428
                      Gerrit-PatchSet: 18
                      Gerrit-Owner: Daniel Angulo <angd...@google.com>
                      Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
                      Gerrit-Reviewer: Daniel Angulo <angd...@google.com>
                      Gerrit-Reviewer: Stephen Nusko <nus...@chromium.org>
                      Gerrit-Comment-Date: Fri, 27 Mar 2026 19:27:04 +0000
                      Gerrit-HasComments: No
                      Gerrit-Has-Labels: Yes
                      satisfied_requirement
                      open
                      diffy

                      Chromium LUCI CQ (Gerrit)

                      unread,
                      Mar 27, 2026, 5:07:52 PM (6 days ago) Mar 27
                      to Daniel Angulo, Arthur Sonzogni, Stephen Nusko, AyeAye, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org

                      Chromium LUCI CQ submitted the change

                      Change information

                      Commit message:
                      spanification: automatically spanify .../tracing/perfetto/privacy_filtering_check.cc etc.

                      This is the result of running the automatic spanification on linux and
                      updating code to use and pass spans where size is known.

                      The original patch was fully automated using script:
                      //tools/clang/spanify/rewrite-multiple-platforms.sh -platforms=linux
                      Then refined with gemini-cli and lastly manually refined

                      gemini-run/batch-run-1761614304/group_162
                      BUG: 439964610
                      Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
                      Commit-Queue: Daniel Angulo <angd...@google.com>
                      Reviewed-by: Arthur Sonzogni <arthurs...@chromium.org>
                      Auto-Submit: Daniel Angulo <angd...@google.com>
                      Reviewed-by: Stephen Nusko <nus...@chromium.org>
                      Cr-Commit-Position: refs/heads/main@{#1606472}
                      Files:
                      • M services/tracing/perfetto/privacy_filtering_check.cc
                      Change size: M
                      Delta: 1 file changed, 41 insertions(+), 36 deletions(-)
                      Branch: refs/heads/main
                      Submit Requirements:
                      • requirement satisfiedCode-Review: +1 by Arthur Sonzogni, +1 by Stephen Nusko
                      Open in Gerrit
                      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                      Gerrit-MessageType: merged
                      Gerrit-Project: chromium/src
                      Gerrit-Branch: main
                      Gerrit-Change-Id: Id28596d051629e66bec29f70a4fe700a121137e9
                      Gerrit-Change-Number: 7571428
                      Gerrit-PatchSet: 19
                      Gerrit-Owner: Daniel Angulo <angd...@google.com>
                      Gerrit-Reviewer: Arthur Sonzogni <arthurs...@chromium.org>
                      Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
                      open
                      diffy
                      satisfied_requirement
                      Reply all
                      Reply to author
                      Forward
                      0 new messages