Skip to content

Fix legacy C2S slider segment parsing - #6

Merged
Starrah merged 2 commits into
MuNET-OSS:masterfrom
dudehacker:fix/c2s-legacy-slider-width
Oct 8, 2026
Merged

Starrah merged 2 commits into
MuNET-OSS:masterfrom
dudehacker:fix/c2s-legacy-slider-width

Conversation

@dudehacker

@dudehacker dudehacker commented Oct 7, 2026 •

Copy link
Copy Markdown

0129_03.zip

fix slider conversion for old format chart, example chart with issue attached

Review in cubic

Sourcery 摘要

修复旧版 C2S 解析问题,确保在省略可选属性时,滑条片段和空中音符关系仍保持正确。

Bug 修复:

  • 修复可选结束宽度缺失时旧版 C2S 滑条片段的解析问题,保留片段的起始宽度。
  • 当可选方向或颜色属性缺失时,保留旧版 C2S 音符关系和默认值。

测试:

  • 增加针对缺失可选 C2S 属性以及旧版滑条片段宽度处理的回归测试。
Original summary in English

Sourcery 摘要

修复旧版 C2S 解析和时间转换问题,避免不完整的可选数据破坏滑条几何结构或空中音符关系。

Bug 修复:

  • 修复旧版 C2S 滑条片段在省略可选末端宽度数据时的解析问题,保留片段的起始宽度。
  • 当缺少可选的方向或颜色属性时,保留旧版 C2S 的空中音符关系和默认值。
  • 在生成 UGC 节拍时忽略无效的拍号,同时保留有效的时间映射,供后续音符使用。

测试:

  • 增加针对缺失旧版 C2S 属性、滑条宽度处理和无效拍号条目的回归测试。
Original summary in English

Sourcery 总结

修复旧版 C2S 解析问题,确保不完整的可选数据能够保留滑条几何形状和空气音符关系。

错误修复:

  • 修复旧版 C2S 谱面在省略可选的滑条末端宽度、方向或颜色属性时的解析问题。
  • 在缺少可选属性时,保留旧版空气音符关系和默认值。

测试:

  • 增加对缺失可选 C2S 属性以及旧版滑条片段宽度处理的回归测试。
Original summary in English

Summary by Sourcery

Fix legacy C2S parsing so incomplete optional data preserves slider geometry and air-note relationships.

Bug Fixes:

  • Fix parsing of legacy C2S charts when optional slider end-width, direction, or color attributes are omitted.
  • Preserve legacy air-note relationships and default values when optional attributes are missing.

Tests:

  • Add regression coverage for missing optional C2S attributes and legacy slider segment width handling.

@sourcery-ai

sourcery-ai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

审查者指南

通过为省略的方向/颜色字段提供安全默认值,并在缺少分段结束宽度时继承滑条的起始宽度,修复旧版 C2S 解析问题;回归测试覆盖默认值以及空中音符的父级关系。

旧版 C2S 滑条分段解析流程图

flowchart TD
    A[C2S slide note parsed] --> B[ParseSegment]
    B --> C[Read segment duration and end cell]
    C --> D{End width present?}
    D -->|Yes| E[Use parsed end width]
    D -->|No| F[Use note.Width]
    E --> G[Apply Math.Max]
    F --> G
    G --> H[Create slide segment]
Loading

文件级变更

变更 详细信息 文件
保留旧版 C2S 可选属性,并在省略滑条分段结束宽度时使用音符宽度。
  • 将缺失的 CHR 方向默认为 UP,将缺失的空中音符颜色默认为 DEF,且不引发解析问题。
  • 缺少分段结束宽度字段时,回退使用父级滑条的起始宽度。
  • 保留现有的音符和分段解析行为,同时规范化格式。
parser/chu/C2sParser.cs
增加对缺失旧版字段和空中音符父级关联的回归测试覆盖。
  • 验证省略 CHR 方向和空中音符颜色时,解析、默认值和目标音符关系均能保持正确。
  • 验证缺少结束宽度的滑条分段会继承初始宽度,且不会产生警告。
tests/chu/ChuTests.cs

提示和命令

与 Sourcery 交互

  • 触发新的审查: 在拉取请求中评论 @sourcery-ai review。
  • 继续讨论: 直接回复 Sourcery 的审查评论。
  • 根据审查评论生成 GitHub issue: 回复审查评论,请 Sourcery 根据该评论创建 issue。你也可以回复审查评论并使用 @sourcery-ai issue,以根据该评论创建 issue。
  • 生成拉取请求标题: 在拉取请求标题的任意位置写入 @sourcery-ai,即可随时生成标题。你也可以在拉取请求中评论 @sourcery-ai title,以随时(重新)生成标题。
  • 生成拉取请求摘要: 在拉取请求正文中任意位置写入 @sourcery-ai summary,即可在指定位置随时生成 PR 摘要。你也可以在拉取请求中评论 @sourcery-ai summary,以随时(重新)生成摘要。
  • 生成审查者指南: 在拉取请求中评论 @sourcery-ai guide,即可随时(重新)生成审查者指南。
  • 解决所有 Sourcery 评论: 在拉取请求中评论 @sourcery-ai resolve,即可解决所有 Sourcery 评论。如果你已经处理完所有评论且不想再看到它们,这会很有用。
  • 忽略所有 Sourcery 审查: 在拉取请求中评论 @sourcery-ai dismiss,即可忽略所有现有的 Sourcery 审查。如果你想从新的审查开始,这尤其有用——别忘了评论 @sourcery-ai review 以触发新的审查!

自定义你的使用体验

访问你的控制面板以:

  • 启用或禁用审查功能,例如 Sourcery 生成的拉取请求摘要、审查者指南等。
  • 更改审查语言。
  • 添加、删除或编辑自定义审查指令。
  • 调整其他审查设置。

获取帮助

Original review guide in English

Reviewer's Guide

Fixes legacy C2S parsing by supplying safe defaults for omitted direction/color fields and inheriting a slide’s starting width when a segment end width is absent, with regression tests covering defaults and air-note parent relationships.

Flow diagram for legacy C2S slider segment parsing

flowchart TD
    A[C2S slide note parsed] --> B[ParseSegment]
    B --> C[Read segment duration and end cell]
    C --> D{End width present?}
    D -->|Yes| E[Use parsed end width]
    D -->|No| F[Use note.Width]
    E --> G[Apply Math.Max]
    F --> G
    G --> H[Create slide segment]
Loading

File-Level Changes

Change Details Files
Preserve legacy C2S optional attributes and use note width when slider segment end width is omitted.
  • Default missing CHR directions to UP and missing air-note colors to DEF without raising parse issues.
  • Fall back to the parent slide’s starting width for missing segment end-width fields.
  • Retain existing note and segment parsing behavior while normalizing formatting.
parser/chu/C2sParser.cs
Add regression coverage for missing legacy fields and air-note parent linking.
  • Verify omitted CHR direction and air color preserve parsing, defaults, and target-note relationships.
  • Verify a slider segment without an end width inherits the initial width and produces no alerts.
tests/chu/ChuTests.cs

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

@cubic-dev-ai cubic-dev-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.

All reported issues were addressed across 2 files

Reply to a comment to ask cubic a question or push back. It learns from your replies.

Re-trigger cubic

Comment thread parser/chu/C2sParser.cs Outdated

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

嘿——我发现了 1 个问题

面向 AI Agent 的提示
请处理本次代码审查中的评论:

## 各条评论

### 评论 1
<location path="parser/chu/C2sParser.cs" line_range="131" />
<code_context>
-            seg.EndCell = Int(p, durationIdx + 1); 
-            seg.EndWidth = Math.Max(1, Int(p, durationIdx + 2, 1));
+            seg.EndCell = Int(p, durationIdx + 1);
+            seg.EndWidth = Math.Max(1, Int(p, durationIdx + 2, note.Width));
             if (note.IsAir) seg.EndHeight = Decimal(p, durationIdx + 3, 5);
         }
</code_context>
<issue_to_address>
**滑条端点使用了过时的宽度**

当后续连接的分段省略其结束宽度,而较早的分段已经改变了滑条宽度时,`ParseNote` 会在运行 `ParseSegment` 之前将该分段的音符替换为现有链,因此 `note.Width` 是该链的原始宽度,而不是此分段的起始宽度。回退值会为端点分配错误的宽度,导致滑条几何形状不正确,并破坏后续分段的连接。

