Skip to content

fix(editor): an auto-sync import keeps the front of the chart#357

Merged
ChrisBeWithYou merged 1 commit into
mainfrom
fix/import-negtime-notes
Jul 22, 2026
Merged

fix(editor): an auto-sync import keeps the front of the chart#357
ChrisBeWithYou merged 1 commit into
mainfrom
fix/import-negtime-notes

Conversation

@ChrisBeWithYou

@ChrisBeWithYou ChrisBeWithYou commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

The bug

Fixes got-feedBack/feedBack#246 — a Guitar Pro import aligned to a recording with a lead-in (the audio starts before the tab's bar 1) silently loses its opening notes. One report lost the first 16. It only happens with audio auto-sync; a plain import is fine — which pins the cause to the offset application.

Root cause

The scalar-offset import path baked the audio offset into the converted XML (convert_file(audio_offset=…)). For a lead-in the resolved offset is negative, so the front notes land at a negative XML time — and core's parse_arrangement slices each level with bisect_left(times, 0.0), discarding everything before t = 0. No warning; the notes are just gone before the frontend ever sees them.

The newer per-bar warp path was already immune: it converts at offset 0 and retimes the parsed Song in memory afterward. This bug lived only in the scalar-offset fallback the warp path hands off to (GP5 with repeats, degenerate/absent sync points, or an older core).

The fix

Mirror what warp already does — never bake the offset into the XML:

  • convert-gp now always converts at audio_offset=0.0.
  • The scalar offset is applied to the parsed Song in memory via the new _apply_gp_import_offset, built on the existing, tested _apply_chart_offset (which rewrites absolute times only and preserves negatives).
  • The GP notation sidecars (keys tracks) are retimed by the same amount so _attach_gp_notation stays consistent.

Notes, beats, sections and keys notation all ride the shift; nothing off the front is dropped. Zero spec change; the warp path is untouched.

Tests

  • tests/test_gp_import_offset.py — front notes survive at negative time (nothing dropped), sidecars retimed by the same offset, zero-offset no-op.
  • Full suite: 385 passed, 5 skipped; ESLint clean; JS suite 310 passed.

Confirmed by static code-trace on current main (core slice + the editor's negative-offset bake, both verified). A /verify run with a real lead-in GP would add an end-to-end before/after repro.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Fixed Guitar Pro auto-sync imports with audio lead-ins so opening notes are no longer deleted.
    • Preserved notes, beats, notation, and timing when applying import offsets.
    • Improved handling of positive, negative, and zero timing offsets.
  • Tests

    • Added regression coverage for lead-in offsets, note preservation, and notation synchronization.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@ChrisBeWithYou, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 17 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8b5601a3-fa65-41d7-bab6-bda2093cec58

📥 Commits

Reviewing files that changed from the base of the PR and between 0f969b4 and e0d5112.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • routes.py
  • tests/test_gp_import_offset.py
📝 Walkthrough

Walkthrough

GP imports now convert source files at offset zero, then apply scalar audio offsets after parsing. The change preserves lead-in notes, retimes notation sidecars, and adds regression tests for negative, positive, and zero offsets.

Changes

GP import offset handling

Layer / File(s) Summary
Post-parse offset application
routes.py
GP conversion parses at audio_offset=0.0, then shifts parsed song timing and retimes notation sidecars for non-warp offsets.
Offset regression coverage
tests/test_gp_import_offset.py, CHANGELOG.md
Tests cover lead-in notes, positive offsets, zero-offset no-ops, and sidecar retiming; the changelog documents the fix.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

  • Issue 246 — Covers the Guitar Pro auto-sync import behavior where leading notes were deleted.

Possibly related PRs

Suggested reviewers: byrongamatos

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the main fix for auto-sync imports preserving the chart's front notes.
Linked Issues check ✅ Passed The changes preserve GP5 front notes during auto-sync imports, matching issue #246's reported deletion of the opening chart section.
Out of Scope Changes check ✅ Passed The PR stays focused on the auto-sync import fix, with only the expected changelog and regression test additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/import-negtime-notes

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

A Guitar Pro import aligned to a recording with a lead-in used to lose its
opening notes. The scalar-offset path baked the audio offset into the
converted XML, so the pre-roll landed at a negative time that core's
parse_arrangement slices off at t>=0 — silently dropping the front of the
chart (one report lost the first 16 notes). If auto-sync wasn't used it
imported fine, which pinned the cause to the offset application.

Guitar Pro is now always converted at offset 0.0 and the shift is applied to
the parsed arrangement in memory via the new _apply_gp_import_offset (built on
the existing, tested _apply_chart_offset, which preserves negative times) —
the same in-place retime the per-bar warp path already used and was immune
because of. This repairs the scalar-offset fallback the warp path hands off to
(GP5 with repeats, degenerate/absent sync points, or an older core). Notes,
beats, sections and the keys notation sidecars all ride the shift.

Tests: tests/test_gp_import_offset.py (front notes survive at negative time;
sidecars retimed by the same offset; zero-offset no-op).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017xGPjDBF8NTwTK7VQvizix
Signed-off-by: ChrisBeWithYou <chris@rifflarr.local>
@ChrisBeWithYou
ChrisBeWithYou force-pushed the fix/import-negtime-notes branch from 0f969b4 to e0d5112 Compare July 22, 2026 23:02
@ChrisBeWithYou
ChrisBeWithYou merged commit d81f0ad into main Jul 22, 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.

1 participant