Skip to content

fix: 深度代码审查修复(6个issue)#15

Merged
GeziP merged 15 commits into
mainfrom
fix/code-review-fixes
May 7, 2026
Merged

fix: 深度代码审查修复(6个issue)#15
GeziP merged 15 commits into
mainfrom
fix/code-review-fixes

Conversation

@GeziP

@GeziP GeziP commented May 6, 2026

Copy link
Copy Markdown
Owner

Summary

基于深度代码审查,修复了 6 个 issue,涵盖 Critical/Major/Minor 级别问题。

Changes

文件 修改
src/ui/logviewer.cpp/h 清除搜索状态、删除死代码、标签成员变量、搜索防抖、样式表作用域
src/core/logexporter.cpp/h 进度节流、错误检查、BOM 修正、流式 JSON、删除 escapeForJson
src/core/logentry.h 添加 operator==
src/core/logloader.cpp 错误信息包含文件路径
src/utils/languagemanager.h/cpp Qt signal 替代 std::function 回调
src/utils/appsettings.h/cpp unique_ptr 替代裸指针
src/main.cpp qRegisterMetaType 注册
LogReader.pro c++11 → c++17
tests/CMakeLists.txt target_include_directories
tests/test_logentry.cpp HH 格式、QElapsedTimer include

Test plan

  • 构建验证:CMake + qmake 均能编译通过
  • 功能验证:加载日志文件、过滤、搜索、导出 TXT/CSV/JSON
  • 语言切换:中英文切换后标签和菜单正确更新
  • 性能验证:大文件搜索不卡顿、导出进度条正常刷新
  • 测试套件:ctest --output-on-failure 全部通过

@codex @droid 请 review 代码变更,特别关注:

  1. 流式 JSON 输出的正确性
  2. LanguageManager signal 改造的线程安全性
  3. 搜索防抖的用户体验

🤖 Generated with Claude Code

GeziP and others added 6 commits May 6, 2026 13:56
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Remove dead code in logviewer.cpp/h: parseLogFile, filterLogs, displayLogs, searchInItem, clearHighlightsInItem, clearSearchHighlights
- Remove unused escapeForJson in logexporter.cpp/h
- Fix C++ standard from c++11 to c++17 in LogReader.pro
- Replace include_directories with target_include_directories in tests/CMakeLists.txt
- Add operator== to LogEntry struct
- Fix test timestamp format from hh:mm:ss to HH:mm:ss (24-hour)
- Add missing QElapsedTimer include in test_logentry.cpp
- Convert AppSettings raw pointer to std::unique_ptr<QSettings>
- Include file path in LogLoader error message
- Scope stylesheet from qApp to this window in logviewer.cpp

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 88b4a4d97e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/core/logexporter.cpp Outdated
Comment on lines +337 to +339
out << " " << QJsonDocument(QJsonValue(key)).toJson(QJsonDocument::Compact)
<< ": "
<< QJsonDocument(QJsonValue(value)).toJson(QJsonDocument::Compact);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Replace invalid QJsonDocument(QJsonValue) construction

The new JSON streaming path constructs QJsonDocument from QJsonValue when writing keys/values, but QJsonDocument only has constructors for QJsonObject/QJsonArray (plus copy/move), so this does not compile on supported Qt versions and blocks both qmake/CMake builds. This needs to use a valid escaping path (for example a QJsonObject/QJsonArray wrapper or another escaping API) instead of QJsonDocument(QJsonValue(...)).

Useful? React with 👍 / 👎.

GeziP and others added 2 commits May 6, 2026 14:45
Quality CI:
- clang-format 检查现在会真正阻断 CI(移除 || echo)
- clang-tidy 仅在发现 error 时失败(移除无条件 || true)
- 添加 -DENABLE_TESTING=ON,运行测试
- 移除 Windows 多余的 MinGW 安装
- Sanitizers 仅在 Ubuntu 运行(Windows ASan 不可靠)
- 移除 Sanitizers/Coverage 中重复的 clang-tidy
- 修复 Coverage 中无效的 --help 尝试
- 移除无效的 -DENABLE_CODE_COVERAGE=ON

