Skip to content

Update to release 3.2.2#921

Merged
boomzero merged 19 commits intomasterfrom
dev
Feb 27, 2026
Merged

Update to release 3.2.2#921
boomzero merged 19 commits intomasterfrom
dev

Conversation

@boomzero
Copy link
Member

@boomzero boomzero commented Feb 27, 2026

What does this PR aim to accomplish?:

Release version 3.2.2 to production. This release includes two bug fixes:

  1. Fix contest ranking table styling for dark mode (Fix contest ranking table styling for dark mode #916) — Contest ranking tables on contestrank-oi.php and contestrank-correct.php now display with proper colors in dark mode.
  2. Gate WebSocket toast notifications by per-feature popup settings (Gate WebSocket toast notifications by per-feature popup settings #919) — WebSocket-based toast notifications now correctly respect the per-feature popup toggle settings (BBSPopup and MessagePopup), instead of always showing.

How does this PR accomplish the above?:

Merges the dev branch (containing PRs #916 and #919) into master to trigger a production release.


By submitting this pull request, I confirm the following:

  1. I have read and understood the contributor's guide, as well as this entire template. I understand which branch to base my commits and Pull Requests against.
  2. I have commented on my proposed changes within the code and I have tested my changes.
  3. I am willing to help maintain this change if there are issues with it later.
  4. It is compatible with the GNU General Public License v3.0
  5. I have squashed any insignificant commits. (git rebase)
  6. I have checked that another pull request for this purpose does not exist.
  7. I have considered and confirmed that this submission will be valuable to others.
  8. I accept that this submission may not be used, and the pull request can be closed at the will of the maintainer.
  9. I give this submission freely and claim no ownership to its content.

  • I have read the above and my PR is ready for review. Check this box to confirm

boomzero and others added 16 commits February 22, 2026 14:07
Clear inline background/color styles from XMOJ server on header and
data rows so Bootstrap dark theme applies correctly. Force black
background with white text on all header cells including problem letter
links. Also fix rgb -> rgba for solved cell background alpha channel,
and add missing text color styling for contestrank-correct.php cells.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix contest ranking table styling for dark mode
The last-commit-author guard now only exits for non-edited events,
so PR title/body changes still update Update.json metadata even
when the branch tip is a github-actions[bot] commit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The WebSocket handler called CreateAndShowBBSMentionToast and
CreateAndShowMailMentionToast unconditionally, ignoring the user's
BBSPopup/MessagePopup toggle. This made behavior differ from the
polling fallback, which already checks UtilityEnabled() per type.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Gate WebSocket toast notifications by per-feature popup settings
Exclude all bot actors (not just github-actions[bot]) from triggering
the UpdateVersion workflow, preventing loops from AI code review bots.
Allow edited events through the script-level guard so PR title/body
changes still update Update.json metadata.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sourcery-ai
Copy link

sourcery-ai bot commented Feb 27, 2026

Reviewer's Guide

Release 3.2.2 bumps the script/package versions and applies two behavior changes: dark-mode-safe contest ranking table styling on OI/correct ranking pages, and WebSocket notification handling that respects per-feature popup toggles, plus a safer auto-version-bump workflow that avoids infinite loops and supports edited PR events.

Sequence diagram for WebSocket notification handling with popup gating

sequenceDiagram
    participant WSClient as WebSocketClient
    participant Server as WebSocketServer
    participant Handler as NotificationHandler
    participant Settings as SettingsStore
    participant UI as ToastUI

    Server->>WSClient: bbs_mention message (data)
    WSClient->>Handler: HandleNotificationMessage(event)
    Handler->>Settings: UtilityEnabled(BBSPopup)
    Settings-->>Handler: true_or_false
    alt BBSPopup_enabled
        Handler->>UI: CreateAndShowBBSMentionToast(data)
    else BBSPopup_disabled
        Handler-->>UI: No_call_suppress_BBS_toast
    end

    Server->>WSClient: mail_mention message (data)
    WSClient->>Handler: HandleNotificationMessage(event)
    Handler->>Settings: UtilityEnabled(MessagePopup)
    Settings-->>Handler: true_or_false
    alt MessagePopup_enabled
        Handler->>UI: CreateAndShowMailMentionToast(data)
    else MessagePopup_disabled
        Handler-->>UI: No_call_suppress_mail_toast
    end
Loading

Flow diagram for contest ranking table dark mode styling logic

flowchart TD
    A[Detect_ranking_page_and_load_rank_table] --> B[Select_header_cells_querySelectorAll_rank_thead_tr_star]
    B --> C[Set_header_texts_to_rank_user_nickname_ac_score]
    C --> D[For_each_header_cell_remove_bgcolor_and_force_black_background_and_white_text]
    D --> E[For_each_header_cell_force_link_color_white]
    E --> F[Fetch_current_page_HTML_for_refresh]
    F --> G[Parse_document_and_select_rank_table_rows]
    G --> H[For_each_data_row_clear_row_background_color]
    H --> I[Set_first_cell_medal_span_and_adjust_medal_color]
    I --> J[Normalize_username_and_nickname_cells]
    J --> K[For_each_of_first_five_cells_clear_background_and_text_color]
    K --> L[For_each_problem_cell_from_index_5_compute_status_and_error_count]
    L --> M[Set_problem_cell_background_color_with_rgba_green_for_solved_and_other_colors_for_status]
    M --> N[Set_problem_cell_text_color_white_if_DarkMode_else_black]
    N --> O[Replace_rank_table_body_with_processed_rows]
Loading

File-Level Changes

Change Details Files
Gate WebSocket toast notifications on per-feature popup settings so BBS/mail mentions only appear when the corresponding utility is enabled.
  • Wrap BBS mention toast creation in a UtilityEnabled("BBSPopup") guard.
  • Wrap mail mention toast creation in a UtilityEnabled("MessagePopup") guard.
XMOJ.user.js
Fix contest ranking tables for dark mode on OI and correction ranking pages while preserving status coloring.
  • Refactor rank table header cell selection to use a NodeList of all header cells and set the first five labels programmatically.
  • Normalize header styles by removing legacy bgcolor attributes, forcing black backgrounds and white text/links for headers, and clearing row-level background color on refresh.
  • Clear background and text colors for the first five data cells in each row before re-applying status styles to problem cells.
  • Change solved-cell background color from rgb() to rgba() to support variable opacity and ensure text color follows dark-mode (white) vs light-mode (black).
XMOJ.user.js
Make the UpdateVersion automation workflow more robust by avoiding bot-only restrictions and handling edited PR events without infinite loops.
  • Extend UpdateVersion.js to accept the GitHub event action as a CLI argument, log it, and only skip when the last commit is from github-actions[bot] and the event action is not "edited".
  • Relax the workflow job condition to allow any non-bot GitHub actor by checking that the actor name does not end with "[bot]" instead of comparing to a single bot account.
  • Pass github.event.action from the workflow into the UpdateVersion.js script.
Update/UpdateVersion.js
.github/workflows/UpdateVersion.yml
Bump project version metadata to 3.2.2 for the userscript and NPM package, including update metadata.
  • Update the @Version header in XMOJ.user.js from 3.2.0 to 3.2.2.
  • Update the package.json version from 3.2.0 to 3.2.2.
  • Update Update.json metadata to reference release 3.2.2.
XMOJ.user.js
package.json
Update.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@hendragon-bot hendragon-bot bot added GitHub-related user-script This issue or pull request is related to the main user script update-script Related to our update infrastructure! labels Feb 27, 2026
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The contest rank header styling logic is duplicated for both OI and correction views; consider extracting the common header update/styling into a shared helper to reduce repetition and keep future changes in one place.
  • In the rank table loops you frequently hard-code indices like HeaderCells[0..4] and for (let j = 0; j < 5 && j < Temp[i].cells.length; j++); using the actual length of the header/cells (or a derived constant) would make this code more resilient to future column layout changes.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The contest rank header styling logic is duplicated for both OI and correction views; consider extracting the common header update/styling into a shared helper to reduce repetition and keep future changes in one place.
- In the rank table loops you frequently hard-code indices like `HeaderCells[0..4]` and `for (let j = 0; j < 5 && j < Temp[i].cells.length; j++)`; using the actual `length` of the header/cells (or a derived constant) would make this code more resilient to future column layout changes.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@boomzero
Copy link
Member Author

Reviewer's Guide

Release 3.2.2 bumps the script/package versions and applies two behavior changes: dark-mode-safe contest ranking table styling on OI/correct ranking pages, and WebSocket notification handling that respects per-feature popup toggles, plus a safer auto-version-bump workflow that avoids infinite loops and supports edited PR events.

Sequence diagram for WebSocket notification handling with popup gating

sequenceDiagram
    participant WSClient as WebSocketClient
    participant Server as WebSocketServer
    participant Handler as NotificationHandler
    participant Settings as SettingsStore
    participant UI as ToastUI

    Server->>WSClient: bbs_mention message (data)
    WSClient->>Handler: HandleNotificationMessage(event)
    Handler->>Settings: UtilityEnabled(BBSPopup)
    Settings-->>Handler: true_or_false
    alt BBSPopup_enabled
        Handler->>UI: CreateAndShowBBSMentionToast(data)
    else BBSPopup_disabled
        Handler-->>UI: No_call_suppress_BBS_toast
    end

    Server->>WSClient: mail_mention message (data)
    WSClient->>Handler: HandleNotificationMessage(event)
    Handler->>Settings: UtilityEnabled(MessagePopup)
    Settings-->>Handler: true_or_false
    alt MessagePopup_enabled
        Handler->>UI: CreateAndShowMailMentionToast(data)
    else MessagePopup_disabled
        Handler-->>UI: No_call_suppress_mail_toast
    end
Loading

Flow diagram for contest ranking table dark mode styling logic

flowchart TD
    A[Detect_ranking_page_and_load_rank_table] --> B[Select_header_cells_querySelectorAll_rank_thead_tr_star]
    B --> C[Set_header_texts_to_rank_user_nickname_ac_score]
    C --> D[For_each_header_cell_remove_bgcolor_and_force_black_background_and_white_text]
    D --> E[For_each_header_cell_force_link_color_white]
    E --> F[Fetch_current_page_HTML_for_refresh]
    F --> G[Parse_document_and_select_rank_table_rows]
    G --> H[For_each_data_row_clear_row_background_color]
    H --> I[Set_first_cell_medal_span_and_adjust_medal_color]
    I --> J[Normalize_username_and_nickname_cells]
    J --> K[For_each_of_first_five_cells_clear_background_and_text_color]
    K --> L[For_each_problem_cell_from_index_5_compute_status_and_error_count]
    L --> M[Set_problem_cell_background_color_with_rgba_green_for_solved_and_other_colors_for_status]
    M --> N[Set_problem_cell_text_color_white_if_DarkMode_else_black]
    N --> O[Replace_rank_table_body_with_processed_rows]
Loading

File-Level Changes

Change Details Files
Gate WebSocket toast notifications on per-feature popup settings so BBS/mail mentions only appear when the corresponding utility is enabled.

  • Wrap BBS mention toast creation in a UtilityEnabled("BBSPopup") guard.
  • Wrap mail mention toast creation in a UtilityEnabled("MessagePopup") guard.

XMOJ.user.js
Fix contest ranking tables for dark mode on OI and correction ranking pages while preserving status coloring.

  • Refactor rank table header cell selection to use a NodeList of all header cells and set the first five labels programmatically.
  • Normalize header styles by removing legacy bgcolor attributes, forcing black backgrounds and white text/links for headers, and clearing row-level background color on refresh.
  • Clear background and text colors for the first five data cells in each row before re-applying status styles to problem cells.
  • Change solved-cell background color from rgb() to rgba() to support variable opacity and ensure text color follows dark-mode (white) vs light-mode (black).

XMOJ.user.js
Make the UpdateVersion automation workflow more robust by avoiding bot-only restrictions and handling edited PR events without infinite loops.

  • Extend UpdateVersion.js to accept the GitHub event action as a CLI argument, log it, and only skip when the last commit is from github-actions[bot] and the event action is not "edited".
  • Relax the workflow job condition to allow any non-bot GitHub actor by checking that the actor name does not end with "[bot]" instead of comparing to a single bot account.
  • Pass github.event.action from the workflow into the UpdateVersion.js script.

Update/UpdateVersion.js
.github/workflows/UpdateVersion.yml
Bump project version metadata to 3.2.2 for the userscript and NPM package, including update metadata.

  • Update the @Version header in XMOJ.user.js from 3.2.0 to 3.2.2.
  • Update the package.json version from 3.2.0 to 3.2.2.
  • Update Update.json metadata to reference release 3.2.2.

XMOJ.user.js
package.json
Update.json
Tips and commands

wtf

@cloudflare-workers-and-pages
Copy link

Deploying xmoj-script-dev-channel with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0ce06a7
Status:⚡️  Build in progress...

View logs

@boomzero boomzero merged commit e14e33c into master Feb 27, 2026
10 of 12 checks passed
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 5 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="Update/UpdateVersion.js">

<violation number="1" location="Update/UpdateVersion.js:18">
P2: The new skip condition contradicts the comment and still blocks non-"edited" actions like `opened`/`reopened`. If the intent is to skip only on push-triggered `synchronize` events, this should explicitly check for `synchronize` instead of `!== "edited"` so metadata updates aren’t skipped for other actions.</violation>
</file>

<file name="package.json">

<violation number="1" location="package.json:3">
P2: Manual version bump in package.json violates the automated versioning workflow and risks desynchronizing versions. Revert the manual change and let UpdateVersion.js handle version updates.</violation>
</file>

<file name="Update.json">

<violation number="1" location="Update.json:3391">
P2: Production releases should set "Prerelease" to false. This entry marks 3.2.2 as a prerelease, which will mislabel the production release.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

console.log("Last commit author: " + lastCommitAuthor);
if (lastCommitAuthor === "github-actions[bot]") {
console.log("Event action : " + eventAction);
if (lastCommitAuthor === "github-actions[bot]" && eventAction !== "edited") {
Copy link

@cubic-dev-ai cubic-dev-ai bot Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The new skip condition contradicts the comment and still blocks non-"edited" actions like opened/reopened. If the intent is to skip only on push-triggered synchronize events, this should explicitly check for synchronize instead of !== "edited" so metadata updates aren’t skipped for other actions.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At Update/UpdateVersion.js, line 18:

<comment>The new skip condition contradicts the comment and still blocks non-"edited" actions like `opened`/`reopened`. If the intent is to skip only on push-triggered `synchronize` events, this should explicitly check for `synchronize` instead of `!== "edited"` so metadata updates aren’t skipped for other actions.</comment>

<file context>
@@ -8,9 +8,14 @@ execSync("gh pr checkout " + PRNumber);
 console.log("Last commit author: " + lastCommitAuthor);
-if (lastCommitAuthor === "github-actions[bot]") {
+console.log("Event action       : " + eventAction);
+if (lastCommitAuthor === "github-actions[bot]" && eventAction !== "edited") {
     console.log("Last commit was made by github-actions[bot]. Skipping to prevent infinite loop.");
     process.exit(0);
</file context>
Suggested change
if (lastCommitAuthor === "github-actions[bot]" && eventAction !== "edited") {
if (lastCommitAuthor === "github-actions[bot]" && eventAction === "synchronize") {
Fix with Cubic

package.json Outdated
{
"name": "xmoj-script",
"version": "3.2.0",
"version": "3.2.2",
Copy link

@cubic-dev-ai cubic-dev-ai bot Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Manual version bump in package.json violates the automated versioning workflow and risks desynchronizing versions. Revert the manual change and let UpdateVersion.js handle version updates.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At package.json, line 3:

<comment>Manual version bump in package.json violates the automated versioning workflow and risks desynchronizing versions. Revert the manual change and let UpdateVersion.js handle version updates.</comment>

<file context>
@@ -1,6 +1,6 @@
 {
   "name": "xmoj-script",
-  "version": "3.2.0",
+  "version": "3.2.2",
   "description": "an improvement script for xmoj.tech",
   "main": "AddonScript.js",
</file context>
Fix with Cubic

},
"3.2.1": {
"UpdateDate": 1771740586846,
"Prerelease": true,
Copy link

@cubic-dev-ai cubic-dev-ai bot Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Production releases should set "Prerelease" to false. This entry marks 3.2.2 as a prerelease, which will mislabel the production release.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At Update.json, line 3391:

<comment>Production releases should set "Prerelease" to false. This entry marks 3.2.2 as a prerelease, which will mislabel the production release.</comment>

<file context>
@@ -3385,6 +3385,28 @@
+        },
+        "3.2.1": {
+            "UpdateDate": 1771740586846,
+            "Prerelease": true,
+            "UpdateContents": [
+                {
</file context>
Suggested change
"Prerelease": true,
"Prerelease": false,
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GitHub-related size/L update-script Related to our update infrastructure! user-script This issue or pull request is related to the main user script

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant