Repository navigation
Fix legacy C2S slider segment parsing - #6
Conversation
审查者指南通过为省略的方向/颜色字段提供安全默认值,并在缺少分段结束宽度时继承滑条的起始宽度,修复旧版 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]
文件级变更
提示和命令与 Sourcery 交互
自定义你的使用体验访问你的控制面板以:
获取帮助Original review guide in EnglishReviewer's GuideFixes 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 parsingflowchart 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]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
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
There was a problem hiding this comment.
嘿——我发现了 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
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
| 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)); |
There was a problem hiding this comment.
🟡 中等 · 滑条端点使用了过时的宽度
当后续连接的分段省略其结束宽度,而较早的分段已经改变了滑条宽度时,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.8171248 to
ef62fb4
Compare
0129_03.zip
fix slider conversion for old format chart, example chart with issue attached
Sourcery 摘要
修复旧版 C2S 解析问题,确保在省略可选属性时,滑条片段和空中音符关系仍保持正确。
Bug 修复:
测试:
Original summary in English
Sourcery 摘要
修复旧版 C2S 解析和时间转换问题,避免不完整的可选数据破坏滑条几何结构或空中音符关系。
Bug 修复:
测试:
Original summary in English
Sourcery 总结
修复旧版 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:
Tests: