Skip to content

feat: expose recursive DConfig subpaths in daemon and clients - #178

Closed
18202781743 wants to merge 1 commit into
linuxdeepin:masterfrom
18202781743:recursive-config-subpaths
Closed

18202781743 wants to merge 1 commit into
linuxdeepin:masterfrom
18202781743:recursive-config-subpaths

Conversation

@18202781743

@18202781743 18202781743 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

DConfig Manager 提供递归 subpaths 属性和变更通知。属性合并 override、全局缓存和当前用户缓存中的路径,返回相对于当前连接起点的结果。

  • dde-dconfig list 支持按资源和起点查询,Bash 和 Zsh 补全从资源根查询。
  • 编辑器在打开应用和重新选中资源时刷新子路径。
  • 同步更新 D-Bus 接口、现有使用手册的子路径用法、示例和单元测试。

递归枚举依赖配套的 linuxdeepin/dtkcore#602。本 PR 汇总 #177 中的 Manager 功能和客户端适配,直接以 master 为基线。

PMS TASK-398893

Qt 6 构建通过,CTest 207 项通过、6 项跳过,Bash 和 Zsh 补全脚本通过语法检查。

Summary by Sourcery

Expose recursive configuration subpaths and their change notifications across the daemon, command-line client, completions, editor, documentation, examples, and tests.

New Features:

  • Expose recursively discovered subpaths through the D-Bus manager interface, including change notifications and connection-relative results.
  • Extend dde-dconfig list and shell completions to query and complete subpaths by resource, starting path, and user.
  • Refresh and display discovered subpaths in the configuration editor, including nested user-cache paths.

Bug Fixes:

  • Preserve leading-slash subpath identifiers consistently across metadata and override configuration paths.

Enhancements:

  • Merge subpaths from installed overrides, global cache, and current-user cache while deduplicating and sorting results.
  • Add an example for reading and monitoring subpath changes over D-Bus.

Build:

  • Enable Qt DBus and automatic MOC generation for the example application.

Documentation:

  • Document recursive subpath listing, completion behavior, editor discovery, and the updated D-Bus property and signal.

Tests:

  • Add coverage for nested subpath enumeration, override changes, user-cache notifications, and global-cache refreshes.

@18202781743
18202781743 requested review from BLumia and mhduiy November 25, 2026 08:55
@sourcery-ai

sourcery-ai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Data structures

Normalize nested metadata and override subpaths to the shared leading-slash representation used by recursive enumeration.

  • dconfig-center/dde-dconfig-daemon/dconfig_global.h L96-102, L118, L145

API

Expose the read-only Manager subpaths property and its change signal in the D-Bus contract and connection object.

  • dconfig-center/dde-dconfig-daemon/dconfigconn.h L1-82 (5 small edits)
  • dconfig-center/dde-dconfig-daemon/services/org.desktopspec.ConfigManager.Manager.xml L4, L45

Add subpath retrieval to the configuration getter abstraction used by clients.

  • dconfig-center/common/valuehandler.h L9, L17

Extend dde-dconfig list with resource and starting-subpath queries for discovered paths.

  • dconfig-center/dde-dconfig/completion/dde-dconfig.bash L146-166, L210, L234
  • dconfig-center/dde-dconfig/completion/dde-dconfig.zsh L142-156, L352-355 (+3 small edits)
  • dconfig-center/dde-dconfig/main.cpp L172-179, L208-248 (+4 small edits)

Uses of the API

Read subpaths through the configuration getter so command-line clients can enumerate paths from the Manager.

  • dconfig-center/common/valuehandler.cpp L32-40, L181-185 (+2 small edits)

Use discovered subpaths to refresh the editor’s resource tree when opening an app or reselecting a resource.

  • dconfig-center/dde-dconfig-editor/mainwindow.cpp L252-256, L518-521, L529-548 (+4 small edits)
  • dconfig-center/dde-dconfig-editor/mainwindow.h L60-61, L117 (removed lines), L126-127

Add an example mode that reads the initial subpaths property and watches for updates over D-Bus.

  • dconfig-center/example/main.cpp L157-201, L206-211, L219-229 (+1 small edits)

Implementation

Calculate each connection’s recursive subpaths and emit D-Bus property notifications when that list changes.

  • dconfig-center/dde-dconfig-daemon/dconfigconn.cpp L1, L20-21, L61-114

Expose resource-local prefix and notify its connections when subpath sources change.

  • dconfig-center/dde-dconfig-daemon/dconfigresource.cpp L502-514 (+6 small edits)
  • dconfig-center/dde-dconfig-daemon/dconfigresource.h L1, L57-64

Refresh affected connections after cache synchronization and reloads, including refreshing all connections for global-cache updates.

  • dconfig-center/dde-dconfig-daemon/dconfigserver.cpp L376-395, L658-665 (+4 small edits)
  • dconfig-center/dde-dconfig-daemon/dconfigserver.h L1, L118-119

