Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ This section applies to any agent (Claude, Codex, Cursor, opencode, ...) working
- Keep UI and analysis engine decoupled through shared contracts.
- Prefer minimal, test-first changes for production code.
- Prefer practical, friendly, rehearsal-first wording over academic or authority-heavy language.
- Name tonight's first assignment with the assignee, the corroborated holding part when an active role matches, the owned assignment summary, the labeled section, and the time so the next action is obvious.
- Do not reduce the product to a chord analyzer when form, timing, player coordination, playable ranges, simplification, and setup cues are the real rehearsal blockers.
- Do not frame usability as a reason to accept weak analysis quality; BandScope should aim for both easy use and high accuracy.

Expand Down
1 change: 1 addition & 0 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Last updated: 2026-03-11
## Brand source

- Product identity, UX tone, copy rules, and prioritization tie-breakers live in `docs/brand-story.md`.
- The mounted workspace copy for tonight's first assignment must name the assignee, the corroborated holding part when an active graph node matches, the owned assignment summary, the labeled section, and the time so the next action is obvious. Open moves to the matching rendered map section. Do not invent a job from comments, approvals, rehearsal priority, setup, cue, groove, simplification, overlap, range copy, ready, or blocked status.
- Future PRDs, TRDs, onboarding copy, empty states, error messages, and marketing copy should use that document as the single brand source of truth.

## Security source
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Added

- Name tonight's first assignment in the mounted rehearsal workspace so the room can continue the job already in motion; the Open action moves to the matching rendered map section, while comments, approvals, ready, blocked, or inherited runtime metadata remain guidance-only instead of becoming navigation authority.
- Name tonight's first playable range on the ready rehearsal map and tell the player to check that span on their instrument before the section.
- Display the analyzed song tempo (BPM) as a badge in the rehearsal workspace.
- 각 합주 역할(Role)별 개인 연습 진행도를 0~100% 범위로 기록 및 시각화할 수 있는 연습 진척도(`practiceProgress`) 트래커 기능 추가. UI 컨트롤(슬라이더 및 +/- 버튼)과 한/영 다국어 지원 포함.
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ BandScope is a local-first desktop app for rehearsal prep: it turns a song into

Three layers, decoupled through shared contracts:

- `apps/desktop` — Tauri 2 + Vite + React 19 shell (Tailwind 4, Base UI, Storybook). Feature screens live in `src/features/` (home, workspace, chords, ranges, player, settings). The ready workspace names tonight's first playable range and the next instrument check. `src/lib/analysis.ts` and `src/lib/job_runner.ts` call typed Tauri IPC commands, with a browser fallback that serves demo data when not running inside Tauri.
- `apps/desktop` — Tauri 2 + Vite + React 19 shell (Tailwind 4, Base UI, Storybook). Feature screens live in `src/features/` (home, workspace, chords, ranges, player, settings). The mounted workspace names tonight's first assignment and opens the matching rendered map section. The ready workspace names tonight's first playable range and the next instrument check. Do not invent a job from comments, approvals, rehearsal priority, setup, cue, groove, simplification, overlap, range copy, ready, or blocked status. `src/lib/analysis.ts` and `src/lib/job_runner.ts` call typed Tauri IPC commands, with a browser fallback that serves demo data when not running inside Tauri.
- `apps/desktop/src-tauri/src/main.rs` — the Rust orchestration boundary. Tauri commands (`start_analysis_job`, `get_analysis_job_status`, `select_local_audio_source`, `import_youtube_url`) validate untrusted input (project IDs, file paths, URLs) and spawn the Python engine as a subprocess. There is no loopback HTTP listener and no network path for local analysis.
- `services/analysis-engine` — Python package `bandscope_analysis` (librosa/numpy). Entry point `cli.py` reads a JSON job request on stdin and prints a structured job-status JSON envelope on stdout (`--progress-jsonl` streams progress lines). `api.py` orchestrates the pipeline across the `separation`, `sections`, `roles`, `chords`, `ranges`, `temporal`, `transcription`, and `youtube` modules.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { fireEvent, render, screen } from "@testing-library/react";
import { createDemoRehearsalSong } from "@bandscope/shared-types";
import { afterEach, describe, expect, it, vi } from "vitest";
import { FirstAssignmentCallout } from "./FirstAssignmentCallout";

describe("FirstAssignmentCallout Korean role copy", () => {
afterEach(() => {
vi.unstubAllGlobals();
});

it("keeps vowel-ending dynamic role names particle-safe before and after the assignment action", () => {
vi.stubGlobal("navigator", { language: "ko-KR" });
const song = createDemoRehearsalSong();
const seed = song.sections[0]!;
seed.roles = [
{
...seed.roles[0]!,
id: "piano",
name: "피아노",
rehearsalPriority: "high"
}
];
seed.partGraph = [{ role_id: "piano", is_active: true, handoff_to: [], handoff_from: [] }];
song.collaboration = {
syncMode: "local_only",
syncNote: "Keep assignments local for now.",
assignments: [
{
id: "assign-piano",
assignee: "리듬팀",
summary: "픽업 다음 2박에 들어가세요.",
sectionId: seed.id,
roleId: "piano",
status: "in_progress"
}
],
comments: [],
approvals: []
};

const grid = document.createElement("div");
grid.dataset.testid = "song-structure-grid";
grid.setAttribute("role", "region");
grid.setAttribute("aria-label", "Scrollable song structure timeline");
const target = document.createElement("div");
target.dataset.sectionIndex = "0";
Object.defineProperty(target, "scrollIntoView", {
configurable: true,
value: vi.fn()
});
grid.appendChild(target);
document.body.appendChild(grid);

render(<FirstAssignmentCallout song={song} />);

expect(screen.getByText("0:10 벌스에서 피아노 파트 담당은 리듬팀입니다.")).toBeTruthy();
expect(screen.queryByText(/피아노이/)).toBeNull();
expect(screen.queryByText(/리듬팀이/)).toBeNull();

fireEvent.click(screen.getByRole("button", { name: "0:10 피아노 과제 위치 열기" }));

expect(screen.getByText("0:10에서 피아노 파트 과제를 이어서 하세요. 함께 잠그세요.")).toBeTruthy();
expect(screen.queryByText(/피아노과/)).toBeNull();
expect(screen.queryByText(/리듬팀과/)).toBeNull();

grid.remove();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { fireEvent, render, screen } from "@testing-library/react";
import { createDemoRehearsalSong } from "@bandscope/shared-types";
import { afterEach, describe, expect, it, vi } from "vitest";
import { FirstAssignmentCallout } from "./FirstAssignmentCallout";

describe("FirstAssignmentCallout reduced motion", () => {
afterEach(() => {
vi.unstubAllGlobals();
});

it("scrolls immediately when the operating system requests reduced motion", () => {
vi.stubGlobal("matchMedia", (query: string) => ({
matches: query === "(prefers-reduced-motion: reduce)",
media: query,
onchange: null,
addListener: vi.fn(),
removeListener: vi.fn(),
addEventListener: vi.fn(),
removeEventListener: vi.fn(),
dispatchEvent: vi.fn()
}));

const grid = document.createElement("div");
grid.dataset.testid = "song-structure-grid";
grid.setAttribute("role", "region");
grid.setAttribute("aria-label", "Scrollable song structure timeline");
const target = document.createElement("div");
target.dataset.sectionIndex = "0";
const scrollIntoView = vi.fn();
Object.defineProperty(target, "scrollIntoView", {
configurable: true,
value: scrollIntoView
});
grid.appendChild(target);
document.body.appendChild(grid);

render(<FirstAssignmentCallout song={createDemoRehearsalSong()} />);
fireEvent.click(screen.getByRole("button", { name: "Open Bass Guitar assignment at 0:10" }));
expect(scrollIntoView).toHaveBeenCalledWith({ block: "nearest", behavior: "auto" });

grid.remove();
});
});
217 changes: 217 additions & 0 deletions apps/desktop/src/features/workspace/FirstAssignmentCallout.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
import { fireEvent, render, screen } from "@testing-library/react";
import { createDemoRehearsalSong, type RehearsalSong } from "@bandscope/shared-types";
import { afterEach, describe, expect, it, vi } from "vitest";
import { FirstAssignmentCallout } from "./FirstAssignmentCallout";

function songWithAssignment() {
return createDemoRehearsalSong();
}

function appendSongStructureTarget(ariaLabel = "Scrollable song structure timeline") {
const timeline = document.createElement("div");
timeline.setAttribute("role", "region");
timeline.setAttribute("aria-label", ariaLabel);
const grid = document.createElement("div");
grid.dataset.testid = "song-structure-grid";
const target = document.createElement("div");
target.dataset.sectionIndex = "0";
const scrollIntoView = vi.fn();
Object.defineProperty(target, "scrollIntoView", {
configurable: true,
value: scrollIntoView
});
grid.appendChild(target);
timeline.appendChild(grid);
document.body.appendChild(timeline);
return { grid: timeline, scrollIntoView };
}

describe("FirstAssignmentCallout", () => {
afterEach(() => {
vi.unstubAllGlobals();
});

it("contains a malformed runtime song root instead of crashing the callout", () => {
render(<FirstAssignmentCallout song={null as unknown as RehearsalSong} />);

expect(
screen.getByText("No assignment yet. Stay on tonight's map until a part has a job.")
).toBeTruthy();
});

it("contains a hostile song identity accessor instead of crashing the callout", () => {
const song = songWithAssignment();
Object.defineProperty(song, "id", {
configurable: true,
enumerable: true,
get() {
throw new Error("hostile song id getter");
}
});

expect(() => render(<FirstAssignmentCallout song={song} />)).not.toThrow();
expect(screen.getByRole("button", { name: "Open Bass Guitar assignment at 0:10" })).toBeTruthy();
});

it("resets armed guidance when accessor-id songs change with the same assignment signature", () => {
const firstSong = songWithAssignment();
const nextSong = songWithAssignment();
for (const song of [firstSong, nextSong]) {
Object.defineProperty(song, "id", {
configurable: true,
enumerable: true,
get() {
throw new Error("hostile song id getter");
}
});
}
const { grid } = appendSongStructureTarget();
const { rerender } = render(<FirstAssignmentCallout song={firstSong} />);

fireEvent.click(screen.getByRole("button", { name: "Open Bass Guitar assignment at 0:10" }));
expect(screen.getByText(/Keep the Bass Guitar assignment moving at 0:10. Lock it in together./)).toBeTruthy();

rerender(<FirstAssignmentCallout song={nextSong} />);

expect(screen.getByText("Rhythm Section holds Bass Guitar in the verse at 0:10.")).toBeTruthy();
expect(screen.queryByText(/Keep the Bass Guitar assignment moving at 0:10. Lock it in together./)).toBeNull();

grid.remove();
});

it("names the first assignment as map navigation, scrolls to its rendered section, and arms that action", () => {
const { grid, scrollIntoView } = appendSongStructureTarget();

render(<FirstAssignmentCallout song={songWithAssignment()} />);

expect(screen.getByText("Lock the bass entrance against the pickup so the chorus lift lands together.")).toBeTruthy();
const action = screen.getByRole("button", {
name: "Open Bass Guitar assignment at 0:10"
});
expect(action).toBeTruthy();
fireEvent.click(action);
expect(scrollIntoView).toHaveBeenCalledWith({ block: "nearest", behavior: "smooth" });
expect(screen.getByText(/Keep the Bass Guitar assignment moving at 0:10. Lock it in together./)).toBeTruthy();

grid.remove();
});

it("keeps map navigation stable when the renderer accessible name is localized", () => {
const { grid, scrollIntoView } = appendSongStructureTarget("스크롤 가능한 곡 구조 타임라인");

render(<FirstAssignmentCallout song={songWithAssignment()} />);

fireEvent.click(screen.getByRole("button", { name: "Open Bass Guitar assignment at 0:10" }));

expect(scrollIntoView).toHaveBeenCalledWith({ block: "nearest", behavior: "smooth" });
expect(screen.getByText(/Keep the Bass Guitar assignment moving at 0:10. Lock it in together./)).toBeTruthy();

grid.remove();
});

it("does not claim map navigation completed when the rendered section target is missing", () => {
render(<FirstAssignmentCallout song={songWithAssignment()} />);

fireEvent.click(screen.getByRole("button", { name: "Open Bass Guitar assignment at 0:10" }));

expect(screen.getByText("Rhythm Section holds Bass Guitar in the verse at 0:10.")).toBeTruthy();
expect(screen.queryByText(/Keep the Bass Guitar assignment moving at 0:10. Lock it in together./)).toBeNull();
});

it("navigates by renderer-owned section position instead of untrusted analysis ids", () => {
const song = songWithAssignment();
song.sections[0]!.id = "analysis section / duplicate";
song.collaboration!.assignments[0]!.sectionId = "analysis section / duplicate";
const { grid, scrollIntoView } = appendSongStructureTarget();

render(<FirstAssignmentCallout song={song} />);

fireEvent.click(screen.getByRole("button", { name: "Open Bass Guitar assignment at 0:10" }));
expect(scrollIntoView).toHaveBeenCalledWith({ block: "nearest", behavior: "smooth" });

grid.remove();
});

it("scopes map navigation to the song-structure renderer when another surface reuses an index", () => {
const decoy = document.createElement("div");
decoy.dataset.sectionIndex = "0";
const decoyScrollIntoView = vi.fn();
Object.defineProperty(decoy, "scrollIntoView", {
configurable: true,
value: decoyScrollIntoView
});
document.body.appendChild(decoy);
const { grid, scrollIntoView } = appendSongStructureTarget();

render(<FirstAssignmentCallout song={songWithAssignment()} />);

fireEvent.click(screen.getByRole("button", { name: "Open Bass Guitar assignment at 0:10" }));

expect(decoyScrollIntoView).not.toHaveBeenCalled();
expect(scrollIntoView).toHaveBeenCalledWith({ block: "nearest", behavior: "smooth" });

decoy.remove();
grid.remove();
});

it("shows fresh guidance when the first assignment changes or returns later", () => {
const initialSong = songWithAssignment();
const { grid } = appendSongStructureTarget();
const { rerender } = render(<FirstAssignmentCallout song={initialSong} />);
fireEvent.click(screen.getByRole("button", { name: "Open Bass Guitar assignment at 0:10" }));
expect(screen.getByText(/Keep the Bass Guitar assignment moving at 0:10. Lock it in together./)).toBeTruthy();

const nextSong = songWithAssignment();
nextSong.id = "next-song";
nextSong.sections[0]!.timeRange = { start: 20, end: 40 };
rerender(<FirstAssignmentCallout song={nextSong} />);
expect(screen.getByText("Rhythm Section holds Bass Guitar in the verse at 0:20.")).toBeTruthy();

grid.remove();
});

it("keeps an unavailable assignment guidance-only", () => {
const song = songWithAssignment();
song.collaboration = undefined;
render(<FirstAssignmentCallout song={song} />);
expect(screen.queryByRole("button")).toBeNull();
expect(
screen.getByText("No assignment yet. Stay on tonight's map until a part has a job.")
).toBeTruthy();
});

it("names a band-wide assignment when no part carries it", () => {
const song = songWithAssignment();
for (const node of song.sections[0]!.partGraph) {
node.is_active = false;
}
const { grid, scrollIntoView } = appendSongStructureTarget();
render(<FirstAssignmentCallout song={song} />);
const action = screen.getByRole("button", { name: "Open the first assignment at 0:10" });
expect(screen.getByText("Rhythm Section holds the verse assignment at 0:10.")).toBeTruthy();
fireEvent.click(action);
expect(scrollIntoView).toHaveBeenCalledWith({ block: "nearest", behavior: "smooth" });
expect(screen.getByText("Keep the assignment moving at 0:10. Lock it in together.")).toBeTruthy();
grid.remove();
});

it("localizes the assignment form label instead of exposing its raw enum in Korean copy", () => {
vi.stubGlobal("navigator", { language: "ko-KR" });
const song = songWithAssignment();
song.sections[0]!.roles[0]!.name = "베이스 기타";

render(<FirstAssignmentCallout song={song} />);

expect(screen.getByText("0:10 벌스에서 베이스 기타 파트 담당은 Rhythm Section입니다.")).toBeTruthy();
expect(screen.queryByText(/verse에서/)).toBeNull();
});

it("renders the owned assignment summary as a text node instead of template syntax", () => {
const song = songWithAssignment();
song.collaboration!.assignments[0]!.summary = "Lock {role} at {at} with {assignee}";
song.collaboration!.assignments[1]!.status = "ready";
render(<FirstAssignmentCallout song={song} />);
expect(screen.getByText("Lock {role} at {at} with {assignee}")).toBeTruthy();
expect(screen.queryByText("Lock Bass Guitar at 0:10 with Rhythm Section")).toBeNull();
});
});
Loading
Loading