-
Notifications
You must be signed in to change notification settings - Fork 0
feat(workspace): name the next rehearsal action from help #972
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
36
commits into
develop
Choose a base branch
from
feat/rehearsal-help-next-action
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
36 commits
Select commit
Hold shift + click to select a range
65de458
feat(workspace): name the next rehearsal action from help
seonghobae 83f36ef
test(help): detect case-insensitive module collisions
seonghobae c78e4df
fix(help): use case-distinct component module path
seonghobae 15a5a15
fix(help): import case-distinct help component module
seonghobae af86124
test(help): import case-distinct dialog module
seonghobae f0e9247
fix(help): remove case-colliding component path
seonghobae 2d457be
fix(help): separate import declarations
seonghobae a053c8c
test(help): cover retry selecting a different song
seonghobae 97f332f
fix(help): reset failed analysis when choosing a new song
seonghobae 58450b5
docs(test): record help module path trust boundary
seonghobae f46a7ca
test(help): reject stale result after choosing a new song
seonghobae 85b3924
fix(help): clear stale result when selecting a new song
seonghobae b22c78c
test(help): block stale analysis during source import
seonghobae 8d51eea
fix(help): enforce analysis start guard during import
seonghobae a786fae
test(help): require map action to leave score view
seonghobae a7b25de
fix(help): switch to workspace before showing the map
seonghobae dcc2b46
test(help): keep focus on the rehearsal map after close
seonghobae d018d98
fix(help): preserve map focus after dialog close
seonghobae 24fdf58
test(help): include the dialog in desktop coverage
seonghobae 91c789a
test(help): require compact access to rehearsal help
seonghobae 636c898
fix(help): expose rehearsal help on compact layouts
seonghobae d5e31f1
refactor(help): remove obsolete coming-soon copy
seonghobae 7efbe15
test: match rehearsal map action label exactly
seonghobae 63dec82
test: align source replacement and save failure contracts
seonghobae d2af745
test(help): show wait state during source import
seonghobae db3ced1
test(help): distinguish load failures and compact action label
seonghobae dc5463d
fix(help): align busy, failure, and compact action states
seonghobae 0747f3c
fix(help): restore background grid class while aligning help state
seonghobae abfbae1
test: cover YouTube source state reset
seonghobae 901e70f
fix(workspace): clear stale analysis after YouTube import
seonghobae 6b1f7d5
fix(workspace): keep rehearsal map visible on save failure
seonghobae b9ecf6c
test(rehearsal): cover distinct compact help and stale save alert
seonghobae c0095ca
fix(rehearsal): clear stale save state and disambiguate help
seonghobae 7283b52
Merge branch 'develop' into feat/rehearsal-help-next-action
seonghobae 4788e36
Merge remote-tracking branch 'origin/develop' into HEAD
seonghobae 749b5e6
fix(help): align wait copy with tests, stop offering a hidden map
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
335 changes: 335 additions & 0 deletions
335
apps/desktop/src/App.rehearsalHelpFailure.integration.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,335 @@ | ||
| import { createDemoRehearsalSong } from "@bandscope/shared-types"; | ||
| import { fireEvent, render, screen, waitFor, within } from "@testing-library/react"; | ||
| import { beforeEach, describe, expect, it, vi } from "vitest"; | ||
| import { App } from "./App"; | ||
|
|
||
| const analysisMocks = vi.hoisted(() => ({ | ||
| getAnalysisJobStatus: vi.fn(), | ||
| importYoutubeUrl: vi.fn(), | ||
| isSupportedYoutubeUrl: vi.fn(), | ||
| loadProject: vi.fn(), | ||
| saveProject: vi.fn(), | ||
| selectLocalAudioSource: vi.fn(), | ||
| startAnalysisJob: vi.fn(), | ||
| subscribeToAnalysisJobUpdates: vi.fn(async () => () => undefined), | ||
| })); | ||
|
|
||
| vi.mock("./lib/analysis", () => ({ | ||
| createDefaultAnalysisRequest: () => ({ | ||
| sourceKind: "demo", | ||
| sourceLabel: "Late Night Set", | ||
| roleFocus: ["bass-guitar", "keys-right", "lead-vocal"], | ||
| }), | ||
| getAnalysisJobStatus: analysisMocks.getAnalysisJobStatus, | ||
| importYoutubeUrl: analysisMocks.importYoutubeUrl, | ||
| isSupportedYoutubeUrl: analysisMocks.isSupportedYoutubeUrl, | ||
| loadProject: analysisMocks.loadProject, | ||
| MAX_YOUTUBE_URL_LENGTH: 2048, | ||
| saveProject: analysisMocks.saveProject, | ||
| selectLocalAudioSource: analysisMocks.selectLocalAudioSource, | ||
| startAnalysisJob: analysisMocks.startAnalysisJob, | ||
| subscribeToAnalysisJobUpdates: analysisMocks.subscribeToAnalysisJobUpdates, | ||
| })); | ||
|
|
||
| vi.mock("./features/score/ScoreView", () => ({ | ||
| ScoreView: () => <div data-testid="score-view">Score view</div>, | ||
| })); | ||
|
|
||
| function bootstrap(projectId: string, fileName: string) { | ||
| return { | ||
| projectId, | ||
| sourceMode: "reference", | ||
| projectRoot: `/tmp/bandscope/projects/${projectId}`, | ||
| cacheRoot: `/tmp/bandscope/cache/${projectId}`, | ||
| tempRoot: `/tmp/bandscope/temp/${projectId}`, | ||
| source: { | ||
| sourcePath: `/Users/test/Music/${fileName}`, | ||
| fileName, | ||
| extension: "wav", | ||
| fileSizeBytes: 1024000, | ||
| }, | ||
| }; | ||
| } | ||
|
|
||
| /** | ||
| * Security Notes: | ||
| * - Local paths in this suite are synthetic test fixtures and are never rendered in customer-facing copy. | ||
| * - The suite mocks the existing picker and analysis boundaries; it adds no network access or IPC permission. | ||
| */ | ||
| describe("App rehearsal-help failure recovery", () => { | ||
| beforeEach(() => { | ||
| for (const mock of Object.values(analysisMocks)) { | ||
| mock.mockReset(); | ||
| } | ||
| analysisMocks.isSupportedYoutubeUrl.mockReturnValue(false); | ||
| analysisMocks.subscribeToAnalysisJobUpdates.mockResolvedValue(() => undefined); | ||
| }); | ||
|
|
||
| it("gives compact rehearsal help a distinct accessible name", () => { | ||
| render(<App />); | ||
|
|
||
| const compactNav = screen.getByRole("navigation", { name: /compact rehearsal views/i }); | ||
| const compactHelp = within(compactNav).getByRole("button", { | ||
| name: /^open rehearsal help compact view$/i, | ||
| }); | ||
|
|
||
| expect(screen.getByRole("button", { name: /^open rehearsal help$/i })).toBeTruthy(); | ||
| fireEvent.click(compactHelp); | ||
| expect(screen.getByTestId("rehearsal-help-dialog")).toBeTruthy(); | ||
| }); | ||
|
|
||
| it("does not describe a project-load error as an analysis failure", async () => { | ||
| analysisMocks.loadProject.mockRejectedValueOnce(new Error("Broken project fixture")); | ||
|
|
||
| render(<App />); | ||
|
|
||
| fireEvent.click(screen.getByRole("button", { name: /open project/i })); | ||
| await waitFor(() => expect(screen.getByRole("alert")).toBeTruthy()); | ||
|
|
||
| fireEvent.click(screen.getByRole("button", { name: "Open rehearsal help" })); | ||
| const helpDialog = screen.getByTestId("rehearsal-help-dialog"); | ||
| expect(within(helpDialog).getByTestId("rehearsal-help-next-action").textContent).toMatch( | ||
| /choose a local song first/i, | ||
| ); | ||
| expect(within(helpDialog).getByTestId("rehearsal-help-next-action").textContent).not.toMatch( | ||
| /analysis did not finish/i, | ||
| ); | ||
| }); | ||
|
|
||
| it("advances from retry to start analysis after a different local song is selected", async () => { | ||
| analysisMocks.selectLocalAudioSource | ||
| .mockResolvedValueOnce({ ok: true, bootstrap: bootstrap("project-a", "failed-song.wav") }) | ||
| .mockResolvedValueOnce({ ok: true, bootstrap: bootstrap("project-b", "fresh-song.wav") }); | ||
| analysisMocks.startAnalysisJob.mockResolvedValueOnce({ | ||
| jobId: "job-help-failed", | ||
| state: "failed", | ||
| requestedAt: "2026-08-21T05:00:00.000Z", | ||
| updatedAt: "2026-08-21T05:00:01.000Z", | ||
| error: { | ||
| code: "engine_unavailable", | ||
| message: "Analysis engine is unavailable.", | ||
| }, | ||
| }); | ||
|
|
||
| render(<App />); | ||
|
|
||
| fireEvent.click(screen.getByRole("button", { name: /choose local audio/i })); | ||
| await waitFor(() => expect(screen.getByText(/failed-song\.wav/i)).toBeTruthy()); | ||
|
|
||
| fireEvent.click(screen.getByRole("button", { name: /^start analysis$/i })); | ||
| await waitFor(() => { | ||
| expect(screen.getByRole("alert").textContent).toMatch(/analysis engine is unavailable/i); | ||
| }); | ||
|
|
||
| fireEvent.click(screen.getByRole("button", { name: "Open rehearsal help" })); | ||
| let helpDialog = screen.getByTestId("rehearsal-help-dialog"); | ||
| expect(within(helpDialog).getByTestId("rehearsal-help-next-action").textContent).toMatch( | ||
| /choose another local song and try again/i, | ||
| ); | ||
| fireEvent.click(within(helpDialog).getByRole("button", { name: /choose another song/i })); | ||
|
|
||
| await waitFor(() => expect(screen.getByText(/fresh-song\.wav/i)).toBeTruthy()); | ||
| fireEvent.click(screen.getByRole("button", { name: "Open rehearsal help" })); | ||
| helpDialog = screen.getByTestId("rehearsal-help-dialog"); | ||
|
|
||
| expect(within(helpDialog).getByTestId("rehearsal-help-next-action").textContent).toMatch( | ||
| /start analysis to get tonight's first cues/i, | ||
| ); | ||
| expect(within(helpDialog).queryByRole("button", { name: /choose another song/i })).toBeNull(); | ||
| expect(screen.queryByRole("alert")).toBeNull(); | ||
| }); | ||
|
|
||
| it("forgets the previous analyzed song when a different local source is selected", async () => { | ||
| analysisMocks.selectLocalAudioSource | ||
| .mockResolvedValueOnce({ ok: true, bootstrap: bootstrap("project-a", "analyzed-song.wav") }) | ||
| .mockResolvedValueOnce({ ok: true, bootstrap: bootstrap("project-b", "fresh-song.wav") }); | ||
| analysisMocks.startAnalysisJob.mockResolvedValueOnce({ | ||
| jobId: "job-help-succeeded", | ||
| state: "succeeded", | ||
| requestedAt: "2026-08-21T05:10:00.000Z", | ||
| updatedAt: "2026-08-21T05:10:01.000Z", | ||
| progressLabel: "Analysis ready", | ||
| progressStage: "ready", | ||
| progressPercent: 100, | ||
| cacheStatus: "disabled", | ||
| result: createDemoRehearsalSong(), | ||
| }); | ||
|
|
||
| render(<App />); | ||
|
|
||
| fireEvent.click(screen.getByRole("button", { name: /choose local audio/i })); | ||
| await waitFor(() => expect(screen.getByText(/analyzed-song\.wav/i)).toBeTruthy()); | ||
|
|
||
| fireEvent.click(screen.getByRole("button", { name: /^start analysis$/i })); | ||
| await waitFor(() => { | ||
| expect(screen.getByRole("button", { name: /save project/i }).getAttribute("aria-disabled")).toBeNull(); | ||
| }); | ||
|
|
||
| fireEvent.click(screen.getByRole("button", { name: /choose local audio/i })); | ||
| await waitFor(() => expect(screen.getByText(/fresh-song\.wav/i)).toBeTruthy()); | ||
|
|
||
| fireEvent.click(screen.getByRole("button", { name: "Open rehearsal help" })); | ||
| const helpDialog = screen.getByTestId("rehearsal-help-dialog"); | ||
| expect(within(helpDialog).getByTestId("rehearsal-help-next-action").textContent).toMatch( | ||
| /start analysis to get tonight's first cues/i, | ||
| ); | ||
| expect(within(helpDialog).queryByRole("button", { name: /show the rehearsal map/i })).toBeNull(); | ||
| }); | ||
|
|
||
| it("clears a stale save failure when a different local source is selected", async () => { | ||
| analysisMocks.selectLocalAudioSource | ||
| .mockResolvedValueOnce({ ok: true, bootstrap: bootstrap("project-save-a", "save-failed-song.wav") }) | ||
| .mockResolvedValueOnce({ ok: true, bootstrap: bootstrap("project-save-b", "fresh-song.wav") }); | ||
| analysisMocks.startAnalysisJob.mockResolvedValueOnce({ | ||
| jobId: "job-help-save-failure", | ||
| state: "succeeded", | ||
| requestedAt: "2026-08-22T06:00:00.000Z", | ||
| updatedAt: "2026-08-22T06:00:01.000Z", | ||
| progressLabel: "Analysis ready", | ||
| progressStage: "ready", | ||
| progressPercent: 100, | ||
| cacheStatus: "disabled", | ||
| result: createDemoRehearsalSong(), | ||
| }); | ||
| analysisMocks.saveProject.mockRejectedValueOnce(new Error("Disk unavailable")); | ||
|
|
||
| render(<App />); | ||
|
|
||
| fireEvent.click(screen.getByRole("button", { name: /choose local audio/i })); | ||
| await waitFor(() => expect(screen.getByText(/save-failed-song\.wav/i)).toBeTruthy()); | ||
| fireEvent.click(screen.getByRole("button", { name: /^start analysis$/i })); | ||
| await waitFor(() => { | ||
| expect(screen.getByRole("button", { name: /save project/i }).getAttribute("aria-disabled")).toBeNull(); | ||
| }); | ||
|
|
||
| fireEvent.click(screen.getByRole("button", { name: /save project/i })); | ||
| await waitFor(() => expect(screen.getByRole("alert").textContent).toMatch(/disk unavailable/i)); | ||
|
|
||
| fireEvent.click(screen.getByRole("button", { name: /choose local audio/i })); | ||
| await waitFor(() => expect(screen.getByText(/fresh-song\.wav/i)).toBeTruthy()); | ||
| expect(screen.queryByRole("alert")).toBeNull(); | ||
| }); | ||
|
|
||
| it("forgets the previous analyzed song when a YouTube source is imported", async () => { | ||
| analysisMocks.isSupportedYoutubeUrl.mockReturnValue(true); | ||
| analysisMocks.selectLocalAudioSource.mockResolvedValueOnce({ | ||
| ok: true, | ||
| bootstrap: bootstrap("project-local", "analyzed-song.wav"), | ||
| }); | ||
| analysisMocks.startAnalysisJob.mockResolvedValueOnce({ | ||
| jobId: "job-help-youtube-reset", | ||
| state: "succeeded", | ||
| requestedAt: "2026-08-21T05:15:00.000Z", | ||
| updatedAt: "2026-08-21T05:15:01.000Z", | ||
| progressLabel: "Analysis ready", | ||
| progressStage: "ready", | ||
| progressPercent: 100, | ||
| cacheStatus: "disabled", | ||
| result: createDemoRehearsalSong(), | ||
| }); | ||
| analysisMocks.importYoutubeUrl.mockResolvedValueOnce({ | ||
| ok: true, | ||
| bootstrap: bootstrap("project-youtube", "imported-song.m4a"), | ||
| }); | ||
|
|
||
| render(<App />); | ||
|
|
||
| fireEvent.click(screen.getByRole("button", { name: /choose local audio/i })); | ||
| await waitFor(() => expect(screen.getByText(/analyzed-song\.wav/i)).toBeTruthy()); | ||
| fireEvent.click(screen.getByRole("button", { name: /^start analysis$/i })); | ||
| await waitFor(() => { | ||
| expect(screen.getByRole("button", { name: /save project/i }).getAttribute("aria-disabled")).toBeNull(); | ||
| }); | ||
|
|
||
| fireEvent.change(screen.getByRole("textbox", { name: /youtube url/i }), { | ||
| target: { value: "https://www.youtube.com/watch?v=dQw4w9WgXcQ" }, | ||
| }); | ||
| fireEvent.click(screen.getByRole("button", { name: /import youtube/i })); | ||
| await waitFor(() => expect(screen.getByText(/imported-song\.m4a/i)).toBeTruthy()); | ||
|
|
||
| fireEvent.click(screen.getByRole("button", { name: "Open rehearsal help" })); | ||
| const helpDialog = screen.getByTestId("rehearsal-help-dialog"); | ||
| expect(within(helpDialog).getByTestId("rehearsal-help-next-action").textContent).toMatch( | ||
| /start analysis to get tonight's first cues/i, | ||
| ); | ||
| expect(within(helpDialog).queryByRole("button", { name: /show the rehearsal map/i })).toBeNull(); | ||
| }); | ||
|
|
||
| it("shows a wait-only help state while a YouTube import is in flight", async () => { | ||
| let resolveImport: ((value: unknown) => void) | undefined; | ||
| analysisMocks.isSupportedYoutubeUrl.mockReturnValue(true); | ||
| analysisMocks.selectLocalAudioSource.mockResolvedValueOnce({ | ||
| ok: true, | ||
| bootstrap: bootstrap("project-local", "local-song.wav"), | ||
| }); | ||
| analysisMocks.importYoutubeUrl.mockImplementationOnce( | ||
| () => | ||
| new Promise((resolve) => { | ||
| resolveImport = resolve; | ||
| }), | ||
| ); | ||
|
|
||
| render(<App />); | ||
|
|
||
| fireEvent.click(screen.getByRole("button", { name: /choose local audio/i })); | ||
| await waitFor(() => expect(screen.getByText(/local-song\.wav/i)).toBeTruthy()); | ||
|
|
||
| fireEvent.change(screen.getByRole("textbox", { name: /youtube url/i }), { | ||
| target: { value: "https://www.youtube.com/watch?v=dQw4w9WgXcQ" }, | ||
| }); | ||
| fireEvent.click(screen.getByRole("button", { name: /import youtube/i })); | ||
| await waitFor(() => { | ||
| expect(screen.getByRole("button", { name: /import youtube/i }).textContent).toMatch(/importing/i); | ||
| }); | ||
|
|
||
| fireEvent.click(screen.getByRole("button", { name: "Open rehearsal help" })); | ||
| const helpDialog = screen.getByTestId("rehearsal-help-dialog"); | ||
|
|
||
| expect(within(helpDialog).getByTestId("rehearsal-help-next-action").textContent).toMatch( | ||
| /wait for this step to finish/i, | ||
| ); | ||
| expect(within(helpDialog).queryByRole("button", { name: /^start analysis$/i })).toBeNull(); | ||
| expect(analysisMocks.startAnalysisJob).not.toHaveBeenCalled(); | ||
|
|
||
| resolveImport?.({ ok: true, bootstrap: bootstrap("project-youtube", "imported-song.m4a") }); | ||
| await waitFor(() => expect(screen.getByText(/imported-song\.m4a/i)).toBeTruthy()); | ||
| }); | ||
|
|
||
| it("switches from score back to the workspace before showing the rehearsal map", async () => { | ||
| analysisMocks.selectLocalAudioSource.mockResolvedValueOnce({ | ||
| ok: true, | ||
| bootstrap: bootstrap("project-map", "map-song.wav"), | ||
| }); | ||
| analysisMocks.startAnalysisJob.mockResolvedValueOnce({ | ||
| jobId: "job-help-map", | ||
| state: "succeeded", | ||
| requestedAt: "2026-08-21T05:20:00.000Z", | ||
| updatedAt: "2026-08-21T05:20:01.000Z", | ||
| progressLabel: "Analysis ready", | ||
| progressStage: "ready", | ||
| progressPercent: 100, | ||
| cacheStatus: "disabled", | ||
| result: createDemoRehearsalSong(), | ||
| }); | ||
|
|
||
| render(<App />); | ||
|
|
||
| fireEvent.click(screen.getByRole("button", { name: /choose local audio/i })); | ||
| await waitFor(() => expect(screen.getByText(/map-song\.wav/i)).toBeTruthy()); | ||
| fireEvent.click(screen.getByRole("button", { name: /^start analysis$/i })); | ||
| await waitFor(() => { | ||
| expect(screen.getByRole("button", { name: /save project/i }).getAttribute("aria-disabled")).toBeNull(); | ||
| }); | ||
|
|
||
| fireEvent.click(screen.getAllByRole("button", { name: /^score$/i })[0]!); | ||
| await waitFor(() => expect(screen.getByTestId("score-view")).toBeTruthy()); | ||
|
|
||
| fireEvent.click(screen.getByRole("button", { name: "Open rehearsal help" })); | ||
| const helpDialog = screen.getByTestId("rehearsal-help-dialog"); | ||
| fireEvent.click(within(helpDialog).getByRole("button", { name: /show the rehearsal map/i })); | ||
|
|
||
| await waitFor(() => expect(screen.queryByTestId("score-view")).toBeNull()); | ||
| await waitFor(() => expect(screen.queryByTestId("rehearsal-help-dialog")).toBeNull()); | ||
| expect(document.activeElement?.id).toBe("main-content"); | ||
| }); | ||
| }); | ||
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.