fix(editor): restore from-scratch create — artist and audio are optional - #174
Conversation
Typing a title enabled the Create button. Clicking it said "Artist is required." Supplying an artist then said "Audio is required for an audio-only project", which made the advertised draft-now-audio-later flow impossible. The roster chips were ignored — every draft came out as a lone Lead arrangement — and the eight extended-metadata fields the modal collects were never sent. Root cause is the duplicate `_editorDoBlankCreate` found while extracting src/create.js (#173): main.js defined it twice, function declarations hoist, and the LAST one in source order silently won. So PR #45's redesign never ran, and the older definition kept sending the server's documented BACK-COMPAT payload (`initial_arrangement` + `init_drum_tab`) instead of the roster it asks for. Everything else already agreed, which is what makes this unambiguous rather than a product call: _createGateOpen enables Create on a title + one instrument (and is unit-tested) screen.html marks only Title "(required)" editorDoCreate comments, right above the call: "only a title is required; audio + artist are optional" create_sloppak "title required"; "Artist is OPTIONAL for a draft"; "Draft-now, audio-later: audio is OPTIONAL"; and it calls initial_arrangement/init_drum_tab the "Legacy shape" Only the handler disagreed. It now validates a title and a non-empty instrument roster, treats artist and audio as optional, and sends `arrangements` plus the spec-complete metadata via the same _createExtendedMeta() helper the Guitar Pro and EOF paths already use. Kept from the old function: the art-upload retry (art normally uploads on selection; this covers a selection whose upload failed). Added: the roster check re-enables the button on failure, which the redesign's version forgot. Removed createState.initialArrangement and createState.initDrumTab — nothing reads them now. The separate, older editorShowCreateSloppakModal dialog still sends the legacy shape with its own drum checkbox, and the server still accepts it; untouched. Codex flagged one apparent regression: that the old payload defaulted init_drum_tab to true, so a default create used to seed Drums as well. It reads that way, but the line below the default overwrites it with a lookup for `#editor-create-drum-tab` — an element the same redesign deleted from screen.html. Verified against the live DOM: the element does not exist, the expression is false, and the server appended nothing. The default roster was ['Lead'] before this change and is ['Lead'] after it. verify_blank_create.py drives the real modal and reads the real POST body: a title alone POSTs, no artist and no audio are sent or demanded, the roster chips arrive as `arrangements`, no back-compat keys are sent, and the extended fields travel. It fails on 6 of 8 checks against the pre-fix code. End to end the server writes an audio-less draft (`stems: []`) with arrangements/lead.json, arrangements/drums.json and drum_tab.json when Drums is chosen. node --test 89/89, pytest 248/248, npm run lint 0 errors, all 16 headless harnesses pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughChangesBlank creation flow
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CreateUI
participant BlankCreate
participant UploadArt
participant CreateSloppak
CreateUI->>BlankCreate: Submit title and roster
BlankCreate->>UploadArt: Retry album-art upload when artPath is unset
UploadArt-->>BlankCreate: Return art_path
BlankCreate->>CreateSloppak: Send roster and extended metadata
CreateSloppak-->>CreateUI: Complete blank creation
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
This PR fixes the “Blank / from-scratch” create flow in src/create.js so it matches the intended draft workflow: only a title + non-empty instrument roster are required, while artist and audio are optional. It also restores sending the roster-based arrangements payload and forwards the modal’s extended metadata via the shared helper, aligning the client with the backend contract.
Changes:
- Remove obsolete blank-create state (
initialArrangement,initDrumTab) and stop sending legacy back-compat keys. - Update
_editorDoBlankCreatevalidation and payload to (a) require title + at least one instrument, (b) allow missing artist/audio, and (c) sendarrangementsplus extended metadata. - Document the fix in
CHANGELOG.md.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/create.js | Fixes blank-create validation and payload to support draft-now (artist/audio optional) and send roster-based arrangements + extended metadata. |
| CHANGELOG.md | Adds a detailed Unreleased “Fixed” entry describing the restored blank-create behavior and root cause. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Follow-up to the duplicate-function bug found in #173.
The symptom
Type a title. The Create button enables. Click it:
Supply an artist:
So the advertised draft-now, audio-later flow was impossible. And even when it did succeed, the roster chips (“What are you arranging?”) were ignored — every draft came out as a lone
Leadarrangement — and the eight extended-metadata fields the modal collects (album artist, track, disc, genres, language, ISRC, MBID, authors) were silently dropped.Root cause
main.jsdefined_editorDoBlankCreatetwice. Function declarations hoist, and the last one in source order silently wins, so PR #45’s redesign never ran. The older definition kept sending the server’s documented back-compat payload (initial_arrangement+init_drum_tab) instead of the roster the server asks for.Why this is a bug fix, not a product call
Everything else in the system already agreed. Only the handler disagreed:
_createGateOpen(unit-tested)screen.html(required)editorDoCreate, right above the callcreate_sloppak(routes.py)initial_arrangement/init_drum_tabthe “Legacy shape”The fix
Validate a title and a non-empty instrument roster. Artist and audio optional. Send
arrangementsplus the spec-complete metadata through the same_createExtendedMeta()helper the Guitar Pro and EOF paths already use.createState.initialArrangementandcreateState.initDrumTab, which now have no reader. The separate, oldereditorShowCreateSloppakModaldialog still sends the legacy shape with its own drum checkbox, and the server still accepts it. Untouched.A Codex finding I did not take
Codex reported a regression: the old payload defaulted
init_drum_tabtotrue, so a default create used to seed Drums too.It reads that way — but the line below the default overwrites it:
#editor-create-drum-tabwas deleted fromscreen.htmlby the same redesign. Verified against the live DOM: the element does not exist, the expression isfalse, and the server appended nothing. The default roster was[Lead]before this change and is[Lead]after it. No behaviour lost.Verification
verify_blank_create.pydrives the real modal and reads the real POST body.Artist is required.)arrangementsgenres)End to end, with a title and
Lead + Drumschosen, the server writes an audio-less draft:node --test89/89 ·pytest248/248 ·npm run lint0 errors · all 16 headless harnesses pass.cc @ChrisBeWithYou — this restores your #45 work.
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Documentation