chore: Bundle A+B (去重 + 工具链升级 + CI 硬门禁 + 配置卫生)#60
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
该 PR 主要聚焦于工具链/依赖升级、CI 质量门禁落地(Vitest 覆盖率阈值在 CI 强制执行)、以及一些配置与前端代码的卫生/复用改造(如主题判断与 augment 稀有度样式抽离),整体不涉及业务逻辑变更。
Changes:
- 前端:Vitest 覆盖率阈值下调到当前基线并在 CI 中改跑
test:coverage;清理无用 TS path alias;新增子项目.gitignore;ESLint 开启no-explicit-any(warn)。 - 前端:主题暗色判断统一改用
useTheme();augment 稀有度样式 class 逻辑抽到utils/augment;修复/规避卸载后定时器回调写响应式状态(tracked timers)。 - Rust/Tauri:升级
env_logger到 0.11;移除tauri.conf.json的不安全传输配置;Windows token 解析正则改为静态编译以减少重复开销。
Reviewed changes
Copilot reviewed 17 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| lol-record-analysis-tauri/vitest.config.ts | 调整覆盖率阈值为基线并补充说明注释 |
| lol-record-analysis-tauri/tsconfig.json | 移除未使用的 path alias 配置 |
| lol-record-analysis-tauri/src/views/settings/Automation.vue | 移除调试 console.log |
| lol-record-analysis-tauri/src/pinia/setting.ts | 主题读写从直调 invoke 改为走 IPC service 封装 |
| lol-record-analysis-tauri/src/composables/useSessionSync.ts | 引入 tracked setTimeout,卸载时清理 pending timers |
| lol-record-analysis-tauri/src/components/record/RecordCard.vue | 主题判断改用 useTheme;augment 稀有度 class 复用工具函数 |
| lol-record-analysis-tauri/src/components/record/MatchHistory.vue | route.query.name 改为 computed;分页/筛选调用统一使用 name.value |
| lol-record-analysis-tauri/src/components/record/MatchDetailModal.vue | 主题判断改用 useTheme(并复用 augment 稀有度 class 工具) |
| lol-record-analysis-tauri/src/components/gaming/PlayerCard.vue | 主题判断改用 useTheme |
| lol-record-analysis-tauri/src/App.vue | 主题判断改用 useTheme |
| lol-record-analysis-tauri/src-tauri/tauri.conf.json | 移除 dangerousInsecureTransportProtocol 配置 |
| lol-record-analysis-tauri/src-tauri/src/lcu/util/token.rs | Regex::new 改为 LazyLock 静态缓存,避免重复编译 |
| lol-record-analysis-tauri/src-tauri/Cargo.toml | env_logger 升级到 0.11 |
| lol-record-analysis-tauri/src-tauri/Cargo.lock | 锁文件随依赖升级更新(移除 atty 等,引入 jiff/anstream 等) |
| lol-record-analysis-tauri/package.json | @tauri-apps/plugin-opener 从 alpha 升级到 ^2 |
| lol-record-analysis-tauri/package-lock.json | 同步 opener 版本变更 |
| lol-record-analysis-tauri/.gitignore | 新增 dist/coverage 等忽略项(子项目级) |
| lol-record-analysis-tauri/.eslintrc.cjs | 启用 @typescript-eslint/no-explicit-any: warn |
| .github/workflows/quality-checks.yml | 前端 CI 改跑 npm run test:coverage 以强制覆盖率阈值 |
Files not reviewed (1)
- lol-record-analysis-tauri/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)
lol-record-analysis-tauri/src/components/record/MatchHistory.vue:93
- 这里仍从
../type导入championOption,但该文件已标注为@deprecated(建议改为从@renderer/types/domain/champion导入)。既然本次已改动该文件的 imports/逻辑,建议顺手替换掉以避免继续传播弃用入口。
import { computed, onMounted, provide, ref, watch } from 'vue'
import { useLoadingBar } from 'naive-ui'
import { useRoute } from 'vue-router'
import { renderSingleSelectTag, renderLabel, filterChampionFunc } from '../composition'
import { modeOptions, initModeOptions } from './composition'
import { invoke } from '@tauri-apps/api/core'
import { championOption } from '../type'
import type { Game, MatchHistory } from './match'
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| async function initTheme() { | ||
| try { | ||
| const savedTheme = await invoke<string>('get_config', { key: 'theme' }) | ||
| const savedTheme = await getConfigByIpc<string>('theme') |
added 2 commits
May 17, 2026 00:48
- isDark x4: App / PlayerCard / MatchDetailModal / RecordCard 改用 useTheme()
composable,删除各自本地的 isDark computed 与不再用的 settingsStore 引用。
- RecordCard: augmentRarityClass 改调 utils/augment.ts 的通用版(与
MatchDetailModal 对齐),删除本地副本。
- pinia/setting.ts: initTheme/toggleTheme 走 services/ipc.ts 的
get/putConfigByIpc 封装。顺手修复 initTheme 之前用裸 invoke<string>
接收 ConfigValue<string> 包装的隐藏 bug——之前 savedTheme 永远是
{ value: '...' } 对象,与字符串比较恒为 false,导致 light 模式启动后
仍被回退为 dark。
- Automation.vue: 删调试遗漏的 console.log('addPickData', value)。
- MatchHistory.vue: 合并两个 onMounted;模块级 `let name = ''` 改为
computed(() => route.query.name),消除路由变更不重渲染时的过期值风险。
- useSessionSync: setTimeout 改走 trackedSetTimeout,onUnmounted 中
clearTimeout 所有未触发的 timer,避免组件卸载后写已销毁的响应式状态。
- token.rs: auth_resolver 的 Regex 抽到 static LazyLock,避免每次
LCU 认证失败重试时重复编译正则。
依赖: - env_logger 0.9 → 0.11:移除间接依赖 atty 0.2 (GHSA-g98v-hv3f-hcfr)。 0.11 默认 features 仍含 humantime(由 jiff 实现),timestamp_millis() API 保持兼容。Cargo.lock 同步刷新。 - @tauri-apps/plugin-opener "^2.0.0-alpha.3" → "^2":从 alpha 锁出, 跟随上游 stable 2.x。package-lock.json 同步刷新。 CI 硬门禁: - quality-checks.yml: `npm run test` → `npm run test:coverage`。 之前 vitest.config.ts 设了 80% threshold 但 CI 没跑 --coverage, 导致 threshold 形同虚设。 - vitest.config.ts: threshold 调整为当前 floor (lines/statements 15、 functions 45、branches 73) ——做"无回归基线",禁止 PR 把覆盖率推下来。 CLAUDE.md 中 80% 仍为长期目标,靠后续添加测试逐步抬升。 配置卫生: - tsconfig.json: 删除从未引用的 @components/@utils path alias (全代码库 grep 0 hits)。 - .eslintrc.cjs: 启用 @typescript-eslint/no-explicit-any 为 warn。 CODE_QUALITY.md 早有"禁用 any"约定但未规则化。当前 91 处 warning, 待后续按文件逐步治理后再升 error。 - tauri.conf.json: 删除 dangerousInsecureTransportProtocol。两条 updater endpoint 都已是 https://,这个标志当前实际无明文流量, 但留着等于给未来挖坑。 - lol-record-analysis-tauri/.gitignore: 新建(仓库缺失)。忽略 dist/、 coverage/、IDE/OS 杂项。本 PR 启用 coverage 生成后必须 ignore,否则 污染开发树。
be198af to
feaf554
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
整体 review 的 Bundle A + B 合并 PR。已 rebase 到当前 main(包含已合并的 #58 / #61),原 PR #59 内容并入此 PR,#59 将被关闭。
Bundle A — 去重 + 修小漏洞(commit
0bdb2b5)isDark×4 →useTheme():App.vue / PlayerCard.vue / MatchDetailModal.vue / RecordCard.vue 各自复制了一份computed(() => theme.name === 'Dark'|'dark'),统一调用composables/useTheme.ts(已被useTheme.spec.ts覆盖)。augmentRarityClass去重:RecordCard.vue 私有版本删除,统一调utils/augment.ts的通用版(与 MatchDetailModal 对齐)。pinia/setting.ts:经 rebase 到 main,已与 refactor: 统一 config IPC 格式为 { value: T } 包装 #61 的 helper 改造对齐,原 refactor: 去重 + 修小漏洞集合 (Bundle A) #59 中的"bug fix"在 refactor: 统一 config IPC 格式为 { value: T } 包装 #61 已实现,此处仅保留 import 和调用形式。Automation.vue:删除调试遗漏的console.log('addPickData', value)。MatchHistory.vue:两个onMounted合并;模块级let name = ''→computed(() => route.query.name),避免路由变更未重渲染时拿到过期值;championOption导入路径从 deprecated'../type'改成 canonical@renderer/types/domain/champion。useSessionSync:retry 路径的setTimeout引入trackedSetTimeout+pendingTimersSet,onUnmounted时clearTimeout所有未触发的 timer,避免组件卸载后写已销毁响应式状态。token.rs:auth_resolver:内联Regex::new(...)抽到static AUTH_REGEX: LazyLock<Regex>,LCU 认证重试时不再重复编译。Bundle B — 工具链 + CI + 配置卫生(commit
feaf554)依赖升级(移除 GHSA)
env_logger 0.9 → 0.11:间接依赖atty 0.2.14有 GHSA-g98v-hv3f-hcfr (Windows unsound),0.11 完全移除。Cargo.lock同步:atty/hermit-abi 0.1/humantime/termcolor全部摘除,新加jiff系作为时间格式化后端。main.rs里的buf.timestamp_millis()API 不变。@tauri-apps/plugin-opener "^2.0.0-alpha.3" → "^2":之前一直锁在 alpha,永远不会升 stable 2.x。CI 硬门禁
vitest.config.ts写了 80% threshold 但 CI 跑npm run test(不带--coverage),threshold 形同虚设。npm run test:coverage,threshold 真正生效。配置卫生
tsconfig.json:删@components/@utilspath alias(grep 整个 src 0 hits,dead config)。.eslintrc.cjs:启用@typescript-eslint/no-explicit-any: warn。CODE_QUALITY.md 早就禁 any 但没规则化。当前 91 处 warning,warn 级别不阻塞 CI,留作后续逐文件治理。tauri.conf.json:删dangerousInsecureTransportProtocol: true。两条 updater endpoint 都已 https://,flag 当前没有实际明文流量,但留着等于给未来挖坑。lol-record-analysis-tauri/.gitignore:仓库之前没这个文件(只有src-tauri/.gitignore),dist/和coverage/都不在任何 ignore 范围。启用 coverage 生成后必须 ignore。Rebase 备注
原 #59 / #60 都基于 #58 之前的 main,与已合并的 #58 (token.rs AtomicU32 + markdown-it html:false) 和 #61 (config IPC 包装) 有冲突。本次 rebase 后:
token.rs的 LazyLock import 与 fix(security): close CUR_PID data race and disable markdown-it raw HTML #58 的 atomic import 并列,AtomicU32 改造 + AUTH_REGEX 都保留。pinia/setting.ts自动 merge 到 refactor: 统一 config IPC 格式为 { value: T } 包装 #61 的版本(功能完全等价,refactor: 去重 + 修小漏洞集合 (Bundle A) #59 内的"bug fix"已被 refactor: 统一 config IPC 格式为 { value: T } 包装 #61 的强切设计取代)。Automation.vue自动 merge:保留 refactor: 统一 config IPC 格式为 { value: T } 包装 #61 的?? false / ?? []defaults + 裸值写入 + Bundle A 删除的 console.log。Test plan
npm run check✓ 0 errors / 91no-explicit-anywarnings(预期)npm run test✓ 12/12 suites pass,219 tests passtimestamp_millis()在 0.11 仍存在)test:coveragegatesecurity-auditjob 跑cargo audit后 atty GHSA 告警消失npm run tauri dev启动正常(plugin-opener 升级不影响 IPC;主题切换 / 战绩场数 / Automation 开关 / Pick-Ban 规则 / UserRecord 模式持久化均正常)