[sub apps] add ukm metrics [chromium/src : main]

0 views
Skip to first unread message

Vlad Krot (Gerrit)

unread,
Jun 30, 2026, 7:41:52 AM (8 days ago) Jun 30
to Luc Nguyen, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, Andrew Rayskiy, Simon Hangl, aixba+wat...@chromium.org, asvitkine...@chromium.org, dibyapal+wa...@chromium.org, dmurph+watc...@chromium.org, japhet+...@chromium.org, kuragin+web-ap...@chromium.org, loyso...@chromium.org, mek+w...@chromium.org, mgiuca...@chromium.org, philli...@chromium.org, rmcelra...@chromium.org, webap...@microsoft.com, zelin+watch-we...@chromium.org
Attention needed from Luc Nguyen

Vlad Krot voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Luc Nguyen
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: I536c6bf61e94b12278fb67a5072ba9d73654255d
Gerrit-Change-Number: 8019651
Gerrit-PatchSet: 2
Gerrit-Owner: Vlad Krot <vk...@google.com>
Gerrit-Reviewer: Luc Nguyen <lucn...@google.com>
Gerrit-Reviewer: Vlad Krot <vk...@google.com>
Gerrit-CC: Andrew Rayskiy <green...@google.com>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Simon Hangl <sim...@google.com>
Gerrit-Attention: Luc Nguyen <lucn...@google.com>
Gerrit-Comment-Date: Tue, 30 Jun 2026 11:41:37 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Andrew Rayskiy (Gerrit)

unread,
Jun 30, 2026, 8:08:24 AM (8 days ago) Jun 30
to Vlad Krot, Luc Nguyen, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, Simon Hangl, aixba+wat...@chromium.org, asvitkine...@chromium.org, dibyapal+wa...@chromium.org, dmurph+watc...@chromium.org, japhet+...@chromium.org, kuragin+web-ap...@chromium.org, loyso...@chromium.org, mek+w...@chromium.org, mgiuca...@chromium.org, philli...@chromium.org, rmcelra...@chromium.org, webap...@microsoft.com, zelin+watch-we...@chromium.org
Attention needed from Luc Nguyen and Vlad Krot

Andrew Rayskiy added 7 comments

File chrome/browser/web_applications/commands/apply_pending_manifest_update_command.cc
Line 289, Patchset 2 (Latest): if (lock_) {
Andrew Rayskiy . unresolved

How can it be null?

File chrome/browser/web_applications/sub_apps/sub_apps_service_impl.h
Line 85, Patchset 2 (Latest): std::pair<blink::mojom::SubAppsServiceResultCode,
Andrew Rayskiy . unresolved

Pairs are usually hard to read. Maybe define a struct for this?

File chrome/browser/web_applications/web_app_provider.cc
Line 672, Patchset 2 (Latest):void WebAppProvider::ReportSubAppMetricsOnStartup() {
Andrew Rayskiy . unresolved

Maybe put this into DoDelayedPostStartupWork?

Line 673, Patchset 2 (Latest): if (!profile_ || !content::AreIsolatedWebAppsEnabled(profile_)) {
Andrew Rayskiy . unresolved

The profile_ check is redundant

Line 682, Patchset 2 (Latest): if (!parent_app_id.has_value()) {
Andrew Rayskiy . unresolved

This is redundant -- if the app matches the filter, the property is always correct

Line 686, Patchset 2 (Latest): auto found = iwa_id_to_sub_apps_count.find(*parent_app_id);
Andrew Rayskiy . unresolved

`iwa_id_to_sub_apps_count[*parent_app_id]++` works well, no?

Line 698, Patchset 2 (Latest): for (auto& pair : iwa_id_to_sub_apps_count) {
Andrew Rayskiy . unresolved

`for (const auto& [app_id, count] : ...)`

Open in Gerrit

Related details

Attention is currently required from:
  • Luc Nguyen
  • Vlad Krot
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: I536c6bf61e94b12278fb67a5072ba9d73654255d
    Gerrit-Change-Number: 8019651
    Gerrit-PatchSet: 2
    Gerrit-Owner: Vlad Krot <vk...@google.com>
    Gerrit-Reviewer: Luc Nguyen <lucn...@google.com>
    Gerrit-Reviewer: Vlad Krot <vk...@google.com>
    Gerrit-CC: Andrew Rayskiy <green...@google.com>
    Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
    Gerrit-CC: Simon Hangl <sim...@google.com>
    Gerrit-Attention: Luc Nguyen <lucn...@google.com>
    Gerrit-Attention: Vlad Krot <vk...@google.com>
    Gerrit-Comment-Date: Tue, 30 Jun 2026 12:08:04 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Andrew Rayskiy (Gerrit)

    unread,
    Jun 30, 2026, 9:00:04 AM (8 days ago) Jun 30
    to Vlad Krot, Luc Nguyen, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, Simon Hangl, aixba+wat...@chromium.org, asvitkine...@chromium.org, dibyapal+wa...@chromium.org, dmurph+watc...@chromium.org, japhet+...@chromium.org, kuragin+web-ap...@chromium.org, loyso...@chromium.org, mek+w...@chromium.org, mgiuca...@chromium.org, philli...@chromium.org, rmcelra...@chromium.org, webap...@microsoft.com, zelin+watch-we...@chromium.org
    Attention needed from Luc Nguyen and Vlad Krot

    Andrew Rayskiy added 3 comments

    File chrome/browser/web_applications/isolated_web_apps/isolated_web_app_metrics_helper.cc
    Line 22, Patchset 2 (Latest): ukm::builders::SubApp_CountPerParent(source_id)
    Andrew Rayskiy . unresolved

    I don't think we need to defend against `kInvalidSourceId` here -- the call sites in the codebase that I see just inline this call

    Line 34, Patchset 2 (Latest): ukm::IwaSourceUrlRecorder::GetSourceIdForIwaUrl(app_origin.GetURL());
    Andrew Rayskiy . unresolved

    ditto here

    Line 45, Patchset 2 (Latest): ukm::IwaSourceUrlRecorder::MarkSourceForDeletion(source_id);
    Andrew Rayskiy . unresolved

    Why do we need to mark it for deletion every time?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Luc Nguyen
    • Vlad Krot
    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: I536c6bf61e94b12278fb67a5072ba9d73654255d
    Gerrit-Change-Number: 8019651
    Gerrit-PatchSet: 2
    Gerrit-Owner: Vlad Krot <vk...@google.com>
    Gerrit-Reviewer: Andrew Rayskiy <green...@google.com>
    Gerrit-Reviewer: Luc Nguyen <lucn...@google.com>
    Gerrit-Reviewer: Vlad Krot <vk...@google.com>
    Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
    Gerrit-CC: Simon Hangl <sim...@google.com>
    Gerrit-Attention: Luc Nguyen <lucn...@google.com>
    Gerrit-Attention: Vlad Krot <vk...@google.com>
    Gerrit-Comment-Date: Tue, 30 Jun 2026 12:59:46 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Vlad Krot (Gerrit)

    unread,
    Jun 30, 2026, 9:15:50 AM (8 days ago) Jun 30
    to Andrew Rayskiy, Luc Nguyen, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, Simon Hangl, aixba+wat...@chromium.org, asvitkine...@chromium.org, dibyapal+wa...@chromium.org, dmurph+watc...@chromium.org, japhet+...@chromium.org, kuragin+web-ap...@chromium.org, loyso...@chromium.org, mek+w...@chromium.org, mgiuca...@chromium.org, philli...@chromium.org, rmcelra...@chromium.org, webap...@microsoft.com, zelin+watch-we...@chromium.org
    Attention needed from Andrew Rayskiy and Luc Nguyen

    Vlad Krot added 7 comments

    File chrome/browser/web_applications/commands/apply_pending_manifest_update_command.cc
    Andrew Rayskiy . unresolved

    How can it be null?

    Vlad Krot

    Good question. Considering the code above it cannot be null since it is not checked anywhere else.

    File chrome/browser/web_applications/sub_apps/sub_apps_service_impl.h
    Line 85, Patchset 2: std::pair<blink::mojom::SubAppsServiceResultCode,
    Andrew Rayskiy . resolved

    Pairs are usually hard to read. Maybe define a struct for this?

    Vlad Krot

    Done

    File chrome/browser/web_applications/web_app_provider.cc
    Line 672, Patchset 2:void WebAppProvider::ReportSubAppMetricsOnStartup() {
    Andrew Rayskiy . resolved

    Maybe put this into DoDelayedPostStartupWork?

    Vlad Krot

    Done

    Line 673, Patchset 2: if (!profile_ || !content::AreIsolatedWebAppsEnabled(profile_)) {
    Andrew Rayskiy . resolved

    The profile_ check is redundant

    Vlad Krot

    Done

    Line 682, Patchset 2: if (!parent_app_id.has_value()) {
    Andrew Rayskiy . resolved

    This is redundant -- if the app matches the filter, the property is always correct

    Vlad Krot

    Done

    Line 686, Patchset 2: auto found = iwa_id_to_sub_apps_count.find(*parent_app_id);
    Andrew Rayskiy . resolved

    `iwa_id_to_sub_apps_count[*parent_app_id]++` works well, no?

    Vlad Krot

    Yes, thanks for noting, I forgot that c++ has default values inserted on reads.

    Line 698, Patchset 2: for (auto& pair : iwa_id_to_sub_apps_count) {
    Andrew Rayskiy . resolved

    `for (const auto& [app_id, count] : ...)`

    Vlad Krot

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Andrew Rayskiy
    • Luc Nguyen
    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: I536c6bf61e94b12278fb67a5072ba9d73654255d
    Gerrit-Change-Number: 8019651
    Gerrit-PatchSet: 2
    Gerrit-Owner: Vlad Krot <vk...@google.com>
    Gerrit-Reviewer: Andrew Rayskiy <green...@google.com>
    Gerrit-Reviewer: Luc Nguyen <lucn...@google.com>
    Gerrit-Reviewer: Vlad Krot <vk...@google.com>
    Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
    Gerrit-CC: Simon Hangl <sim...@google.com>
    Gerrit-Attention: Luc Nguyen <lucn...@google.com>
    Gerrit-Attention: Andrew Rayskiy <green...@google.com>
    Gerrit-Comment-Date: Tue, 30 Jun 2026 13:15:32 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Andrew Rayskiy <green...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Vlad Krot (Gerrit)

    unread,
    Jun 30, 2026, 9:30:25 AM (8 days ago) Jun 30
    to Andrew Rayskiy, Luc Nguyen, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, Simon Hangl, aixba+wat...@chromium.org, asvitkine...@chromium.org, dibyapal+wa...@chromium.org, dmurph+watc...@chromium.org, japhet+...@chromium.org, kuragin+web-ap...@chromium.org, loyso...@chromium.org, mek+w...@chromium.org, mgiuca...@chromium.org, philli...@chromium.org, rmcelra...@chromium.org, webap...@microsoft.com, zelin+watch-we...@chromium.org
    Attention needed from Andrew Rayskiy, Luc Nguyen and Vlad Krot

    Vlad Krot added 4 comments

    File chrome/browser/web_applications/commands/apply_pending_manifest_update_command.cc
    Andrew Rayskiy . resolved

    How can it be null?

    Vlad Krot

    Good question. Considering the code above it cannot be null since it is not checked anywhere else.

    Vlad Krot

    Done

    File chrome/browser/web_applications/isolated_web_apps/isolated_web_app_metrics_helper.cc
    Line 22, Patchset 2: ukm::builders::SubApp_CountPerParent(source_id)
    Andrew Rayskiy . resolved

    I don't think we need to defend against `kInvalidSourceId` here -- the call sites in the codebase that I see just inline this call

    Vlad Krot

    Done

    Line 34, Patchset 2: ukm::IwaSourceUrlRecorder::GetSourceIdForIwaUrl(app_origin.GetURL());
    Andrew Rayskiy . resolved

    ditto here

    Vlad Krot

    Done

    Line 45, Patchset 2: ukm::IwaSourceUrlRecorder::MarkSourceForDeletion(source_id);
    Andrew Rayskiy . unresolved

    Why do we need to mark it for deletion every time?

    Vlad Krot

    This is how PWA also do it via `components/ukm/app_source_url_recorder.cc`.
    For most metrics this source id auto deletes itself, but for IWA I made it to be like WebApp, manual deletion, so that we can create source id, send a few metrics and delete it manually. See `components/ukm/ukm_recorder_impl.cc` `MaybeMarkForDeletion()`

    The source ids always have to be cleaned up from memory, the only question is to do it automatically or manually.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Andrew Rayskiy
    • Luc Nguyen
    • Vlad Krot
    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: I536c6bf61e94b12278fb67a5072ba9d73654255d
    Gerrit-Change-Number: 8019651
    Gerrit-PatchSet: 3
    Gerrit-Owner: Vlad Krot <vk...@google.com>
    Gerrit-Reviewer: Andrew Rayskiy <green...@google.com>
    Gerrit-Reviewer: Luc Nguyen <lucn...@google.com>
    Gerrit-Reviewer: Vlad Krot <vk...@google.com>
    Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
    Gerrit-CC: Simon Hangl <sim...@google.com>
    Gerrit-Attention: Luc Nguyen <lucn...@google.com>
    Gerrit-Attention: Andrew Rayskiy <green...@google.com>
    Gerrit-Attention: Vlad Krot <vk...@google.com>
    Gerrit-Comment-Date: Tue, 30 Jun 2026 13:30:07 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Andrew Rayskiy <green...@google.com>
    Comment-In-Reply-To: Vlad Krot <vk...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    gwsq (Gerrit)

    unread,
    Jul 1, 2026, 12:00:35 PM (7 days ago) Jul 1
    to Vlad Krot, Chromium Web Applications Reviews, Luke Deng, Alexei Svitkine, Andrew Rayskiy, Luc Nguyen, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, Simon Hangl, aixba+wat...@chromium.org, asvitkine...@chromium.org, dibyapal+wa...@chromium.org, dmurph+watc...@chromium.org, japhet+...@chromium.org, kuragin+web-ap...@chromium.org, loyso...@chromium.org, mek+w...@chromium.org, mgiuca...@chromium.org, philli...@chromium.org, rmcelra...@chromium.org, webap...@microsoft.com, zelin+watch-we...@chromium.org
    Attention needed from Alexei Svitkine, Andrew Rayskiy, Luc Nguyen and Luke Deng

    Message from gwsq

    Shadowed: luke...@chromium.org

    Reviewer source(s):
    luke...@chromium.org is from context(googleclient/chrome/chromium_gwsq/chrome/browser/ui/web_applications/config.gwsq,googleclient/chrome/chromium_gwsq/chrome/browser/web_applications/config.gwsq)

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alexei Svitkine
    • Andrew Rayskiy
    • Luc Nguyen
    • Luke Deng
    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: I536c6bf61e94b12278fb67a5072ba9d73654255d
    Gerrit-Change-Number: 8019651
    Gerrit-PatchSet: 5
    Gerrit-Owner: Vlad Krot <vk...@google.com>
    Gerrit-Reviewer: Alexei Svitkine <asvi...@chromium.org>
    Gerrit-Reviewer: Andrew Rayskiy <green...@google.com>
    Gerrit-Reviewer: Luc Nguyen <lucn...@google.com>
    Gerrit-Reviewer: Luke Deng <luke...@google.com>
    Gerrit-Reviewer: Vlad Krot <vk...@google.com>
    Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
    Gerrit-CC: Chromium Web Applications Reviews <chromium-web...@google.com>
    Gerrit-CC: Simon Hangl <sim...@google.com>
    Gerrit-CC: gwsq
    Gerrit-Attention: Luke Deng <luke...@google.com>
    Gerrit-Attention: Luc Nguyen <lucn...@google.com>
    Gerrit-Attention: Alexei Svitkine <asvi...@chromium.org>
    Gerrit-Attention: Andrew Rayskiy <green...@google.com>
    Gerrit-Comment-Date: Wed, 01 Jul 2026 16:00:00 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Dibyajyoti Pal (Gerrit)

    unread,
    Jul 1, 2026, 1:33:45 PM (7 days ago) Jul 1
    to Vlad Krot, Chromium Web Applications Reviews, Alexei Svitkine, Andrew Rayskiy, Luc Nguyen, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, Simon Hangl, aixba+wat...@chromium.org, asvitkine...@chromium.org, dibyapal+wa...@chromium.org, dmurph+watc...@chromium.org, japhet+...@chromium.org, kuragin+web-ap...@chromium.org, loyso...@chromium.org, mek+w...@chromium.org, mgiuca...@chromium.org, philli...@chromium.org, rmcelra...@chromium.org, webap...@microsoft.com, zelin+watch-we...@chromium.org
    Attention needed from Alexei Svitkine, Andrew Rayskiy, Luc Nguyen and Vlad Krot

    Dibyajyoti Pal added 11 comments

    File chrome/browser/web_applications/commands/apply_pending_manifest_update_command.cc
    Line 287, Patchset 5 (Latest): // For sub apps send UKM in addition to UMA that is send via callback chaining
    Dibyajyoti Pal . unresolved

    nitty-nit: `sent`

    File chrome/browser/web_applications/commands/apply_pending_manifest_update_command_unittest.cc
    Line 549, Patchset 5 (Latest): // Install dummy apps using isolated-app:// scheme URLs.
    webapps::AppId parent_app_id =
    test::InstallDummyWebApp(profile(), "Parent App", parent_url);
    webapps::AppId app_id =
    test::InstallDummyWebApp(profile(), "Sub App", sub_app_url);

    // Make them IWAs and set parent relationship.
    {
    ScopedRegistryUpdate update = provider().sync_bridge_unsafe().BeginUpdate();
    WebApp* app = update->UpdateApp(app_id);
    app->SetParentAppId(parent_app_id);

    WebApp* parent = update->UpdateApp(parent_app_id);
    parent->SetIsolationData(
    IsolationData::Builder(IwaStorageUnownedBundle(base::FilePath(
    FILE_PATH_LITERAL("/dummy/path"))),
    IwaVersion::Create("1.0.0").value())
    .Build());

    app->SetIsolationData(
    IsolationData::Builder(IwaStorageUnownedBundle(base::FilePath(
    FILE_PATH_LITERAL("/dummy/path2"))),
    IwaVersion::Create("1.0.0").value())
    .Build());

    // Manually set pending update info.
    proto::PendingUpdateInfo pending_update_info;
    pending_update_info.set_name("New Name");
    pending_update_info.set_was_ignored(false);
    app->SetPendingUpdateInfo(std::move(pending_update_info));
    }
    Dibyajyoti Pal . unresolved

    Will refer to @green...@google.com here on whether this works as a way to install IWAs, or if there are more robust ways to install IWAs.

    File chrome/browser/web_applications/isolated_web_apps/isolated_web_app_metrics_helper.h
    Line 50, Patchset 5 (Latest): static void ReportSubAppSilentUpdateResult(
    Dibyajyoti Pal . unresolved

    Just a heads up, this set of metrics will be triggered more often than the other ones. Commented in the UKM doc as well, the silent update mechanism triggers everytime a page visit happens to a single app, to check if there is a difference in the manifest w.r.t the existing app. If the manifest hasn't changed, the "flow" exits with ["AppUpToDate"](https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/web_applications/scheduler/manifest_silent_update_result.h;drc=a81bc8561d938a2cfa58705d6d7c1121a2dd0f78;l=23), so this metric might be more biased towards that.

    Just something to keep an eye out.

    File chrome/browser/web_applications/isolated_web_apps/isolated_web_app_metrics_helper.cc
    Line 15, Patchset 5 (Latest): base::flat_map<url::Origin, int> origin_to_subapps_count) {
    Dibyajyoti Pal . unresolved

    Since this is just a generic map, do we need to have it be sorted per `url::Origin`? It doesn't seem like we have to do it, in which case, can we use `absl::flat_hash_map` here as per [Chromium guidelines](https://source.chromium.org/chromium/chromium/src/+/main:base/containers/README.md;l=32-35?q=absl::flat_hash_map%20f:.md%20-f:gen%2F)?

    Line 29, Patchset 5 (Latest): const url::Origin& app_origin,
    Dibyajyoti Pal . unresolved

    nit: `parent_app_origin`?

    Line 65, Patchset 5 (Latest): .SetResult(static_cast<int64_t>(result))
    Dibyajyoti Pal . unresolved

    nitty-nit: Can we just use `int` here? The number of metrics shouldn't be enough to need 64 bits imo, wdyt?

    File chrome/browser/web_applications/isolated_web_apps/isolated_web_app_metrics_helper_unittest.cc
    Line 26, Patchset 5 (Latest):TEST_F(IsolatedWebAppMetricsHelperTest, ReportNumInstalledSubApps) {
    Dibyajyoti Pal . unresolved

    This test is pretty good, but it only tests the metrics helper behavior (which forwards data to the UKM system). Instead, can we add the individual tests for these use-cases at the callsites, like we do for `chrome/browser/web_applications/commands/apply_pending_manifest_update_command_unittest.cc`? That allows us to test the whole behavior of the sub app system, instead of just verifying the UKM part of things.

    If you want to keep this test around and add those E2E tests later on, that's fine too!

    File chrome/browser/web_applications/sub_apps/sub_apps_service_impl.h
    Line 83, Patchset 5 (Latest): struct AddResultCodeWithMetric {
    blink::mojom::SubAppsServiceResultCode result;
    IsolatedWebAppMetricsHelper::LogSubAppInstallResult metric_result;
    };

    using AddResult =
    base::expected<std::vector<blink::mojom::SubAppsServiceAddResultPtr>,
    AddResultCodeWithMetric>;
    Dibyajyoti Pal . unresolved

    There's 3 different enums that are being sent to the UKM system to measure the output of one flow (whether the sub app was installed correctly, or if not, what happened). Can we streamline that behavior here, so that the flow returns a single enum metric for all the use-cases (both success and failure)? That makes this part more readable imo, wdyt?

    File chrome/browser/web_applications/sub_apps/sub_apps_service_impl.cc
    Line 797, Patchset 5 (Latest): AddCallInfo* add_call_info = base::FindOrNull(add_call_info_, add_call_id);
    Dibyajyoti Pal . unresolved

    Since `add_call_id` is only removed at the end of this function, `add_call_info` should always be present in the map here. Let's use `CHECK_DEREF(base::FindOrNull(...))` to explicitly state this invariant?

    File chrome/browser/web_applications/web_app_provider.h
    Line 293, Patchset 5 (Latest): void ReportSubAppMetricsOnStartup();
    Dibyajyoti Pal . unresolved

    Let's make it `private:`?

    File chrome/browser/web_applications/web_app_provider.cc
    Line 688, Patchset 5 (Latest): for (const auto& [url, count] : iwa_id_to_sub_apps_count) {
    Dibyajyoti Pal . unresolved

    This isn't the url, but the `parent_app_id`, right? Let's rename this to `app_id`?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alexei Svitkine
    • Andrew Rayskiy
    • Luc Nguyen
    • Vlad Krot
    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: I536c6bf61e94b12278fb67a5072ba9d73654255d
    Gerrit-Change-Number: 8019651
    Gerrit-PatchSet: 5
    Gerrit-Owner: Vlad Krot <vk...@google.com>
    Gerrit-Reviewer: Alexei Svitkine <asvi...@chromium.org>
    Gerrit-Reviewer: Andrew Rayskiy <green...@google.com>
    Gerrit-Reviewer: Dibyajyoti Pal <diby...@chromium.org>
    Gerrit-Reviewer: Luc Nguyen <lucn...@google.com>
    Gerrit-Reviewer: Vlad Krot <vk...@google.com>
    Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
    Gerrit-CC: Chromium Web Applications Reviews <chromium-web...@google.com>
    Gerrit-CC: Simon Hangl <sim...@google.com>
    Gerrit-CC: gwsq
    Gerrit-Attention: Luc Nguyen <lucn...@google.com>
    Gerrit-Attention: Alexei Svitkine <asvi...@chromium.org>
    Gerrit-Attention: Andrew Rayskiy <green...@google.com>
    Gerrit-Attention: Vlad Krot <vk...@google.com>
    Gerrit-Comment-Date: Wed, 01 Jul 2026 17:33:34 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Vlad Krot (Gerrit)

    unread,
    Jul 2, 2026, 12:22:11 PM (6 days ago) Jul 2
    to Dibyajyoti Pal, Chromium Web Applications Reviews, Alexei Svitkine, Andrew Rayskiy, Luc Nguyen, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, Simon Hangl, aixba+wat...@chromium.org, asvitkine...@chromium.org, dibyapal+wa...@chromium.org, dmurph+watc...@chromium.org, japhet+...@chromium.org, kuragin+web-ap...@chromium.org, loyso...@chromium.org, mek+w...@chromium.org, mgiuca...@chromium.org, philli...@chromium.org, rmcelra...@chromium.org, webap...@microsoft.com, zelin+watch-we...@chromium.org
    Attention needed from Alexei Svitkine, Andrew Rayskiy, Dibyajyoti Pal and Luc Nguyen

    Vlad Krot added 12 comments

    File chrome/browser/web_applications/commands/apply_pending_manifest_update_command.cc
    Line 287, Patchset 5: // For sub apps send UKM in addition to UMA that is send via callback chaining
    Dibyajyoti Pal . resolved

    nitty-nit: `sent`

    Vlad Krot

    Done

    File chrome/browser/web_applications/commands/apply_pending_manifest_update_command_unittest.cc
    Line 549, Patchset 5: // Install dummy apps using isolated-app:// scheme URLs.

    webapps::AppId parent_app_id =
    test::InstallDummyWebApp(profile(), "Parent App", parent_url);
    webapps::AppId app_id =
    test::InstallDummyWebApp(profile(), "Sub App", sub_app_url);

    // Make them IWAs and set parent relationship.
    {
    ScopedRegistryUpdate update = provider().sync_bridge_unsafe().BeginUpdate();
    WebApp* app = update->UpdateApp(app_id);
    app->SetParentAppId(parent_app_id);

    WebApp* parent = update->UpdateApp(parent_app_id);
    parent->SetIsolationData(
    IsolationData::Builder(IwaStorageUnownedBundle(base::FilePath(
    FILE_PATH_LITERAL("/dummy/path"))),
    IwaVersion::Create("1.0.0").value())
    .Build());

    app->SetIsolationData(
    IsolationData::Builder(IwaStorageUnownedBundle(base::FilePath(
    FILE_PATH_LITERAL("/dummy/path2"))),
    IwaVersion::Create("1.0.0").value())
    .Build());

    // Manually set pending update info.
    proto::PendingUpdateInfo pending_update_info;
    pending_update_info.set_name("New Name");
    pending_update_info.set_was_ignored(false);
    app->SetPendingUpdateInfo(std::move(pending_update_info));
    }
    Dibyajyoti Pal . resolved

    Will refer to @green...@google.com here on whether this works as a way to install IWAs, or if there are more robust ways to install IWAs.

    Vlad Krot

    This is for sure not a robust way to install IWA, but I did this hacky way due to not knowing how to also install sub apps in unit tests. But you raised a valid concern, let me improve how it is done.

    File chrome/browser/web_applications/isolated_web_apps/isolated_web_app_metrics_helper.h
    Line 50, Patchset 5: static void ReportSubAppSilentUpdateResult(
    Dibyajyoti Pal . unresolved

    Just a heads up, this set of metrics will be triggered more often than the other ones. Commented in the UKM doc as well, the silent update mechanism triggers everytime a page visit happens to a single app, to check if there is a difference in the manifest w.r.t the existing app. If the manifest hasn't changed, the "flow" exits with ["AppUpToDate"](https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/web_applications/scheduler/manifest_silent_update_result.h;drc=a81bc8561d938a2cfa58705d6d7c1121a2dd0f78;l=23), so this metric might be more biased towards that.

    Just something to keep an eye out.

    Vlad Krot

    I guess it is fine, we would see that the command is called.

    File chrome/browser/web_applications/isolated_web_apps/isolated_web_app_metrics_helper.cc
    Line 15, Patchset 5: base::flat_map<url::Origin, int> origin_to_subapps_count) {
    Dibyajyoti Pal . resolved

    Since this is just a generic map, do we need to have it be sorted per `url::Origin`? It doesn't seem like we have to do it, in which case, can we use `absl::flat_hash_map` here as per [Chromium guidelines](https://source.chromium.org/chromium/chromium/src/+/main:base/containers/README.md;l=32-35?q=absl::flat_hash_map%20f:.md%20-f:gen%2F)?

    Vlad Krot

    Done

    Line 29, Patchset 5: const url::Origin& app_origin,
    Dibyajyoti Pal . resolved

    nit: `parent_app_origin`?

    Vlad Krot

    Done

    Line 45, Patchset 2: ukm::IwaSourceUrlRecorder::MarkSourceForDeletion(source_id);
    Andrew Rayskiy . resolved

    Why do we need to mark it for deletion every time?

    Vlad Krot

    This is how PWA also do it via `components/ukm/app_source_url_recorder.cc`.
    For most metrics this source id auto deletes itself, but for IWA I made it to be like WebApp, manual deletion, so that we can create source id, send a few metrics and delete it manually. See `components/ukm/ukm_recorder_impl.cc` `MaybeMarkForDeletion()`

    The source ids always have to be cleaned up from memory, the only question is to do it automatically or manually.

    Vlad Krot

    Acknowledged

    Line 65, Patchset 5: .SetResult(static_cast<int64_t>(result))
    Dibyajyoti Pal . resolved

    nitty-nit: Can we just use `int` here? The number of metrics shouldn't be enough to need 64 bits imo, wdyt?

    Vlad Krot

    Right, let's change it.

    File chrome/browser/web_applications/isolated_web_apps/isolated_web_app_metrics_helper_unittest.cc
    Line 26, Patchset 5:TEST_F(IsolatedWebAppMetricsHelperTest, ReportNumInstalledSubApps) {
    Dibyajyoti Pal . resolved

    This test is pretty good, but it only tests the metrics helper behavior (which forwards data to the UKM system). Instead, can we add the individual tests for these use-cases at the callsites, like we do for `chrome/browser/web_applications/commands/apply_pending_manifest_update_command_unittest.cc`? That allows us to test the whole behavior of the sub app system, instead of just verifying the UKM part of things.

    If you want to keep this test around and add those E2E tests later on, that's fine too!

    Vlad Krot

    I propose a bit simpler solution. Move most of the logic except feature flag checking into `chrome/browser/web_applications/isolated_web_apps/isolated_web_app_metrics_helper.cc`, so that it can all be unit tested.

    File chrome/browser/web_applications/sub_apps/sub_apps_service_impl.h
    Line 83, Patchset 5: struct AddResultCodeWithMetric {

    blink::mojom::SubAppsServiceResultCode result;
    IsolatedWebAppMetricsHelper::LogSubAppInstallResult metric_result;
    };

    using AddResult =
    base::expected<std::vector<blink::mojom::SubAppsServiceAddResultPtr>,
    AddResultCodeWithMetric>;
    Dibyajyoti Pal . unresolved

    There's 3 different enums that are being sent to the UKM system to measure the output of one flow (whether the sub app was installed correctly, or if not, what happened). Can we streamline that behavior here, so that the flow returns a single enum metric for all the use-cases (both success and failure)? That makes this part more readable imo, wdyt?

    Vlad Krot

    I honestly do not see how it is feasible. For example we have `LogSubAppInstallResult::kSuccess` and `LogSubAppInstallResult::kSuccessBypassApproval`, due to this it is hard to streamline into single result of the flow because reporting of result and tracking state is in different places. And regardless of the result code, we send also metrics for individual results inside `std::vector<blink::mojom::SubAppsServiceAddResultPtr>`

    File chrome/browser/web_applications/sub_apps/sub_apps_service_impl.cc
    Line 797, Patchset 5: AddCallInfo* add_call_info = base::FindOrNull(add_call_info_, add_call_id);
    Dibyajyoti Pal . resolved

    Since `add_call_id` is only removed at the end of this function, `add_call_info` should always be present in the map here. Let's use `CHECK_DEREF(base::FindOrNull(...))` to explicitly state this invariant?

    Vlad Krot

    Done

    File chrome/browser/web_applications/web_app_provider.h
    Line 293, Patchset 5: void ReportSubAppMetricsOnStartup();
    Dibyajyoti Pal . unresolved

    Let's make it `private:`?

    Vlad Krot

    I also had such a thought, but the class has a lot of functions and no private modifier anywhere, so maybe for consistency leave as it is.

    File chrome/browser/web_applications/web_app_provider.cc
    Line 688, Patchset 5: for (const auto& [url, count] : iwa_id_to_sub_apps_count) {
    Dibyajyoti Pal . resolved

    This isn't the url, but the `parent_app_id`, right? Let's rename this to `app_id`?

    Vlad Krot

    yes, thanks for spotting that.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alexei Svitkine
    • Andrew Rayskiy
    • Dibyajyoti Pal
    • Luc Nguyen
    Gerrit-Attention: Dibyajyoti Pal <diby...@chromium.org>
    Gerrit-Attention: Luc Nguyen <lucn...@google.com>
    Gerrit-Attention: Alexei Svitkine <asvi...@chromium.org>
    Gerrit-Attention: Andrew Rayskiy <green...@google.com>
    Gerrit-Comment-Date: Thu, 02 Jul 2026 16:21:54 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Dibyajyoti Pal <diby...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Alexei Svitkine (Gerrit)

    unread,
    Jul 2, 2026, 2:23:21 PM (6 days ago) Jul 2
    to Vlad Krot, Dibyajyoti Pal, Chromium Web Applications Reviews, Andrew Rayskiy, Luc Nguyen, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, Simon Hangl, aixba+wat...@chromium.org, asvitkine...@chromium.org, dibyapal+wa...@chromium.org, dmurph+watc...@chromium.org, japhet+...@chromium.org, kuragin+web-ap...@chromium.org, loyso...@chromium.org, mek+w...@chromium.org, mgiuca...@chromium.org, philli...@chromium.org, rmcelra...@chromium.org, webap...@microsoft.com, zelin+watch-we...@chromium.org
    Attention needed from Andrew Rayskiy, Dibyajyoti Pal, Luc Nguyen and Vlad Krot

    Alexei Svitkine voted Code-Review+1

    Code-Review+1
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Andrew Rayskiy
    • Dibyajyoti Pal
    • Luc Nguyen
    • Vlad Krot
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not 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: I536c6bf61e94b12278fb67a5072ba9d73654255d
      Gerrit-Change-Number: 8019651
      Gerrit-PatchSet: 6
      Gerrit-Owner: Vlad Krot <vk...@google.com>
      Gerrit-Reviewer: Alexei Svitkine <asvi...@chromium.org>
      Gerrit-Reviewer: Andrew Rayskiy <green...@google.com>
      Gerrit-Reviewer: Dibyajyoti Pal <diby...@chromium.org>
      Gerrit-Reviewer: Luc Nguyen <lucn...@google.com>
      Gerrit-Reviewer: Vlad Krot <vk...@google.com>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-CC: Chromium Web Applications Reviews <chromium-web...@google.com>
      Gerrit-CC: Simon Hangl <sim...@google.com>
      Gerrit-CC: gwsq
      Gerrit-Attention: Dibyajyoti Pal <diby...@chromium.org>
      Gerrit-Attention: Luc Nguyen <lucn...@google.com>
      Gerrit-Attention: Andrew Rayskiy <green...@google.com>
      Gerrit-Attention: Vlad Krot <vk...@google.com>
      Gerrit-Comment-Date: Thu, 02 Jul 2026 18:23:07 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Luc Nguyen (Gerrit)

      unread,
      Jul 2, 2026, 6:04:46 PM (6 days ago) Jul 2
      to Vlad Krot, Alexei Svitkine, Dibyajyoti Pal, Chromium Web Applications Reviews, Andrew Rayskiy, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, Simon Hangl, aixba+wat...@chromium.org, asvitkine...@chromium.org, dibyapal+wa...@chromium.org, dmurph+watc...@chromium.org, japhet+...@chromium.org, kuragin+web-ap...@chromium.org, loyso...@chromium.org, mek+w...@chromium.org, mgiuca...@chromium.org, philli...@chromium.org, rmcelra...@chromium.org, webap...@microsoft.com, zelin+watch-we...@chromium.org
      Attention needed from Andrew Rayskiy, Dibyajyoti Pal and Vlad Krot

      Luc Nguyen voted Code-Review+1

      Code-Review+1
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Andrew Rayskiy
      • Dibyajyoti Pal
      • Vlad Krot
      Gerrit-Attention: Andrew Rayskiy <green...@google.com>
      Gerrit-Attention: Vlad Krot <vk...@google.com>
      Gerrit-Comment-Date: Thu, 02 Jul 2026 22:04:33 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Andrew Rayskiy (Gerrit)

      unread,
      Jul 3, 2026, 5:02:31 AM (6 days ago) Jul 3
      to Vlad Krot, Luc Nguyen, Alexei Svitkine, Dibyajyoti Pal, Chromium Web Applications Reviews, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, Simon Hangl, aixba+wat...@chromium.org, asvitkine...@chromium.org, dibyapal+wa...@chromium.org, dmurph+watc...@chromium.org, japhet+...@chromium.org, kuragin+web-ap...@chromium.org, loyso...@chromium.org, mek+w...@chromium.org, mgiuca...@chromium.org, philli...@chromium.org, rmcelra...@chromium.org, webap...@microsoft.com, zelin+watch-we...@chromium.org
      Attention needed from Dibyajyoti Pal and Vlad Krot

      Andrew Rayskiy voted and added 2 comments

      Votes added by Andrew Rayskiy

      Code-Review+1

      2 comments

      File chrome/browser/web_applications/DEPS
      Line 2, Patchset 6 (Latest): "+absl/container/flat_hash_map.h",
      Andrew Rayskiy . unresolved

      This looks out of place! The correct include would be `third_party/abseil-cpp/absl/container/flat_hash_map.h`, and it doesn't require an include rule IIUC

      Are you still using it?

      File chrome/browser/web_applications/sub_apps/sub_apps_service_impl.cc
      Line 319, Patchset 6 (Latest): WebAppProvider* provider = GetWebAppProvider(render_frame_host());
      Andrew Rayskiy . unresolved

      For the follow-up (if you don't mind): this class is extremely polluted with similar `GetWebAppProvider(render_frame_host())` calls everywhere. Can we turn this into a simple class function like `provider()` and inline it everywhere?

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Dibyajyoti Pal
      • Vlad Krot
      Gerrit-Attention: Vlad Krot <vk...@google.com>
      Gerrit-Comment-Date: Fri, 03 Jul 2026 09:02:14 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Vlad Krot (Gerrit)

      unread,
      Jul 6, 2026, 9:23:52 AM (2 days ago) Jul 6
      to Andrew Rayskiy, Luc Nguyen, Alexei Svitkine, Dibyajyoti Pal, Chromium Web Applications Reviews, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, Simon Hangl, aixba+wat...@chromium.org, asvitkine...@chromium.org, dibyapal+wa...@chromium.org, dmurph+watc...@chromium.org, japhet+...@chromium.org, kuragin+web-ap...@chromium.org, loyso...@chromium.org, mek+w...@chromium.org, mgiuca...@chromium.org, philli...@chromium.org, rmcelra...@chromium.org, webap...@microsoft.com, zelin+watch-we...@chromium.org
      Attention needed from Andrew Rayskiy and Dibyajyoti Pal

      Vlad Krot added 2 comments

      File chrome/browser/web_applications/DEPS
      Line 2, Patchset 6 (Latest): "+absl/container/flat_hash_map.h",
      Andrew Rayskiy . unresolved

      This looks out of place! The correct include would be `third_party/abseil-cpp/absl/container/flat_hash_map.h`, and it doesn't require an include rule IIUC

      Are you still using it?

      Vlad Krot

      Without this I get presubmit error

      ```
      ** Presubmit ERRORS: 1 **
      You added one or more #includes that violate checkdeps rules.
      chrome/browser/web_applications/isolated_web_apps/isolated_web_app_metrics_helper.cc
      Illegal include: "absl/container/flat_hash_map.h"
      Because of no rule applying.
      ```
      File chrome/browser/web_applications/sub_apps/sub_apps_service_impl.cc
      Line 319, Patchset 6 (Latest): WebAppProvider* provider = GetWebAppProvider(render_frame_host());
      Andrew Rayskiy . resolved

      For the follow-up (if you don't mind): this class is extremely polluted with similar `GetWebAppProvider(render_frame_host())` calls everywhere. Can we turn this into a simple class function like `provider()` and inline it everywhere?

      Vlad Krot

      makes sense. Refactored.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Andrew Rayskiy
      • Dibyajyoti Pal
      Gerrit-Attention: Andrew Rayskiy <green...@google.com>
      Gerrit-Comment-Date: Mon, 06 Jul 2026 13:23:35 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Andrew Rayskiy <green...@google.com>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Andrew Rayskiy (Gerrit)

      unread,
      Jul 6, 2026, 9:31:21 AM (2 days ago) Jul 6
      to Vlad Krot, Luc Nguyen, Alexei Svitkine, Dibyajyoti Pal, Chromium Web Applications Reviews, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, Simon Hangl, aixba+wat...@chromium.org, asvitkine...@chromium.org, dibyapal+wa...@chromium.org, dmurph+watc...@chromium.org, japhet+...@chromium.org, kuragin+web-ap...@chromium.org, loyso...@chromium.org, mek+w...@chromium.org, mgiuca...@chromium.org, philli...@chromium.org, rmcelra...@chromium.org, webap...@microsoft.com, zelin+watch-we...@chromium.org
      Attention needed from Dibyajyoti Pal and Vlad Krot

      Andrew Rayskiy voted and added 1 comment

      Votes added by Andrew Rayskiy

      Code-Review+1

      1 comment

      File chrome/browser/web_applications/DEPS
      Line 2, Patchset 6: "+absl/container/flat_hash_map.h",
      Andrew Rayskiy . unresolved

      This looks out of place! The correct include would be `third_party/abseil-cpp/absl/container/flat_hash_map.h`, and it doesn't require an include rule IIUC

      Are you still using it?

      Vlad Krot

      Without this I get presubmit error

      ```
      ** Presubmit ERRORS: 1 **
      You added one or more #includes that violate checkdeps rules.
      chrome/browser/web_applications/isolated_web_apps/isolated_web_app_metrics_helper.cc
      Illegal include: "absl/container/flat_hash_map.h"
      Because of no rule applying.
      ```
      Andrew Rayskiy

      `absl/container/flat_hash_map.h` is an illegal include. Use `third_party/abseil-cpp/absl/container/flat_hash_map.h` and be happy?

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Dibyajyoti Pal
      • Vlad Krot
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not 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: I536c6bf61e94b12278fb67a5072ba9d73654255d
      Gerrit-Change-Number: 8019651
      Gerrit-PatchSet: 7
      Gerrit-Owner: Vlad Krot <vk...@google.com>
      Gerrit-Reviewer: Alexei Svitkine <asvi...@chromium.org>
      Gerrit-Reviewer: Andrew Rayskiy <green...@google.com>
      Gerrit-Reviewer: Dibyajyoti Pal <diby...@chromium.org>
      Gerrit-Reviewer: Luc Nguyen <lucn...@google.com>
      Gerrit-Reviewer: Vlad Krot <vk...@google.com>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-CC: Chromium Web Applications Reviews <chromium-web...@google.com>
      Gerrit-CC: Simon Hangl <sim...@google.com>
      Gerrit-CC: gwsq
      Gerrit-Attention: Dibyajyoti Pal <diby...@chromium.org>
      Gerrit-Attention: Vlad Krot <vk...@google.com>
      Gerrit-Comment-Date: Mon, 06 Jul 2026 13:31:05 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Dibyajyoti Pal (Gerrit)

      unread,
      Jul 6, 2026, 11:41:28 AM (2 days ago) Jul 6
      to Vlad Krot, Andrew Rayskiy, Luc Nguyen, Alexei Svitkine, Chromium Web Applications Reviews, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, Simon Hangl, aixba+wat...@chromium.org, asvitkine...@chromium.org, dibyapal+wa...@chromium.org, dmurph+watc...@chromium.org, japhet+...@chromium.org, kuragin+web-ap...@chromium.org, loyso...@chromium.org, mek+w...@chromium.org, mgiuca...@chromium.org, philli...@chromium.org, rmcelra...@chromium.org, webap...@microsoft.com, zelin+watch-we...@chromium.org
      Attention needed from Vlad Krot

      Dibyajyoti Pal added 5 comments

      Patchset-level comments
      File-level comment, Patchset 7 (Latest):
      Dibyajyoti Pal . resolved

      This looks reasonably good, there's some places that can be improved imo, but nothing blocking for now.

      File chrome/browser/web_applications/isolated_web_apps/isolated_web_app_metrics_helper.h
      Line 50, Patchset 5: static void ReportSubAppSilentUpdateResult(
      Dibyajyoti Pal . resolved

      Just a heads up, this set of metrics will be triggered more often than the other ones. Commented in the UKM doc as well, the silent update mechanism triggers everytime a page visit happens to a single app, to check if there is a difference in the manifest w.r.t the existing app. If the manifest hasn't changed, the "flow" exits with ["AppUpToDate"](https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/web_applications/scheduler/manifest_silent_update_result.h;drc=a81bc8561d938a2cfa58705d6d7c1121a2dd0f78;l=23), so this metric might be more biased towards that.

      Just something to keep an eye out.

      Vlad Krot

      I guess it is fine, we would see that the command is called.

      Dibyajyoti Pal

      Acked, as long as you're aware of it that's fine.

      File chrome/browser/web_applications/isolated_web_apps/isolated_web_app_metrics_helper.cc
      Line 26, Patchset 7 (Latest): CHECK(parent_app_id);
      Dibyajyoti Pal . resolved

      Defensive programming, nice!

      File chrome/browser/web_applications/isolated_web_apps/isolated_web_app_metrics_helper_unittest.cc
      Line 26, Patchset 5:TEST_F(IsolatedWebAppMetricsHelperTest, ReportNumInstalledSubApps) {
      Dibyajyoti Pal . unresolved

      This test is pretty good, but it only tests the metrics helper behavior (which forwards data to the UKM system). Instead, can we add the individual tests for these use-cases at the callsites, like we do for `chrome/browser/web_applications/commands/apply_pending_manifest_update_command_unittest.cc`? That allows us to test the whole behavior of the sub app system, instead of just verifying the UKM part of things.

      If you want to keep this test around and add those E2E tests later on, that's fine too!

      Vlad Krot

      I propose a bit simpler solution. Move most of the logic except feature flag checking into `chrome/browser/web_applications/isolated_web_apps/isolated_web_app_metrics_helper.cc`, so that it can all be unit tested.

      Dibyajyoti Pal

      This works for the use-case where we're measuring the sub apps and the count of the children (which kinda makes sense). How are you planning on moving the update specific use-cases to the IWA metrics helper?

      File chrome/browser/web_applications/sub_apps/sub_apps_service_impl.h
      Line 83, Patchset 5: struct AddResultCodeWithMetric {
      blink::mojom::SubAppsServiceResultCode result;
      IsolatedWebAppMetricsHelper::LogSubAppInstallResult metric_result;
      };

      using AddResult =
      base::expected<std::vector<blink::mojom::SubAppsServiceAddResultPtr>,
      AddResultCodeWithMetric>;
      Dibyajyoti Pal . unresolved

      There's 3 different enums that are being sent to the UKM system to measure the output of one flow (whether the sub app was installed correctly, or if not, what happened). Can we streamline that behavior here, so that the flow returns a single enum metric for all the use-cases (both success and failure)? That makes this part more readable imo, wdyt?

      Vlad Krot

      I honestly do not see how it is feasible. For example we have `LogSubAppInstallResult::kSuccess` and `LogSubAppInstallResult::kSuccessBypassApproval`, due to this it is hard to streamline into single result of the flow because reporting of result and tracking state is in different places. And regardless of the result code, we send also metrics for individual results inside `std::vector<blink::mojom::SubAppsServiceAddResultPtr>`

      Dibyajyoti Pal

      Actually, the example you shared is a good example where the result is already streamlined into a single enum to be measured.

      What if we:

      • Returned the result of all `Add` calls as `blink::mojom::SubAppsServiceResultCode` per call? We could update the enum values inside it as well to account for the cases where the bypass happened, instead of using a separate boolean value for it. We could store the result for it in `AddCallInfo` too.
      • At the end of all the `Add` calls, update `ReportAddMetricsAndRunCallback()` to parse every `SubAppsServiceResultCode`, convert it to a `IsolatedWebAppMetricsHelper::LogSubAppInstallResult`, and send them to UKM.

      Wdyt? Fine to do as a follow-up, the current code still seems complicated while parsing.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Vlad Krot
      Gerrit-Attention: Vlad Krot <vk...@google.com>
      Gerrit-Comment-Date: Mon, 06 Jul 2026 15:41:10 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Dibyajyoti Pal <diby...@chromium.org>
      Comment-In-Reply-To: Vlad Krot <vk...@google.com>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Dibyajyoti Pal (Gerrit)

      unread,
      Jul 6, 2026, 11:41:35 AM (2 days ago) Jul 6
      to Vlad Krot, Andrew Rayskiy, Luc Nguyen, Alexei Svitkine, Chromium Web Applications Reviews, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, Simon Hangl, aixba+wat...@chromium.org, asvitkine...@chromium.org, dibyapal+wa...@chromium.org, dmurph+watc...@chromium.org, japhet+...@chromium.org, kuragin+web-ap...@chromium.org, loyso...@chromium.org, mek+w...@chromium.org, mgiuca...@chromium.org, philli...@chromium.org, rmcelra...@chromium.org, webap...@microsoft.com, zelin+watch-we...@chromium.org
      Attention needed from Vlad Krot

      Dibyajyoti Pal voted Code-Review+1

      Code-Review+1
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Vlad Krot
      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: I536c6bf61e94b12278fb67a5072ba9d73654255d
      Gerrit-Change-Number: 8019651
      Gerrit-PatchSet: 7
      Gerrit-Owner: Vlad Krot <vk...@google.com>
      Gerrit-Reviewer: Alexei Svitkine <asvi...@chromium.org>
      Gerrit-Reviewer: Andrew Rayskiy <green...@google.com>
      Gerrit-Reviewer: Dibyajyoti Pal <diby...@chromium.org>
      Gerrit-Reviewer: Luc Nguyen <lucn...@google.com>
      Gerrit-Reviewer: Vlad Krot <vk...@google.com>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-CC: Chromium Web Applications Reviews <chromium-web...@google.com>
      Gerrit-CC: Simon Hangl <sim...@google.com>
      Gerrit-CC: gwsq
      Gerrit-Attention: Vlad Krot <vk...@google.com>
      Gerrit-Comment-Date: Mon, 06 Jul 2026 15:41:20 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Dibyajyoti Pal (Gerrit)

      unread,
      Jul 6, 2026, 11:42:01 AM (2 days ago) Jul 6
      to Vlad Krot, Andrew Rayskiy, Luc Nguyen, Alexei Svitkine, Chromium Web Applications Reviews, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, Simon Hangl, aixba+wat...@chromium.org, asvitkine...@chromium.org, dibyapal+wa...@chromium.org, dmurph+watc...@chromium.org, japhet+...@chromium.org, kuragin+web-ap...@chromium.org, loyso...@chromium.org, mek+w...@chromium.org, mgiuca...@chromium.org, philli...@chromium.org, rmcelra...@chromium.org, webap...@microsoft.com, zelin+watch-we...@chromium.org
      Attention needed from Vlad Krot

      Dibyajyoti Pal added 1 comment

      File chrome/browser/web_applications/web_app_provider.h
      Line 293, Patchset 5: void ReportSubAppMetricsOnStartup();
      Dibyajyoti Pal . resolved

      Let's make it `private:`?

      Vlad Krot

      I also had such a thought, but the class has a lot of functions and no private modifier anywhere, so maybe for consistency leave as it is.

      Dibyajyoti Pal

      Acknowledged

      Gerrit-Comment-Date: Mon, 06 Jul 2026 15:41:38 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Vlad Krot (Gerrit)

      unread,
      Jul 7, 2026, 10:36:47 AM (yesterday) Jul 7
      to Andrew Rayskiy, Luc Nguyen, Alexei Svitkine, Chromium Web Applications Reviews, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, Simon Hangl, aixba+wat...@chromium.org, asvitkine...@chromium.org, dibyapal+wa...@chromium.org, dmurph+watc...@chromium.org, japhet+...@chromium.org, kuragin+web-ap...@chromium.org, loyso...@chromium.org, mek+w...@chromium.org, mgiuca...@chromium.org, philli...@chromium.org, rmcelra...@chromium.org, webap...@microsoft.com, zelin+watch-we...@chromium.org
      Attention needed from Andrew Rayskiy

      Vlad Krot added 1 comment

      File chrome/browser/web_applications/DEPS
      Line 2, Patchset 6: "+absl/container/flat_hash_map.h",
      Andrew Rayskiy . unresolved

      This looks out of place! The correct include would be `third_party/abseil-cpp/absl/container/flat_hash_map.h`, and it doesn't require an include rule IIUC

      Are you still using it?

      Vlad Krot

      Without this I get presubmit error

      ```
      ** Presubmit ERRORS: 1 **
      You added one or more #includes that violate checkdeps rules.
      chrome/browser/web_applications/isolated_web_apps/isolated_web_app_metrics_helper.cc
      Illegal include: "absl/container/flat_hash_map.h"
      Because of no rule applying.
      ```
      Andrew Rayskiy

      `absl/container/flat_hash_map.h` is an illegal include. Use `third_party/abseil-cpp/absl/container/flat_hash_map.h` and be happy?

      Vlad Krot

      the second does not work, while the first works fine

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Andrew Rayskiy
      Gerrit-Attention: Andrew Rayskiy <green...@google.com>
      Gerrit-Comment-Date: Tue, 07 Jul 2026 14:36:27 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Vlad Krot (Gerrit)

      unread,
      Jul 7, 2026, 11:08:35 AM (yesterday) Jul 7
      to Dibyajyoti Pal, Andrew Rayskiy, Luc Nguyen, Alexei Svitkine, Chromium Web Applications Reviews, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, Simon Hangl, aixba+wat...@chromium.org, asvitkine...@chromium.org, dibyapal+wa...@chromium.org, dmurph+watc...@chromium.org, japhet+...@chromium.org, kuragin+web-ap...@chromium.org, loyso...@chromium.org, mek+w...@chromium.org, mgiuca...@chromium.org, philli...@chromium.org, rmcelra...@chromium.org, webap...@microsoft.com, zelin+watch-we...@chromium.org
      Attention needed from Andrew Rayskiy and Dibyajyoti Pal

      Vlad Krot added 1 comment

      File chrome/browser/web_applications/sub_apps/sub_apps_service_impl.h
      Line 83, Patchset 5: struct AddResultCodeWithMetric {
      blink::mojom::SubAppsServiceResultCode result;
      IsolatedWebAppMetricsHelper::LogSubAppInstallResult metric_result;
      };

      using AddResult =
      base::expected<std::vector<blink::mojom::SubAppsServiceAddResultPtr>,
      AddResultCodeWithMetric>;
      Dibyajyoti Pal . unresolved

      There's 3 different enums that are being sent to the UKM system to measure the output of one flow (whether the sub app was installed correctly, or if not, what happened). Can we streamline that behavior here, so that the flow returns a single enum metric for all the use-cases (both success and failure)? That makes this part more readable imo, wdyt?

      Vlad Krot

      I honestly do not see how it is feasible. For example we have `LogSubAppInstallResult::kSuccess` and `LogSubAppInstallResult::kSuccessBypassApproval`, due to this it is hard to streamline into single result of the flow because reporting of result and tracking state is in different places. And regardless of the result code, we send also metrics for individual results inside `std::vector<blink::mojom::SubAppsServiceAddResultPtr>`

      Dibyajyoti Pal

      Actually, the example you shared is a good example where the result is already streamlined into a single enum to be measured.

      What if we:

      • Returned the result of all `Add` calls as `blink::mojom::SubAppsServiceResultCode` per call? We could update the enum values inside it as well to account for the cases where the bypass happened, instead of using a separate boolean value for it. We could store the result for it in `AddCallInfo` too.
      • At the end of all the `Add` calls, update `ReportAddMetricsAndRunCallback()` to parse every `SubAppsServiceResultCode`, convert it to a `IsolatedWebAppMetricsHelper::LogSubAppInstallResult`, and send them to UKM.

      Wdyt? Fine to do as a follow-up, the current code still seems complicated while parsing.

      Vlad Krot

      "We could update the enum values inside it as well to account for the cases where the bypass happened" - I actually was doing that before, but one of reviewers asked to not expose those states to blink side.

      So we can have intermediate enum which later maps to `blink::mojom::SubAppsServiceResultCode` and `IsolatedWebAppMetricsHelper::LogSubAppInstallResult`

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Andrew Rayskiy
      • Dibyajyoti Pal
      Gerrit-Attention: Dibyajyoti Pal <diby...@chromium.org>
      Gerrit-Attention: Andrew Rayskiy <green...@google.com>
      Gerrit-Comment-Date: Tue, 07 Jul 2026 15:08:16 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Dibyajyoti Pal (Gerrit)

      unread,
      Jul 7, 2026, 12:13:10 PM (yesterday) Jul 7
      to Vlad Krot, Andrew Rayskiy, Luc Nguyen, Alexei Svitkine, Chromium Web Applications Reviews, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, Simon Hangl, aixba+wat...@chromium.org, asvitkine...@chromium.org, dibyapal+wa...@chromium.org, dmurph+watc...@chromium.org, japhet+...@chromium.org, kuragin+web-ap...@chromium.org, loyso...@chromium.org, mek+w...@chromium.org, mgiuca...@chromium.org, philli...@chromium.org, rmcelra...@chromium.org, webap...@microsoft.com, zelin+watch-we...@chromium.org
      Attention needed from Andrew Rayskiy and Vlad Krot

      Dibyajyoti Pal added 3 comments

      File chrome/browser/web_applications/DEPS
      Line 2, Patchset 6: "+absl/container/flat_hash_map.h",
      Andrew Rayskiy . unresolved

      This looks out of place! The correct include would be `third_party/abseil-cpp/absl/container/flat_hash_map.h`, and it doesn't require an include rule IIUC

      Are you still using it?

      Vlad Krot

      Without this I get presubmit error

      ```
      ** Presubmit ERRORS: 1 **
      You added one or more #includes that violate checkdeps rules.
      chrome/browser/web_applications/isolated_web_apps/isolated_web_app_metrics_helper.cc
      Illegal include: "absl/container/flat_hash_map.h"
      Because of no rule applying.
      ```
      Andrew Rayskiy

      `absl/container/flat_hash_map.h` is an illegal include. Use `third_party/abseil-cpp/absl/container/flat_hash_map.h` and be happy?

      Vlad Krot

      the second does not work, while the first works fine

      Dibyajyoti Pal

      I believe Andrew's suggestion is correct, we should be using that in the header files where we need, and not update the DEPS here. We already have usages of [`absl::flat_hash_map`](https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/web_applications/model/web_app_icon_types.h;l=17?q=third_party%2Fabseil-cpp%2Fabsl%2Fcontainer%2Fflat_hash_map.h%20f:web_applications%2F) like that in our codebase, that should work.

      File chrome/browser/web_applications/commands/apply_pending_manifest_update_command.cc
      Line 292, Patchset 7 (Latest): url::Origin::Create(registrar.GetAppStartUrl(app_id_)), check_result);
      Dibyajyoti Pal . unresolved

      nit: `app_id_` here is the sub-app's ID. Since IWA sub-apps share the same origin as the parent IWA, `url::Origin::Create(...)` will evaluate to the parent app's origin, which practically matches what `ReportSubAppPendingUpdateResult` expects (`parent_app_origin`). However, consider explicitly fetching the parent app's start URL (via `parent_app_id()`) to align with the parameter name and improve readability.

      File chrome/browser/web_applications/sub_apps/sub_apps_service_impl.h
      Line 83, Patchset 5: struct AddResultCodeWithMetric {
      blink::mojom::SubAppsServiceResultCode result;
      IsolatedWebAppMetricsHelper::LogSubAppInstallResult metric_result;
      };

      using AddResult =
      base::expected<std::vector<blink::mojom::SubAppsServiceAddResultPtr>,
      AddResultCodeWithMetric>;
      Dibyajyoti Pal . unresolved

      There's 3 different enums that are being sent to the UKM system to measure the output of one flow (whether the sub app was installed correctly, or if not, what happened). Can we streamline that behavior here, so that the flow returns a single enum metric for all the use-cases (both success and failure)? That makes this part more readable imo, wdyt?

      Vlad Krot

      I honestly do not see how it is feasible. For example we have `LogSubAppInstallResult::kSuccess` and `LogSubAppInstallResult::kSuccessBypassApproval`, due to this it is hard to streamline into single result of the flow because reporting of result and tracking state is in different places. And regardless of the result code, we send also metrics for individual results inside `std::vector<blink::mojom::SubAppsServiceAddResultPtr>`

      Dibyajyoti Pal

      Actually, the example you shared is a good example where the result is already streamlined into a single enum to be measured.

      What if we:

      • Returned the result of all `Add` calls as `blink::mojom::SubAppsServiceResultCode` per call? We could update the enum values inside it as well to account for the cases where the bypass happened, instead of using a separate boolean value for it. We could store the result for it in `AddCallInfo` too.
      • At the end of all the `Add` calls, update `ReportAddMetricsAndRunCallback()` to parse every `SubAppsServiceResultCode`, convert it to a `IsolatedWebAppMetricsHelper::LogSubAppInstallResult`, and send them to UKM.

      Wdyt? Fine to do as a follow-up, the current code still seems complicated while parsing.

      Vlad Krot

      "We could update the enum values inside it as well to account for the cases where the bypass happened" - I actually was doing that before, but one of reviewers asked to not expose those states to blink side.

      So we can have intermediate enum which later maps to `blink::mojom::SubAppsServiceResultCode` and `IsolatedWebAppMetricsHelper::LogSubAppInstallResult`

      Dibyajyoti Pal

      That would also work, as long as the code here is simplified to return a single thing. 😄

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Andrew Rayskiy
      • Vlad Krot
      Gerrit-Attention: Andrew Rayskiy <green...@google.com>
      Gerrit-Attention: Vlad Krot <vk...@google.com>
      Gerrit-Comment-Date: Tue, 07 Jul 2026 16:12:57 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Dibyajyoti Pal <diby...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Andrew Rayskiy (Gerrit)

      unread,
      Jul 7, 2026, 12:14:49 PM (yesterday) Jul 7
      to Vlad Krot, Luc Nguyen, Alexei Svitkine, Chromium Web Applications Reviews, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, Simon Hangl, aixba+wat...@chromium.org, asvitkine...@chromium.org, dibyapal+wa...@chromium.org, dmurph+watc...@chromium.org, japhet+...@chromium.org, kuragin+web-ap...@chromium.org, loyso...@chromium.org, mek+w...@chromium.org, mgiuca...@chromium.org, philli...@chromium.org, rmcelra...@chromium.org, webap...@microsoft.com, zelin+watch-we...@chromium.org
      Attention needed from Vlad Krot

      Andrew Rayskiy added 1 comment

      File chrome/browser/web_applications/DEPS
      Line 2, Patchset 6: "+absl/container/flat_hash_map.h",
      Andrew Rayskiy . unresolved

      This looks out of place! The correct include would be `third_party/abseil-cpp/absl/container/flat_hash_map.h`, and it doesn't require an include rule IIUC

      Are you still using it?

      Vlad Krot

      Without this I get presubmit error

      ```
      ** Presubmit ERRORS: 1 **
      You added one or more #includes that violate checkdeps rules.
      chrome/browser/web_applications/isolated_web_apps/isolated_web_app_metrics_helper.cc
      Illegal include: "absl/container/flat_hash_map.h"
      Because of no rule applying.
      ```
      Andrew Rayskiy

      `absl/container/flat_hash_map.h` is an illegal include. Use `third_party/abseil-cpp/absl/container/flat_hash_map.h` and be happy?

      Vlad Krot

      the second does not work, while the first works fine

      Dibyajyoti Pal

      I believe Andrew's suggestion is correct, we should be using that in the header files where we need, and not update the DEPS here. We already have usages of [`absl::flat_hash_map`](https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/web_applications/model/web_app_icon_types.h;l=17?q=third_party%2Fabseil-cpp%2Fabsl%2Fcontainer%2Fflat_hash_map.h%20f:web_applications%2F) like that in our codebase, that should work.

      Andrew Rayskiy

      +1

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Vlad Krot
      Gerrit-Attention: Vlad Krot <vk...@google.com>
      Gerrit-Comment-Date: Tue, 07 Jul 2026 16:14:31 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Vlad Krot (Gerrit)

      unread,
      8:51 AM (9 hours ago) 8:51 AM
      to Dibyajyoti Pal, Andrew Rayskiy, Luc Nguyen, Alexei Svitkine, Chromium Web Applications Reviews, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, Simon Hangl, aixba+wat...@chromium.org, asvitkine...@chromium.org, dibyapal+wa...@chromium.org, dmurph+watc...@chromium.org, japhet+...@chromium.org, kuragin+web-ap...@chromium.org, loyso...@chromium.org, mek+w...@chromium.org, mgiuca...@chromium.org, philli...@chromium.org, rmcelra...@chromium.org, webap...@microsoft.com, zelin+watch-we...@chromium.org
      Attention needed from Alexei Svitkine, Andrew Rayskiy, Dibyajyoti Pal and Luc Nguyen

      Vlad Krot added 4 comments

      File chrome/browser/web_applications/DEPS
      Line 2, Patchset 6: "+absl/container/flat_hash_map.h",
      Andrew Rayskiy . resolved

      This looks out of place! The correct include would be `third_party/abseil-cpp/absl/container/flat_hash_map.h`, and it doesn't require an include rule IIUC

      Are you still using it?

      Vlad Krot

      Without this I get presubmit error

      ```
      ** Presubmit ERRORS: 1 **
      You added one or more #includes that violate checkdeps rules.
      chrome/browser/web_applications/isolated_web_apps/isolated_web_app_metrics_helper.cc
      Illegal include: "absl/container/flat_hash_map.h"
      Because of no rule applying.
      ```
      Andrew Rayskiy

      `absl/container/flat_hash_map.h` is an illegal include. Use `third_party/abseil-cpp/absl/container/flat_hash_map.h` and be happy?

      Vlad Krot

      the second does not work, while the first works fine

      Vlad Krot

      sorry, you are right, I need to change c++ header and it works, great!

      File chrome/browser/web_applications/commands/apply_pending_manifest_update_command.cc
      Line 292, Patchset 7: url::Origin::Create(registrar.GetAppStartUrl(app_id_)), check_result);
      Dibyajyoti Pal . resolved

      nit: `app_id_` here is the sub-app's ID. Since IWA sub-apps share the same origin as the parent IWA, `url::Origin::Create(...)` will evaluate to the parent app's origin, which practically matches what `ReportSubAppPendingUpdateResult` expects (`parent_app_origin`). However, consider explicitly fetching the parent app's start URL (via `parent_app_id()`) to align with the parameter name and improve readability.

      Vlad Krot

      Done

      File chrome/browser/web_applications/isolated_web_apps/isolated_web_app_metrics_helper_unittest.cc
      Line 26, Patchset 5:TEST_F(IsolatedWebAppMetricsHelperTest, ReportNumInstalledSubApps) {
      Dibyajyoti Pal . unresolved

      This test is pretty good, but it only tests the metrics helper behavior (which forwards data to the UKM system). Instead, can we add the individual tests for these use-cases at the callsites, like we do for `chrome/browser/web_applications/commands/apply_pending_manifest_update_command_unittest.cc`? That allows us to test the whole behavior of the sub app system, instead of just verifying the UKM part of things.

      If you want to keep this test around and add those E2E tests later on, that's fine too!

      Vlad Krot

      I propose a bit simpler solution. Move most of the logic except feature flag checking into `chrome/browser/web_applications/isolated_web_apps/isolated_web_app_metrics_helper.cc`, so that it can all be unit tested.

      Dibyajyoti Pal

      This works for the use-case where we're measuring the sub apps and the count of the children (which kinda makes sense). How are you planning on moving the update specific use-cases to the IWA metrics helper?

      Vlad Krot

      For `chrome/browser/web_applications/manifest_update_manager.cc` metrics I have added assertions of them being send to `chrome/browser/web_applications/sub_apps/sub_app_update_browsertest.cc`
      Or do you prefer them being rather added to `ManifestSilentUpdateCommand`?

      File chrome/browser/web_applications/sub_apps/sub_apps_service_impl.h
      Line 83, Patchset 5: struct AddResultCodeWithMetric {
      blink::mojom::SubAppsServiceResultCode result;
      IsolatedWebAppMetricsHelper::LogSubAppInstallResult metric_result;
      };

      using AddResult =
      base::expected<std::vector<blink::mojom::SubAppsServiceAddResultPtr>,
      AddResultCodeWithMetric>;
      Dibyajyoti Pal . resolved

      There's 3 different enums that are being sent to the UKM system to measure the output of one flow (whether the sub app was installed correctly, or if not, what happened). Can we streamline that behavior here, so that the flow returns a single enum metric for all the use-cases (both success and failure)? That makes this part more readable imo, wdyt?

      Vlad Krot

      I honestly do not see how it is feasible. For example we have `LogSubAppInstallResult::kSuccess` and `LogSubAppInstallResult::kSuccessBypassApproval`, due to this it is hard to streamline into single result of the flow because reporting of result and tracking state is in different places. And regardless of the result code, we send also metrics for individual results inside `std::vector<blink::mojom::SubAppsServiceAddResultPtr>`

      Dibyajyoti Pal

      Actually, the example you shared is a good example where the result is already streamlined into a single enum to be measured.

      What if we:

      • Returned the result of all `Add` calls as `blink::mojom::SubAppsServiceResultCode` per call? We could update the enum values inside it as well to account for the cases where the bypass happened, instead of using a separate boolean value for it. We could store the result for it in `AddCallInfo` too.
      • At the end of all the `Add` calls, update `ReportAddMetricsAndRunCallback()` to parse every `SubAppsServiceResultCode`, convert it to a `IsolatedWebAppMetricsHelper::LogSubAppInstallResult`, and send them to UKM.

      Wdyt? Fine to do as a follow-up, the current code still seems complicated while parsing.

      Vlad Krot

      "We could update the enum values inside it as well to account for the cases where the bypass happened" - I actually was doing that before, but one of reviewers asked to not expose those states to blink side.

      So we can have intermediate enum which later maps to `blink::mojom::SubAppsServiceResultCode` and `IsolatedWebAppMetricsHelper::LogSubAppInstallResult`

      Dibyajyoti Pal

      That would also work, as long as the code here is simplified to return a single thing. 😄

      Vlad Krot

      Done

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Alexei Svitkine
      • Andrew Rayskiy
      • Dibyajyoti Pal
      • Luc Nguyen
        Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement 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: I536c6bf61e94b12278fb67a5072ba9d73654255d
          Gerrit-Change-Number: 8019651
          Gerrit-PatchSet: 7
          Gerrit-Owner: Vlad Krot <vk...@google.com>
          Gerrit-Reviewer: Alexei Svitkine <asvi...@chromium.org>
          Gerrit-Reviewer: Andrew Rayskiy <green...@google.com>
          Gerrit-Reviewer: Dibyajyoti Pal <diby...@chromium.org>
          Gerrit-Reviewer: Luc Nguyen <lucn...@google.com>
          Gerrit-Reviewer: Vlad Krot <vk...@google.com>
          Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
          Gerrit-CC: Chromium Web Applications Reviews <chromium-web...@google.com>
          Gerrit-CC: Simon Hangl <sim...@google.com>
          Gerrit-CC: gwsq
          Gerrit-Attention: Dibyajyoti Pal <diby...@chromium.org>
          Gerrit-Attention: Luc Nguyen <lucn...@google.com>
          Gerrit-Attention: Alexei Svitkine <asvi...@chromium.org>
          Gerrit-Attention: Andrew Rayskiy <green...@google.com>
          Gerrit-Comment-Date: Wed, 08 Jul 2026 12:51:10 +0000
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Dibyajyoti Pal (Gerrit)

          unread,
          4:08 PM (2 hours ago) 4:08 PM
          to Vlad Krot, Andrew Rayskiy, Luc Nguyen, Alexei Svitkine, Chromium Web Applications Reviews, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, Simon Hangl, aixba+wat...@chromium.org, asvitkine...@chromium.org, dibyapal+wa...@chromium.org, dmurph+watc...@chromium.org, japhet+...@chromium.org, kuragin+web-ap...@chromium.org, loyso...@chromium.org, mek+w...@chromium.org, mgiuca...@chromium.org, philli...@chromium.org, rmcelra...@chromium.org, webap...@microsoft.com, zelin+watch-we...@chromium.org
          Attention needed from Alexei Svitkine, Andrew Rayskiy and Vlad Krot

          Dibyajyoti Pal voted and added 3 comments

          Votes added by Dibyajyoti Pal

          Code-Review+1

          3 comments

          Patchset-level comments
          File-level comment, Patchset 10 (Latest):
          Dibyajyoti Pal . resolved

          LGTM, thanks for the tests and making the sub apps enums so simple! 😄

          File chrome/browser/web_applications/isolated_web_apps/isolated_web_app_metrics_helper_unittest.cc
          Line 26, Patchset 5:TEST_F(IsolatedWebAppMetricsHelperTest, ReportNumInstalledSubApps) {
          Dibyajyoti Pal . unresolved

          This test is pretty good, but it only tests the metrics helper behavior (which forwards data to the UKM system). Instead, can we add the individual tests for these use-cases at the callsites, like we do for `chrome/browser/web_applications/commands/apply_pending_manifest_update_command_unittest.cc`? That allows us to test the whole behavior of the sub app system, instead of just verifying the UKM part of things.

          If you want to keep this test around and add those E2E tests later on, that's fine too!

          Vlad Krot

          I propose a bit simpler solution. Move most of the logic except feature flag checking into `chrome/browser/web_applications/isolated_web_apps/isolated_web_app_metrics_helper.cc`, so that it can all be unit tested.

          Dibyajyoti Pal

          This works for the use-case where we're measuring the sub apps and the count of the children (which kinda makes sense). How are you planning on moving the update specific use-cases to the IWA metrics helper?

          Vlad Krot

          For `chrome/browser/web_applications/manifest_update_manager.cc` metrics I have added assertions of them being send to `chrome/browser/web_applications/sub_apps/sub_app_update_browsertest.cc`
          Or do you prefer them being rather added to `ManifestSilentUpdateCommand`?

          Dibyajyoti Pal

          Either of them is fine, I'll leave it to your discretion based on whichever is simpler :shrug:

          The current tests added to `SubAppUpdateBrowserTest` LGTM!

          File chrome/browser/web_applications/sub_apps/sub_apps_service_impl.h
          Line 58, Patchset 10 (Latest):// Internal enum to represent error codes of add function.
          // It is remapped to ukm and mojo corresponding enums.
          enum class AddCallErrorCode {
          kUserDeclined,
          kUserDeclinedEmbargo,
          kLimitExceeded,
          kWebAppsNotUserInstallable,
          };
          Dibyajyoti Pal . resolved

          Thanks for this, it's so much better and readable!

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Alexei Svitkine
          • Andrew Rayskiy
          • Vlad Krot
          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: I536c6bf61e94b12278fb67a5072ba9d73654255d
            Gerrit-Change-Number: 8019651
            Gerrit-PatchSet: 10
            Gerrit-Owner: Vlad Krot <vk...@google.com>
            Gerrit-Reviewer: Alexei Svitkine <asvi...@chromium.org>
            Gerrit-Reviewer: Andrew Rayskiy <green...@google.com>
            Gerrit-Reviewer: Dibyajyoti Pal <diby...@chromium.org>
            Gerrit-Reviewer: Luc Nguyen <lucn...@google.com>
            Gerrit-Reviewer: Vlad Krot <vk...@google.com>
            Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
            Gerrit-CC: Chromium Web Applications Reviews <chromium-web...@google.com>
            Gerrit-CC: Simon Hangl <sim...@google.com>
            Gerrit-CC: gwsq
            Gerrit-Attention: Alexei Svitkine <asvi...@chromium.org>
            Gerrit-Attention: Andrew Rayskiy <green...@google.com>
            Gerrit-Attention: Vlad Krot <vk...@google.com>
            Gerrit-Comment-Date: Wed, 08 Jul 2026 20:08:20 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: Yes
            Comment-In-Reply-To: Dibyajyoti Pal <diby...@chromium.org>
            Comment-In-Reply-To: Vlad Krot <vk...@google.com>
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy
            Reply all
            Reply to author
            Forward
            0 new messages