Skip to content

fix(resources): restore the music mood filter panel - #111

Merged
creatorcluster merged 1 commit into
creatorcluster:mainfrom
Coder-soft:fix/music-moods-panel
Oct 21, 2026
Merged

creatorcluster merged 1 commit into
creatorcluster:mainfrom
Coder-soft:fix/music-moods-panel

Conversation

@Coder-soft

@Coder-soft Coder-soft commented Oct 21, 2026 •

Copy link
Copy Markdown

Summary

The music mood sidebar was invisible for every visitor on https://renderdragon.org/resources?category=music.

<MusicMoodFilter>            (src/components/resources/MusicMoodFilter.tsx)
  allMoods = union(moodsData.moods)
  if allMoods.length === 0
    return null              # ← silently removes the whole left panel

moodsData came from GET /music_moods, and the request path was broken:

api-router.fetch
  classify("/music_moods")
-   → "assets"   # not in RESOURCE_PREFIXES
-   → assets-api-worker → 404 "Not found"
-   → client res.json() throws → moods stay [] → panel returns null
+   → "resources"  # e3 (hamburger.codersoft.xyz) → hamburger-api fallback
+   → 200 [ { filename, moods[], source } × 465 ]

Changes:

  • workers/api-router/src/index.ts — /music_moods moved into the resources pool (and into the partner assets:read read set). Added a general rule: a 404 on a JSON API path now tries the next origin instead of handing that 404 to the client, so an origin missing a route can never silently break an endpoint again.
  • e3 hamburger-api (/home/home/assets-api/server.mjs, not in this repo) — serves music/music_moods.json from disk on the signed API path, so the primary origin implements it too, and it tracks the catalog through __update.
  • src/components/resources/MusicMoodFilter.tsx + ResourcesHub.tsx — the panel no longer unmounts on failure: it renders a skeleton while loading, an error state with Try again, and an explicit "No mood tags available yet." The fetch now checks res.ok and that the payload is a list.

There is no "genres" filter in the codebase or in the data — music_moods.json only carries mood tags, so this restores the single Mood Filter panel.

Evidence

Origin behaviour, before the change (which is what production hit):

$ curl -s -o /dev/null -w '%{http_code} %{size_download}\n' https://assets-api-worker.powernplant101-c6b.workers.dev/music_moods
404 9                     # "Not found" — the only origin ASSETS_ORIGINS has

$ curl -s -o /dev/null -w '%{http_code} %{size_download}\n' https://hamburger-api.powernplant101-c6b.workers.dev/music_moods
200 79270                 # the working implementation was never reached

After patching e3 and deploying the router:

$ ssh e3 node /tmp/sig_test.mjs     # signed v1/GET//music_moods request, api-router client id
status 200 bytes 54788 head [{"filename":"073kizuna_-_Destinys_Union.mp3","moods":["triumphant","uplifting","emotional","hopeful"],"source":"web search"},

$ pnpm exec wrangler deploy          # workers/api-router
Uploaded codersoft-api-router (7.85 sec)
Current Version ID: 77964ba4-fff4-4bce-a87d-58708153d0a4

$ pnpm exec tsc -b                   # no errors in the touched files
$ pnpm exec eslint src/components/resources/MusicMoodFilter.tsx src/pages/ResourcesHub.tsx
$ pnpm exec vite build
✓ built in 24.02s

Merge Danger

Door: two-way — the router change is revertible with a redeploy; the web change is purely additive UI state.

Blast Radius: route classification

/music_moods now goes through e3 first (like /all, /category/*, /fonts, /mcicons). Partner keys with assets:read gain this read-only path. The new 404-failover only applies to the five JSON API paths, never to asset file paths, so a genuinely missing file still returns 404 from the first origin.

Summary by CodeRabbit

  • New Features

    • Added loading indicators, error messages, retry controls, and empty-state messaging to the music mood filter.
    • Music moods now load on demand when viewing community music resources.
    • Added support for retrying failed mood requests.
  • Bug Fixes

    • Improved API routing and failover for music mood and category resource requests.

The mood sidebar vanished for every production visitor. /music_moods was
classified as an asset path by the api-router, so it was sent to
assets-api-worker, which does not implement it and answers 404. The client
then failed to parse "Not found", left the mood list empty, and
MusicMoodFilter returned null — no panel, no error.

- router: route /music_moods to the resources pool (e3 / hamburger-api) and
  allow it for partner read keys; also fail over to the next origin when a
  JSON API path returns 404 instead of passing that 404 to the client
- e3: serve music/music_moods.json from disk on the signed API path so the
  primary origin implements the endpoint too
- web: surface loading/error states in the panel (with retry) instead of
  silently rendering nothing when the request fails
@vercel

vercel Bot commented Oct 21, 2026

Copy link
Copy Markdown

@Coder-soft is attempting to deploy a commit to the yamura3's projects Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your trial has ended. Reactivate Greptile to resume code reviews.

@coderabbitai

coderabbitai Bot commented Oct 21, 2026

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 480ff103-c18c-4434-92e0-94ef24985a59
📥 Commits

Reviewing files that changed from the base of the PR and between f489d97 and c64a692.

📒 Files selected for processing: 3
  • src/components/resources/MusicMoodFilter.tsx
  • src/pages/ResourcesHub.tsx
  • workers/api-router/src/index.ts
+-------------------------------------------------+
| Copilot is my sidekick. I'm the main character. |
+-------------------------------------------------+
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@creatorcluster
creatorcluster merged commit 9dc241e into creatorcluster:main Oct 21, 2026
0 of 3 checks passed
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