Skip to content

fix(editor): handshape authoring edge-case fixes (E2 follow-up, Codex) - #11

Merged
byrongamatos merged 1 commit into
mainfrom
fix/e2-handshape-codex-followups
Jun 20, 2026
Merged

byrongamatos merged 1 commit into
mainfrom
fix/e2-handshape-codex-followups

Conversation

@byrongamatos

Copy link
Copy Markdown
Collaborator

Follow-up to #10 (E2 span-lane handshape authoring). An independent post-merge Codex review surfaced a P1 + four P2/P3 edge cases; this fixes all six.

Sev Finding Fix
P1 Span over empty bars created a handshape with chord_id=0 (unrelated/invalid template) onHandshapeLaneMouseUp create path now also requires _handshapeSpanFrets(...) to resolve a voicing; else a status hint, no handshape
P2 Tempo/drum mode toggle mid-drag dropped an in-flight handshape edit (no history cmd) _finalizeActiveDrag commits a handshape drag via onHandshapeLaneMouseUp
P2 Delete of a selected handshape mid-drag left S.drag dangling clear S.drag when it points at the deleted handshape
P2 AddHandshapeCmd tracked its template by identity → undo/redo across a save could orphan/dup templates exec() resolves/appends by fret-key (no redo dup); rollback() removes by object identity (a save replaces template objects, so post-save it correctly leaves reconstruct-owned templates — incl. ones now backing a real chord — alone)
P3 Zero-/negative-length handshapes loaded as 2px slivers drop on load (end_time > start_time)
P3 Remap didn't clear S.handshapeSel when it dropped the selected handshape clear it in reconstructChords

Review

Codex re-reviewed twice: the first pass confirmed 5/6 resolved but caught a regression in the P2c fix (key-based rollback could splice a template referenced by arr.chords after a save) — fixed by the exec-key / rollback-identity split above; the final pass is clean (no findings).

Test

node --check screen.js            # OK
node tests/chord_relink.test.js   # 10 passed
node tests/handshape_authoring.test.js  # 4 passed

Part of got-feedBack/feedBack#334.

🤖 Generated with Claude Code

Post-merge Codex review of the E2 span-lane authoring (PR #10) surfaced a P1
plus four P2/P3 edge cases. Fix all:

- P1: drawing a span over empty bars created a handshape with chord_id=0 (an
  unrelated/invalid template). onHandshapeLaneMouseUp now requires
  _handshapeSpanFrets() to resolve a voicing before creating.
- P2: a tempo/drum mode toggle mid-drag dropped an in-flight handshape edit with
  no history command. _finalizeActiveDrag now commits it via onHandshapeLaneMouseUp.
- P2: deleting a selected handshape mid-drag left S.drag dangling -> clear it.
- P2: AddHandshapeCmd tracked its template by object identity, so undo/redo across
  a save's reconstruct could orphan/duplicate templates. exec() now resolves/appends
  by fret-key (no redo duplicate); rollback() removes by object identity (so a save,
  which replaces template objects, isn't wrongly undone -> won't splice a template
  now backing a real chord).
- P3: zero-/negative-length handshapes dropped on load (end_time > start_time).
- P3: reconstructChords clears S.handshapeSel if the remap drops the selected
  handshape from the current arrangement.

Codex re-reviewed twice (a first fix introduced a rollback regression, now
resolved); final pass clean. node --check + both JS suites pass (10/10, 4/4).

Part of got-feedBack/feedBack#334.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@byrongamatos
byrongamatos merged commit cbe6431 into main Jun 20, 2026
@byrongamatos
byrongamatos deleted the fix/e2-handshape-codex-followups branch June 20, 2026 17:18
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