Add a JSON checker and formatter for MAGI [chromium/src : main]

0 views
Skip to first unread message

Joe Downing (Gerrit)

unread,
May 20, 2026, 7:52:38 PM (22 hours ago) May 20
to Chromium LUCI CQ, chromium...@chromium.org, chromotin...@chromium.org

Joe Downing added 2 comments

File remoting/tools/magi-mode/PRESUBMIT.py
Line 379, Patchset 5 (Latest): import importlib.util
Joe Downing . unresolved

Can you move this import to the top of the file?

Line 387, Patchset 5 (Latest): check_json_format = importlib.util.module_from_spec(spec)
Joe Downing . unresolved

If `exec_module` raises a `FileNotFoundError` (or any other exception), `check_json_format` will still refer to the unexecuted module object. Because it is not `None`, the script will later attempt to call `check_json_format.CheckFormatting(...)` which will crash with an `AttributeError`.\n\nConsider using a temporary variable and only assigning `check_json_format` upon success:\n```python\n if spec:\n mod = importlib.util.module_from_spec(spec)\n spec.loader.exec_module(mod)\n check_json_format = mod\n```

Open in Gerrit

Related details

Attention set is empty
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: I7ec5122cb67877f2536d8db02a1cdd917970c698
Gerrit-Change-Number: 7865113
Gerrit-PatchSet: 5
Gerrit-Owner: Joe Downing <joe...@chromium.org>
Gerrit-Reviewer: Joe Downing <joe...@chromium.org>
Gerrit-Comment-Date: Wed, 20 May 2026 23:52:29 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Joe Downing (Gerrit)

unread,
May 20, 2026, 8:18:32 PM (22 hours ago) May 20
to Chromium LUCI CQ, chromium...@chromium.org, chromotin...@chromium.org

Joe Downing added 2 comments

File remoting/tools/magi-mode/PRESUBMIT.py
Line 379, Patchset 5: import importlib.util
Joe Downing . resolved

Can you move this import to the top of the file?

Joe Downing

Done

Line 387, Patchset 5: check_json_format = importlib.util.module_from_spec(spec)
Joe Downing . resolved

If `exec_module` raises a `FileNotFoundError` (or any other exception), `check_json_format` will still refer to the unexecuted module object. Because it is not `None`, the script will later attempt to call `check_json_format.CheckFormatting(...)` which will crash with an `AttributeError`.\n\nConsider using a temporary variable and only assigning `check_json_format` upon success:\n```python\n if spec:\n mod = importlib.util.module_from_spec(spec)\n spec.loader.exec_module(mod)\n check_json_format = mod\n```

Joe Downing

