Repository navigation
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Ivy233 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's GuideThe daemon now distinguishes an uninstalled DConfig meta file from genuine resource-loading failures: it reports the former as org.desktopspec.ConfigManager.ResourceNotFound and preserves the generic Failed error for the latter, with shared lookup logic and unit coverage validating the distinction. Sequence diagram for DConfig resource acquisition errorssequenceDiagram
participant Client
participant Server as DSGConfigServer
participant Resource as DSGConfigResource
participant DConfigFile
Client->>Server: acquireManagerV2(uid, appid)
Server->>Resource: load(appid)
Resource->>DConfigFile: metaPath(m_localPrefix)
DConfigFile-->>Resource: meta path or empty path
Resource-->>Server: loadStatus
alt load succeeds
Server-->>Client: QDBusObjectPath
else load fails
Server->>Resource: isMetaFileMissing(innerAppid)
Resource->>DConfigFile: metaPath(m_localPrefix)
DConfigFile-->>Resource: empty or non-empty path
alt meta path is empty
Server-->>Client: ResourceNotFound
else meta path exists
Server-->>Client: org.freedesktop.DBus.Error.Failed
end
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
The daemon replied with the generic org.freedesktop.DBus.Error.Failed both when a configuration resource has no meta file installed (an expected case, e.g. an optional component's configuration is not packaged) and when a real load failure happened (e.g. unparsable meta file). Clients could not tell the two apart, so the expected case was printed at warning level by dtkcore. Reply with a dedicated org.desktopspec.ConfigManager.ResourceNotFound error when the meta file is simply not installed; real load failures keep the generic Failed error. isMetaFileMissing() reuses the same meta lookup as the resource loading path. daemon 不再用通用 Failed 同时表示“meta 未安装”和“meta 在盘但加载失败”: 前者返回专用错误名 org.desktopspec.ConfigManager.ResourceNotFound,供 客户端降级为 debug;后者保持 Failed,避免掩盖真实故障。新增 isMetaFileMissing() 复用与资源加载相同的 meta 查找逻辑。 PMS: TASK-394335
1a3bcae to
22095df
Compare
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 语法正确,逻辑清晰。isMetaFileMissing() 方法正确复用了 getOrCreateFile() 的 meta 查找逻辑,acquireManagerV2() 中的条件分支正确区分了 meta 未安装和加载失败两种情况。测试用例覆盖了三种场景:已安装(不缺失)、存在但不可解析(不缺失)、完全不存在(缺失)。 2. 代码质量 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 代码结构清晰,注释完整。所有新增代码均配有详细注释,解释了设计意图和与 dtkcore 的同步要求。新增的 ResourceNotFoundError 常量遵循了现有代码风格(与 VirtualInterAppId 一致)。isMetaFileMissing() 方法注释明确说明了与 load() 查找逻辑的一致性关系。测试用例注释清晰说明了每个场景的预期行为。 3. 代码性能 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 性能良好,资源使用合理。isMetaFileMissing() 仅在错误路径(load 失败后)调用,创建临时 DConfigFile 对象的开销可忽略。ResourceNotFoundError 使用 QStringLiteral 宏实现编译时优化。无需优化。 4. 代码安全 🔒评价: 优秀 ✅ 通过
安全漏洞详情: 建议: 存在0个安全漏洞。ResourceNotFoundError 为编译时常量字符串,无注入风险。错误消息使用 QString::arg() 安全构造。isMetaFileMissing() 仅检查路径是否为空,不涉及文件系统写入操作。无敏感信息泄露。 💡 改进建议代码示例// 本次提交代码质量优秀,无需修改。
// isMetaFileMissing() 实现简洁正确:
//
// bool DSGConfigResource::isMetaFileMissing(const QString &appid) const
// {
// DConfigFile file(innerAppidToOuter(appid), m_fileName, m_subpath);
// return file.meta()->metaPath(m_localPrefix).isEmpty();
// }
//
// acquireManagerV2() 中的错误分流逻辑:
//
// if (resource->isMetaFileMissing(innerAppid))
// sendErrorReply(ResourceNotFoundError, errorMsg);
// else
// sendErrorReply(QDBusError::Failed, errorMsg);本报告由 AI 代码审查工具自动生成 |
|
/retest |
|
TAG Bot New tag: 1.0.47 |
The daemon replied with the generic org.freedesktop.DBus.Error.Failed both when a configuration resource has no meta file installed (an expected case, e.g. an optional component's configuration is not packaged) and when a real load failure happened (e.g. an unparsable meta file). Clients could not tell the two apart, so the expected case was printed at warning level by dtkcore.
Reply with a dedicated org.desktopspec.ConfigManager.ResourceNotFound error when the meta file is simply not installed; real load failures keep the generic Failed error. isMetaFileMissing() reuses the same meta lookup as the resource loading path.
daemon 不再用通用 Failed 同时表示"meta 未安装"和"meta 在盘但加载失败":前者返回专用错误名 org.desktopspec.ConfigManager.ResourceNotFound,供客户端降级为 debug;后者保持 Failed,避免掩盖真实故障。新增 isMetaFileMissing() 复用与资源加载相同的 meta 查找逻辑。
配套客户端侧改动:linuxdeepin/dtkcore PR #588(优先按该错误名分流日志级别,本地 meta 查找保留为旧版 daemon 的回退路径;两侧可独立合入)。
PMS: TASK-394335
Summary by Sourcery
Differentiate absent configuration metadata from real resource load failures in daemon error responses.
New Features:
Bug Fixes:
Enhancements: