Skip to content

Add optional US regional gear names#369

Merged
Flohhhhh merged 1 commit into
developmentfrom
codex/us-regional-gear-names
Jul 17, 2026
Merged

Add optional US regional gear names#369
Flohhhhh merged 1 commit into
developmentfrom
codex/us-regional-gear-names

Conversation

@Flohhhhh

Copy link
Copy Markdown
Owner

Summary

  • add US as a distinct gear naming region, including the generated Drizzle enum migration
  • let editors save complete US/EU/JP regional names without forcing the canonical brand prefix
  • preserve canonical fallback behavior for items without a US alias
  • update locale resolution, search suggestions, developer API validation, specs display, translations, tests, and documentation
  • keep broader brand/name presentation mapping out of scope

Why

Some products use a different brand in the United States, such as Samyang products sold as Rokinon. A dedicated optional US alias supports that market-specific name without changing the canonical/global catalog identity.

Validation

  • npm run test — 165 files, 729 tests passed
  • targeted regional naming/search/API/translation suite — 56 tests passed
  • scoped ESLint — passed with no errors
  • React Doctor — no issues
  • git diff --check — passed

Known baseline issue

Repository-wide TypeScript checking still reports the existing untouched tests/unit/spec-registry-i18n.test.ts:257 mismatch where the test supplies string | number to numeric weightGrams.

Add US as a distinct gear naming region and allow editors to store complete regional aliases without forcing the canonical brand prefix. Update locale resolution, search suggestions, API validation, translations, documentation, and regression coverage while preserving canonical fallback behavior.
@vercel

vercel Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
sharplyphoto Ignored Ignored Jul 17, 2026 12:41pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added United States regional gear naming alongside Global, European, and Japanese aliases.
    • Gear search suggestions now support regional results and display the matching alias when available.
    • Added localized gear-renaming dialog content across supported languages.
    • Expanded gear renaming to manage regional aliases.
  • Documentation

    • Updated regional naming, search, mapping, gear specifications, and developer API documentation.

Walkthrough

The PR adds US to regional gear aliases, database and locale contracts, rename editing, display resolution, search suggestions, localized UI, tests, and system documentation.

Changes

Regional Gear Naming

Layer / File(s) Summary
US region contracts and routing
drizzle/..., src/lib/gear/region.ts, src/lib/locale/locales.ts, src/server/..., src/app/.../lists/*, tests/unit/developer-api-schemas-serializers.test.ts, tests/unit/locale-market-detection.test.ts
The database enum, locale resolution, API validation, list DTOs, and related tests now support US.
Regional alias rename flow
src/components/gear/rename-gear-*, src/app/.../gear/..., messages/*.json, tests/unit/rename-gear-dialog.test.ts
Rename state and alias updates support US/EU/JP values, trim inputs, remove brand-prefix construction, and use localized dialog strings.
Regional display and search behavior
src/lib/specs/registry.tsx, tests/unit/gear-naming.test.ts, tests/unit/search-service.test.ts
Viewer-facing specs and search suggestions use US aliases where available and fall back to canonical names otherwise.
Regional naming documentation
docs/camera-specs/regional-naming-system.md, docs/developer-api.md, docs/gear-specification-system.md, docs/mapping-system.md, docs/search-system.md
Documentation describes US alias storage, region resolution, search behavior, rename persistence, and the suggestions API.

Possibly related PRs

  • Flohhhhh/sharply#243: Covers the underlying regional gear-alias and display/search system extended here with US support.
  • Flohhhhh/sharply#350: Intersects with the rename dialog’s regional alias state and update handling.
  • Flohhhhh/sharply#365: Provides the Developer API request-schema implementation extended here to accept region=US.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding optional US regional gear names.
Description check ✅ Passed The description matches the changeset and covers the new US region, fallback behavior, and related updates.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

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

⚠️ Outside diff range comments (2)
src/components/gear/rename-gear-dialog.tsx (2)

151-158: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Fix broken navigation logic when the user opts to navigate.

The current condition prevents navigation if the user chooses to "Go to item page after renaming" but only changes a regional alias. In that scenario, shouldNavigate is true, but resultSlug !== currentSlug is false, resulting in a fallback to router.refresh() that leaves the user stranded on the admin table.

Since the shouldNavigate boolean already incorporates both the default behavior (when showNavigateOption is false) and the checkbox override (when showNavigateOption is true), the extra slug comparison is redundant and breaks the opt-in navigation flow.

💡 Proposed fix
         const shouldNavigate = showNavigateOption
           ? navigateAfterRename
           : resultSlug !== currentSlug;
-        if (shouldNavigate && resultSlug !== currentSlug) {
+        if (shouldNavigate) {
           router.push(`/gear/${resultSlug}`);
         } else {
           router.refresh();
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/gear/rename-gear-dialog.tsx` around lines 151 - 158, Update
the navigation condition in the rename handler to use shouldNavigate directly,
removing the redundant resultSlug !== currentSlug check. Preserve router.push
for every opted-in or default navigation case, and retain router.refresh only
when shouldNavigate is false.

213-218: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Associate labels with their respective inputs for accessibility.

The dynamically generated Label and Input elements for regional aliases lack htmlFor and id attributes. This prevents screen readers from correctly associating the region name label with the input field.

♿ Proposed fix
-                    <Label className="text-muted-foreground text-xs">
+                    <Label htmlFor={`alias-${region}`} className="text-muted-foreground text-xs">
                       {region}
                     </Label>
                     <Input
+                      id={`alias-${region}`}
                       placeholder={t("aliasPlaceholder", { region })}
                       value={aliases[region] ?? ""}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/gear/rename-gear-dialog.tsx` around lines 213 - 218, Associate
each regional alias Label and Input in the rename dialog by assigning a matching
htmlFor and id derived from the region value, ensuring every dynamically
generated label targets its corresponding input.
🧹 Nitpick comments (1)
src/lib/specs/registry.tsx (1)

578-582: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider using a consistent label format for regional names.

For consistency with "EU Name" and "Japan Name" used in the subsequent conditionals, consider labeling the US alias as "US Name".

💡 Proposed refactor
           const usAlias = findAlias("US");
           if (usAlias && viewer !== "US") {
-            entries.push({ label: "US", name: usAlias });
+            entries.push({ label: "US Name", name: usAlias });
           }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/specs/registry.tsx` around lines 578 - 582, Update the US alias entry
in the surrounding regional-name logic to use the consistent “US Name” label,
matching the existing “EU Name” and “Japan Name” labels while leaving the alias
lookup and viewer condition unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@drizzle/0025_ordinary_valeria_richards.sql`:
- Line 1: Remove the generated migration artifacts: delete
drizzle/0025_ordinary_valeria_richards.sql lines 1-1,
drizzle/meta/0025_snapshot.json lines 1-5, and the corresponding journal entry
in drizzle/meta/_journal.json lines 180-185. No replacement migration files are
needed; retain only the schema change.

---

Outside diff comments:
In `@src/components/gear/rename-gear-dialog.tsx`:
- Around line 151-158: Update the navigation condition in the rename handler to
use shouldNavigate directly, removing the redundant resultSlug !== currentSlug
check. Preserve router.push for every opted-in or default navigation case, and
retain router.refresh only when shouldNavigate is false.
- Around line 213-218: Associate each regional alias Label and Input in the
rename dialog by assigning a matching htmlFor and id derived from the region
value, ensuring every dynamically generated label targets its corresponding
input.

---

Nitpick comments:
In `@src/lib/specs/registry.tsx`:
- Around line 578-582: Update the US alias entry in the surrounding
regional-name logic to use the consistent “US Name” label, matching the existing
“EU Name” and “Japan Name” labels while leaving the alias lookup and viewer
condition unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b1f69ef7-b63c-4239-ba74-98056ea74083

📥 Commits

Reviewing files that changed from the base of the PR and between 0105e81 and 1bc8460.

📒 Files selected for processing (34)
  • docs/camera-specs/regional-naming-system.md
  • docs/developer-api.md
  • docs/gear-specification-system.md
  • docs/mapping-system.md
  • docs/search-system.md
  • drizzle/0025_ordinary_valeria_richards.sql
  • drizzle/meta/0025_snapshot.json
  • drizzle/meta/_journal.json
  • messages/de.json
  • messages/en.json
  • messages/es.json
  • messages/fr.json
  • messages/it.json
  • messages/ja.json
  • messages/ms.json
  • messages/zh.json
  • src/app/[locale]/(admin)/admin/gear/columns.tsx
  • src/app/[locale]/(pages)/gear/[slug]/page.tsx
  • src/app/[locale]/(pages)/u/_components/lists/list-sortable-items.tsx
  • src/app/[locale]/(pages)/u/_components/lists/types.ts
  • src/components/gear/rename-gear-button.tsx
  • src/components/gear/rename-gear-dialog-utils.ts
  • src/components/gear/rename-gear-dialog.tsx
  • src/lib/gear/region.ts
  • src/lib/locale/locales.ts
  • src/lib/specs/registry.tsx
  • src/server/db/schema.ts
  • src/server/developer-api/schemas.ts
  • src/server/user-lists/service.ts
  • tests/unit/developer-api-schemas-serializers.test.ts
  • tests/unit/gear-naming.test.ts
  • tests/unit/locale-market-detection.test.ts
  • tests/unit/rename-gear-dialog.test.ts
  • tests/unit/search-service.test.ts
💤 Files with no reviewable changes (3)
  • src/components/gear/rename-gear-button.tsx
  • src/app/[locale]/(pages)/gear/[slug]/page.tsx
  • src/app/[locale]/(admin)/admin/gear/columns.tsx
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: lint
🧰 Additional context used
📓 Path-based instructions (6)
**/*

