Skip to content

修复 ColorMatch 导出结果无法重新加载的问题 - #1422

Open
Whning0513 wants to merge 5 commits into
MaaXYZ:mainfrom
Whning0513:fix/issue-1315-color-match-roundtrip
Open

修复 ColorMatch 导出结果无法重新加载的问题#1422
Whning0513 wants to merge 5 commits into
MaaXYZ:mainfrom
Whning0513:fix/issue-1315-color-match-roundtrip

Conversation

@Whning0513

@Whning0513 Whning0513 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

你好,

这次主要改了什么

这次主要是修了一个 ColorMatch 配置导出后无法重新加载的问题呢。

简单来说的话,当 ColorMatch 没有配置 lowerupper 时,PipelineDumper 会把它们导出成空数组。这个结果再次交给 PipelineParser 时,解析器会把空数组当成非法输入,导致同一份配置无法重新加载。

修改内容

然后,解析到空的 lowerupper 时,会和字段缺失一样使用默认值。这样一来,既能兼容现有的 dumper 输出,也能让手写的空数组配置正常处理。

检查

  • 增加了 ColorMatch Parser/Dumper round-trip 测试;
  • 已通过 clang-format、Python 语法和 git diff --check 检查;
  • GitHub Actions 会在 PR 中重新运行。

Fixes #1315 — whning#0513 官服

由 Sourcery 提供的摘要

在导出的 bounds 为空数组时,恢复 ColorMatch 配置的往返(round-trip)兼容性。

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复导出(dump)与解析(parse)配置之间的兼容性。

测试:

  • 新增一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略 bounds 的配置。
Original summary in English

Summary by Sourcery

Restore ColorMatch configuration round-trip compatibility when bounds are exported as empty arrays.

Bug Fixes:

  • Allow empty ColorMatch lower and upper arrays to fall back to their default values, restoring compatibility between dumped and parsed configurations.

Tests:

  • Add a ColorMatch parser/dumper round-trip test covering configurations with omitted bounds.

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复导出(dumped)与解析(parsed)配置之间的兼容性。

测试:

  • 新增一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略边界配置的场景。
Original summary in English

由 Sourcery 提供的摘要

在导出的 bounds 为空数组时,恢复 ColorMatch 配置的往返(round-trip)兼容性。

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复导出(dump)与解析(parse)配置之间的兼容性。

测试:

  • 新增一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略 bounds 的配置。
Original summary in English

Summary by Sourcery

Restore ColorMatch configuration round-trip compatibility when bounds are exported as empty arrays.

Bug Fixes:

  • Allow empty ColorMatch lower and upper arrays to fall back to their default values, restoring compatibility between dumped and parsed configurations.

Tests:

  • Add a ColorMatch parser/dumper round-trip test covering configurations with omitted bounds.

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复已导出和已解析配置之间的兼容性。

测试:

  • 添加一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略 bounds 的配置场景。
Original summary in English

由 Sourcery 提供的摘要

在导出的 bounds 为空数组时,恢复 ColorMatch 配置的往返(round-trip)兼容性。

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复导出(dump)与解析(parse)配置之间的兼容性。

测试:

  • 新增一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略 bounds 的配置。
Original summary in English

Summary by Sourcery

Restore ColorMatch configuration round-trip compatibility when bounds are exported as empty arrays.

Bug Fixes:

  • Allow empty ColorMatch lower and upper arrays to fall back to their default values, restoring compatibility between dumped and parsed configurations.

Tests:

  • Add a ColorMatch parser/dumper round-trip test covering configurations with omitted bounds.

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复导出(dumped)与解析(parsed)配置之间的兼容性。

测试:

  • 新增一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略边界配置的场景。
Original summary in English

由 Sourcery 提供的摘要

在导出的 bounds 为空数组时,恢复 ColorMatch 配置的往返(round-trip)兼容性。

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复导出(dump)与解析(parse)配置之间的兼容性。

测试:

  • 新增一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略 bounds 的配置。
Original summary in English

Summary by Sourcery

Restore ColorMatch configuration round-trip compatibility when bounds are exported as empty arrays.

Bug Fixes:

  • Allow empty ColorMatch lower and upper arrays to fall back to their default values, restoring compatibility between dumped and parsed configurations.

Tests:

  • Add a ColorMatch parser/dumper round-trip test covering configurations with omitted bounds.
Original summary in English

由 Sourcery 提供的摘要

在导出的 bounds 为空数组时,恢复 ColorMatch 配置的往返(round-trip)兼容性。

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复导出(dump)与解析(parse)配置之间的兼容性。

测试:

  • 新增一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略 bounds 的配置。
Original summary in English

Summary by Sourcery

Restore ColorMatch configuration round-trip compatibility when bounds are exported as empty arrays.

Bug Fixes:

  • Allow empty ColorMatch lower and upper arrays to fall back to their default values, restoring compatibility between dumped and parsed configurations.

Tests:

  • Add a ColorMatch parser/dumper round-trip test covering configurations with omitted bounds.

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复导出(dumped)与解析(parsed)配置之间的兼容性。

测试:

  • 新增一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略边界配置的场景。
