Skip to content

feat: add output-mirror protocol, deprecate virtual-output-v1 - #109

Open
wineee wants to merge 4 commits into
linuxdeepin:masterfrom
wineee:output-mirror-protocol
Open

wineee wants to merge 4 commits into
linuxdeepin:masterfrom
wineee:output-mirror-protocol

Conversation

@wineee

@wineee wineee commented Sep 11, 2026

Copy link
Copy Markdown
Member
  1. Introduce treeland-output-mirror-manager-unstable-v1.xml with manager/group split, wl_output object identity, explicit set_source/add_output/remove_output, and registry-pattern enumeration via group_added/group_removed events.
  2. Move treeland-virtual-output-manager-v1.xml to deprecated/ unchanged; it remains installed by default for migration.
  3. Register the new protocol in TREELAND_PROTOCOL_DDE_XML_FILES and the old one in TREELAND_PROTOCOL_DEPRECATED_XML_FILES.
  4. Update dde README.md and README.zh_CN.md with the new protocol table row and a 0.7.0 breaking-changes subsection in both languages describing the wire-level differences.

Log: Redesign the output copy/mirror protocol around wl_output object identity instead of output-name strings, with explicit source/mirror separation, registry-push enumeration, and fully specified object lifecycles; the old string-array and positional semantics are removed.

Influence:

  1. Verify wayland-scanner generates client/server headers and code for the new XML without errors.
  2. Verify cmake configure/build/install places the new file in share/treeland-protocols and the old file still installs from deprecated/.
  3. Verify dde README.md and README.zh_CN.md table rows and the 0.7.0 breaking-changes subsection are present and in sync.

feat: 新增 output-mirror 协议,废弃 virtual-output-v1

  1. 新增 treeland-output-mirror-manager-unstable-v1.xml,采用 manager/group 分离、wl_output 对象身份、显式 set_source/add_output/remove_output,以及通过 group_added/group_removed 事件的 registry 模式枚举。
  2. 将 treeland-virtual-output-manager-v1.xml 原样移至 deprecated/,默认仍安装以供迁移。
  3. 在 TREELAND_PROTOCOL_DDE_XML_FILES 注册新协议,在 TREELAND_PROTOCOL_DEPRECATED_XML_FILES 注册旧协议。
  4. 更新 dde README.md 与 README.zh_CN.md 的协议表行,并在双 语 README 中新增 0.7.0 破坏性变更子节,描述线缆级差异。

Log: 围绕 wl_output 对象身份重新设计输出复制/镜像协议,显式
区分源与镜像、采用 registry 推送枚举并完整定义对象生命周期;
旧的字符串数组与位置语义已移除。

Influence:

  1. 验证 wayland-scanner 对新 XML 生成 client/server 头文件与 代码无报错。
  2. 验证 cmake 配置/构建/安装将新文件安装至 share/treeland-protocols,旧文件仍从 deprecated/ 安装。
  3. 验证 dde README.md 与 README.zh_CN.md 表行及 0.7.0 破坏 性变更子节存在且内容同步。

Summary by Sourcery

Adopt stable UUID-based output identity and replace the legacy virtual-output interface with an explicit, registry-driven output mirroring protocol while preserving the old protocol for migration.

New Features:

  • Add stable output UUID protocols for identifying outputs through wl_output and wlr output-head objects, including disabled and mirrored outputs.
  • Introduce an output-group mirroring protocol with explicit source and mirror management, registry-based group discovery, persistent configuration, and defined group lifecycles.

Bug Fixes:

  • Clarify output addressing and state handling in the output manager protocol, including UUID validation and failure reporting.

Enhancements:

  • Replace virtual-output name and positional-array semantics with UUID-based source and mirror operations and non-fatal operation failures.
  • Retain the legacy virtual-output protocol unchanged under deprecated protocols for migration compatibility.

Build:

  • Register the new output UUID and output-group protocols for normal installation and the legacy virtual-output protocol for deprecated installation.

Documentation:

  • Update English and Chinese protocol tables and document the 0.7.0 wire-level breaking changes and migration guidance.

@sourcery-ai

sourcery-ai Bot commented Sep 11, 2026

Copy link
Copy Markdown

Reviewer's Guide

Introduces the experimental output-mirror manager/group protocol with wl_output-based identity, push-based group enumeration, explicit lifecycle and membership semantics, while moving the old virtual-output protocol to deprecated installation and documenting the 0.7.0 migration in English and Chinese.

Sequence diagram for output mirror group discovery and configuration

sequenceDiagram
    participant Client
    participant Manager as treeland_output_mirror_manager_v1
    participant Group as treeland_output_mirror_group_v1
    participant Output as wl_output

    Client->>Manager: bind
    Manager-->>Client: group_added(id, name)
    Manager-->>Group: source(output or null)
    Manager-->>Group: output_added(mirror)
    Client->>Manager: create_group(id, name)
    Manager-->>Client: group object
    Client->>Group: set_source(Output)
    Group-->>Client: source(Output)
    Client->>Group: add_output(Output)
    Group-->>Client: output_added(Output)
Loading

State diagram for output mirror group lifecycle

stateDiagram-v2
    [*] --> Empty: create_group
    Empty --> Configured: set_source / add_output
    Configured --> Mirroring: source and mirror present
    Mirroring --> Configured: remove_output
    Empty --> Dissolved: dissolve
    Configured --> Dissolved: dissolve
    Mirroring --> Dissolved: dissolve
    Dissolved --> [*]: destroy

    state Configured {
        [*] --> SourceOrMirrors
        SourceOrMirrors --> SourceOrMirrors: set_source / add_output
        SourceOrMirrors --> SourceOrMirrors: remove_output
    }
Loading

File-Level Changes

Change Details Files
Replace the legacy virtual-output protocol with a wl_output-identity-based output-mirror protocol.
  • Define separate manager and group interfaces with explicit source and mirror membership operations.
  • Use wl_output object references instead of output-name strings and positional output arrays.
  • Add fatal manager/group error enums and document group lifecycle, state initialization, and hardware-removal behavior.
dde/treeland-output-mirror-manager-unstable-v1.xml
Reclassify the legacy protocol as deprecated while keeping it available for migration.
  • Register the new XML in the DDE protocol installation list.
  • Register the unchanged legacy XML in the deprecated protocol installation list.
CMakeLists.txt
deprecated/treeland-virtual-output-manager-v1.xml
Document the protocol replacement and wire-level migration requirements in both supported README languages.
  • Replace the protocol catalog entry with the new manager/group interfaces and semantics.
  • Add a 0.7.0 breaking-changes section covering renamed interfaces, object-based outputs, registry enumeration, errors, lifecycle, and source failover behavior.
  • Keep English and Chinese migration guidance aligned.
dde/README.md
dde/README.zh_CN.md

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 reviewed your changes and they look great!


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

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: wineee

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

Copilot AI 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.

🟡 Changes recommended

The unchanged v2 wire identity, undefined unknown-UUID initialization, stale package version, and incorrect documented API name must be addressed.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds UUID-based output identity and mirroring while retaining the legacy virtual-output protocol for migration.

Changes:

  • Adds UUID and output-mirror protocols.
  • Migrates output-manager v2 from wl_output objects to UUIDs.
  • Updates installation and bilingual migration documentation.
File summaries
File Description
CMakeLists.txt Registers new and deprecated protocols.
deprecated/treeland-virtual-output-manager-v1.xml Preserves the legacy protocol.
dde/treeland-output-uuid-unstable-v1.xml Defines UUID lookup for wl_output.
dde/treeland-output-uuid-head-unstable-v1.xml Adds UUID lookup for wlr heads.
dde/treeland-output-mirror-manager-unstable-v1.xml Defines UUID-based mirror groups.
dde/treeland-output-manager-unstable-v2.xml Replaces object arguments with UUID strings.
dde/README.md Documents protocols and migration.
dde/README.zh_CN.md Adds synchronized Chinese documentation.
Review details
  • Files reviewed: 7/8 changed files
  • Comments generated: 5
  • Review effort level: Balanced

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread dde/treeland-output-manager-unstable-v2.xml
Comment thread dde/README.md
Comment thread dde/treeland-output-manager-unstable-v2.xml Outdated
Comment thread dde/README.md Outdated
Comment thread dde/README.zh_CN.md Outdated
@wineee
wineee force-pushed the output-mirror-protocol branch from e4b1a96 to dc7a7c7 Compare September 14, 2026 07:03
1. Introduce treeland-output-mirror-manager-unstable-v1.xml with
   manager/group split, wl_output object identity, explicit
   set_source/add_output/remove_output, and registry-pattern
   enumeration via group_added/group_removed events.
