Skip to content

feat: add subpath list support to dde-dconfig-daemon - #601

Closed
18202781743 wants to merge 4 commits into
masterfrom
agent/developer/5f479c18869e
Closed

18202781743 wants to merge 4 commits into
masterfrom
agent/developer/5f479c18869e

Conversation

@18202781743

@18202781743 18202781743 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Description

Add subpaths and cacheSubpaths interfaces to DConfigFile for dconfig override subpath support.

This is part of the dde-dconfig-daemon subpath list support feature. The dtkcore changes provide the base interfaces that dde-dconfig-daemon uses to retrieve and manage subpath lists.

Related

Summary by Sourcery

Add DConfigFile subpath enumeration interfaces for retrieving override and cache subpath lists.

New Features:

  • Add APIs to retrieve one-level DConfig override subpaths from configuration metadata and cache directories.
  • Add support for enumerating subpaths from user-created DConfig cache objects.

Enhancements:

  • Deduplicate discovered subpaths across override and cache locations while supporting optional local directory prefixes.

…subpath support

1. Add virtual subpaths() to DConfigMeta for scanning one-level child
   directories of override dirs, with default empty implementation to
   preserve backward compatibility
2. Add virtual cacheSubpaths() to DConfigCache for scanning one-level
   child directories of cache dirs, with default empty implementation
3. Implement subpaths() override in DConfigMetaImpl to scan allOverrideDirs
   for child directories, deduplicating results
4. Implement cacheSubpaths() override in DConfigCacheImpl to scan cache
   directory for child directories
5. Make getCacheDir() const to support const cacheSubpaths() override
6. Update SPDX copyright year to 2026

feat: 添加 subpaths 和 cacheSubpaths 接口支持 dconfig override 子路径获取

1. 在 DConfigMeta 中添加虚函数 subpaths(),扫描 override 目录的一层
   子目录,使用默认空实现以保持向后兼容
2. 在 DConfigCache 中添加虚函数 cacheSubpaths(),扫描 cache 目录的一层
   子目录,使用默认空实现
3. 在 DConfigMetaImpl 中实现 subpaths() 重写,扫描 allOverrideDirs 的
   子目录并去重
4. 在 DConfigCacheImpl 中实现 cacheSubpaths() 重写,扫描 cache 目录的
   子目录
5. 将 getCacheDir() 改为 const 以支持 const cacheSubpaths() 重写
6. 更新 SPDX 版权年份至 2026

PMS: TASK-398893
Log: 添加 DConfigMeta::subpaths 和 DConfigCache::cacheSubpaths 接口,支持扫描 override 和 cache 目录的一层子路径
Influence: 外部继承 DConfigMeta/DConfigCache 的子类不受影响,默认返回空列表
@deepin-ci-robot

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[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

@sourcery-ai

sourcery-ai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

API

Expose non-virtual subpath discovery methods on DConfigFile, including the cache helper, without changing the base-class vtables.

  • include/global/dconfigfile.h L1, L74-76

Implementation

Implement one-level subpath scanning across metadata override directories and the global cache, and safely handle unsupported cache subclasses.

  • src/dconfigfile.cpp L1225-1245, L1682-1770 (+2 small edits)

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

…esign

1. Remove virtual subpaths() from DConfigMeta base class to avoid
   ABI-incompatible vtable changes for external derived classes
2. Remove virtual cacheSubpaths() from DConfigCache base class for
   the same ABI compatibility reason
3. Add non-virtual subpaths() to DConfigFile, scanning
   allOverrideDirs(true, prefix) and allOverrideDirs(false, prefix)
   plus global cache directory for one-level child directories
4. Add static cacheSubpaths() to DConfigFile, using
   static_cast<const DConfigCacheImpl*> for safe downcast
5. Change DConfigCacheImpl::cacheSubpaths() from override to
   non-virtual method
6. Update SPDX copyright year to 2026

refactor: 将 subpaths/cacheSubpaths 从虚函数改为非虚函数设计

1. 移除 DConfigMeta 基类中的虚函数 subpaths(),避免对外部派生类
   造成 ABI 不兼容的 vtable 变更
2. 移除 DConfigCache 基类中的虚函数 cacheSubpaths(),原因同上
3. 在 DConfigFile 中新增非虚 subpaths(),通过
   allOverrideDirs(true, prefix) 和 allOverrideDirs(false, prefix)
   以及全局 cache 目录扫描一层子目录
4. 在 DConfigFile 中新增 static cacheSubpaths(),使用
   static_cast<const DConfigCacheImpl*> 安全向下转型
5. DConfigCacheImpl::cacheSubpaths() 从 override 改为非虚方法
6. 更新 SPDX 版权年份至 2026

PMS: TASK-398893
Log: 将 subpaths 和 cacheSubpaths 从基类虚函数改为 DConfigFile 的非虚/static 方法,避免 ABI 不兼容
Influence: 外部继承 DConfigMeta/DConfigCache 的子类不受影响,vtable 布局不变
1. Replace static_cast with dynamic_cast in DConfigFile::cacheSubpaths()
   to avoid undefined behavior when an externally created DConfigCache
   subclass is passed in.
2. Add null check after dynamic_cast, return empty list on failure.
3. Update doc comment to reflect the safer cast approach.

PMS: task-view-398893
Log: dconfigfile cacheSubpaths 使用 dynamic_cast 替代 static_cast,避免向下转型 UB 风险
Influence: cacheSubpaths 在传入非 DConfigCacheImpl 类型时安全返回空列表
fix: 修复 QSet::insert().second 编译错误

1. QSet::insert() returns iterator, not std::pair<iterator,bool>
2. Replaced 4 occurrences of seen.insert(subpath).second with
   if (!seen.contains(subpath)) { seen.insert(subpath); result << subpath; }
3. Fixes compilation failure on Qt6 where QSet lacks .second member

1. QSet::insert() 返回迭代器而非 std::pair<iterator,bool>
2. 将 4 处 seen.insert(subpath).second 替换为 contains 判断写法
3. 修复 Qt6 下 QSet 没有 .second 成员的编译错误

PMS: TASK-398893
Log: 修复 dtkcore 中 QSet::insert().second 导致的编译失败
Influence: src/dconfigfile.cpp 中 subpaths/cacheSubpaths 函数的去重逻辑
@18202781743

Copy link
Copy Markdown
Contributor Author

关闭此 PR:代码已迁移至新分支 agent/developer/cb163ff66d48(commit c435730),将在新分支上重新创建 PR。关联 issue: DDE-647

@18202781743
18202781743 deleted the agent/developer/5f479c18869e branch November 19, 2026 07:25
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