Done

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: I7ec5122cb67877f2536d8db02a1cdd917970c698
    Gerrit-Change-Number: 7865113
    Gerrit-PatchSet: 6
    Gerrit-Owner: Joe Downing <joe...@chromium.org>
    Gerrit-Reviewer: Joe Downing <joe...@chromium.org>
    Gerrit-Comment-Date: Thu, 21 May 2026 00:18:23 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Joe Downing <joe...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Joe Downing (Gerrit)

    unread,
    May 20, 2026, 8:41:53 PM (22 hours ago) May 20
    to Yuwei Huang, Chromium LUCI CQ, chromium...@chromium.org, chromotin...@chromium.org
    Attention needed from Yuwei Huang

    Joe Downing voted and added 1 comment

    Votes added by Joe Downing

    Commit-Queue+1

    1 comment

    Patchset-level comments
    File-level comment, Patchset 7 (Latest):
    Joe Downing . resolved

    PTAL!

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Yuwei Huang
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: I7ec5122cb67877f2536d8db02a1cdd917970c698
    Gerrit-Change-Number: 7865113
    Gerrit-PatchSet: 7
    Gerrit-Owner: Joe Downing <joe...@chromium.org>
    Gerrit-Reviewer: Joe Downing <joe...@chromium.org>
    Gerrit-Reviewer: Yuwei Huang <yuw...@chromium.org>
    Gerrit-Attention: Yuwei Huang <yuw...@chromium.org>
    Gerrit-Comment-Date: Thu, 21 May 2026 00:41:44 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Yuwei Huang (Gerrit)

    unread,
    May 20, 2026, 8:51:14 PM (22 hours ago) May 20
    to Joe Downing, Chromium LUCI CQ, chromium...@chromium.org, chromotin...@chromium.org
    Attention needed from Joe Downing

    Yuwei Huang voted Code-Review+1

    Code-Review+1
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Joe Downing
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I7ec5122cb67877f2536d8db02a1cdd917970c698
      Gerrit-Change-Number: 7865113
      Gerrit-PatchSet: 7
      Gerrit-Owner: Joe Downing <joe...@chromium.org>
      Gerrit-Reviewer: Joe Downing <joe...@chromium.org>
      Gerrit-Reviewer: Yuwei Huang <yuw...@chromium.org>
      Gerrit-Attention: Joe Downing <joe...@chromium.org>
      Gerrit-Comment-Date: Thu, 21 May 2026 00:51:02 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      Joe Downing (Gerrit)

      unread,
      May 20, 2026, 8:52:17 PM (21 hours ago) May 20
      to Yuwei Huang, Chromium LUCI CQ, chromium...@chromium.org, chromotin...@chromium.org
      Attention needed from Joe Downing

      Joe Downing voted and added 1 comment

      Votes added by Joe Downing

      Commit-Queue+2

      1 comment

      Patchset-level comments
      Joe Downing . resolved

      Thanks!

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Joe Downing
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I7ec5122cb67877f2536d8db02a1cdd917970c698
      Gerrit-Change-Number: 7865113
      Gerrit-PatchSet: 7
      Gerrit-Owner: Joe Downing <joe...@chromium.org>
      Gerrit-Reviewer: Joe Downing <joe...@chromium.org>
      Gerrit-Reviewer: Yuwei Huang <yuw...@chromium.org>
      Gerrit-Attention: Joe Downing <joe...@chromium.org>
      Gerrit-Comment-Date: Thu, 21 May 2026 00:52:08 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      Chromium LUCI CQ (Gerrit)

      unread,
      May 20, 2026, 9:36:06 PM (21 hours ago) May 20
      to Joe Downing, Yuwei Huang, chromium...@chromium.org, chromotin...@chromium.org

      Chromium LUCI CQ submitted the change

      Change information

      Commit message:
      Add a JSON checker and formatter for MAGI

      AFAICT the normal Chromium linter and formatters do not handle
      JSON so I added a script to handle this and ensure all of the
      MAGI JSON files are formatted consistently.
      Change-Id: I7ec5122cb67877f2536d8db02a1cdd917970c698
      Reviewed-by: Yuwei Huang <yuw...@chromium.org>
      Commit-Queue: Joe Downing <joe...@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#1633989}
      Files:
      • M remoting/tools/magi-mode/PRESUBMIT.py
      • M remoting/tools/magi-mode/PRESUBMIT_test.py
      • A remoting/tools/magi-mode/check_json_format.py
      • M remoting/tools/magi-mode/magi_schema.json
      • M remoting/tools/magi-mode/personas/ai/mas.json
      • M remoting/tools/magi-mode/personas/core/scoping.json
      • M remoting/tools/magi-mode/personas/infra/chromium_build.json
      • M remoting/tools/magi-mode/tests/magi_stage_specify_tests.json
      • M remoting/tools/magi-mode/tests/magi_test_schemas.json
      • M remoting/tools/magi-mode/tests/testdata/project.magi.json
      • M remoting/tools/magi-mode/tests/testdata/state_block.magi.json
      Change size: L
      Delta: 11 files changed, 374 insertions(+), 190 deletions(-)
      Branch: refs/heads/main
      Submit Requirements:
      • requirement satisfiedCode-Review: +1 by Yuwei Huang
      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: I7ec5122cb67877f2536d8db02a1cdd917970c698
      Gerrit-Change-Number: 7865113
      Gerrit-PatchSet: 8
      Gerrit-Owner: Joe Downing <joe...@chromium.org>
      Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
      Gerrit-Reviewer: Joe Downing <joe...@chromium.org>
      Gerrit-Reviewer: Yuwei Huang <yuw...@chromium.org>
      open
      diffy
      satisfied_requirement
      Reply all
      Reply to author
      Forward
      0 new messages