2. Move treeland-virtual-output-manager-v1.xml to deprecated/
   unchanged; it remains installed by default for migration.
3. Register the new protocol in TREELAND_PROTOCOL_DDE_XML_FILES
   and the old one in TREELAND_PROTOCOL_DEPRECATED_XML_FILES.
4. Update dde README.md and README.zh_CN.md with the new protocol
   table row and a 0.7.0 breaking-changes subsection in both
   languages describing the wire-level differences.

Log: Redesign the output copy/mirror protocol around wl_output
object identity instead of output-name strings, with explicit
source/mirror separation, registry-push enumeration, and fully
specified object lifecycles; the old string-array and positional
semantics are removed.

Influence:
1. Verify wayland-scanner generates client/server headers and
   code for the new XML without errors.
2. Verify cmake configure/build/install places the new file in
   share/treeland-protocols and the old file still installs from
   deprecated/.
3. Verify dde README.md and README.zh_CN.md table rows and the
   0.7.0 breaking-changes subsection are present and in sync.

feat: 新增 output-mirror 协议,废弃 virtual-output-v1

1. 新增 treeland-output-mirror-manager-unstable-v1.xml,采用
   manager/group 分离、wl_output 对象身份、显式
   set_source/add_output/remove_output,以及通过
   group_added/group_removed 事件的 registry 模式枚举。
2. 将 treeland-virtual-output-manager-v1.xml 原样移至
   deprecated/,默认仍安装以供迁移。
3. 在 TREELAND_PROTOCOL_DDE_XML_FILES 注册新协议,在
   TREELAND_PROTOCOL_DEPRECATED_XML_FILES 注册旧协议。
4. 更新 dde README.md 与 README.zh_CN.md 的协议表行,并在双
   语 README 中新增 0.7.0 破坏性变更子节,描述线缆级差异。

Log: 围绕 wl_output 对象身份重新设计输出复制/镜像协议,显式
区分源与镜像、采用 registry 推送枚举并完整定义对象生命周期;
旧的字符串数组与位置语义已移除。

Influence:
1. 验证 wayland-scanner 对新 XML 生成 client/server 头文件与
   代码无报错。
2. 验证 cmake 配置/构建/安装将新文件安装至
   share/treeland-protocols,旧文件仍从 deprecated/ 安装。
3. 验证 dde README.md 与 README.zh_CN.md 表行及 0.7.0 破坏
   性变更子节存在且内容同步。
1. Add treeland-output-uuid-unstable-v1.xml: stable opaque uuid
   identity for wl_output objects via treeland_output_uuid_manager_v1
   .get_uuid; treeland_output_uuid_v1 is frozen at v1 (two independent
   factory ancestors).
2. Add treeland-output-uuid-head-unstable-v1.xml: companion protocol
   depending on wlr-output-management; its manager returns the same
   treeland_output_uuid_v1 object from a zwlr_output_head_v1,
   including disabled outputs with no live wl_output global.
3. Switch treeland-output-manager-unstable-v2.xml to uuid addressing:
   set_primary_output, get_picture_control, and the primary_output
   event take uuid strings; empty uuid means no primary output; new
   fatal error error.invalid_uuid for empty uuids.
4. Switch treeland-output-mirror-manager-unstable-v1.xml to uuid
   addressing: set_source, add_output, remove_output, source,
   output_added, and output_removed carry uuid strings; source event
   uses empty uuid instead of a null object when no source is set.
5. Update dde README.md and README.zh_CN.md with the two new protocol
   table rows and the 0.7.0 breaking-changes entries covering the new
   uuid protocols, the output-manager-v2 wire change, and the mirror
   protocol redesign.

