Skip to content

fix: studio skip reason i18n - #320

Merged
Anyesh merged 4 commits into
mainfrom
fix/studio-skip-reason-i18n
Nov 10, 2026
Merged

Anyesh merged 4 commits into
mainfrom
fix/studio-skip-reason-i18n

Conversation

@Anyesh

@Anyesh Anyesh commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

Description

Related Issue

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/CD or build changes

Checklist

  • I have read the CONTRIBUTING guide
  • My code follows the project's coding style
  • I have added tests that prove my fix/feature works
  • New and existing tests pass locally
  • I have updated documentation as needed
  • My changes don't introduce new warnings or errors

Testing

Test Environment

  • Docker Compose
  • Kubernetes
  • Local development

Tests Performed

Screenshots (if applicable)

Additional Notes

Summary by Sourcery

Fix studio item and AI-assist skip messaging so all labels are localized and conflicts identify the relevant existing item.

Bug Fixes:

  • Use translated item type labels throughout the studio UI when item names or role labels are unavailable.
  • Show the actual conflicting item in AI-assist skip notifications instead of an untranslated internal reason.

Enhancements:

  • Track conflicting canvas and newly merged items during AI-assisted outfit merging to provide accurate skip context.

Tests:

  • Add coverage for localized studio labels, AI-assist conflict notifications, and conflict tracking across multi-slot items.

@sourcery-ai

sourcery-ai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Data structures

Change AI-assist skipped results to expose the conflicting item instead of a presentation-ready reason string.

  • frontend/lib/studio/ai-assist-merge.ts L5

Implementation

Track which item holds each occupied slot so skipped suggestions can identify the item they conflict with, including items merged earlier in the same call.

  • frontend/lib/studio/ai-assist-merge.ts L12-18, L23-29

UI

Show translated labels for the suggested and conflicting items in the skip toast, and use translated type labels for canvas items without a role.

  • frontend/components/studio/canvas-panel.tsx L23
  • frontend/components/studio/details-panel.tsx L49, L72-74
  • frontend/messages/de/outfits.json L84
  • frontend/messages/en/outfits.json L84
  • frontend/messages/fr/outfits.json L84
  • frontend/messages/it/outfits.json L84
  • frontend/messages/ja/outfits.json L84
  • frontend/messages/ko/outfits.json L84
  • frontend/messages/zh-CN/outfits.json L84
  • frontend/messages/zh-TW/outfits.json L84

Tests

Cover translated item labels in the Studio panels and verify the merge reports the correct conflicting item.

  • frontend/tests/studio-panels-i18n.test.tsx L1-82
  • frontend/tests/studio-suit.test.ts L35, L44, L50
  • frontend/tests/studio.test.ts L183-191

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

@github-actions github-actions Bot added the javascript Pull requests that update javascript code label Nov 10, 2026

@sourcery-ai sourcery-ai 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.

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="frontend/components/studio/canvas-panel.tsx" line_range="23" />
<code_context>
   const roleLabel = (type: string) => {
     const role = ITEM_ROLE[type];
-    return role ? roleName(role) : type;
+    return role ? roleName(role) : typeLabel(type);
   };
   if (items.length === 0) {
</code_context>
<issue_to_address>
**Unknown types stay in English**

When a canvas or studio item has a type with no matching catalog entry, `typeLabel` calls `useCatalogLabel`, which falls back to title-cased raw text for an absent type, so the item label remains in English instead of the current locale.

Provide a localized fallback for types that are absent from the catalog instead of displaying humanized raw text.

Also at `frontend/tests/studio-panels-i18n.test.tsx:24`.
</issue_to_address>

### Comment 2
<location path="frontend/tests/studio-panels-i18n.test.tsx" line_range="23" />
<code_context>
+    t.raw = t
+    t.rich = t
+    t.markup = t
+    t.has = () => true
+    return t
+  },
</code_context>
<issue_to_address>
**Unknown type expects a nonexistent translation**

When the test is meant to verify the label produced with the real catalog, when `kimono` is absent from the real English type catalog, `useCatalogLabel` correctly falls back to `Kimono`, but this mock forces `t.has` to return true and fabricates `constants.types.kimono`, so the CanvasPanel assertion passes with output the real catalog would not produce.

Use a type present in the catalog for the translation assertion, or assert the readable fallback for `kimono` and make the mock's `has` reflect catalog membership.
</issue_to_address>

Sourcery assessment

Approval pending. 2 findings to address first.

Blocking findings: frontend/components/studio/canvas-panel.tsx:23, frontend/tests/studio-panels-i18n.test.tsx:23


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

const roleLabel = (type: string) => {
const role = ITEM_ROLE[type];
return role ? roleName(role) : type;
return role ? roleName(role) : typeLabel(type);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Unknown types stay in English

When a canvas or studio item has a type with no matching catalog entry, typeLabel calls useCatalogLabel, which falls back to title-cased raw text for an absent type, so the item label remains in English instead of the current locale.

Provide a localized fallback for types that are absent from the catalog instead of displaying humanized raw text.

Also at frontend/tests/studio-panels-i18n.test.tsx:24.

Prompt for AI agents
In `frontend/components/studio/canvas-panel.tsx` at line 23:

**Unknown types stay in English**

When a canvas or studio item has a type with no matching catalog entry, `typeLabel` calls `useCatalogLabel`, which falls back to title-cased raw text for an absent type, so the item label remains in English instead of the current locale.

Provide a localized fallback for types that are absent from the catalog instead of displaying humanized raw text.

Also at `frontend/tests/studio-panels-i18n.test.tsx:24`.

t.raw = t
t.rich = t
t.markup = t
t.has = () => true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Unknown type expects a nonexistent translation

When the test is meant to verify the label produced with the real catalog, when kimono is absent from the real English type catalog, useCatalogLabel correctly falls back to Kimono, but this mock forces t.has to return true and fabricates constants.types.kimono, so the CanvasPanel assertion passes with output the real catalog would not produce.

Use a type present in the catalog for the translation assertion, or assert the readable fallback for kimono and make the mock's has reflect catalog membership.

Prompt for AI agents
In `frontend/tests/studio-panels-i18n.test.tsx` at line 23:

**Unknown type expects a nonexistent translation**

When the test is meant to verify the label produced with the real catalog, when `kimono` is absent from the real English type catalog, `useCatalogLabel` correctly falls back to `Kimono`, but this mock forces `t.has` to return true and fabricates `constants.types.kimono`, so the CanvasPanel assertion passes with output the real catalog would not produce.

Use a type present in the catalog for the translation assertion, or assert the readable fallback for `kimono` and make the mock's `has` reflect catalog membership.

@Anyesh
Anyesh merged commit 1ebe14c into main Nov 10, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

javascript Pull requests that update javascript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant