-
Notifications
You must be signed in to change notification settings - Fork 0
feat(workspace): name using your own song as the first next action #980
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
14
commits into
develop
Choose a base branch
from
feat/first-run-use-own-song
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
14 commits
Select commit
Hold shift + click to select a range
a6d5b6f
feat(workspace): name using your own song as the first next action
e929b60
test(workspace): prevent concurrent local song intake
seonghobae 843023f
fix(workspace): serialize local song intake
seonghobae a35a90e
test(workspace): block YouTube intake during local selection
seonghobae 18caa7a
fix(workspace): serialize local and YouTube source intake
seonghobae 3126f8e
chore(i18n): remove superseded empty-state copy
seonghobae 5fa1ad0
chore(i18n): remove superseded empty-state copy
seonghobae b347b84
test(workspace): document locale override helper
seonghobae cda99c2
test(workspace): bind local picker fixture contract
seonghobae 9bc2ead
test(desktop): gate YouTube clear during local picker
seonghobae 571b913
Merge branch 'develop' into feat/first-run-use-own-song
seonghobae ab719fa
Merge remote-tracking branch 'origin/develop' into HEAD
seonghobae bc92235
fix(workspace): hide youtube clear action during local pick
seonghobae 14dfb02
fix(desktop): block analysis during local file pick
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
159 changes: 159 additions & 0 deletions
159
apps/desktop/src/App.localSelectionConcurrency.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,159 @@ | ||
| import type { ProjectBootstrapSummary } from "@bandscope/shared-types"; | ||
| import { fireEvent, render, screen, waitFor } from "@testing-library/react"; | ||
| import { beforeEach, describe, expect, it, vi } from "vitest"; | ||
| import { App } from "./App"; | ||
| import type { LocalAudioSelectionResult } from "./lib/analysis"; | ||
|
|
||
| const analysisMocks = vi.hoisted(() => ({ | ||
| getAnalysisJobStatus: vi.fn(), | ||
| importYoutubeUrl: vi.fn(), | ||
| isSupportedYoutubeUrl: vi.fn(() => false), | ||
| loadProject: vi.fn(), | ||
| saveProject: vi.fn(), | ||
| selectLocalAudioSource: vi.fn<() => Promise<LocalAudioSelectionResult>>(), | ||
| 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>Score view</div>, | ||
| })); | ||
|
|
||
| const selectedBootstrap = { | ||
| projectId: "project-local-intake", | ||
| sourceMode: "reference", | ||
| projectRoot: "/tmp/bandscope/projects/project-local-intake", | ||
| cacheRoot: "/tmp/bandscope/cache/project-local-intake", | ||
| tempRoot: "/tmp/bandscope/temp/project-local-intake", | ||
| source: { | ||
| sourcePath: "/Users/test/Music/selected-song.wav", | ||
| fileName: "selected-song.wav", | ||
| extension: "wav", | ||
| fileSizeBytes: 1024, | ||
| }, | ||
| } satisfies ProjectBootstrapSummary; | ||
|
|
||
| type SuccessfulLocalAudioSelection = Extract<LocalAudioSelectionResult, { ok: true }>; | ||
|
|
||
| /** | ||
| * Security Notes: | ||
| * - The selected path is a synthetic test fixture and is not asserted as buyer-visible copy. | ||
| * - This test mocks the existing local-picker boundary and adds no filesystem, network, or IPC authority. | ||
| */ | ||
| describe("App local song intake concurrency", () => { | ||
| beforeEach(() => { | ||
| for (const mock of Object.values(analysisMocks)) { | ||
| mock.mockReset(); | ||
| } | ||
| analysisMocks.isSupportedYoutubeUrl.mockReturnValue(false); | ||
| analysisMocks.subscribeToAnalysisJobUpdates.mockResolvedValue(() => undefined); | ||
| }); | ||
|
|
||
| it("allows only one local picker while the first selection is pending", async () => { | ||
| let resolveSelection: ((value: SuccessfulLocalAudioSelection) => void) | undefined; | ||
| analysisMocks.selectLocalAudioSource.mockImplementation( | ||
| () => | ||
| new Promise<SuccessfulLocalAudioSelection>((resolve) => { | ||
| resolveSelection = resolve; | ||
| }), | ||
| ); | ||
|
|
||
| render(<App />); | ||
|
|
||
| const emptyAction = screen.getByRole("button", { name: "Use my own song" }); | ||
| const headerAction = screen.getByRole("button", { name: "Choose local audio" }); | ||
| fireEvent.click(emptyAction); | ||
|
|
||
| await waitFor(() => { | ||
| expect(emptyAction).toBeDisabled(); | ||
| expect(headerAction).toBeDisabled(); | ||
| }); | ||
|
|
||
| fireEvent.click(emptyAction); | ||
| fireEvent.click(headerAction); | ||
| emptyAction.removeAttribute("disabled"); | ||
| expect(emptyAction).not.toBeDisabled(); | ||
| fireEvent.click(emptyAction); | ||
| expect(analysisMocks.selectLocalAudioSource).toHaveBeenCalledTimes(1); | ||
|
|
||
| resolveSelection?.({ ok: true, bootstrap: selectedBootstrap }); | ||
| await waitFor(() => expect(screen.getByText("selected-song.wav")).toBeTruthy()); | ||
| }); | ||
|
|
||
| it("blocks every YouTube source control while the local picker owns source selection", async () => { | ||
| let resolveSelection: ((value: SuccessfulLocalAudioSelection) => void) | undefined; | ||
| analysisMocks.isSupportedYoutubeUrl.mockReturnValue(true); | ||
| analysisMocks.selectLocalAudioSource.mockImplementation( | ||
| () => | ||
| new Promise<SuccessfulLocalAudioSelection>((resolve) => { | ||
| resolveSelection = resolve; | ||
| }), | ||
| ); | ||
|
|
||
| render(<App />); | ||
|
|
||
| const youtubeInput = screen.getByRole("textbox", { name: "YouTube URL" }); | ||
| const youtubeImport = screen.getByRole("button", { name: "Import YouTube" }); | ||
| fireEvent.change(youtubeInput, { target: { value: "https://www.youtube.com/watch?v=demo" } }); | ||
| expect(youtubeImport).not.toBeDisabled(); | ||
| expect(screen.getByRole("button", { name: "Clear YouTube URL" })).toBeTruthy(); | ||
|
|
||
| fireEvent.click(screen.getByRole("button", { name: "Use my own song" })); | ||
|
|
||
| await waitFor(() => { | ||
| expect(youtubeInput).toBeDisabled(); | ||
| expect(youtubeImport).toBeDisabled(); | ||
| expect(screen.queryByRole("button", { name: "Clear YouTube URL" })).toBeNull(); | ||
| }); | ||
|
|
||
| youtubeImport.removeAttribute("disabled"); | ||
| expect(youtubeImport).not.toBeDisabled(); | ||
| fireEvent.click(youtubeImport); | ||
| expect(analysisMocks.importYoutubeUrl).not.toHaveBeenCalled(); | ||
|
|
||
| resolveSelection?.({ ok: true, bootstrap: selectedBootstrap }); | ||
| await waitFor(() => expect(screen.getByText("selected-song.wav")).toBeTruthy()); | ||
| }); | ||
|
|
||
| it("blocks analysis while a replacement local picker is pending", async () => { | ||
| let resolveSelection: ((value: SuccessfulLocalAudioSelection) => void) | undefined; | ||
| analysisMocks.selectLocalAudioSource | ||
| .mockResolvedValueOnce({ ok: true, bootstrap: selectedBootstrap }) | ||
| .mockImplementationOnce( | ||
| () => | ||
| new Promise<SuccessfulLocalAudioSelection>((resolve) => { | ||
| resolveSelection = resolve; | ||
| }), | ||
| ); | ||
|
|
||
| render(<App />); | ||
| fireEvent.click(screen.getByRole("button", { name: "Use my own song" })); | ||
| await waitFor(() => expect(screen.getByText("selected-song.wav")).toBeTruthy()); | ||
|
|
||
| const startAnalysis = screen.getByRole("button", { name: "Start analysis" }); | ||
| expect(startAnalysis).not.toBeDisabled(); | ||
| fireEvent.click(screen.getByRole("button", { name: "Choose local audio" })); | ||
|
|
||
| await waitFor(() => expect(startAnalysis).toBeDisabled()); | ||
|
|
||
| resolveSelection?.({ ok: true, bootstrap: selectedBootstrap }); | ||
| await waitFor(() => expect(startAnalysis).not.toBeDisabled()); | ||
| }); | ||
| }); | ||
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
|
devin-ai-integration[bot] marked this conversation as resolved.
seonghobae marked this conversation as resolved.
|
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
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.