Configuration

Enable Qt DBus and automatic MOC support required by the example’s monitoring mode.

  • dconfig-center/example/CMakeLists.txt L5, L10-12, L20

Documentation

Document recursive subpath queries, shell completion, editor discovery, and the Manager property and signal.

  • dconfig-center/docs/DtkConfig.zh_CN.md L303-310, L315-316, L338-339
  • dconfig-center/docs/org.desktopspec.ConfigManager.Manager.xml L6-8, L87-89

Tests

Verify normalized nested path parsing and recursive enumeration, plus change notifications for overrides and cache synchronization.

  • dconfig-center/tests/ut_dconfig_global.cpp L154, L177-185
  • dconfig-center/tests/ut_dconfigserver.cpp L116-251

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

@sourcery-ai sourcery-ai 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.

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="dconfig-center/dde-dconfig-daemon/dconfigconn.cpp" line_range="84" />
<code_context>
     result << meta()->subpaths(localPrefix);

     // Global cache subpaths (global shared)
-    result << file()->globalCache()->subpathList(localPrefix);
</code_context>
<issue_to_address>
**Other users’ paths are exposed**

When an unprivileged local D-Bus caller requests a manager for another existing user’s UID and reads `subpaths`, `DSGConfigConn::subpaths()` includes the selected UID’s cache paths without calling `hasPermissionByUid`; the caller can read recursive subpath names from another user’s manager object.

Restrict cross-UID manager acquisition or enforce the caller-UID check before returning per-user subpaths.
</issue_to_address>

### Comment 2
<location path="dconfig-center/dde-dconfig-daemon/services/org.desktopspec.ConfigManager.Manager.xml" line_range="4" />
<code_context>
     <property access="read" type="s" name="version"/>
     <property access="read" type="as" name="keyList"/>
-    <property access="read" type="as" name="subpathList"/>
+    <property access="read" type="as" name="subpaths"/>
     <method name='value'>
       <arg type='s' name='key' direction='in'/>
</code_context>
<issue_to_address>
**Older clients lose subpath access**

When an older client remains during a staggered upgrade and reads `subpathList` or subscribes to `subpathListChanged`, the Manager interface exports only `subpaths` and `subpathsChanged`, with no compatibility alias, so reads of `subpathList` fail with `UnknownProperty` and subscriptions to `subpathListChanged` receive no updates; existing clients lose subpath data and change notifications.

Keep compatibility aliases for the old property and signal on the Manager interface.

Also at `dconfig-center/dde-dconfig-daemon/services/org.desktopspec.ConfigManager.Manager.xml:45`.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

// Current user cache subpaths (per-user)
result << cache()->subpathList(localPrefix);
result << cache()->subpaths(localPrefix);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Other users’ paths are exposed

When an unprivileged local D-Bus caller requests a manager for another existing user’s UID and reads subpaths, DSGConfigConn::subpaths() includes the selected UID’s cache paths without calling hasPermissionByUid; the caller can read recursive subpath names from another user’s manager object.

Restrict cross-UID manager acquisition or enforce the caller-UID check before returning per-user subpaths.

Prompt for AI agents
In `dconfig-center/dde-dconfig-daemon/dconfigconn.cpp` at line 84:

**Other users’ paths are exposed**

When an unprivileged local D-Bus caller requests a manager for another existing user’s UID and reads `subpaths`, `DSGConfigConn::subpaths()` includes the selected UID’s cache paths without calling `hasPermissionByUid`; the caller can read recursive subpath names from another user’s manager object.

Restrict cross-UID manager acquisition or enforce the caller-UID check before returning per-user subpaths.

@18202781743
18202781743 marked this pull request as draft November 25, 2026 09:46
@18202781743
18202781743 force-pushed the recursive-config-subpaths branch from ff1e9c6 to 884f755 Compare November 26, 2026 09:52
@18202781743 18202781743 changed the title feat: expose recursive subpaths on the DConfig Manager interface feat: expose recursive DConfig subpaths in daemon and clients Nov 26, 2026
@18202781743
18202781743 changed the base branch from agent/developer/cb163ff66d48 to master November 26, 2026 09:52
The Manager now provides a read-only subpaths property that reports
recursively discovered subpaths and emits change notifications when they
update. The CLI, shell completion, and editor consume this property to
discover subpaths instead of relying on the leading slash alone.

feat: 在守护进程和客户端中暴露递归 DConfig 子路径

Manager 现在提供只读的 subpaths 属性,用于报告递归发现的子路径,并在更新
时发出变更通知。CLI、Shell 补全和编辑器使用该属性来发现子路径,而不再仅
依赖开头的斜杠。

PMS: TASK-398893
@18202781743
18202781743 force-pushed the recursive-config-subpaths branch from 884f755 to afc1b3e Compare November 26, 2026 10:50
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743

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

@18202781743

Copy link
Copy Markdown
Contributor Author

#177

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.

2 participants