Log: Output identity across treeland output protocols is now based on
stable opaque uuid strings obtained from the new treeland-output-uuid
protocols, replacing both output-name strings and wl_output object
references; uuids are unique among connected outputs, stable across
sessions and reconnections, and shared between the wl_output and
wlr-head factories.

Influence:
1. Verify wayland-scanner generates client/server headers and code
   for all four output protocol XMLs without errors.
2. Verify cmake configure/build/install registers and installs both
   new uuid XML files and the modified output-manager-v2 and mirror
   XMLs.
3. Verify the treeland-output-uuid-head client code links against
   treeland_output_uuid_v1_interface provided by the
   treeland-output-uuid generated code.
4. Verify dde README.md and README.zh_CN.md contain matching protocol
   tables and synchronized 0.7.0 breaking-changes sections.

feat: 新增 output-uuid 协议,输出改为 uuid 寻址

1. 新增 treeland-output-uuid-unstable-v1.xml:通过
   treeland_output_uuid_manager_v1.get_uuid 为 wl_output 提供稳定
   不透明 uuid 身份;treeland_output_uuid_v1 冻结于 v1(两个独立
   工厂祖先)。
2. 新增 treeland-output-uuid-head-unstable-v1.xml:依赖
   wlr-output-management 的配套协议;其管理器从
   zwlr_output_head_v1 返回同一个 treeland_output_uuid_v1 对象,
   涵盖无存活 wl_output 全局的禁用输出。
3. treeland-output-manager-unstable-v2.xml 改为 uuid 寻址:
   set_primary_output、get_picture_control 与 primary_output 事件
   改用 uuid 字符串;空 uuid 表示无主屏;新增致命错误
   error.invalid_uuid(空 uuid)。
4. treeland-output-mirror-manager-unstable-v1.xml 改为 uuid 寻址:
   set_source、add_output、remove_output、source、output_added 与
   output_removed 携带 uuid 字符串;source 事件在无源时以空 uuid
   替代 null 对象。
5. 更新 dde README.md 与 README.zh_CN.md:新增两个协议表行,并在
   0.7.0 破坏性变更中覆盖新 uuid 协议、output-manager-v2 线缆变
   更与 mirror 协议重设计。

Log: treeland 输出协议体系的输出身份现基于新 treeland-output-uuid
协议提供的稳定不透明 uuid 字符串,同时替代输出名字符串与
wl_output 对象引用;uuid 在已连接输出间唯一、跨会话与重插稳定,
并由 wl_output 与 wlr head 两个工厂共享。

Influence:
1. 验证 wayland-scanner 对全部四个输出协议 XML 生成 client/server
   头文件与代码无报错。
2. 验证 cmake 配置/构建/安装注册并安装两个新 uuid XML 及修改后的
   output-manager-v2 与 mirror XML。
3. 验证 treeland-output-uuid-head 客户端代码能链接由
   treeland-output-uuid 生成代码提供的
   treeland_output_uuid_v1_interface。
4. 验证 dde README.md 与 README.zh_CN.md 协议表一致且 0.7.0 破坏
   性变更内容同步。
1. Slim verbose descriptions across output-uuid, output-uuid-head,
   and output-mirror-manager XMLs; remove cross-layer duplication
   while keeping all normative content (RFC 2119, error codes,
   lifecycles, successor rules, frozen rationale).
2. Fix get_picture_control contract contradiction: an unknown uuid
   no longer creates a picture-control object with no source for
   initial events; it is now a fatal error.unknown_output at
   creation, so the unconditional color_temperature/brightness
   initial-state contract holds.
3. Split mirror group errors by severity: invalid_output,
   duplicate_output, output_in_use, and not_in_group become
   non-fatal failures reported via the new operation_failed event
   (code + uuid); only already_dissolved remains a fatal protocol
   error. Transient output state no longer terminates the client
   connection.
4. Add source argument to create_group so a group is created with
   its source already set; observers never see an empty-source
   group. A non-empty source with no connected enabled output is a
   fatal error.invalid_source at creation.
5. Fix README: the two uuid managers both use the request name
   get_uuid; there is no get_uuid_for_head. Consolidate the
   output-manager breaking changes into 0.7.0 (v2 was unreleased)
   and drop the new uuid protocols from the breaking-changes list.

Log: No user-facing changes

Influence:
1. Verify wayland-scanner generates client/server headers and code
   for all four output protocol XMLs without errors.
2. Verify get_picture_control with an unknown uuid is rejected at
   creation and no picture-control object is created.
3. Verify an add_output failing due to output unplug emits
   operation_failed without terminating the connection.
4. Verify create_group with a source uuid creates a group whose
   initial source event carries that uuid.
5. Verify dde README.md and README.zh_CN.md contain matching 0.7.0
   breaking-changes sections and no get_uuid_for_head reference.

refactor: 收紧输出协议语义与文档

1. 精简 output-uuid、output-uuid-head 与 output-mirror-manager
   XML 的冗余描述;去除跨层级重复,同时保留全部规范内容
   (RFC 2119、错误码、生命周期、后继规则、frozen 理由)。
2. 修正 get_picture_control 契约矛盾:未知 uuid 不再创建无源
   可供初始事件的 picture-control 对象;现为创建时致命错误
   error.unknown_output,故无条件发送 color_temperature/
   brightness 初始状态的契约成立。
3. 按严重程度划分 mirror group 错误:invalid_output、
   duplicate_output、output_in_use、not_in_group 改为通过新增
   operation_failed 事件(code + uuid)报告的非致命失败;仅
   already_dissolved 仍为致命协议错误。瞬态输出状态不再终止
   客户端连接。
4. 为 create_group 新增 source 参数,使组创建时即已设置源;
   观察者不会看到空源组。不标识已连接已启用输出的非空源在创建
   时为致命错误 error.invalid_source。
5. 修正 README:两个 uuid manager 都使用请求名 get_uuid;不存
   在 get_uuid_for_head。将 output-manager 破坏性变更合并至
   0.7.0(v2 未发布),并将新 uuid 协议移出破坏性变更列表。

Log: 无用户可见变化

Influence:
1. 验证 wayland-scanner 对全部四个输出协议 XML 生成 client/
   server 头文件与代码无报错。
2. 验证 get_picture_control 传未知 uuid 在创建时被拒绝且不创建
   picture-control 对象。
3. 验证 add_output 因输出拔出失败时发送 operation_failed 且不
   终止连接。
4. 验证 create_group 带 source uuid 创建的组其初始 source 事件
   携带该 uuid。
5. 验证 dde README.md 与 README.zh_CN.md 的 0.7.0 破坏性变更
   内容一致且无 get_uuid_for_head 引用。
1. Rename file/protocol/interfaces: treeland_output_mirror_* to
   treeland_output_group_manager_v1 and treeland_output_group_v1
2. Group names are now compositor-assigned; add name event on the
   group and get_group request on the manager; drop client-supplied
   name argument and the invalid_name/name_exists manager errors
3. Replace output_added/output_removed with a single full-list
   outputs event carrying count plus concatenated fixed-length uuids
4. Split configured vs effective state: unplugged or disabled outputs
   remain configured and auto-resume on return, no auto source
   promotion, and the compositor persists groups across restarts
5. Document wl_output visibility: only the source exposes wl_output,
   mirror uuids come from treeland-output-uuid-head-unstable-v1; add
   groups_done event terminating the bind-time group_added dump
6. Declare fixed-length uuids in treeland-output-uuid(-head) so the
   outputs array can be parsed without separators

Log: Redesigned the unreleased output group protocol XML; no released
consumers are affected

Influence:
1. Verify xmllint and check-protocol-xml.sh pass on all changed XMLs
2. Verify wayland-scanner generates valid headers for the renamed
   interfaces and the new name/outputs/groups_done events
3. Verify CMake installs the renamed XML via TREELAND_PROTOCOL_DDE_XML_FILES
4. Track Treeland to rebind the renamed global and implement the new
   request/event set before any consumer ships

refactor: 重构输出镜像协议为输出分组管理协议

