-
Notifications
You must be signed in to change notification settings - Fork 0
feat(workspace): name tonight's first drop plan on the map #1040
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
seonghobae
wants to merge
40
commits into
develop
Choose a base branch
from
feat/workspace-first-drop-plan
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
fa27cdf
feat(workspace): name tonight's first drop plan on the map
seonghobae 7f16388
fix(review): remove unused drop-plan constant
seonghobae 620aed1
test(review): pin user drop guidance after open
seonghobae 1c0fa8a
test(i18n): pin consistent Korean drop-plan guidance
seonghobae b340f15
fix(i18n): align Korean drop-plan guidance tone
seonghobae 2664c8e
test(workspace): reject untranslated model drop guidance
seonghobae cf938af
fix(workspace): reject free-form model drop guidance
seonghobae a1c5a57
fix(ci): restore extractor formatter contract
seonghobae f36fa45
test(core): reject orphan drop-plan provenance
seonghobae be72fe2
test(i18n): align particle-safe drop copy expectation
seonghobae 0aab1d6
test(i18n): align provenance guidance expectation
seonghobae 0892572
test(analysis): preserve shared source across role swap
seonghobae 86363f3
test(drop-plan): pin shared-source continuity
seonghobae fc0d3c8
fix(drop-plan): compare continuing sources
seonghobae 72a3012
fix(drop-plan): preserve shared source continuity
seonghobae ea6c8d9
test(drop-plan): reject unknown native provenance
seonghobae 431eae7
fix(drop-plan): validate native provenance
seonghobae ea3284a
style(drop-plan): apply pinned Ruff formatting
seonghobae 3ed69f3
test(review): reject accompaniment drop-plan ownership
seonghobae e4d48df
fix(review): reject accompaniment drop-plan ownership
seonghobae af95ce4
fix(ci): apply pinned Ruff formatting
seonghobae bfc35d4
fix(ci): match pinned Ruff set-comprehension layout
seonghobae ed677cb
fix(ci): restore pinned Ruff drop-plan layout
seonghobae bfd8c02
style(ci): apply Ruff formatting to drop-plan extractor
seonghobae c043158
style(ci): make named drop entries formatter-stable
seonghobae 21ec157
test(review): reset drop armed state on display identity changes
seonghobae 0fe3cf7
fix(review): reset drop armed state on display identity changes
seonghobae db4d992
fix(ci): apply canonical Ruff formatting
seonghobae 3c2da0c
fix(ci): preserve formatter-required final newline
seonghobae b0b425d
test(drop-plan): build accompaniment swap fixture safely
seonghobae be14490
test(drop-plan): reject blank sourced guidance
seonghobae 0d5a454
test(drop-plan): reject blank native guidance
seonghobae 86de898
test(drop-plan): cover multiline sourced guidance
seonghobae b8f7889
test(drop-plan): cover multiline native guidance
seonghobae ec12e75
fix(drop-plan): reject invalid sourced guidance
seonghobae 5a2847b
fix(drop-plan): reject invalid native guidance
seonghobae 3880092
test(native): reproduce shared role persistence mismatch
seonghobae 5ee84d8
fix(native): preserve optional shared role fields
seonghobae 59efc24
test(native): bound shared practice progress
seonghobae 28a8579
fix(native): enforce shared practice progress range
seonghobae File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,180 @@ | ||
| use bandscope_desktop_core::project_payload_from_content; | ||
| use serde_json::{json, Value}; | ||
|
|
||
| fn song_with_drop_plan() -> Value { | ||
| json!({ | ||
| "id": "analyzed-song", | ||
| "title": "Late Night Set", | ||
| "sections": [ | ||
| { | ||
| "id": "chorus-1", | ||
| "label": "chorus", | ||
| "groove": "Filled chorus downbeat", | ||
| "timeRange": { "start": 30, "end": 46 }, | ||
| "confidence": { | ||
| "level": "high", | ||
| "source": "model", | ||
| "notes": "Stem activity corroborates the drop." | ||
| }, | ||
| "roles": [ | ||
| { | ||
| "id": "lead-vocal", | ||
| "name": "Lead Vocal", | ||
| "roleType": "vocal", | ||
| "harmony": { | ||
| "chord": "C#m7", | ||
| "functionLabel": "vi landing", | ||
| "source": "model" | ||
| }, | ||
| "cue": { | ||
| "kind": "transition", | ||
| "value": "Come in on the filled chorus." | ||
| }, | ||
| "range": { | ||
| "lowestNote": "G#3", | ||
| "highestNote": "C#5" | ||
| }, | ||
| "confidence": { | ||
| "level": "high", | ||
| "source": "model", | ||
| "notes": "Vocal enters when the texture fills." | ||
| }, | ||
| "rehearsalPriority": "high", | ||
| "simplification": "Hold the landing syllable.", | ||
| "setupNote": "Keep the attack short.", | ||
| "manualOverrides": [], | ||
| "overlapWarnings": [], | ||
| "dropPlan": "Hit this drop; come in together when the texture fills.", | ||
| "dropPlanSource": "model" | ||
| } | ||
| ], | ||
| "partGraph": [ | ||
| { | ||
| "role_id": "lead-vocal", | ||
| "is_active": true, | ||
| "handoff_to": [], | ||
| "handoff_from": [] | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "exportSummary": { | ||
| "format": "cue-sheet", | ||
| "headline": "Land the chorus drop together.", | ||
| "focusSections": ["chorus-1"] | ||
| } | ||
| }) | ||
| } | ||
|
|
||
| #[test] | ||
| fn project_contract_round_trips_drop_plan_provenance() { | ||
| let payload = song_with_drop_plan(); | ||
| let content = serde_json::to_string(&payload).expect("fixture should serialize"); | ||
|
|
||
| let parsed = project_payload_from_content(&content) | ||
| .expect("native project contract must accept shared drop-plan fields"); | ||
| let serialized = serde_json::to_value(parsed).expect("native project contract should serialize"); | ||
|
|
||
| assert_eq!( | ||
| serialized["sections"][0]["roles"][0]["dropPlan"], | ||
| payload["sections"][0]["roles"][0]["dropPlan"] | ||
| ); | ||
| assert_eq!( | ||
| serialized["sections"][0]["roles"][0]["dropPlanSource"], | ||
| json!("model") | ||
| ); | ||
| } | ||
|
|
||
| #[test] | ||
| fn project_contract_round_trips_optional_shared_role_fields() { | ||
| let mut payload = song_with_drop_plan(); | ||
| let role = payload["sections"][0]["roles"][0] | ||
| .as_object_mut() | ||
| .expect("role fixture should be an object"); | ||
| role.insert( | ||
| "harmonicExplanation".into(), | ||
| json!("The leading tone resolves into the chorus tonic."), | ||
| ); | ||
| role.insert( | ||
| "transpositionPlan".into(), | ||
| json!("Move the line down a whole step if the vocal sits high."), | ||
| ); | ||
| role.insert( | ||
| "transcription".into(), | ||
| json!([{ | ||
| "pitch": "C#4", | ||
| "onset": 30.0, | ||
| "offset": 30.5, | ||
| "velocity": 96.0 | ||
| }]), | ||
| ); | ||
| role.insert("practiceProgress".into(), json!(75)); | ||
| let content = serde_json::to_string(&payload).expect("fixture should serialize"); | ||
|
|
||
| let parsed = project_payload_from_content(&content) | ||
| .expect("native project contract must accept optional shared role fields"); | ||
| let serialized = serde_json::to_value(parsed).expect("native project contract should serialize"); | ||
| let serialized_role = &serialized["sections"][0]["roles"][0]; | ||
|
|
||
| for field in [ | ||
| "harmonicExplanation", | ||
| "transpositionPlan", | ||
| "transcription", | ||
| "practiceProgress", | ||
| ] { | ||
| assert_eq!(serialized_role[field], payload["sections"][0]["roles"][0][field]); | ||
| } | ||
| } | ||
|
|
||
| #[test] | ||
| fn project_contract_rejects_practice_progress_outside_shared_range() { | ||
| let mut payload = song_with_drop_plan(); | ||
| payload["sections"][0]["roles"][0]["practiceProgress"] = json!(101); | ||
| let content = serde_json::to_string(&payload).expect("fixture should serialize"); | ||
|
|
||
| assert!( | ||
| project_payload_from_content(&content).is_err(), | ||
| "native persisted contract must enforce the shared 0..=100 practice-progress range" | ||
| ); | ||
| } | ||
|
|
||
| #[test] | ||
| fn project_contract_rejects_drop_plan_source_without_drop_plan() { | ||
| let mut payload = song_with_drop_plan(); | ||
| payload["sections"][0]["roles"][0] | ||
| .as_object_mut() | ||
| .expect("role fixture should be an object") | ||
| .remove("dropPlan"); | ||
| let content = serde_json::to_string(&payload).expect("fixture should serialize"); | ||
|
|
||
| assert!( | ||
| project_payload_from_content(&content).is_err(), | ||
| "native persisted contract must reject provenance without the value it describes" | ||
| ); | ||
| } | ||
|
|
||
| #[test] | ||
| fn project_contract_rejects_invalid_drop_plan_copy_with_source() { | ||
| for drop_plan in ["", " ", "land here\nthen hold", "land here\rthen hold"] { | ||
| let mut payload = song_with_drop_plan(); | ||
| payload["sections"][0]["roles"][0]["dropPlan"] = json!(drop_plan); | ||
| let content = serde_json::to_string(&payload).expect("fixture should serialize"); | ||
|
|
||
| assert!( | ||
| project_payload_from_content(&content).is_err(), | ||
| "native persisted contract must reject blank or multiline sourced drop-plan copy" | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| #[test] | ||
| fn project_contract_rejects_unknown_drop_plan_source() { | ||
| let mut payload = song_with_drop_plan(); | ||
| payload["sections"][0]["roles"][0]["dropPlanSource"] = json!("legacy"); | ||
| let content = serde_json::to_string(&payload).expect("fixture should serialize"); | ||
|
|
||
| assert!( | ||
| project_payload_from_content(&content).is_err(), | ||
| "native persisted contract must reject provenance outside model/user" | ||
| ); | ||
| } |
85 changes: 85 additions & 0 deletions
85
apps/desktop/src/features/workspace/FirstDropPlanCallout.custom-guidance.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| import { fireEvent, render, screen } from "@testing-library/react"; | ||
| import { createDemoRehearsalSong } from "@bandscope/shared-types"; | ||
| import { afterEach, describe, expect, it, vi } from "vitest"; | ||
| import { FirstDropPlanCallout } from "./FirstDropPlanCallout"; | ||
|
|
||
| const appendedSongStructureTargets = new Set<HTMLElement>(); | ||
|
|
||
| function songWithCustomDropPlan(source: "model" | "user" | undefined, text: string) { | ||
| const song = createDemoRehearsalSong(); | ||
| const verse = song.sections[0]!; | ||
| verse.partGraph = verse.partGraph.map((node) => ({ | ||
| ...node, | ||
| is_active: node.role_id === "bass-guitar" || node.role_id === "keys-right" | ||
| })); | ||
| const chorus = structuredClone(verse); | ||
| chorus.id = "chorus-1"; | ||
| chorus.label = "chorus"; | ||
| chorus.timeRange = { start: verse.timeRange.end, end: verse.timeRange.end + 16 }; | ||
| chorus.partGraph = chorus.partGraph.map((node) => ({ ...node, is_active: true })); | ||
| const vocal = chorus.roles.find((role) => role.id === "lead-vocal")!; | ||
| vocal.dropPlan = text; | ||
| if (source) { | ||
| vocal.dropPlanSource = source; | ||
| } | ||
| song.sections = [verse, chorus]; | ||
| return song; | ||
| } | ||
|
|
||
| function appendSongStructureTarget() { | ||
| const timeline = document.createElement("div"); | ||
| const grid = document.createElement("div"); | ||
| grid.dataset.testid = "song-structure-grid"; | ||
| const target = document.createElement("div"); | ||
| target.dataset.sectionIndex = "1"; | ||
| Object.defineProperty(target, "scrollIntoView", { | ||
| configurable: true, | ||
| value: vi.fn() | ||
| }); | ||
| grid.appendChild(target); | ||
| timeline.appendChild(grid); | ||
| document.body.appendChild(timeline); | ||
| appendedSongStructureTargets.add(timeline); | ||
| } | ||
|
|
||
| describe("FirstDropPlanCallout custom guidance", () => { | ||
| afterEach(() => { | ||
| for (const timeline of appendedSongStructureTargets) { | ||
| timeline.remove(); | ||
| } | ||
| appendedSongStructureTargets.clear(); | ||
| }); | ||
|
|
||
| it("preserves user-authored drop guidance verbatim", () => { | ||
| render( | ||
| <FirstDropPlanCallout | ||
| song={songWithCustomDropPlan("user", "Come in on the snare; don't rush the last eighth.")} | ||
| /> | ||
| ); | ||
| expect(screen.getByText("Come in on the snare; don't rush the last eighth.")).toBeTruthy(); | ||
| }); | ||
|
|
||
| it("keeps user-authored guidance in the plain body after opening the drop", () => { | ||
| appendSongStructureTarget(); | ||
| render( | ||
| <FirstDropPlanCallout | ||
| song={songWithCustomDropPlan("user", "Come in on the snare; don't rush the last eighth.")} | ||
| /> | ||
| ); | ||
|
|
||
| fireEvent.click(screen.getByRole("button", { name: "Open Lead Vocal drop at 0:30" })); | ||
|
|
||
| expect(screen.getByText("Lead Vocal lands the chorus drop at 0:30.")).toBeTruthy(); | ||
| expect(screen.getByText("Come in on the snare; don't rush the last eighth.")).toBeTruthy(); | ||
| expect(screen.queryByText(/Land Lead Vocal together at 0:30 when the texture fills./)).toBeNull(); | ||
| }); | ||
|
|
||
| it("preserves custom copy without model provenance instead of rewriting it", () => { | ||
| render( | ||
| <FirstDropPlanCallout | ||
| song={songWithCustomDropPlan(undefined, "Stack the last bar and land together.")} | ||
| /> | ||
| ); | ||
| expect(screen.getByText("Stack the last bar and land together.")).toBeTruthy(); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.