Step card: operation params line from last run#704
Conversation
|
Warning Review limit reached
More reviews will be available in 53 minutes and 43 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughДобавлен модуль ChangesСтрока параметров операции в StepCard
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@cuprum-ui/src/components/operations/StepCard.tsx`:
- Line 29: The side property function in StepCard.tsx currently uses a simple
ternary operator that defaults any value other than "top" to "bottom", which
causes incorrect translations for unexpected side values. Replace this logic to
explicitly check for both "top" and "bottom" values separately, and add proper
handling for unexpected or invalid side values (such as returning undefined or a
fallback translation). This ensures the component only applies the bottom
translation when the side value is explicitly "bottom", not for any unknown or
invalid input.
In `@cuprum-ui/src/locales/en/project.json`:
- Around line 297-303: The English locale file en/project.json has incorrect
pluralization rules for the tools key. English CLDR pluralization only uses
`one` (for count=1) and `other` (for all other counts), but the current
implementation includes `tools_few` and `tools_many` which are Russian
pluralization rules and will cause the key name to be displayed instead of the
translation when count is not 1. Replace the `tools_few` and `tools_many` keys
with a single `tools_other` key in the meta object, keeping the `tools_one` key
as is, so the plural form correctly displays for all non-singular counts.
🪄 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: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 0c550183-a854-4d11-88aa-9d6fde7a157b
📒 Files selected for processing (5)
cuprum-ui/src/components/operations/StepCard.tsxcuprum-ui/src/lib/stepMetaLine.test.tscuprum-ui/src/lib/stepMetaLine.tscuprum-ui/src/locales/en/project.jsoncuprum-ui/src/locales/ru/project.json
| tools: (n) => t("operations.meta.tools", { count: n }), | ||
| dur: { h: t("runHistory.hourShort"), m: t("runHistory.minShort"), s: t("runHistory.secShort") }, | ||
| sec: t("runHistory.secShort"), | ||
| side: (s) => t(s === "top" ? "operations.meta.side.top" : "operations.meta.side.bottom"), |
There was a problem hiding this comment.
Не подставляйте bottom для неизвестного side.
Сейчас любое значение, отличное от "top", отображается как "bottom", что даёт неверную мета-строку при неожиданных данных.
Предлагаемый фикс
- side: (s) => t(s === "top" ? "operations.meta.side.top" : "operations.meta.side.bottom"),
+ side: (s) => {
+ if (s === "top") return t("operations.meta.side.top");
+ if (s === "bottom") return t("operations.meta.side.bottom");
+ return s;
+ },🤖 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 `@cuprum-ui/src/components/operations/StepCard.tsx` at line 29, The side
property function in StepCard.tsx currently uses a simple ternary operator that
defaults any value other than "top" to "bottom", which causes incorrect
translations for unexpected side values. Replace this logic to explicitly check
for both "top" and "bottom" values separately, and add proper handling for
unexpected or invalid side values (such as returning undefined or a fallback
translation). This ensures the component only applies the bottom translation
when the side value is explicitly "bottom", not for any unknown or invalid
input.
| "meta": { | ||
| "holes": "holes", | ||
| "tools_one": "{{count}} drill", | ||
| "tools_few": "{{count}} drills", | ||
| "tools_many": "{{count}} drills", | ||
| "side": { "top": "Top", "bottom": "Bottom" } | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== i18n init / plural options =="
rg -n -C3 'i18next|init\(|plural|compatibilityJSON|pluralSeparator' cuprum-ui/src
echo
echo "== tools plural keys in locales =="
rg -n '"tools_(one|few|many|other)"' cuprum-ui/src/locales/en/project.json cuprum-ui/src/locales/ru/project.json
echo
echo "== calls that rely on count pluralization =="
rg -n -C2 'operations\.meta\.tools|t\(".*tools".*count' cuprum-ui/srcRepository: fixcik/cuprum
Length of output: 50369
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "=== i18next init configuration ==="
sed -n '10,25p' cuprum-ui/src/i18n/index.ts
echo
echo "=== Check for plural-related config ==="
rg -A 10 'i18n\.use.*init' cuprum-ui/src/i18n/index.ts
echo
echo "=== tools keys in en/project.json ==="
grep -o '"tools[^"]*"' cuprum-ui/src/locales/en/project.json | sort | uniq
echo
echo "=== tools keys in ru/project.json ==="
grep -o '"tools[^"]*"' cuprum-ui/src/locales/ru/project.json | sort | uniq
echo
echo "=== StepCard usage of operations.meta.tools ==="
rg -B5 -A5 'operations\.meta\.tools|meta\.tools' cuprum-ui/src/components/operations/StepCard.tsxRepository: fixcik/cuprum
Length of output: 1247
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "=== Full i18n/index.ts file ==="
cat cuprum-ui/src/i18n/index.ts
echo
echo "=== Check for any compatibility or plural settings ==="
rg -r 'compatibilityJSON|pluralSeparator|load.*plural|cldr' cuprum-ui/src/i18n/
echo
echo "=== Check exact en/project.json lines around tools ==="
sed -n '295,310p' cuprum-ui/src/locales/en/project.json
echo
echo "=== Check exact ru/project.json lines around tools ==="
sed -n '295,310p' cuprum-ui/src/locales/ru/project.jsonRepository: fixcik/cuprum
Length of output: 748
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "=== en/project.json around tools keys ==="
cat cuprum-ui/src/locales/en/project.json | jq '.operations.meta' 2>/dev/null || sed -n '290,310p' cuprum-ui/src/locales/en/project.json
echo
echo "=== ru/project.json around tools keys ==="
cat cuprum-ui/src/locales/ru/project.json | jq '.operations.meta' 2>/dev/null || sed -n '290,310p' cuprum-ui/src/locales/ru/project.json
echo
echo "=== Check if i18next package.json has plural rules info ==="
rg -A2 -B2 '"i18next"' cuprum-ui/package.jsonRepository: fixcik/cuprum
Length of output: 718
Добавьте tools_other в английскую локаль; удалите tools_few и tools_many из неё.
Стандартные CLDR правила pluralization для английского используют только one (для count=1) и other (для 0, 2, 3, ...). В текущем файле отсутствует tools_other, поэтому при count ≠ 1 вместо текста выведется ключ operations.meta.tools. Ключи tools_few и tools_many — это русские правила и в английской локали не используются.
Измените en/project.json с:
"tools_one": "{{count}} drill",
"tools_few": "{{count}} drills",
"tools_many": "{{count}} drills",На:
"tools_one": "{{count}} drill",
"tools_other": "{{count}} drills",🤖 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 `@cuprum-ui/src/locales/en/project.json` around lines 297 - 303, The English
locale file en/project.json has incorrect pluralization rules for the tools key.
English CLDR pluralization only uses `one` (for count=1) and `other` (for all
other counts), but the current implementation includes `tools_few` and
`tools_many` which are Russian pluralization rules and will cause the key name
to be displayed instead of the translation when count is not 1. Replace the
`tools_few` and `tools_many` keys with a single `tools_other` key in the meta
object, keeping the `tools_one` key as is, so the plural form correctly displays
for all non-singular counts.
Closes #700. Часть эпика #697.
Строка параметров операции в карточке шага — из дешёвых данных последнего прогона (без свежего планировщика):
N отв. · K свёрл · ≈ время(progressTotal + paramsJson.estimateSec/toolCount)Сторона · Xс(paramsJson.side/exposureS)Чистый stepMetaLine под тестами; i18n с плюрализацией свёрл. pnpm build + vitest зелёные.
Summary by CodeRabbit
Улучшения