📄 CodeRabbit inference engine (AGENTS.md)

Update all relevant documentation in /docs when code changes could cause documentation drift.

Files:

  • tests/unit/locale-market-detection.test.ts
  • src/server/db/schema.ts
  • src/app/[locale]/(pages)/u/_components/lists/types.ts
  • tests/unit/search-service.test.ts
  • messages/it.json
  • src/components/gear/rename-gear-dialog-utils.ts
  • src/app/[locale]/(pages)/u/_components/lists/list-sortable-items.tsx
  • messages/ms.json
  • messages/es.json
  • messages/fr.json
  • drizzle/meta/_journal.json
  • docs/search-system.md
  • docs/developer-api.md
  • docs/mapping-system.md
  • drizzle/0025_ordinary_valeria_richards.sql
  • messages/zh.json
  • src/server/developer-api/schemas.ts
  • tests/unit/gear-naming.test.ts
  • src/server/user-lists/service.ts
  • messages/de.json
  • messages/ja.json
  • src/lib/locale/locales.ts
  • messages/en.json
  • src/lib/gear/region.ts
  • tests/unit/developer-api-schemas-serializers.test.ts
  • docs/gear-specification-system.md
  • src/lib/specs/registry.tsx
  • tests/unit/rename-gear-dialog.test.ts
  • drizzle/meta/0025_snapshot.json
  • docs/camera-specs/regional-naming-system.md
  • src/components/gear/rename-gear-dialog.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Replace new hardcoded user-facing strings with translation keys for all locales.

Files:

  • tests/unit/locale-market-detection.test.ts
  • src/server/db/schema.ts
  • src/app/[locale]/(pages)/u/_components/lists/types.ts
  • tests/unit/search-service.test.ts
  • src/components/gear/rename-gear-dialog-utils.ts
  • src/app/[locale]/(pages)/u/_components/lists/list-sortable-items.tsx
  • src/server/developer-api/schemas.ts
  • tests/unit/gear-naming.test.ts
  • src/server/user-lists/service.ts
  • src/lib/locale/locales.ts
  • src/lib/gear/region.ts
  • tests/unit/developer-api-schemas-serializers.test.ts
  • src/lib/specs/registry.tsx
  • tests/unit/rename-gear-dialog.test.ts
  • src/components/gear/rename-gear-dialog.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Do not introduce direct database access in UI or generic lib modules; pages, API routes, and server components should prefer importing from service/.
Server actions must not be used for fetching; use them only for mutations or other client-to-server actions.
Use TypeScript type checking with npm run typecheck; for large changes, run the combined npm run check validation pass.

Files:

  • tests/unit/locale-market-detection.test.ts
  • src/server/db/schema.ts
  • src/app/[locale]/(pages)/u/_components/lists/types.ts
  • tests/unit/search-service.test.ts
  • src/components/gear/rename-gear-dialog-utils.ts
  • src/app/[locale]/(pages)/u/_components/lists/list-sortable-items.tsx
  • src/server/developer-api/schemas.ts
  • tests/unit/gear-naming.test.ts
  • src/server/user-lists/service.ts
  • src/lib/locale/locales.ts
  • src/lib/gear/region.ts
  • tests/unit/developer-api-schemas-serializers.test.ts
  • src/lib/specs/registry.tsx
  • tests/unit/rename-gear-dialog.test.ts
  • src/components/gear/rename-gear-dialog.tsx
