Skip to content

fix: restore main's lint and localization checks (split bot-items-runtime, drop stale item menu keys) - #51478

Merged
nwparker merged 2 commits into
mainfrom
bugbash/fix-main-bot-items-runtime-lines
Nov 28, 2026
Merged

nwparker merged 2 commits into
mainfrom
bugbash/fix-main-bot-items-runtime-lines

Conversation

@nwparker

@nwparker nwparker commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Pure move refactor that fixes the main lint break caused by #49402: oxlint's max-lines rule (300 non-blank, non-comment lines) failed on src/main/bots/bot-items-runtime.ts at 310, which breaks every open PR's static analysis job.

ELI5

One file got a little too long for the lint rule. This PR moves one self-contained chunk, the code that turns stored bot items into what the UI shows, into its own file. Nothing behaves differently.

Files Added Deleted Net
Test 0 0 0 0
Prod 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​78 $\color{#cf222e}{\Huge{\mathbf{−}}}$​59 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​19

What Changed

  • New src/main/bots/bot-item-views.ts holds botItemViewsFromRows (previously the private BotItemsHost.viewsFromRows method). The body is moved verbatim. this.join, this.deps.bots() and this.owningChat(item) become deps.join, deps.bots() and deps.owningChat(item) through a small BotItemViewDeps object.
  • BotItemsHost.views and BotItemsHost.showView now call botItemViewsFromRows(this.viewDeps(), ...). The new private viewDeps() passes the same join, bots and owning-chat lookups. bots is still read lazily after the worker read, the same as before.
  • The imports that only the moved code used (botItemEventId, botItemQuestionView) moved with it.
  • No public symbols were renamed or removed. BotItemsHost, BotItemsHostDeps and warn still come from bot-items-runtime, so no importers changed.

Line counts for bot-items-runtime.ts (counted the way the lint rule counts them):

  • Before: 368 raw lines, 310 counted
  • After: 328 raw lines, 269 counted (31 lines under the limit)

Why

main fails pnpm exec oxlint on this file, so every PR's static analysis job fails. This brings the file back under the limit without disabling the rule or changing behavior.

Verification

  • pnpm exec oxlint src/main/bots: clean
  • pnpm exec oxfmt --check on both touched files: clean
  • pnpm run typecheck:node: passes
  • pnpm exec vitest run src/main/bots: bot-items-runtime.test.ts and the other bots suites pass. The only failures are in sharing/bot-package-archive.test.ts, which fails the same way on unmodified origin/main in this environment because no system keyring is available.

Also fixes: stale item menu keys (from #51485)

#51417 moved bots.items.menu.cancel/done to bots.items.row.*, but the fr/es/ja/zh-Hant translation PRs merged with the old keys, so verify-localization-catalogs.mjs fails on main with extra keys. This PR removes the stale pair from those 4 locales and carries each locale's existing Cancel translation over to bots.items.row.cancel. The two fixes share one PR because each would fail CI on the other's break.

Performance

No runtime change. The refactor is a pure move: botItemViewsFromRows runs the same code, plus one small deps object per views/showView call, which is negligible next to the store reads it wraps. The locale change only edits keys. No new I/O, polling, subscriptions or hot-path work.

@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds botItemViewsFromRows to build BotItem views from item records and remote view rows. It moves view assembly out of bot-items-runtime.ts. The runtime now supplies the converter’s dependencies and uses it for views and showView. Summary mode sets the description, doneMeans, and closeNote fields to null. The Spanish, French, Japanese, and Traditional Chinese translations update bot-item cancel and done labels.

Merge Risk: Minimal · up to a1e6a

This is a behavior-preserving refactor with small translation label moves. No actionable merge risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
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.
Title check Passed The title names the main change: a refactor that splits bot-items-runtime to restore the lint check, plus removing stale item menu locale keys. It is specific and matches the changeset, though it is l…
Description check Passed The description follows the repository template closely. It has the ELI5, What Changed, Why, Verification, Performance, and a concrete line-count breakdown. Several template sections are missing or un…
Full details: Title check

Explanation

The title names the main change: a refactor that splits bot-items-runtime to restore the lint check, plus removing stale item menu locale keys. It is specific and matches the changeset, though it is long at 101 characters and bundles two fixes.

Full details: Description check

Explanation

The description follows the repository template closely. It has the ELI5, What Changed, Why, Verification, Performance, and a concrete line-count breakdown. Several template sections are missing or unfilled: the Linked Issue section has no 'Fixes #' issue reference, the Visual Proof section is absent, the Testing checkboxes are unchecked, the Risk section has no Level value, and the AI Disclosure and Review sections are empty. The description is mostly complete, so the check passes, but these gaps should be closed before merge.

Resolution

Add a linked issue (or confirm one exists) in the Linked Issue section, state the Visual Proof as N/A with a reason since the locale changes alter visible labels only in a non-behavioral way, fill in the Risk Level (Low appears appropriate for a pure move), and complete the Testing checkboxes or note which were not run.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7cc04acd-4236-4ce6-bbe0-7c03f8468e6d
Commits

Reviewing files that changed from the base of the PR and between 3cc8a74 and a1e6a26.

Files selected for processing: 4

  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/zh-Hant.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

…main

#51417 moved bots.items.menu.cancel/done to bots.items.row.*, while the
fr/es/ja/zh-Hant desktop translation PRs merged with the old keys. The
catalog verifier now fails on main with 'extra' keys. Remove the stale
pair and carry each locale's existing Cancel translation to
bots.items.row.cancel.
@nwparker nwparker changed the title fix(bots): split bot-items-runtime to restore the max-lines lint on main fix: restore main's lint and localization checks (split bot-items-runtime, drop stale item menu keys) Nov 28, 2026
@nwparker
nwparker merged commit 420b0cd into main Nov 28, 2026
55 of 56 checks passed
@nwparker
nwparker deleted the bugbash/fix-main-bot-items-runtime-lines branch November 28, 2026 05:20
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