Skip to content

fix(studio): trust the server format catalog - #2038

Merged
MODSetter merged 1 commit into
MODSetter:devfrom
fukalous:fix/studio-api-format-catalog
Sep 29, 2026
Merged

MODSetter merged 1 commit into
MODSetter:devfrom
fukalous:fix/studio-api-format-catalog

Conversation

@fukalous

@fukalous fukalous commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

What

Use the Studio format catalog returned by the API as the authoritative list once it has loaded. The existing local catalog remains the pre-load fallback; unknown server formats use the established label, icon, tooltip, and viewer fallbacks.

The regression test verifies server order, an unknown format, its availability reason, and removal of a frontend-only format. The Studio architecture document now describes that contract and removes the resolved known gap.

This PR was implemented and reviewed by an AI coding assistant. No independent human review is claimed.

Why

The previous merge iterated only the hard-coded frontend keys, so a backend format was silently omitted until the frontend duplicated its key. It also kept offering formats the server did not return.

Fixes #2002

How to test

  • pnpm exec vitest run --environment jsdom src/features/studio/studio-panel.test.tsx (7 passed)
  • pnpm test (301 passed)
  • pnpm typecheck
  • pnpm exec eslint src/features/studio/studio-panel.tsx src/features/studio/studio-panel.test.tsx
  • pnpm exec prettier --check src/features/studio/studio-panel.tsx src/features/studio/studio-panel.test.tsx
  • python scripts/check_docs.py (97 files, 0 problems)

High-level PR Summary

This PR fixes a bug where the Studio format picker was only showing formats hard-coded in the frontend, causing server-side formats to be silently omitted. The fix makes the API's format catalog the authoritative source once loaded, while keeping the local catalog as a pre-load fallback. The change ensures server-defined formats appear in the correct order, unknown formats are handled gracefully with default UI elements, and formats not returned by the server are properly removed from the picker.

⏱️ Estimated Review Time: 5-15 minutes

💡 Review Order Suggestion
Order File Path
1 surfsense_local/frontend/src/features/studio/studio-panel.tsx
2 surfsense_local/frontend/src/features/studio/studio-panel.test.tsx
3 docs/architecture/studio.md

Need help? Join our Discord

@vercel

vercel Bot commented Sep 29, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Sep 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: da6d686b-030a-4103-8851-4f7da11c86be

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@MODSetter
MODSetter merged commit 823cd43 into MODSetter:dev Sep 29, 2026
1 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