Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (codex): a recognized drum grid and an explicit Drums pick outrank the URL extractor's format guess
[._.]/ Adam Eivy5e7e70e76b2e
diff --git a/client/src/pages/SongBookImport.jsx b/client/src/pages/SongBookImport.jsxindex 3f3cce596d..c3f191a740 100644--- a/client/src/pages/SongBookImport.jsx+++ b/client/src/pages/SongBookImport.jsx@@ -143,14 +143,21 @@ export default function SongBookImport() {applyMetaDefaults(activeMetaRef.current);}, [tab, applyMetaDefaults]);// Memoized on its real inputs so the classifier passes don't re-run on every- // unrelated keystroke (title/artist/tags). `isDrumNotation` runs BEFORE- // detectFormat: a grid row would otherwise classify as plain text (#3115). A- // chosen Drums instrument also implies the kit grid, so the format follows the- // instrument even for a chart the sniff can't recognize yet (e.g. mid-typing).+ // unrelated keystroke (title/artist/tags). Precedence, highest first:+ //+ // 1. A recognized drum grid (`isDrumNotation`) — this runs BEFORE `detectFormat`+ // because a grid row would otherwise classify as plain text (#3115). It also+ // beats the server's `fetchedFormat`: the URL extractor returns generic text+ // and has no drum awareness, so its `tab`/`plain` guess must not override an+ // unmistakable chart.+ // 2. The chosen Drums instrument — the user saying "this is a kit chart"+ // outranks any guess, and covers a chart the sniff can't read yet+ // (mid-typing) as well as one the URL extractor already labelled `tab`.+ // 3. The server's format for a URL import, then `detectFormat` for a paste.const contentFormat = useMemo(() => {- if (tab === 'url' && fetchedFormat) return fetchedFormat;if (isDrumNotation(contentText)) return DRUM_FORMAT;if (instrument === DRUM_INSTRUMENT) return DRUM_FORMAT;+ if (tab === 'url' && fetchedFormat) return fetchedFormat;return detectFormat(contentText);}, [tab, fetchedFormat, contentText, instrument]);const previewIsDrum = contentFormat === DRUM_FORMAT;diff --git a/client/src/pages/SongBookImport.test.jsx b/client/src/pages/SongBookImport.test.jsxindex eb0da6f1ae..e36cb2fa7a 100644--- a/client/src/pages/SongBookImport.test.jsx+++ b/client/src/pages/SongBookImport.test.jsx@@ -142,6 +142,30 @@ describe('SongBookImport', () => {expect(await screen.findByText('drum')).toBeTruthy();});+ it('a recognized grid and the Drums instrument both outrank the URL extractor\'s format', async () => {+ // The URL extractor returns generic text with no drum awareness, so its+ // tab/plain guess must not override an unmistakable chart — nor the user+ // explicitly saying "this is a kit chart".+ api.importSongFromUrl.mockResolvedValue({+ draft: { title: 'Fetched Groove', artist: '', content: { format: 'tab', text: DRUM_CHART }, sourceUrl: 'https://example.com/g' },+ });+ renderPage();+ fireEvent.click(screen.getByRole('tab', { name: 'From URL' }));+ fireEvent.change(screen.getByLabelText('Tab / chord-sheet URL'), { target: { value: 'https://example.com/g' } });+ fireEvent.click(screen.getByRole('button', { name: 'Fetch' }));+ await waitFor(() => expect(screen.getByLabelText('Drum bar 1')).toBeTruthy());++ // And for content the sniff can't read, the instrument still wins.+ api.importSongFromUrl.mockResolvedValue({+ draft: { title: 'Ambiguous', artist: '', content: { format: 'tab', text: 'K: o\nnot yet a grid' }, sourceUrl: 'https://example.com/a' },+ });+ fireEvent.change(screen.getByLabelText('Tab / chord-sheet URL'), { target: { value: 'https://example.com/a' } });+ fireEvent.click(screen.getByRole('button', { name: 'Fetch' }));+ await waitFor(() => expect(screen.getByText('tab')).toBeTruthy());+ fireEvent.change(screen.getByLabelText('Instrument'), { target: { value: 'drums' } });+ await waitFor(() => expect(screen.getByText('drum')).toBeTruthy());+ });+it('leaves a chord sheet on its detected format with the tab preview', async () => {renderPage();fireEvent.change(screen.getByLabelText('Pasted tab content'), { target: { value: '[Verse]\nC G Am F\nInvented lyric line' } });