Original summary in English

由 Sourcery 提供的摘要

在导出的 bounds 为空数组时,恢复 ColorMatch 配置的往返(round-trip)兼容性。

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复导出(dump)与解析(parse)配置之间的兼容性。

测试:

  • 新增一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略 bounds 的配置。
Original summary in English

Summary by Sourcery

Restore ColorMatch configuration round-trip compatibility when bounds are exported as empty arrays.

Bug Fixes:

  • Allow empty ColorMatch lower and upper arrays to fall back to their default values, restoring compatibility between dumped and parsed configurations.

Tests:

  • Add a ColorMatch parser/dumper round-trip test covering configurations with omitted bounds.

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复已导出和已解析配置之间的兼容性。

测试:

  • 添加一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略 bounds 的配置场景。
Original summary in English

由 Sourcery 提供的摘要

在导出的 bounds 为空数组时,恢复 ColorMatch 配置的往返(round-trip)兼容性。

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复导出(dump)与解析(parse)配置之间的兼容性。

测试:

  • 新增一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略 bounds 的配置。
Original summary in English

Summary by Sourcery

Restore ColorMatch configuration round-trip compatibility when bounds are exported as empty arrays.

Bug Fixes:

  • Allow empty ColorMatch lower and upper arrays to fall back to their default values, restoring compatibility between dumped and parsed configurations.

Tests:

  • Add a ColorMatch parser/dumper round-trip test covering configurations with omitted bounds.

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复导出(dumped)与解析(parsed)配置之间的兼容性。

测试:

  • 新增一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略边界配置的场景。
Original summary in English

由 Sourcery 提供的摘要

在导出的 bounds 为空数组时,恢复 ColorMatch 配置的往返(round-trip)兼容性。

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复导出(dump)与解析(parse)配置之间的兼容性。

测试:

  • 新增一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略 bounds 的配置。
Original summary in English

Summary by Sourcery

Restore ColorMatch configuration round-trip compatibility when bounds are exported as empty arrays.

Bug Fixes:

  • Allow empty ColorMatch lower and upper arrays to fall back to their default values, restoring compatibility between dumped and parsed configurations.

Tests:

  • Add a ColorMatch parser/dumper round-trip test covering configurations with omitted bounds.
Original summary in English

由 Sourcery 提供的摘要

在导出的 bounds 为空数组时,恢复 ColorMatch 配置的往返(round-trip)兼容性。

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复导出(dump)与解析(parse)配置之间的兼容性。

测试:

  • 新增一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略 bounds 的配置。
Original summary in English

Summary by Sourcery

Restore ColorMatch configuration round-trip compatibility when bounds are exported as empty arrays.

Bug Fixes:

  • Allow empty ColorMatch lower and upper arrays to fall back to their default values, restoring compatibility between dumped and parsed configurations.

Tests:

  • Add a ColorMatch parser/dumper round-trip test covering configurations with omitted bounds.

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复导出(dumped)与解析(parsed)配置之间的兼容性。

测试:

  • 新增一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略边界配置的场景。
Original summary in English

由 Sourcery 提供的摘要

在导出的 bounds 为空数组时,恢复 ColorMatch 配置的往返(round-trip)兼容性。

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复导出(dump)与解析(parse)配置之间的兼容性。

测试:

  • 新增一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略 bounds 的配置。
Original summary in English

Summary by Sourcery

Restore ColorMatch configuration round-trip compatibility when bounds are exported as empty arrays.

Bug Fixes:

  • Allow empty ColorMatch lower and upper arrays to fall back to their default values, restoring compatibility between dumped and parsed configurations.

Tests:

  • Add a ColorMatch parser/dumper round-trip test covering configurations with omitted bounds.

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复已导出和已解析配置之间的兼容性。

测试:

  • 添加一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略 bounds 的配置场景。
Original summary in English

由 Sourcery 提供的摘要

在导出的 bounds 为空数组时,恢复 ColorMatch 配置的往返(round-trip)兼容性。

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复导出(dump)与解析(parse)配置之间的兼容性。

测试:

  • 新增一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略 bounds 的配置。
Original summary in English

Summary by Sourcery

Restore ColorMatch configuration round-trip compatibility when bounds are exported as empty arrays.

Bug Fixes:

  • Allow empty ColorMatch lower and upper arrays to fall back to their default values, restoring compatibility between dumped and parsed configurations.

Tests:

  • Add a ColorMatch parser/dumper round-trip test covering configurations with omitted bounds.

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复导出(dumped)与解析(parsed)配置之间的兼容性。

测试:

  • 新增一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略边界配置的场景。
Original summary in English

由 Sourcery 提供的摘要

在导出的 bounds 为空数组时,恢复 ColorMatch 配置的往返(round-trip)兼容性。

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复导出(dump)与解析(parse)配置之间的兼容性。

测试:

  • 新增一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略 bounds 的配置。
Original summary in English

Summary by Sourcery

Restore ColorMatch configuration round-trip compatibility when bounds are exported as empty arrays.

Bug Fixes:

  • Allow empty ColorMatch lower and upper arrays to fall back to their default values, restoring compatibility between dumped and parsed configurations.