Release CI:
- 统一 Qt 版本为 6.5.3
- 移除 continue-on-error,构建失败应阻断发布
- Windows 改用 MSVC/Ninja 替代过时的 MinGW 8.1.0
- 添加 -DENABLE_DEPLOY=ON 启用 windeployqt
- 修复 Windows 打包,正确收集 windeployqt 输出
- 移除与 CMake 冲突的单独 lrelease 调用

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
QJsonDocument has no constructor for QJsonValue, causing compilation
failure. Use QJsonArray wrapping + mid() for proper JSON string escaping.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 458340db02

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/ui/logviewer.cpp
Comment on lines 612 to 616
void LogViewer::onSearchTextChanged(const QString& text)
{
currentSearchText = text;
highlightSearchMatches();
searchDebounceTimer->start();
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Recompute search matches before using debounced results

onSearchTextChanged() now only starts a 200ms timer, so searchResults can remain stale while the user immediately triggers actions like export/navigation. In onExportSearchResults(), this can produce a false “no matches” message for text that is actually present if the button is clicked before the timer fires. Please force a synchronous refresh (or flush a pending debounce timer) before any logic that depends on searchResults.

Useful? React with 👍 / 👎.

GeziP and others added 4 commits May 6, 2026 15:03
- 统一 Qt 版本为 5.14.2
- macOS runner 改用 macos-13(Qt 5.14.2 无 ARM 预编译包)
- macOS 架构改为仅 x86_64(移除不兼容的 arm64)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
CI 环境无 X11 显示服务器,Qt 测试程序因 xcb 插件加载失败而
abort。设置 QT_QPA_PLATFORM=offscreen 使用离屏渲染。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Add flushSearchDebounce() that stops the pending timer and runs
highlightSearchMatches() synchronously. Called at the start of
onSearchPrevious(), onSearchNext(), and onExportSearchResults()
to prevent stale searchResults from being used.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
quality.yml:
- lint job: clang-format + cppcheck (continue-on-error, 不阻断)
- build job: Ubuntu + Windows 矩阵构建,Ninja 编译,offscreen 测试
- 移除不可靠的 sanitizers/coverage job
- 移除重复的 clang-tidy 运行

release.yml:
- 精简为 3 平台构建 + 统一发布 job
- 移除 continue-on-error
- macOS 使用 macos-13 (Qt 5.14.2 x86_64)
- 使用 Ninja 替代 MinGW/Make

同时修复 clang-format 格式违规。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c4c5638514

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/release.yml Outdated
needs: [build-windows, build-linux, build-macos]
if: always() && (needs.build-windows.result == 'success' || needs.build-linux.result == 'success' || needs.build-macos.result == 'success')

if: always() && !cancelled()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Restrict release publishing to successful build jobs

Gate the release job on at least one successful build result instead of if: always() && !cancelled(). In its current form, the publish step still runs after failed build jobs, and because fail_on_unmatched_files is false, a tag can produce a release without usable binaries when all platform builds fail.

Useful? React with 👍 / 👎.

Comment thread .github/workflows/quality.yml Outdated
lint:
name: Lint
runs-on: ubuntu-latest
continue-on-error: true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Make lint failures fail CI

Remove the non-blocking configuration for the lint job. With continue-on-error: true, lint failures do not fail the workflow, so formatting and static-analysis regressions can merge undetected even though this workflow is intended to enforce code quality.

Useful? React with 👍 / 👎.

GeziP and others added 3 commits May 6, 2026 15:52
- Windows Qt 显式指定 win64_msvc2017_64,避免链接 MinGW 库
- 移除 lint job 的 continue-on-error,格式违规阻断 CI
- release job 改为至少一个平台构建成功才发布
- 修复 logloader.cpp/h clang-format 违规

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Windows runner defaults to MinGW GCC which conflicts with
MSVC-built Qt libraries. Add ilammy/msvc-dev-cmd to both
quality.yml and release.yml to ensure Ninja uses cl.exe.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Ensures MSVC correctly parses Chinese characters in source files
regardless of system locale (code page).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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