Skip to content

Review followup: PR #871 — fix: move network-activate handler to external JS file #882

@superdav42

Description

@superdav42

Unaddressed review bot suggestions

PR #871 was merged with unaddressed review bot feedback. Each comment
below includes its file path, line number, a direct link to the inline
review comment, and a diff fence with the code context the bot was
flagging. Resolved and outdated threads are filtered out via GitHub's
GraphQL review-thread state. Read the relevant lines, decide whether
the suggestion is correct, and either apply the fix or close this issue
with a wontfix rationale.

Source PR: #871


You are the triager (worker-is-triager rule)

This issue is auto-created from review bot output and dispatched
directly to you. Review bots can be wrong: hallucinated line refs, false
premises about codebase structure, template-driven sweeps without
measurements (see GH#17832-17835 for prior art and prompts/build.txt
section 6a). Do not assume the bot is correct. Verify before acting.

You must end in exactly one of three outcomes — no fourth "hand it back
to the human" path exists. Humans approve decisions; they do not re-do
analysis.

Outcome A — Premise falsified → close the issue

  1. Read the cited file:line (listed under Files to modify below).

  2. If the bot's claim is factually wrong (file doesn't exist at that
    line, function doesn't behave as described, "auto-generated" section
    isn't actually auto-generated, etc.), close the issue with a
    comment in this shape:

    Premise falsified. <what the bot claimed>. <what the code
    actually shows, with a file:line citation or one-line quote>.
    Not acting.

    No PR. No further dispatch. The closing comment trains the next
    session reading this thread and the noise filter.

Outcome B — Premise correct + fix is obvious → implement and PR

  1. Verify the bot's premise as above.
  2. Read the Worker Guidance section below, open a worktree, implement.
  3. Open a PR with Resolves #<this-issue-number> in the body
    (use THIS issue's number, not the source PR's) so merge auto-closes it.
  4. Follow the normal Lifecycle Gate (brief, tests, review-bot-gate,
    merge, postflight).

Outcome C — Premise correct but approach is a genuine judgment call

Only use this path if you reach it after Outcomes A and B don't apply:
the bot's finding is real, but the fix requires a decision that is
architectural, policy, breaking-change, or otherwise genuinely outside
what you can resolve autonomously. In that case, post a decision
comment
with exactly these fields:

  • Premise check: one line, confirming the finding is real.
  • Analysis: 2-4 bullets on the trade-offs.
  • Recommended path: the option you would take if the decision were
    yours, with rationale.
  • Specific question: the single decision the human needs to make
    (yes/no or pick-one, not open-ended).

Then apply needs-maintainer-review and stop. The human wakes up to a
ready-to-approve recommendation, not a blank task.

Ambiguity about scope or style is not Outcome C. Per
prompts/build.txt "Reasoning responsibility", the model does the
thinking and delivers a recommendation. Only escalate what is genuinely
a maintainer-only decision.

Worker Guidance

Files to modify:

  • assets/js/network-activate.js:50

Implementation steps (Outcome B path):

  1. Read the diff block under each inline comment below — it shows the
    exact code the bot was flagging. Open the file only if you need
    surrounding context beyond what the diff tail shows.
  2. Read the bot's full comment below the diff — it contains the rationale
    and any suggested change.
  3. Verify the premise before implementing (see Outcome A). If the premise
    is wrong, switch to Outcome A instead of burning iterations trying to
    satisfy a wrong suggestion.
  4. If multiple comments target the same file, group your edits into one
    logical commit.
  5. Run shellcheck / markdownlint-cli2 / project tests as appropriate.

Verification:

  • Open the new PR with Resolves #<this-issue> so this followup is auto-closed on merge.
  • If the bot's suggestion was incorrect, close this issue with a Outcome A comment — do not open a no-op PR.

Inline comments

coderabbitai on assets/js/network-activate.js:50

View inline comment

+					return;
+				}
+
+				$spinner.removeClass('is-active');
+				$btn.hide();
+				$fallback.show();
+
+				var errorMsg = wu_network_activate.error_message;
+
+				if (response.data && response.data.message) {
+					errorMsg = response.data.message;
+				}

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

In WordPress core, what JSON structure is returned by wp_send_json_error( new WP_Error('code', 'message') )?

💡 Result:

The JSON structure returned by wp_send_json_error( new WP_Error('code', 'message') ) in WordPress core is: json { "success": false, "data": [ { "code": "code", "message": "message" } ] } This is generated by processing the WP_Error object's errors property, which for a single error is an associative array with the code as key and array of messages as value. The function iterates over each code and message, creating an array of objects under data, with success always set to false. The response is then passed to wp_send_json for output and termination.

Citations:


🏁 Script executed:

# Find and read the network-activate.js file
fd -t f network-activate.js

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 110


🏁 Script executed:

# Read the relevant section of the file to confirm the code snippet
if [ -f "assets/js/network-activate.js" ]; then
  wc -l assets/js/network-activate.js
  sed -n '40,60p' assets/js/network-activate.js
fi

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 536


🏁 Script executed:

# Check the AJAX handler file mentioned in the review
fd -t f class-setup-wizard-admin-page.php

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 130


🏁 Script executed:

# If found, check lines 160-185 for WP_Error usage
if [ -f "inc/admin-pages/class-setup-wizard-admin-page.php" ]; then
  sed -n '160,185p' inc/admin-pages/class-setup-wiz

PR review summaries

(none)


aidevops.sh v3.8.56 automated scan.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions