Skip to content

chore: properly change fetch remote css map spinner#3522

Merged
rxri merged 1 commit intospicetify:mainfrom
Donaldino7712:main
Sep 17, 2025
Merged

chore: properly change fetch remote css map spinner#3522
rxri merged 1 commit intospicetify:mainfrom
Donaldino7712:main

Conversation

@Donaldino7712
Copy link
Contributor

@Donaldino7712 Donaldino7712 commented Sep 17, 2025

I forgot about this one

Summary by CodeRabbit

  • New Features
    • Added clearer spinner messages during remote CSS map fetching, including explicit success and warning states. Users now see “Fetched remote CSS map” on success and descriptive warnings if retrieval fails.
  • Style
    • Improved CLI feedback consistency and readability without changing functionality or workflow.

@rxri rxri merged commit 1e6d312 into spicetify:main Sep 17, 2025
5 of 6 checks passed
@coderabbitai
Copy link

coderabbitai bot commented Sep 17, 2025

Walkthrough

Added descriptive messages to spinner notifications in the preprocess step for remote CSS map retrieval, covering success and error cases. No control flow, data handling, or exported declarations were changed.

Changes

Cohort / File(s) Summary of edits
Preprocess spinner messaging
src/preprocess/preprocess.go
Added explicit messages to fetchSpinner.Warning() and fetchSpinner.Success() for remote CSS map fetch outcomes; no logic changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

I spun my ears with every tick and twirl,
A cheery “Fetched!” when flags unfurl—
If clouds roll in, I gently warn,
Then nibble local leaves ’til morn.
Small hops, clear signs, no detours vast—
My spinner sings: the map’s recast! 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title concisely and directly describes the primary change—adjusting the spinner behavior/messages for fetching the remote CSS map—and aligns with the edits shown in preprocess.go; it therefore accurately reflects the main change in the changeset. Although the phrasing "properly change" is slightly informal, it still communicates the intent and scope clearly to reviewers. This makes the title suitable for the PR history and easy for teammates to scan.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/preprocess/preprocess.go (1)

54-64: Close HTTP response body and check status code (resource leak, misreported errors).

cssMapResp.Body isn’t closed; repeated runs can leak FDs. Also, a non-200 response is treated as JSON-malformed.

-    cssMapResp, err := http.Get(cssMapURL)
-    if err != nil {
-        return err
-    } else {
-        err := json.NewDecoder(cssMapResp.Body).Decode(cssTranslationMap)
-        if err != nil {
-            utils.PrintWarning("Remote CSS map JSON malformed.")
-            return err
-        }
-    }
+    resp, err := http.Get(cssMapURL)
+    if err != nil {
+        return err
+    }
+    defer resp.Body.Close()
+    if resp.StatusCode != http.StatusOK {
+        return fmt.Errorf("GET %s: %s", cssMapURL, resp.Status)
+    }
+    if err := json.NewDecoder(resp.Body).Decode(cssTranslationMap); err != nil {
+        utils.PrintWarning("Remote CSS map JSON malformed.")
+        return err
+    }
🧹 Nitpick comments (3)
src/preprocess/preprocess.go (3)

91-91: Make the warning message precise (this failure is tag fetch, not CSS map fetch).

The first failure is fetching the latest tag. The message suggests CSS map fetch failed, which can mislead when the subsequent remote fetch might still succeed.

-            fetchSpinner.Warning("Failed to fetch remote CSS map")
+            fetchSpinner.Warning("Failed to fetch latest tag; will try remote CSS map")

95-101: Surface error details and add tag context to success.

Helps debugging and confirms which tag/main was used.

-        if readRemoteCssMap(tag, &cssTranslationMap) != nil {
-            fetchSpinner.Warning("Failed to fetch remote CSS map")
-            utils.PrintInfo("Using local CSS map instead")
-            readLocalCssMap(&cssTranslationMap)
-        } else {
-            fetchSpinner.Success("Fetched remote CSS map")
-        }
+        if err := readRemoteCssMap(tag, &cssTranslationMap); err != nil {
+            fetchSpinner.Warning(fmt.Sprintf("Failed to fetch remote CSS map (%v)", err))
+            utils.PrintInfo("Using local CSS map instead")
+            readLocalCssMap(&cssTranslationMap)
+        } else {
+            fetchSpinner.Success(fmt.Sprintf("Fetched remote CSS map (%s)", tag))
+        }

88-88: Optional: don’t ignore spinner start error.

Capture/log it to aid diagnostics if the spinner backend fails.

-        fetchSpinner, _ := utils.Spinner.Start("Fetching remote CSS map")
+        fetchSpinner, spinnerErr := utils.Spinner.Start("Fetching remote CSS map")
+        if spinnerErr != nil {
+            utils.PrintWarning(fmt.Sprintf("Spinner start failed: %v", spinnerErr))
+        }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6f82fa9 and 7a55ada.

📒 Files selected for processing (1)
  • src/preprocess/preprocess.go (1 hunks)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants