[blinkpy] Support non-Git checkouts like cogfs [chromium/src : main]

0 views
Skip to first unread message

Jonathan Lee (Gerrit)

unread,
Aug 20, 2025, 8:36:40 PMAug 20
to Brian Sheedy, chromium...@chromium.org, AyeAye, Chromium LUCI CQ, blink-revie...@chromium.org, blink-...@chromium.org, blink-rev...@chromium.org
Attention needed from Brian Sheedy

Jonathan Lee added 1 comment

File third_party/blink/tools/blinkpy/web_tests/models/test_run_results.py
Line 399, Patchset 4 (Latest): git = port_obj.host.git(path)
Jonathan Lee . resolved

`@memoized` still doesn't support keyword args yet unfortunately. `@functools.*cache` won't work either because it holds onto `self`, preventing GC.

Open in Gerrit

Related details

Attention is currently required from:
  • Brian Sheedy
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
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: I8c53751887f3b169bd3f9e918bb1f6e7c6007165
Gerrit-Change-Number: 6866593
Gerrit-PatchSet: 4
Gerrit-Owner: Jonathan Lee <jonath...@google.com>
Gerrit-Reviewer: Brian Sheedy <bsh...@chromium.org>
Gerrit-Reviewer: Jonathan Lee <jonath...@google.com>
Gerrit-Attention: Brian Sheedy <bsh...@chromium.org>
Gerrit-Comment-Date: Thu, 21 Aug 2025 00:36:33 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Brian Sheedy (Gerrit)

unread,
Aug 20, 2025, 8:49:26 PMAug 20
to Jonathan Lee, chromium...@chromium.org, AyeAye, Chromium LUCI CQ, blink-revie...@chromium.org, blink-...@chromium.org, blink-rev...@chromium.org
Attention needed from Jonathan Lee

Brian Sheedy added 1 comment

File third_party/blink/tools/blinkpy/web_tests/models/test_run_results.py
Line 399, Patchset 4 (Latest): git = port_obj.host.git(path)
Jonathan Lee . unresolved

`@memoized` still doesn't support keyword args yet unfortunately. `@functools.*cache` won't work either because it holds onto `self`, preventing GC.

Brian Sheedy

Perhaps a workaround could be to memoize a helper instead of the method in Host?

E.g. instead of:

```
@memoized
def git(self, path: os.PathLike | None = None) -> Git | None:
git = Git(cwd=path,
executive=self.executive,
filesystem=self.filesystem,
platform=self.platform)
return git if git.checkout_root else None
```

Do:

```
def git(self, path: os.PathLike | None = None) -> Git | None:
return _create_git(cwd=path, executive=self.executive, ...)

...

@functools.cache
def _create_git(*, **kwargs) -> Git | None:
git = Git(**kwargs)
return git if git.checkout_root else None
```

It would be nice to remove the Blink-specific version in favor of `functools.cache` if possible.

Open in Gerrit

Related details

Attention is currently required from:
  • Jonathan Lee
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I8c53751887f3b169bd3f9e918bb1f6e7c6007165
    Gerrit-Change-Number: 6866593
    Gerrit-PatchSet: 4
    Gerrit-Owner: Jonathan Lee <jonath...@google.com>
    Gerrit-Reviewer: Brian Sheedy <bsh...@chromium.org>
    Gerrit-Reviewer: Jonathan Lee <jonath...@google.com>
    Gerrit-Attention: Jonathan Lee <jonath...@google.com>
    Gerrit-Comment-Date: Thu, 21 Aug 2025 00:49:17 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Jonathan Lee <jonath...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Jonathan Lee (Gerrit)

    unread,
    Aug 21, 2025, 4:36:09 PMAug 21
    to Brian Sheedy, chromium...@chromium.org, AyeAye, Chromium LUCI CQ, blink-revie...@chromium.org, blink-...@chromium.org, blink-rev...@chromium.org
    Attention needed from Brian Sheedy

    Jonathan Lee voted and added 1 comment

    Votes added by Jonathan Lee

    Commit-Queue+1

    1 comment

    File third_party/blink/tools/blinkpy/web_tests/models/test_run_results.py
    Line 399, Patchset 4: git = port_obj.host.git(path)
    Jonathan Lee . resolved

    `@memoized` still doesn't support keyword args yet unfortunately. `@functools.*cache` won't work either because it holds onto `self`, preventing GC.

    Brian Sheedy

    Perhaps a workaround could be to memoize a helper instead of the method in Host?

    E.g. instead of:

    ```
    @memoized
    def git(self, path: os.PathLike | None = None) -> Git | None:
    git = Git(cwd=path,
    executive=self.executive,
    filesystem=self.filesystem,
    platform=self.platform)
    return git if git.checkout_root else None
    ```

    Do:

    ```
    def git(self, path: os.PathLike | None = None) -> Git | None:
    return _create_git(cwd=path, executive=self.executive, ...)

    ...

    @functools.cache
    def _create_git(*, **kwargs) -> Git | None:
    git = Git(**kwargs)
    return git if git.checkout_root else None
    ```

    It would be nice to remove the Blink-specific version in favor of `functools.cache` if possible.

    Jonathan Lee

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Brian Sheedy
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    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: I8c53751887f3b169bd3f9e918bb1f6e7c6007165
    Gerrit-Change-Number: 6866593
    Gerrit-PatchSet: 5
    Gerrit-Owner: Jonathan Lee <jonath...@google.com>
    Gerrit-Reviewer: Brian Sheedy <bsh...@chromium.org>
    Gerrit-Reviewer: Jonathan Lee <jonath...@google.com>
    Gerrit-Attention: Brian Sheedy <bsh...@chromium.org>
    Gerrit-Comment-Date: Thu, 21 Aug 2025 20:35:57 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Brian Sheedy <bsh...@chromium.org>
    Comment-In-Reply-To: Jonathan Lee <jonath...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Brian Sheedy (Gerrit)

    unread,
    Aug 21, 2025, 4:39:17 PMAug 21
    to Jonathan Lee, chromium...@chromium.org, AyeAye, Chromium LUCI CQ, blink-revie...@chromium.org, blink-...@chromium.org, blink-rev...@chromium.org
    Attention needed from Jonathan Lee

    Brian Sheedy voted and added 2 comments

    Votes added by Brian Sheedy

    Code-Review+1

    2 comments

    Patchset-level comments
    File-level comment, Patchset 5 (Latest):
    Brian Sheedy . resolved

    LGTM % nit

    File third_party/blink/tools/blinkpy/common/host.py
    Line 70, Patchset 5 (Latest):def _cached_git(**kwargs) -> Git:
    Brian Sheedy . unresolved

    Nit: Can also return None.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Jonathan Lee
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      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: I8c53751887f3b169bd3f9e918bb1f6e7c6007165
      Gerrit-Change-Number: 6866593
      Gerrit-PatchSet: 5
      Gerrit-Owner: Jonathan Lee <jonath...@google.com>
      Gerrit-Reviewer: Brian Sheedy <bsh...@chromium.org>
      Gerrit-Reviewer: Jonathan Lee <jonath...@google.com>
      Gerrit-Attention: Jonathan Lee <jonath...@google.com>
      Gerrit-Comment-Date: Thu, 21 Aug 2025 20:39:06 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Jonathan Lee (Gerrit)

      unread,
      Aug 21, 2025, 4:44:14 PMAug 21
      to Brian Sheedy, chromium...@chromium.org, AyeAye, Chromium LUCI CQ, blink-revie...@chromium.org, blink-...@chromium.org, blink-rev...@chromium.org

      Jonathan Lee voted and added 1 comment

      Votes added by Jonathan Lee

      Auto-Submit+0
      Commit-Queue+2

      1 comment

      File third_party/blink/tools/blinkpy/common/host.py
      Line 70, Patchset 5:def _cached_git(**kwargs) -> Git:
      Brian Sheedy . resolved

      Nit: Can also return None.

      Jonathan Lee

      Oops, done. One day, I hope to get enough of `blinkpy/` hinted to actually check these and function as more than documentation.

      Open in Gerrit

      Related details

      Attention set is empty
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      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: I8c53751887f3b169bd3f9e918bb1f6e7c6007165
      Gerrit-Change-Number: 6866593
      Gerrit-PatchSet: 6
      Gerrit-Owner: Jonathan Lee <jonath...@google.com>
      Gerrit-Reviewer: Brian Sheedy <bsh...@chromium.org>
      Gerrit-Reviewer: Jonathan Lee <jonath...@google.com>
      Gerrit-Comment-Date: Thu, 21 Aug 2025 20:44:01 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Brian Sheedy <bsh...@chromium.org>
      satisfied_requirement
      open
      diffy

      Brian Sheedy (Gerrit)

      unread,
      Aug 21, 2025, 4:53:24 PMAug 21
      to Jonathan Lee, chromium...@chromium.org, AyeAye, Chromium LUCI CQ, blink-revie...@chromium.org, blink-...@chromium.org, blink-rev...@chromium.org
      Attention needed from Jonathan Lee

      Brian Sheedy voted and added 1 comment

      Votes added by Brian Sheedy

      Code-Review+1

      1 comment

      File third_party/blink/tools/blinkpy/common/host.py
      Line 70, Patchset 5:def _cached_git(**kwargs) -> Git:
      Brian Sheedy . resolved

      Nit: Can also return None.

      Jonathan Lee

      Oops, done. One day, I hope to get enough of `blinkpy/` hinted to actually check these and function as more than documentation.

      Brian Sheedy

      I'm pretty sure the type hinting helpers I set up should allow for skipping certain files, so you could add basically every file under `blinkpy/` to that list and use it as a burndown list for what needs to have type hinting applied.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Jonathan Lee
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      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: I8c53751887f3b169bd3f9e918bb1f6e7c6007165
      Gerrit-Change-Number: 6866593
      Gerrit-PatchSet: 6
      Gerrit-Owner: Jonathan Lee <jonath...@google.com>
      Gerrit-Reviewer: Brian Sheedy <bsh...@chromium.org>
      Gerrit-Reviewer: Jonathan Lee <jonath...@google.com>
      Gerrit-Attention: Jonathan Lee <jonath...@google.com>
      Gerrit-Comment-Date: Thu, 21 Aug 2025 20:53:13 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Brian Sheedy <bsh...@chromium.org>
      Comment-In-Reply-To: Jonathan Lee <jonath...@google.com>
      satisfied_requirement
      open
      diffy

      Chromium LUCI CQ (Gerrit)

      unread,
      Aug 21, 2025, 5:28:12 PMAug 21
      to Jonathan Lee, Brian Sheedy, chromium...@chromium.org, AyeAye, blink-revie...@chromium.org, blink-...@chromium.org, blink-rev...@chromium.org

      Chromium LUCI CQ submitted the change

      Change information

      Commit message:
      [blinkpy] Support non-Git checkouts like cogfs

      Most callsites can gracefully function without a `git` checkout (e.g.,
      `rebaseline-cl` skips staging `*-expected.*`).

      Make sure to memoize `Host.git()` so that warnings about an invalid
      checkout are only logged once per `path`.
      Bug: 427299613
      Change-Id: I8c53751887f3b169bd3f9e918bb1f6e7c6007165
      Commit-Queue: Jonathan Lee <jonath...@google.com>
      Reviewed-by: Brian Sheedy <bsh...@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#1504716}
      Files:
      • M third_party/blink/tools/blinkpy/common/checkout/git.py
      • M third_party/blink/tools/blinkpy/common/host.py
      • M third_party/blink/tools/blinkpy/style/main.py
      • M third_party/blink/tools/blinkpy/tool/commands/pretty_diff.py
      • M third_party/blink/tools/blinkpy/tool/commands/rebaseline.py
      • M third_party/blink/tools/blinkpy/tool/commands/rebaseline_cl.py
      • M third_party/blink/tools/blinkpy/tool/commands/rebaseline_cl_unittest.py
      • M third_party/blink/tools/blinkpy/wpt_tests/wpt_adapter.py
      Change size: M
      Delta: 8 files changed, 81 insertions(+), 49 deletions(-)
      Branch: refs/heads/main
      Submit Requirements:
      • requirement satisfiedCode-Review: +1 by Brian Sheedy
      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: I8c53751887f3b169bd3f9e918bb1f6e7c6007165
      Gerrit-Change-Number: 6866593
      Gerrit-PatchSet: 7
      Gerrit-Owner: Jonathan Lee <jonath...@google.com>
      Gerrit-Reviewer: Brian Sheedy <bsh...@chromium.org>
      Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
      Gerrit-Reviewer: Jonathan Lee <jonath...@google.com>
      open
      diffy
      satisfied_requirement
      Reply all
      Reply to author
      Forward
      0 new messages