mirror of
https://github.com/got-feedBack/feedBack.git
synced 2026-07-21 12:21:49 +00:00
* Update GitHub repo references from feedback* to feedBack* * rename: slopsmith -> feedBack, byron -> got-feedBack Renames across the entire codebase: - slopsmith/Slopsmith/SLOPSMITH/SlopSmith -> feedBack/FeedBack/FEEDBACK/FeedBack - byron/Byron/Byrongamatos -> got-feedBack/got-feedBack/got-feedBack - /home/byron/ -> /opt/got-feedBack/ - byron@ougsoft.com -> hi@got-feedBack.org - github.com/byrongamatos/ -> github.com/got-feedback/ - com.byron. -> com.got-feedback. - SLOPSMITH_ env vars -> FEEDBACK_ with backward-compat fallback - Protocol/storage strings migrated with read-old/write-new pattern - window.slopsmith JS API -> window.feedBack (canonical) + backward-compat alias Refs: #rename-slopsmith * rename: complete regen against current main + fix backward-compat alias Regenerated the slopsmith->feedBack / byron->got-feedBack rename on top of current main (3 commits had landed since the branch: #572/#554/#574), resolving the four content conflicts in favour of main's newer content (autoplay/auto-exit, accuracy-badge, Virtuoso re-home, feedpak badge). Completion fixes on top of the mechanical rename: - Re-apply rename to post-branch content the original rename never saw: window.slopsmith(.Tour) consumers in lessons.js / notifications.js / onboarding-tour.js, and the matching JS + python tests (autoplay_exit, progression_*, test_feedpak_extension FEEDBACK_* env vars). The test env vars now match server.py (which reads FEEDBACK_SYNC_STARTUP / FEEDBACK_SKIP_STARTUP_TASKS), so the sync-startup test exercises the real path again. - Restore the window.slopsmith backward-compat alias dropped during conflict resolution, and move the bus aliases to AFTER the _feedBackExisting merge block so they reference the fully-assembled object (also fixes the loop_api.test.js API-surface regex, which the original PR latently broke). - Drop the stray empty data/web_library.db (runtime DB lives in CONFIG_DIR) and gitignore it. - Fix stale tone-source test: feed[dB]ack -> fee[dB]ack to match shipped source labels. Verified locally (org CI billing-blocked): JS 819/819 pass; pytest 1669 passed / 1683 collected with 0 import errors; zero residual slopsmith/byron except the two intentional window.slopsmith aliases. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * rename: implement advertised backward-compat + prune dead community plugins Address gaps where PR #537's "Backward compatibility" section was advertised but not implemented, and clean up the community plugin list. Env vars (FEEDBACK_* canonical, legacy SLOPSMITH_* honoured): - New lib/env_compat.py (getenv_compat / env_flag_compat) + tests. server.py (_env_flag + all FEEDBACK_* reads), diagnostics_hardware, gp2midi and tailwind_rebuild now resolve the legacy alias, so existing SLOPSMITH_UI / SLOPSMITH_PLUGINS_DIR / etc. deployments keep working. - Fix the rename collapsing plugins/__init__.py and minigames/routes.py from `FEEDBACK_PLUGINS_DIR or SLOPSMITH_PLUGINS_DIR` into a redundant `FEEDBACK_ or FEEDBACK_` (the fallback was silently lost). Storage (app.js update-channel): - Read feedBack-update-channel, fall back to legacy slopsmith-update-channel, and clear the legacy key on write — so a user's update-channel preference survives the rename instead of resetting to "stable". Community plugin list (README): the rename rewrote third-party repo URLs we don't own. Probed every one; their owners never renamed, so: - Restore the 13 live community plugins to their real slopsmith-* names. - Prune 6 that are 404 to the public (topkoa splitscreen/stems, OmikronApex tuner, Jafz2001 nam-rig-builder, DeathlySin song-preview, Erikcb91 shuffle). - Fix a pre-existing Guitar Theory clone-command typo (nam-tone -> guitar-theory). Verified: env_compat 7/7, JS 819/819, pytest 1690 collected / 0 import errors, rename-sensitive + startup suites green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: byrongamatos <xasiklas@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
247 lines
12 KiB
JavaScript
247 lines
12 KiB
JavaScript
const { test } = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const { loadAudioSession } = require('./audio_session_test_harness');
|
|
|
|
test('audio-mix commands inspect register and unregister participants', async () => {
|
|
const window = loadAudioSession();
|
|
const api = window.feedBack.capabilities;
|
|
const events = [];
|
|
window.feedBack.on('audio-mix:participant-registered', event => events.push(event.detail.payload.participantId));
|
|
|
|
const registered = await api.dispatch({
|
|
capability: 'audio-mix',
|
|
command: 'register-participant',
|
|
source: 'test',
|
|
payload: {
|
|
participantId: 'plugin.delay',
|
|
ownerPluginId: 'delay_plugin',
|
|
label: 'Delay Return',
|
|
kind: 'plugin',
|
|
fader: { id: 'wet', label: 'Wet', min: 0, max: 1, step: 0.01, defaultValue: 0.5, currentValue: 0.6 },
|
|
operations: ['fader.get-value', 'fader.set-value'],
|
|
},
|
|
});
|
|
const inspected = await api.dispatch({ capability: 'audio-mix', command: 'inspect', source: 'test' });
|
|
const removed = await api.dispatch({ capability: 'audio-mix', command: 'unregister-participant', source: 'test', payload: { participantId: 'plugin.delay' } });
|
|
|
|
assert.equal(registered.status, 'applied');
|
|
assert.equal(registered.payload.participantId, 'plugin.delay');
|
|
assert.equal(inspected.payload.participants.some(p => p.participantId === 'plugin.delay'), true);
|
|
assert.equal(events.includes('plugin.delay'), true);
|
|
assert.equal(removed.status, 'applied');
|
|
assert.equal(window.feedBack.audioSession.snapshot().domains['audio-mix'].participants.some(p => p.participantId === 'plugin.delay'), false);
|
|
});
|
|
|
|
test('audio-mix registration reports incompatible participants explicitly', async () => {
|
|
const window = loadAudioSession();
|
|
const result = await window.feedBack.capabilities.dispatch({
|
|
capability: 'audio-mix',
|
|
command: 'register-participant',
|
|
source: 'test',
|
|
payload: { participantId: 'future.plugin', version: 2 },
|
|
});
|
|
|
|
assert.equal(result.status, 'incompatible-version');
|
|
assert.equal(result.outcome, 'incompatible-version');
|
|
assert.equal(window.feedBack.audioSession.snapshot().recentOutcomes.at(-1).outcome, 'incompatible-version');
|
|
});
|
|
|
|
test('audio-mix lists required participant kinds and commits provider fader values', async () => {
|
|
const window = loadAudioSession();
|
|
const api = window.feedBack.capabilities;
|
|
const audioSession = window.feedBack.audioSession;
|
|
audioSession.startSession({ sessionId: 'main:test-song', songKey: 'test-song', songFormat: 'sloppak' });
|
|
|
|
let pluginValue = 0.25;
|
|
for (const [participantId, kind] of [
|
|
['core.song', 'song'],
|
|
['plugin.delay', 'plugin'],
|
|
['stems.master', 'stem'],
|
|
['monitoring.input', 'monitoring'],
|
|
['preview.player', 'preview'],
|
|
]) {
|
|
const isPlugin = participantId === 'plugin.delay';
|
|
await api.dispatch({
|
|
capability: 'audio-mix',
|
|
command: 'register-participant',
|
|
source: 'test',
|
|
payload: {
|
|
participantId,
|
|
ownerPluginId: participantId.split('.')[0],
|
|
label: kind,
|
|
kind,
|
|
fader: { id: 'volume', label: `${kind} volume`, min: 0, max: 1, step: 0.05, defaultValue: 0.5, currentValue: isPlugin ? pluginValue : 0.5 },
|
|
operations: ['fader.get-value', 'fader.set-value'],
|
|
operationHandlers: isPlugin ? {
|
|
'fader.get-value': () => pluginValue,
|
|
'fader.set-value': value => { pluginValue = Math.round(value * 10) / 10; return { committedValue: pluginValue }; },
|
|
} : {},
|
|
},
|
|
});
|
|
}
|
|
|
|
const listed = await api.dispatch({ capability: 'audio-mix', command: 'list-faders', source: 'test' });
|
|
const read = await api.dispatch({ capability: 'audio-mix', command: 'get-fader-value', source: 'test', payload: { participantId: 'plugin.delay', faderId: 'volume' } });
|
|
const started = Date.now();
|
|
const written = await api.dispatch({ capability: 'audio-mix', command: 'set-fader-value', source: 'test', payload: { participantId: 'plugin.delay', faderId: 'volume', value: 0.76 } });
|
|
const latency = Date.now() - started;
|
|
const clamped = await api.dispatch({ capability: 'audio-mix', command: 'set-fader-value', source: 'test', payload: { participantId: 'plugin.delay', faderId: 'volume', value: 5 } });
|
|
|
|
assert.equal(listed.status, 'applied');
|
|
for (const kind of ['song', 'plugin', 'stem', 'monitoring', 'preview']) assert.equal(listed.payload.requiredKinds[kind], true, kind);
|
|
assert.equal(read.payload.committedValue, 0.25);
|
|
assert.equal(written.payload.requestedValue, 0.76);
|
|
assert.equal(written.payload.committedValue, 0.8);
|
|
assert.equal(latency < 500, true, `committed display latency ${latency}ms`);
|
|
assert.equal(clamped.payload.normalizedValue, 1);
|
|
assert.equal(clamped.payload.committedValue, 1);
|
|
});
|
|
|
|
test('audio-mix reports invalid unavailable and timed-out fader operations', async () => {
|
|
const window = loadAudioSession();
|
|
const api = window.feedBack.capabilities;
|
|
const events = [];
|
|
window.feedBack.on('audio-mix:fader-unavailable', event => events.push(event.detail.payload.participantId));
|
|
window.feedBack.audioSession.startSession({ sessionId: 'main:test-song' });
|
|
|
|
await api.dispatch({
|
|
capability: 'audio-mix',
|
|
command: 'register-participant',
|
|
source: 'test',
|
|
payload: {
|
|
participantId: 'plugin.disabled',
|
|
ownerPluginId: 'plugin.disabled',
|
|
label: 'Disabled',
|
|
kind: 'plugin',
|
|
availability: 'unavailable',
|
|
fader: { id: 'volume', label: 'Disabled', min: 0, max: 1, step: 0.1, defaultValue: 0.5, currentValue: 0.5 },
|
|
operations: ['fader.get-value', 'fader.set-value'],
|
|
},
|
|
});
|
|
await api.dispatch({
|
|
capability: 'audio-mix',
|
|
command: 'register-participant',
|
|
source: 'test',
|
|
payload: {
|
|
participantId: 'plugin.slow',
|
|
ownerPluginId: 'plugin.slow',
|
|
label: 'Slow',
|
|
kind: 'plugin',
|
|
fader: { id: 'volume', label: 'Slow', min: 0, max: 1, step: 0.1, defaultValue: 0.4, currentValue: 0.4 },
|
|
operations: ['fader.get-value', 'fader.set-value'],
|
|
operationHandlers: { 'fader.set-value': () => new Promise(() => {}) },
|
|
},
|
|
});
|
|
|
|
const invalid = await api.dispatch({ capability: 'audio-mix', command: 'set-fader-value', source: 'test', payload: { participantId: 'plugin.slow', faderId: 'volume', value: 'loud' } });
|
|
const unavailable = await api.dispatch({ capability: 'audio-mix', command: 'set-fader-value', source: 'test', payload: { participantId: 'plugin.disabled', faderId: 'volume', value: 0.8 } });
|
|
const started = Date.now();
|
|
const timedOut = await api.dispatch({ capability: 'audio-mix', command: 'set-fader-value', source: 'test', payload: { participantId: 'plugin.slow', faderId: 'volume', value: 0.8 } });
|
|
const elapsed = Date.now() - started;
|
|
|
|
assert.equal(invalid.outcome, 'denied');
|
|
assert.equal(unavailable.outcome, 'degraded');
|
|
assert.equal(events.includes('plugin.disabled'), true);
|
|
assert.equal(timedOut.outcome, 'failed');
|
|
assert.equal(timedOut.payload.timedOut, true);
|
|
assert.equal(timedOut.payload.committedValue, 0.4);
|
|
assert.equal(elapsed >= 1900 && elapsed < 2600, true, `timeout elapsed ${elapsed}ms`);
|
|
});
|
|
|
|
test('audio-mix keeps pre-session participants pending then attaches them on session start', async () => {
|
|
const window = loadAudioSession();
|
|
const api = window.feedBack.capabilities;
|
|
|
|
await api.dispatch({
|
|
capability: 'audio-mix',
|
|
command: 'register-participant',
|
|
source: 'test',
|
|
payload: {
|
|
participantId: 'plugin.presession',
|
|
ownerPluginId: 'plugin.presession',
|
|
label: 'Pre-session',
|
|
kind: 'plugin',
|
|
fader: { id: 'volume', label: 'Pre-session', min: 0, max: 1, step: 0.1, defaultValue: 0.3, currentValue: 0.3 },
|
|
operations: ['fader.get-value', 'fader.set-value'],
|
|
},
|
|
});
|
|
const pending = await api.dispatch({ capability: 'audio-mix', command: 'list-faders', source: 'test' });
|
|
window.feedBack.audioSession.startSession({ sessionId: 'main:next-song' });
|
|
const active = await api.dispatch({ capability: 'audio-mix', command: 'list-faders', source: 'test' });
|
|
|
|
assert.equal(pending.payload.faders.find(fader => fader.participantId === 'plugin.presession').availability, 'pending');
|
|
assert.equal(active.payload.faders.find(fader => fader.participantId === 'plugin.presession').availability, 'available');
|
|
});
|
|
|
|
test('audio-mix registration is idempotent and song switching keeps known participants without stale route', async () => {
|
|
const window = loadAudioSession();
|
|
const audioSession = window.feedBack.audioSession;
|
|
audioSession.startSession({ sessionId: 'main:first-song', songKey: 'first-song' });
|
|
audioSession.setRoute({ routeKind: 'stems', availability: 'available' });
|
|
|
|
for (let i = 0; i < 3; i += 1) {
|
|
audioSession.registerMixParticipant({
|
|
participantId: 'plugin.rehydrated',
|
|
ownerPluginId: 'plugin.rehydrated',
|
|
label: 'Rehydrated',
|
|
kind: 'plugin',
|
|
fader: { id: 'volume', label: 'Rehydrated', min: 0, max: 1, step: 0.1, defaultValue: 0.5, currentValue: 0.5 + i * 0.1 },
|
|
operations: ['fader.get-value', 'fader.set-value'],
|
|
});
|
|
}
|
|
const beforeStop = await window.feedBack.capabilities.dispatch({ capability: 'audio-mix', command: 'list-faders', source: 'test' });
|
|
audioSession.stopSession('song switch');
|
|
const stopped = audioSession.snapshot();
|
|
audioSession.startSession({ sessionId: 'main:second-song', songKey: 'second-song' });
|
|
const afterStart = await window.feedBack.capabilities.dispatch({ capability: 'audio-mix', command: 'list-faders', source: 'test' });
|
|
|
|
assert.equal(beforeStop.payload.faders.filter(fader => fader.participantId === 'plugin.rehydrated').length, 1);
|
|
assert.equal(stopped.domains['audio-mix'].route.availability, 'unavailable');
|
|
assert.equal(afterStart.payload.faders.filter(fader => fader.participantId === 'plugin.rehydrated').length, 1);
|
|
assert.equal(afterStart.payload.faders.find(fader => fader.participantId === 'plugin.rehydrated').availability, 'available');
|
|
});
|
|
test('re-registering a mix participant without handlers preserves the existing set-fader-value handler', async () => {
|
|
// Regression for the song-volume mixer no-op: _applySongVolume() runs on
|
|
// every song load and re-registers core.song WITHOUT get/set handlers.
|
|
// registerMixParticipant replaces the participant, so before the fix this
|
|
// wiped the fader.set-value handler installed at init — the mixer slider
|
|
// then moved visually but never applied the volume (archive and sloppak).
|
|
const window = loadAudioSession();
|
|
const audioSession = window.feedBack.audioSession;
|
|
audioSession.startSession({ sessionId: 'main:test-song', songKey: 'test-song', songFormat: 'sloppak' });
|
|
|
|
const applied = [];
|
|
// Initial registration WITH handlers (mirrors _registerSongFader()).
|
|
audioSession.registerMixParticipant({
|
|
participantId: 'core.song',
|
|
ownerPluginId: 'core',
|
|
label: 'Song',
|
|
kind: 'song',
|
|
sourceMode: 'core',
|
|
fader: { id: 'song', label: 'Song', unit: '%', min: 0, max: 100, step: 1, defaultValue: 80, currentValue: 80 },
|
|
operations: ['fader.get-value', 'fader.set-value'],
|
|
operationHandlers: {
|
|
'fader.get-value': () => 80,
|
|
'fader.set-value': (value) => { applied.push(value); return value; },
|
|
},
|
|
});
|
|
|
|
// Re-registration WITHOUT handlers (mirrors _applySongVolume()'s spec).
|
|
audioSession.registerMixParticipant({
|
|
participantId: 'core.song',
|
|
ownerPluginId: 'core',
|
|
label: 'Song',
|
|
kind: 'song',
|
|
sourceMode: 'core',
|
|
fader: { id: 'song', label: 'Song', unit: '%', min: 0, max: 100, step: 1, defaultValue: 80, currentValue: 55 },
|
|
});
|
|
|
|
const result = await audioSession.setFaderValue({ participantId: 'core.song', faderId: 'song', value: 42 });
|
|
|
|
assert.equal(result.outcome, 'handled');
|
|
assert.equal(result.payload.committedValue, 42);
|
|
// The handler must still have been invoked — the actual volume was applied,
|
|
// not silently swallowed by a dropped handler.
|
|
assert.deepEqual(applied, [42]);
|
|
});
|