1. 重命名文件/协议/接口:treeland_output_mirror_* 改为
   treeland_output_group_manager_v1 与 treeland_output_group_v1
2. 组名改由合成器分配;组对象新增 name 事件,manager 新增
   get_group 请求;移除客户端传入的 name 参数及相关错误码
3. output_added/output_removed 合并为单个全量 outputs 事件,
   携带数量与定长 uuid 拼接数组
4. 区分配置态与运行时有效态:拔出/禁用的输出保留配置并自动
   恢复,不再自动提升源,合成器跨重启持久化组配置
5. 说明 wl_output 可见性:仅 source 暴露 wl_output,镜像 uuid
   需经 treeland-output-uuid-head 获取;新增 groups_done 事件
   标记 bind 时 group_added 初始推送结束
6. treeland-output-uuid(-head) 声明 uuid 定长,outputs 数组可
   无分隔符解析

Log: 重新设计尚未发布的输出分组协议 XML,无已发布消费者受影响

Influence:
1. 验证所有变更 XML 通过 xmllint 与 check-protocol-xml.sh
2. 验证 wayland-scanner 能为重命名接口及新增事件生成有效头文件
3. 验证 CMake 经 TREELAND_PROTOCOL_DDE_XML_FILES 安装重命名后的 XML
4. 跟进 Treeland 侧重新绑定全局对象并实现新请求/事件集
@wineee
wineee force-pushed the output-mirror-protocol branch from a0cb707 to 28b2b8b Compare September 16, 2026 05:40
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

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

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
PR 信息 [#109] feat: add output-mirror protocol, deprecate virtual-output-v1
作者 wineee
分支 output-mirror-protocol → master
变更统计 8 个文件,+829 行,-69 行
提交数 4
评分详情 本次提交新增了 output-mirror/output-uuid 系列 Wayland 协议定义文件,废弃了旧的 virtual-output-v1 协议,并更新了构建配置和双语文档。所有 XML 协议定义文件语法正确、结构清晰,文档详尽完整,未发现安全漏洞。

📋 提交目的与代码一致性分析

提交目的: 新增 output-mirror 协议,废弃 virtual-output-v1

代码实现与 commit 目的一致性: 完全一致

  1. CMakeLists.txt: 移除旧协议文件 dde/treeland-virtual-output-manager-v1.xml,新增三个新协议文件到 TREELAND_PROTOCOL_DDE_XML_FILES,将旧文件注册到 TREELAND_PROTOCOL_DEPRECATED_XML_FILES
  2. dde/treeland-output-group-manager-unstable-v1.xml: 新增 486 行,定义输出镜像分组管理协议,采用 manager/group 分离、uuid 寻址、registry 推送枚举模型
  3. dde/treeland-output-manager-unstable-v2.xml: 修改为使用 uuid 字符串寻址替代 wl_output 对象
  4. dde/treeland-output-uuid-unstable-v1.xml: 新增 134 行,定义输出 uuid 身份协议
  5. dde/treeland-output-uuid-head-unstable-v1.xml: 新增 74 行,定义从 wlr head 获取 uuid 的配套协议
  6. deprecated/treeland-virtual-output-manager-v1.xml: 从 dde/ 移至 deprecated/,内容不变
  7. dde/README.md 和 dde/README.zh_CN.md: 更新协议表格,新增 0.7.0 破坏性变更说明

🔍 详细分析

1. 语法逻辑 ✅ (25/25分)

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

分析:

  • 所有 XML 文件均为格式正确的 Wayland 协议定义,包含正确的 <?xml> 声明、<protocol> 根元素、<interface> 定义
  • XML 元素结构正确:<request>/<event>/<enum>/<arg> 元素及其属性(nametypeinterfacesummary 等)均符合 Wayland 协议 XML 模式规范
  • CMakeLists.txt 变更语法正确:从 TREELAND_PROTOCOL_DDE_XML_FILES 列表移除旧文件,新增三个新文件;在 TREELAND_PROTOCOL_DEPRECATED_XML_FILES 列表添加旧文件
  • Markdown 文件格式正确:表格行、章节标题、列表项均规范
  • deprecated/treeland-virtual-output-manager-v1.xml 为纯重命名(similarity index 100%),无内容变更
  • 协议设计逻辑清晰:manager 负责创建/枚举/销毁组,group 对象管理源/镜像输出配置,错误分为致命和非致命两级

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


2. 代码质量 ✅ (25/25分)

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

分析:

  • 文档质量优秀:双语 README(英文 dde/README.md 和中文 dde/README.zh_CN.md)均更新了协议表格行,新增 0.7.0 破坏性变更子节,详细描述了线缆级差异和消费者迁移指南
  • 协议描述详尽:所有 XML 协议文件均包含详尽的 <description> 元素,解释了设计原理、使用方式和 RFC 2119 术语规范
  • 结构清晰:关注点分离良好——treeland-output-uuid-unstable-v1.xml 定义 uuid 身份协议,treeland-output-uuid-head-unstable-v1.xml 作为配套协议从 wlr head 获取 uuid,treeland-output-group-manager-unstable-v1.xml 定义镜像分组管理
  • 命名规范:遵循 Wayland 协议惯例(treeland_*_unstable_v*),接口命名一致
  • 无重复代码:每个协议文件定义独立接口,无代码复制
  • 无调试残留:无残留调试代码、无敏感信息

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


3. 代码性能 ✅ (20/20分)

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

分析:

  • 本次变更为 Wayland 协议定义 XML 文件,不涉及运行时代码,无算法复杂度问题
  • 协议设计采用 registry 推送模型(group_added/group_removed/groups_done 事件)替代旧的轮询模型(get_virtual_output_list 请求),消除了"先列表、再查找"的 TOCTOU 竞争窗口,效率更高
  • outputs 事件使用 count + array 格式传输镜像列表,一次性传输完整列表替代增量更新,减少事件往返次数
  • 协议定义层面无性能瓶颈

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


4. 代码安全 🔒 (30/30分)

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

🔐 发现 0 个安全漏洞

分析:

  • 本次变更为 Wayland 协议定义文件,定义 IPC 接口而非可执行代码,不存在命令注入、SQL 注入、路径遍历等风险
  • 协议仅供特权客户端(DDE 显示设置面板)使用,非特权客户端无法绑定
  • 基于 uuid 的寻址设计为不透明(opaque),协议明确要求客户端不得解析 uuid 内容、不得从中派生含义、不得展示给用户
  • 错误处理定义清晰:
    • 致命错误(invalid_sourceinvalid_namealready_dissolved)终止连接
    • 非致命操作失败(invalid_outputduplicate_outputoutput_in_usenot_in_group)通过 operation_failed 事件报告,连接不终止
  • 对象生命周期管理完善:destroy 仅释放客户端句柄,dissolve 才解散组,避免误操作
  • 无硬编码密钥、无敏感信息泄露、无调试接口暴露

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个

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


📁 变更文件清单

文件 变更类型 说明
CMakeLists.txt 修改 注册新协议文件,移除旧协议到 deprecated 列表
dde/README.md 修改 更新协议表格,新增 0.7.0 破坏性变更说明
dde/README.zh_CN.md 修改 更新中文协议表格,新增 0.7.0 破坏性变更说明
dde/treeland-output-group-manager-unstable-v1.xml 新增 输出镜像分组管理协议(486 行)
dde/treeland-output-manager-unstable-v2.xml 修改 改用 uuid 寻址替代 wl_output 对象
dde/treeland-output-uuid-head-unstable-v1.xml 新增 从 wlr head 获取 uuid 的配套协议(74 行)
dde/treeland-output-uuid-unstable-v1.xml 新增 输出 uuid 身份协议(134 行)
deprecated/treeland-virtual-output-manager-v1.xml 移动 从 dde/ 移至 deprecated/,内容不变

📝 维度评分汇总

维度 评分 满分 状态
语法逻辑 25 25 ✅ 通过
代码质量 25 25 ✅ 通过
代码性能 20 20 ✅ 通过
代码安全 30 30 ✅ 通过
总分 100 100 ✅ 通过

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

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