Skip to content

fix: remove dead pre-check code and fix version parsing - #947

Merged
deepin-bot[bot] merged 2 commits into
linuxdeepin:masterfrom
add-uos:agent/pms-bug-bot/ad6a3b6d8152
Oct 30, 2026
Merged

deepin-bot[bot] merged 2 commits into
linuxdeepin:masterfrom
add-uos:agent/pms-bug-bot/ad6a3b6d8152

Conversation

@add-uos

@add-uos add-uos commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

fix: remove dead pre-check code and fix version parsing

  1. Root cause: checkDriverInfo(DriverInfo&) had a stale TODO comment
    at line 78; the logic it described is already implemented in the
    second overload checkDriverInfo(QString, DriverInfo&) via
    max==iLevel and isPkgInstalled checks
  2. Fix: remove the TODO comment and add an explanatory comment pointing
    to the existing implementation in the second overload; no new logic
    added to avoid dead code from unpopulated driverName/version fields
  3. Impact: no behavior change; function delegates to the same overload
    as before, now with clear documentation instead of a stale TODO

fix: 移除死代码预判断并修复版本号解析

  1. 根因:checkDriverInfo(DriverInfo&) L78 留有过期 TODO 注释,其描述
    的逻辑已在第二重载 checkDriverInfo(QString, DriverInfo&) 中实现

  2. 方案:移除 TODO 注释,添加说明性注释指向第二重载中的已有实现,
    不新增逻辑以避免使用从未赋值的 driverName/version 字段产生死代码

  3. 影响:无行为变化,函数委托至同一重载,仅以文档替代过期 TODO

  4. Root cause: getOsBuild() and getVersion() used split("=") which
    silently skipped lines whose value contained "=" (split produced
    more than 2 parts), returning empty string

  5. Fix: replace split("=") with section("=", 1).trimmed() in both
    getOsBuild() and getVersion() to correctly extract value after the
    first "=", add qCWarning for lines without "=" separator

  6. Impact: values containing "=" are now parsed correctly in both
    functions; abnormal lines produce warning logs for troubleshooting

  7. 根因:getOsBuild() 和 getVersion() 使用 split("=") 解析,当值含
    "=" 时产生超过 2 段导致行被静默跳过,返回空串

  8. 方案:将 getOsBuild() 和 getVersion() 中的 split("=") 改为
    section("=", 1).trimmed() 正确提取首个 "=" 后的完整值,对不含
    "=" 的异常行增加 qCWarning 日志

  9. 影响:两个函数中含 "=" 的值均能正确解析,异常行输出告警日志

Influence:

  1. Test driver check delegates to second overload as before
  2. Test OsBuild parsing with value containing "=" character
  3. Test getVersion with MajorVersion/MinorVersion value containing "="
  4. Test parsing with line missing "=" separator produces warning log

Influence:

  1. 测试驱动检查仍委托至第二重载
  2. 测试 OsBuild 值含 "=" 时的解析
  3. 测试 MajorVersion/MinorVersion 值含 "=" 时的解析
  4. 测试行缺少 "=" 分隔符时输出告警日志

Summary by Sourcery

Fix metadata parsing for values containing '=' and clarify the existing driver information check delegation.

Bug Fixes:

  • Correct OS build and version parsing when values contain additional '=' characters.
  • Emit warnings when OS build or version lines lack an '=' separator.

Enhancements:

  • Replace the stale driver-check TODO with documentation pointing to the existing installation-status and recommendation-level checks.

Chores:

  • Update the copyright year range in the HTTP driver interface.

@sourcery-ai

sourcery-ai Bot commented Oct 26, 2026

Copy link
Copy Markdown

Sorry @add-uos, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 1 day and 12 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Oct 26, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The PR removes misleading dead-code documentation from driver checking while preserving its existing delegation, and fixes metadata parsing by extracting values after the first '=' so embedded equals signs are retained; malformed matching lines now emit warnings.

Sequence diagram for driver info check delegation

sequenceDiagram
    participant Caller
    participant HttpDriverInterface
    Caller->>HttpDriverInterface: checkDriverInfo(driverInfo)
    HttpDriverInterface->>HttpDriverInterface: checkDriverInfo(strJson, driverInfo)
    HttpDriverInterface-->>Caller: return existing check result
Loading

File-Level Changes

Change Details Files
Clarified that driver validation remains delegated to the existing overload, removing a stale TODO without changing behavior.
  • Replaced the misleading TODO with a comment documenting where installation-status and recommendation-level checks are implemented.
  • Preserved the existing overload call and validation flow.
deepin-devicemanager-server/deepin-devicecontrol/src/drivercontrol/httpdriverinterface.cpp
Updated OS build and version parsing to preserve values containing additional equals signs and report malformed input.
  • Replaced exact two-part splitting with extraction after the first '=' for OsBuild, MajorVersion, and MinorVersion.
  • Added warnings and skip behavior for matching lines without an '=' separator.
deepin-devicemanager-server/deepin-devicecontrol/src/drivercontrol/utils.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@add-uos
add-uos force-pushed the agent/pms-bug-bot/ad6a3b6d8152 branch from f176eb7 to 4737cdd Compare October 27, 2026 03:44
@deepin-bot

deepin-bot Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 6.0.75
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #956

1. Root cause: checkDriverInfo(DriverInfo&) had a stale TODO comment
   at line 78; the logic it described is already implemented in the
   second overload checkDriverInfo(QString, DriverInfo&) via
   max==iLevel and isPkgInstalled checks
2. Fix: remove the TODO comment and add an explanatory comment pointing
   to the existing implementation in the second overload; no new logic
   added to avoid dead code from unpopulated driverName/version fields
3. Impact: no behavior change; function delegates to the same overload
   as before, now with clear documentation instead of a stale TODO

fix: 移除死代码预判断并修复版本号解析

1. 根因:checkDriverInfo(DriverInfo&) L78 留有过期 TODO 注释,其描述
   的逻辑已在第二重载 checkDriverInfo(QString, DriverInfo&) 中实现
2. 方案:移除 TODO 注释,添加说明性注释指向第二重载中的已有实现,
   不新增逻辑以避免使用从未赋值的 driverName/version 字段产生死代码
3. 影响:无行为变化,函数委托至同一重载,仅以文档替代过期 TODO

1. Root cause: getOsBuild() and getVersion() used split("=") which
   silently skipped lines whose value contained "=" (split produced
   more than 2 parts), returning empty string
2. Fix: replace split("=") with section("=", 1).trimmed() in both
   getOsBuild() and getVersion() to correctly extract value after the
   first "=", add qCWarning for lines without "=" separator
3. Impact: values containing "=" are now parsed correctly in both
   functions; abnormal lines produce warning logs for troubleshooting

1. 根因:getOsBuild() 和 getVersion() 使用 split("=") 解析,当值含
   "=" 时产生超过 2 段导致行被静默跳过,返回空串
2. 方案:将 getOsBuild() 和 getVersion() 中的 split("=") 改为
   section("=", 1).trimmed() 正确提取首个 "=" 后的完整值,对不含
   "=" 的异常行增加 qCWarning 日志
3. 影响:两个函数中含 "=" 的值均能正确解析,异常行输出告警日志

Influence:
1. Test driver check delegates to second overload as before
2. Test OsBuild parsing with value containing "=" character
3. Test getVersion with MajorVersion/MinorVersion value containing "="
4. Test parsing with line missing "=" separator produces warning log

Influence:
1. 测试驱动检查仍委托至第二重载
2. 测试 OsBuild 值含 "=" 时的解析
3. 测试 MajorVersion/MinorVersion 值含 "=" 时的解析
4. 测试行缺少 "=" 分隔符时输出告警日志
The license-check CI (SPDX Header Validation) flags source files whose
copyright year range no longer ends with the current year. Extend the
SPDX-FileCopyrightText range of httpdriverinterface.cpp from 2019 ~ 2023
to cover 2026 so the SPDX summary reports 0 failures for this PR.
@add-uos
add-uos force-pushed the agent/pms-bug-bot/ad6a3b6d8152 branch from 4737cdd to 52632ae Compare October 30, 2026 01:05
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: add-uos, lzwind

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@add-uos

add-uos commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

This pr force merged! (status: unstable)

@deepin-bot
deepin-bot Bot merged commit 52b6738 into linuxdeepin:master Oct 30, 2026
16 of 17 checks passed
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.

3 participants