请使用当前分段的起始宽度,作为其省略的结束宽度的回退值。
</issue_to_address>

Sourcery 评估

等待批准。 请先处理 1 个发现的问题。

阻塞性发现:parser/chu/C2sParser.cs:131


Sourcery 对开源项目免费——如果您喜欢我们的审查结果,请考虑分享它们 ✨
Original comment in English

Hey - I've found 1 issue

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

## Individual Comments

### Comment 1
<location path="parser/chu/C2sParser.cs" line_range="131" />
<code_context>
-            seg.EndCell = Int(p, durationIdx + 1); 
-            seg.EndWidth = Math.Max(1, Int(p, durationIdx + 2, 1));
+            seg.EndCell = Int(p, durationIdx + 1);
+            seg.EndWidth = Math.Max(1, Int(p, durationIdx + 2, note.Width));
             if (note.IsAir) seg.EndHeight = Decimal(p, durationIdx + 3, 5);
         }
</code_context>
<issue_to_address>
**Slider endpoints use stale width**

When a later connected segment omits its end width after an earlier segment changed the slide width, `ParseNote` replaces the segment note with the existing chain before `ParseSegment` runs, so `note.Width` is the chain’s original width rather than this segment’s starting width. The fallback assigns the wrong endpoint width, producing incorrect slide geometry and breaking later segment connections.

Use the current segment’s starting width as the fallback for its omitted end width.
</issue_to_address>

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: parser/chu/C2sParser.cs:131


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

Comment thread parser/chu/C2sParser.cs Outdated
seg.EndCell = Int(p, durationIdx + 1);
seg.EndWidth = Math.Max(1, Int(p, durationIdx + 2, 1));
seg.EndCell = Int(p, durationIdx + 1);
seg.EndWidth = Math.Max(1, Int(p, durationIdx + 2, note.Width));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 中等 · 滑条端点使用了过时的宽度

当后续连接的分段省略其结束宽度,而较早的分段已经改变了滑条宽度时,ParseNote 会在运行 ParseSegment 之前将该分段的音符替换为现有链,因此 note.Width 是该链的原始宽度,而不是此分段的起始宽度。回退值会为端点分配错误的宽度,导致滑条几何形状不正确,并破坏后续分段的连接。

请使用当前分段的起始宽度,作为其省略的结束宽度的回退值。

面向 AI Agent 的提示
在 `parser/chu/C2sParser.cs` 第 131 行:

**滑条端点使用了过时的宽度**

当后续连接的分段省略其结束宽度,而较早的分段已经改变了滑条宽度时,`ParseNote` 会在运行 `ParseSegment` 之前将该分段的音符替换为现有链,因此 `note.Width` 是该链的原始宽度,而不是此分段的起始宽度。回退值会为端点分配错误的宽度,导致滑条几何形状不正确,并破坏后续分段的连接。

请使用当前分段的起始宽度,作为其省略的结束宽度的回退值。
Original comment in English

🟡 Medium · Slider endpoints use stale width

When a later connected segment omits its end width after an earlier segment changed the slide width, ParseNote replaces the segment note with the existing chain before ParseSegment runs, so note.Width is the chain’s original width rather than this segment’s starting width. The fallback assigns the wrong endpoint width, producing incorrect slide geometry and breaking later segment connections.

Use the current segment’s starting width as the fallback for its omitted end width.

Prompt for AI agents
In `parser/chu/C2sParser.cs` at line 131:

**Slider endpoints use stale width**

When a later connected segment omits its end width after an earlier segment changed the slide width, `ParseNote` replaces the segment note with the existing chain before `ParseSegment` runs, so `note.Width` is the chain’s original width rather than this segment’s starting width. The fallback assigns the wrong endpoint width, producing incorrect slide geometry and breaking later segment connections.

Use the current segment’s starting width as the fallback for its omitted end width.

@dudehacker
dudehacker force-pushed the fix/c2s-legacy-slider-width branch from 8171248 to ef62fb4 Compare October 7, 2026 02:55
@Starrah
Starrah self-requested a review October 7, 2026 17:11
@Starrah
Starrah merged commit 1d752f9 into MuNET-OSS:master Oct 8, 2026
4 checks passed
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