Skip to content

fix(gp): GP5 chord enrichment — diagram-match gate + decoupled name/fingers (E3 follow-up)#523

Merged
byrongamatos merged 1 commit into
mainfrom
fix/e3-gp5-diagram-match
Jun 20, 2026
Merged

fix(gp): GP5 chord enrichment — diagram-match gate + decoupled name/fingers (E3 follow-up)#523
byrongamatos merged 1 commit into
mainfrom
fix/e3-gp5-diagram-match

Conversation

@byrongamatos

Copy link
Copy Markdown
Contributor

Follow-up to #522 (E3 GP chord-diagram extraction). An independent post-merge Codex review surfaced two GP5-path edge cases; this fixes both.

Sev Finding Fix
P2 GP5 enriched the played template from the attached chord diagram without verifying the diagram described the voicing actually played — a mismatched label/diagram mis-named/fingered it, and the back-fill spread it to other strums of the same played pattern New _chord_diagram_frets(); enrich only on an exact, full-span fret-pattern match (mirrors the GP8 guard). Compared over max(played width, num_strings) so a 7/8-string diagram fretting an extended string can't falsely match a narrower played voicing
P3 name + fingers back-fill were coupled — a name-only first annotation blocked a later beat that carried fingers back-fill name and fingers independently

Review

Codex re-reviewed twice: the first match-gate trimmed diagram frets beyond the played width (could still false-match on 7/8-string), fixed by the full-span compare; the final pass is clean (no P1/P2/P3).

Tests (tests/test_gp2rs.py)

+4 cases: mismatch-not-applied, name-then-fingers decoupled, higher-position absolute-fret match, and a 7-string extended-string regression.

PYTHONPATH=lib python -m pytest tests/test_gp2rs.py tests/test_gp2rs_gpx.py -q
# 163 passed

Follow-up to #522. Part of #334.

🤖 Generated with Claude Code

…uple name/fingers

Post-merge Codex review of E3 (PR #522) flagged two GP5 edge cases:

- P2: enrichment applied the diagram's name/fingers to the played template
  without checking the diagram described the voicing actually played. A
  mismatched chord label/diagram could mis-name/finger the played template, and
  the back-fill spread it to other strums of the same played pattern. Now gated
  on an exact, full-span fret-pattern match (new _chord_diagram_frets), mirroring
  the GP8 guard — and comparing over max(played width, num_strings) so a
  7/8-string diagram can't falsely match a narrower played voicing.
- P3: name and fingers back-fill were coupled (a name-only first annotation
  blocked a later beat's fingers). Now independent.

Codex re-reviewed twice (the first match-gate trimmed extended strings; fixed by
the full-span compare); final pass clean. +4 tests (mismatch-not-applied,
name-then-fingers decoupled, higher-position absolute match, 7-string extended
string regression). 163 GP tests pass.

Follow-up to #522. Part of #334.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@byrongamatos
byrongamatos merged commit 293dc86 into main Jun 20, 2026
0 of 3 checks passed
@byrongamatos
byrongamatos deleted the fix/e3-gp5-diagram-match branch June 20, 2026 19:04
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