Skip to content

Step card: operation params line from last run#704

Merged
fixcik merged 5 commits into
masterfrom
worktree-feat+step-card-params
Jun 17, 2026
Merged

Step card: operation params line from last run#704
fixcik merged 5 commits into
masterfrom
worktree-feat+step-card-params

Conversation

@fixcik

@fixcik fixcik commented Jun 17, 2026

Copy link
Copy Markdown
Owner

Closes #700. Часть эпика #697.

Строка параметров операции в карточке шага — из дешёвых данных последнего прогона (без свежего планировщика):

  • drill: N отв. · K свёрл · ≈ время (progressTotal + paramsJson.estimateSec/toolCount)
  • expose: Сторона · Xс (paramsJson.side/exposureS)
  • mill / непрогонявшиеся: строки нет

Чистый stepMetaLine под тестами; i18n с плюрализацией свёрл. pnpm build + vitest зелёные.

Summary by CodeRabbit

Улучшения

  • Новые функции
    • На карточках операций добавлено отображение ключевых параметров: количество отверстий и инструментов, продолжительность выполнения и сторона обработки.

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@fixcik, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8a4c4a9f-534f-4c5b-9898-3268965499d9

📥 Commits

Reviewing files that changed from the base of the PR and between 292a3c4 and 8ecd84f.

📒 Files selected for processing (3)
  • cuprum-ui/src/locales/en/project.json
  • cuprum-ui/src/locales/ru/project.json
  • docs/ROADMAP.md
📝 Walkthrough

Walkthrough

Добавлен модуль stepMetaLine с интерфейсом StepMetaLabels и одноимённой функцией, формирующей строку параметров шага из OperationRun для типов drill и expose. Добавлены unit-тесты, ключи локализации (en/ru) и условный рендер строки с иконкой Wrench в компоненте StepCard.

Changes

Строка параметров операции в StepCard

Layer / File(s) Summary
Контракт и реализация stepMetaLine
cuprum-ui/src/lib/stepMetaLine.ts
Определён интерфейс StepMetaLabels и реализована функция stepMetaLine(run, L): для drill парсит progressTotal, toolCount, estimateSec из paramsJson; для exposeside и exposureS; части объединяются через " · ", при отсутствии данных возвращается null. Парсинг обёрнут в try/catch.
Unit-тесты
cuprum-ui/src/lib/stepMetaLine.test.ts
Покрыты сценарии: null-run, drill с отверстиями/инструментами/оценкой и без, некорректный JSON, expose с/без exposureS, null для mill и drill без progressTotal.
Локализации и интеграция в StepCard
cuprum-ui/src/locales/en/project.json, cuprum-ui/src/locales/ru/project.json, cuprum-ui/src/components/operations/StepCard.tsx
Добавлены ключи operations.meta (holes, tools, side) в оба языковых файла. В StepCard добавлены импорты Wrench и stepMetaLine, вычисление meta с передачей переводов, условный рендер строки с иконкой Wrench.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 Отверстия, свёрла, секунды — всё в ряд,
Строка параметров теперь есть у карточек!
stepMetaLine всё сложит подряд,
И drill, и expose — без лишних затраточек.
Wrench-иконка сверкает — всё в строй! 🔧

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Название точно описывает основное изменение: добавление строки с параметрами операции из последнего запуска в карточку шага.
Linked Issues check ✅ Passed Реализация соответствует требованиям #700: добавлена строка параметров для drill (отверстия, инструменты, время) и expose (сторона), используя кэшированные данные последнего запуска без дорогостоящих вычислений.
Out of Scope Changes check ✅ Passed Все изменения относятся к поставленным целям: реализация функции stepMetaLine, её тестирование, интеграция в StepCard и добавление переводов для локализации.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai 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.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8a19ee2 and 292a3c4.

📒 Files selected for processing (5)
  • cuprum-ui/src/components/operations/StepCard.tsx
  • cuprum-ui/src/lib/stepMetaLine.test.ts
  • cuprum-ui/src/lib/stepMetaLine.ts
  • cuprum-ui/src/locales/en/project.json
  • cuprum-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"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Не подставляйте 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.

Comment on lines +297 to 303
"meta": {
"holes": "holes",
"tools_one": "{{count}} drill",
"tools_few": "{{count}} drills",
"tools_many": "{{count}} drills",
"side": { "top": "Top", "bottom": "Bottom" }
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 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/src

Repository: 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.tsx

Repository: 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.json

Repository: 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.json

Repository: 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.

@fixcik fixcik merged commit 7b85f31 into master Jun 17, 2026
4 checks passed
@fixcik fixcik deleted the worktree-feat+step-card-params branch June 17, 2026 11:06
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