Tests:

  • Add a ColorMatch parser/dumper round-trip test covering configurations with omitted bounds.
Original summary in English

由 Sourcery 提供的摘要

在导出的 bounds 为空数组时,恢复 ColorMatch 配置的往返(round-trip)兼容性。

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复导出(dump)与解析(parse)配置之间的兼容性。

测试:

  • 新增一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略 bounds 的配置。
Original summary in English

Summary by Sourcery

Restore ColorMatch configuration round-trip compatibility when bounds are exported as empty arrays.

Bug Fixes:

  • Allow empty ColorMatch lower and upper arrays to fall back to their default values, restoring compatibility between dumped and parsed configurations.

Tests:

  • Add a ColorMatch parser/dumper round-trip test covering configurations with omitted bounds.

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复导出(dumped)与解析(parsed)配置之间的兼容性。

测试:

  • 新增一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略边界配置的场景。
Original summary in English

由 Sourcery 提供的摘要

在导出的 bounds 为空数组时,恢复 ColorMatch 配置的往返(round-trip)兼容性。

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复导出(dump)与解析(parse)配置之间的兼容性。

测试:

  • 新增一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略 bounds 的配置。
Original summary in English

Summary by Sourcery

Restore ColorMatch configuration round-trip compatibility when bounds are exported as empty arrays.

Bug Fixes:

  • Allow empty ColorMatch lower and upper arrays to fall back to their default values, restoring compatibility between dumped and parsed configurations.

Tests:

  • Add a ColorMatch parser/dumper round-trip test covering configurations with omitted bounds.

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复已导出和已解析配置之间的兼容性。

测试:

  • 添加一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略 bounds 的配置场景。
Original summary in English

由 Sourcery 提供的摘要

在导出的 bounds 为空数组时,恢复 ColorMatch 配置的往返(round-trip)兼容性。

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复导出(dump)与解析(parse)配置之间的兼容性。

测试:

  • 新增一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略 bounds 的配置。
Original summary in English

Summary by Sourcery

Restore ColorMatch configuration round-trip compatibility when bounds are exported as empty arrays.

Bug Fixes:

  • Allow empty ColorMatch lower and upper arrays to fall back to their default values, restoring compatibility between dumped and parsed configurations.

Tests:

  • Add a ColorMatch parser/dumper round-trip test covering configurations with omitted bounds.

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复导出(dumped)与解析(parsed)配置之间的兼容性。

测试:

  • 新增一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略边界配置的场景。
Original summary in English

由 Sourcery 提供的摘要

在导出的 bounds 为空数组时,恢复 ColorMatch 配置的往返(round-trip)兼容性。

Bug 修复:

  • 允许空的 ColorMatch lowerupper 数组回退到其默认值,从而恢复导出(dump)与解析(parse)配置之间的兼容性。

测试:

  • 新增一个 ColorMatch 解析器/导出器的往返测试,用于覆盖省略 bounds 的配置。
Original summary in English

Summary by Sourcery

Restore ColorMatch configuration round-trip compatibility when bounds are exported as empty arrays.

Bug Fixes:

  • Allow empty ColorMatch lower and upper arrays to fall back to their default values, restoring compatibility between dumped and parsed configurations.

Tests:

  • Add a ColorMatch parser/dumper round-trip test covering configurations with omitted bounds.

Copilot AI review requested due to automatic review settings July 29, 2026 18:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - 我在这里给出了一些高层次的反馈:

  • get_and_check_array_or_2darray 中,建议将 opt->as_array() 存储在一个本地引用/变量中,这样就不用多次调用它,也能让围绕空数组的控制流更易读、更易维护。
给 AI 代理的提示
Please address the comments from this code review:

## Overall Comments
- In `get_and_check_array_or_2darray`, consider storing `opt->as_array()` in a local reference/variable so you don't call it multiple times and to make the control flow around empty arrays easier to read and maintain.

Sourcery 对开源项目是免费的——如果你觉得我们的代码审查有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点击 👍 或 👎,我会根据你的反馈改进后续的代码审查。
Original comment in English

Hey - I've left some high level feedback:

  • In get_and_check_array_or_2darray, consider storing opt->as_array() in a local reference/variable so you don't call it multiple times and to make the control flow around empty arrays easier to read and maintain.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `get_and_check_array_or_2darray`, consider storing `opt->as_array()` in a local reference/variable so you don't call it multiple times and to make the control flow around empty arrays easier to read and maintain.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

LogError << "type error" << VAR(key) << VAR(input);
return false;
}
if (opt->as_array().empty()) {

@MistEO MistEO Jul 31, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

这样改完,pipeline_override 没有清空数组的方法了呀

Whning0513 and others added 4 commits August 21, 2026 19:41
Signed-off-by: whn <142425816+Whning0513@users.noreply.github.com>
Signed-off-by: whn <142425816+Whning0513@users.noreply.github.com>
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.

[Bug] PipelineDumper 输出 ColorMatch 的 lower/upper 为空数组 [],但 parser 拒绝接受空数组(无法重新加载 dumper 自己的输出)

3 participants