src/server/db/schema.ts

📄 CodeRabbit inference engine (AGENTS.md)

src/server/db/schema.ts: Make all database schema changes in src/server/db/schema.ts using Drizzle's type-safe schema definitions.
Keep schema changes backwards compatible by default, preferring deprecations over destructive deletions.
Update relevant documentation whenever the database schema changes, including gear-specification-system.md for gear-related schemas and mapping-system.md for mapping or relationship logic changes.

Files:

  • src/server/db/schema.ts
messages/*.json

📄 CodeRabbit inference engine (AGENTS.md)

Maintain translation-key parity across all locale files whenever keys are added, removed, or renamed in messages/en.json.

Files:

  • messages/it.json
  • messages/ms.json
  • messages/es.json
  • messages/fr.json
  • messages/zh.json
  • messages/de.json
  • messages/ja.json
  • messages/en.json
drizzle/**

📄 CodeRabbit inference engine (AGENTS.md)

Do not write or modify migration files in drizzle/; do not run migration-generation or database-push commands as part of schema changes.

Files:

  • drizzle/meta/_journal.json
  • drizzle/0025_ordinary_valeria_richards.sql
  • drizzle/meta/0025_snapshot.json
🪛 GitHub Actions: Protect migration files / 0_check-migration-files.txt
drizzle/0025_ordinary_valeria_richards.sql

[error] 1-1: CI failed because migration files were detected in the PR. Migration files should not be committed by contributors; only schema changes in src/server/db/schema.ts should be committed, and local testing should use npm run db:push.

🪛 GitHub Actions: Protect migration files / check-migration-files
drizzle/0025_ordinary_valeria_richards.sql

[error] 1-1: CI workflow failed: migration files detected in PR. Migration files should not be committed by contributors. Workflow expects schema changes only in src/server/db/schema.ts and local testing via 'npm run db:push'.

🔇 Additional comments (26)
docs/camera-specs/regional-naming-system.md (4)

3-9: LGTM!


13-15: LGTM!


19-21: LGTM!


25-26: LGTM!

docs/developer-api.md (1)

36-38: LGTM!

docs/gear-specification-system.md (1)

60-65: LGTM!

docs/mapping-system.md (1)

157-158: LGTM!

docs/search-system.md (1)

59-59: LGTM!

src/server/db/schema.ts (1)

55-60: LGTM!

src/lib/gear/region.ts (1)

1-1: LGTM!

Also applies to: 42-42

src/lib/locale/locales.ts (1)

48-48: LGTM!

Also applies to: 255-258

src/app/[locale]/(pages)/u/_components/lists/list-sortable-items.tsx (1)

33-33: LGTM!

src/app/[locale]/(pages)/u/_components/lists/types.ts (1)

18-18: LGTM!

src/server/user-lists/service.ts (1)

46-46: LGTM!

src/server/developer-api/schemas.ts (1)

34-40: LGTM!

tests/unit/developer-api-schemas-serializers.test.ts (1)

30-31: LGTM!

Also applies to: 37-41

tests/unit/locale-market-detection.test.ts (1)

9-14: LGTM!

src/components/gear/rename-gear-dialog-utils.ts (1)

8-37: LGTM!

tests/unit/search-service.test.ts (1)

182-212: LGTM!

messages/it.json (1)

161-180: LGTM!

messages/ja.json (1)

161-180: LGTM!

messages/ms.json (1)

161-180: LGTM!

messages/zh.json (1)

161-180: LGTM!

tests/unit/rename-gear-dialog.test.ts (1)

13-23: LGTM!

Also applies to: 82-87, 121-129, 147-147, 162-181

tests/unit/gear-naming.test.ts (2)

1-54: LGTM!


56-66: 🎯 Functional Correctness

No issue here. buildGearSearchName already lowercases and strips punctuation via normalizeGearSearchText, so these expectations match the implementation.

			> Likely an incorrect or invalid review comment.

Comment thread drizzle/0025_ordinary_valeria_richards.sql
@Flohhhhh
Flohhhhh merged commit be83b50 into development Jul 17, 2026
6 of 7 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.

1 participant