Skip to content

fix: correct m_Version to m_Capabilities in PCI - #848

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
add-uos:agent/bug/97c6cf56708f
Oct 24, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
add-uos:agent/bug/97c6cf56708f

Conversation

@add-uos

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

Copy link
Copy Markdown
Contributor

fix: correct m_Version to m_Capabilities in PCI

  1. Root cause: DeviceOtherPCI setTomlAttribute and
    loadOtherDeviceInfo used m_Version instead of m_Capabilities
    due to copy-paste error
  2. Fix: replace m_Version with m_Capabilities at lines 39 and 102
  3. Impact: PCI device Capabilities now correctly reads and
    displays the field instead of Version

Log: Fix PCI device Capabilities showing Version value

Influence:

  1. Verify PCI device Capabilities field displays correct value
  2. Verify PCI device Version field is unaffected
  3. Test with PCI devices having both Version and Capabilities

fix: 修复PCI设备Capabilities误用m_Version的问题

  1. 根因:DeviceOtherPCI的setTomlAttribute和loadOtherDeviceInfo
    因copy-paste错误使用了m_Version而非m_Capabilities
  2. 方案:将第39行和第102行的m_Version改为m_Capabilities
  3. 影响:PCI设备Capabilities字段现在正确读取和显示,Version字段不受影响

Log: 修复PCI设备Capabilities显示Version值的问题

Influence:

  1. 验证PCI设备Capabilities字段显示正确值
  2. 验证PCI设备Version字段不受影响
  3. 测试同时具有Version和Capabilities的PCI设备

Summary by Sourcery

Fix PCI device information mapping so Capabilities is reported independently from Version.

Bug Fixes:

  • Correct PCI device Capabilities handling so it reads and displays the Capabilities value instead of the Version value.

Chores:

  • Update the PCI source file copyright range.

@sourcery-ai

sourcery-ai Bot commented Oct 22, 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 5 days and 12 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Oct 22, 2026

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

Reviewer's Guide

Fixes a copy-paste error in PCI device information handling so the Capabilities field consistently reads from m_Capabilities instead of m_Version, while preserving Version behavior.

File-Level Changes

Change Details Files
Correct PCI Capabilities serialization and display to use the dedicated capabilities member.
  • Use m_Capabilities when writing the Capabilities TOML attribute.
  • Use m_Capabilities when adding Capabilities to the displayed device information.
  • Leave Version handling unchanged, preventing cross-field value substitution.
deepin-devicemanager/src/DeviceManager/DeviceOtherPCI.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

lzwind
lzwind previously approved these changes Oct 24, 2026
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 100 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次提交修复了 PCI 设备信息中 Capabilities 字段错误使用 m_Version 变量的问题, 将其更正为 m_Capabilities。变更范围小且精准,涉及两处调用点的变量名修正, 语法正确、逻辑清晰,无安全漏洞,无性能影响。OCR 审查与启发式扫描均未发现问题。

🔍 详细分析

1. 语法逻辑 ✅

评价: 语法正确,逻辑清晰 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


2. 代码质量 ✅

评价: 代码结构清晰,注释完整 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


3. 代码性能 ✅

评价: 性能良好,资源使用合理 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


4. 代码安全 🔒

评价: 存在0个安全漏洞 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: []


💡 改进建议代码示例

// 修复已正确应用,无需额外修改。 // setInfoFromTomlOneByOne() 中: //   ret = setTomlAttribute(mapInfo, "Capabilities", m_Capabilities); // loadOtherDeviceInfo() 中: //   addOtherDeviceInfo("Capabilities", m_Capabilities);

本报告由 AI 代码审查工具自动生成

1. Root cause: DeviceOtherPCI setTomlAttribute and
   loadOtherDeviceInfo used m_Version instead of m_Capabilities
   due to copy-paste error
2. Fix: replace m_Version with m_Capabilities at lines 39 and 102
3. Impact: PCI device Capabilities now correctly reads and
   displays the field instead of Version

Log: Fix PCI device Capabilities showing Version value

Influence:
1. Verify PCI device Capabilities field displays correct value
2. Verify PCI device Version field is unaffected
3. Test with PCI devices having both Version and Capabilities

fix: 修复PCI设备Capabilities误用m_Version的问题

1. 根因:DeviceOtherPCI的setTomlAttribute和loadOtherDeviceInfo
   因copy-paste错误使用了m_Version而非m_Capabilities
2. 方案:将第39行和第102行的m_Version改为m_Capabilities
3. 影响:PCI设备Capabilities字段现在正确读取和显示,Version字段不受影响

Log: 修复PCI设备Capabilities显示Version值的问题

Influence:
1. 验证PCI设备Capabilities字段显示正确值
2. 验证PCI设备Version字段不受影响
3. 测试同时具有Version和Capabilities的PCI设备
@add-uos
add-uos force-pushed the agent/bug/97c6cf56708f branch from 8e03c3b to 43040d8 Compare October 24, 2026 07:07
@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 24, 2026

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

This pr force merged! (status: unstable)

@deepin-bot
deepin-bot Bot merged commit a684f10 into linuxdeepin:master Oct 24, 2026
13 of 17 checks passed
deepin-bot Bot pushed a commit that referenced this pull request Oct 24, 2026
Follow-up to PR #901. Upstream a684f10 (PR #848) fixed
DEF-DM-OTHERPCI-CAPABILITIES-VERSION: "Capabilities" now writes and
displays m_Capabilities instead of m_Version. Align the 4 affected
cases in ut_deviceotherpci.cpp with the fixed behavior; 84/84 pass.

Log: 缺陷修复后对齐 DeviceOtherPCI 测试断言
Influence: 仅测试代码, 不影响业务逻辑
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