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): bulk Enable-all also turns the domain toggle on
Adam Eivy95278c35a101
diff --git a/client/src/components/meatspace/post/PostDrillConfig.jsx b/client/src/components/meatspace/post/PostDrillConfig.jsxindex 32a4dcbab1..496dcbbd14 100644--- a/client/src/components/meatspace/post/PostDrillConfig.jsx+++ b/client/src/components/meatspace/post/PostDrillConfig.jsx@@ -604,17 +604,30 @@ export default function PostDrillConfig({ config, onSaved, onBack }) {function setAllCognitiveEnabled(enabled) {setCognitiveDrillTypes(prev => setEnabledMap(prev, COGNITIVE_TYPES, enabled ? new Set(COGNITIVE_TYPES) : new Set()));+ // Bulk-enabling drills in a domain whose section toggle is off (e.g.+ // right after the "Math focus" preset) must also turn the domain on —+ // otherwise the flags flip invisibly and Save persists+ // cognitive.enabled=false, so the launcher still ignores every drill the+ // user just enabled. Disabling all leaves the domain toggle alone (an+ // empty-but-on section is a valid state).+ if (enabled) setCognitiveEnabled(true);}// Never bulk-enable LLM drills without a chosen provider — respects the// AI-provider consent posture (no silent expansion into a provider the- // user hasn't picked). Disabling never calls a provider, so it's unguarded.+ // user hasn't picked; issue #2101 explicitly requires a non-empty provider+ // selection here, so the "System Default" sentinel does not satisfy the+ // gate). Disabling never calls a provider, so it's unguarded.function setAllLlmEnabled(enabled) {if (enabled && !llmProviderId) {toast.error('Pick an AI provider above before enabling all LLM drills');return;}setLlmDrillTypes(prev => setEnabledMap(prev, LLM_TYPES, enabled ? new Set(LLM_TYPES) : new Set()));+ // Same domain-on rule as cognitive: enabling all LLM drills while the+ // LLM section toggle is off would otherwise persist+ // llmDrills.enabled=false and the launcher would never run them.+ if (enabled) setLlmEnabled(true);}const selectedProvider = providers.find(p => p.id === llmProviderId);diff --git a/client/src/components/meatspace/post/PostDrillConfig.test.jsx b/client/src/components/meatspace/post/PostDrillConfig.test.jsxindex 5a327ab0b8..16a3b4b76d 100644--- a/client/src/components/meatspace/post/PostDrillConfig.test.jsx+++ b/client/src/components/meatspace/post/PostDrillConfig.test.jsx@@ -324,6 +324,30 @@ describe('PostDrillConfig', () => {expect(screen.getByRole('switch', { name: 'Digit Span' }).getAttribute('aria-checked')).toBe('false');});+ it('Cognitive "Enable all" also turns the domain toggle on when a preset had turned it off', async () => {+ // Regression: bulk-enabling drills in a collapsed/off domain used to+ // flip only the hidden per-drill flags — Save would persist+ // cognitive.enabled=false and the launcher would never run them.+ render(<PostDrillConfig config={config} onSaved={vi.fn()} onBack={vi.fn()} />);+ fireEvent.click(screen.getByText('Math focus')); // sets cognitiveEnabled=false+ expect(screen.getByRole('switch', { name: 'Cognitive drills' }).getAttribute('aria-checked')).toBe('false');+ fireEvent.click(screen.getByLabelText('Enable all Cognitive drills'));+ expect(screen.getByRole('switch', { name: 'Cognitive drills' }).getAttribute('aria-checked')).toBe('true');+ expect(screen.getByRole('switch', { name: 'Digit Span' }).getAttribute('aria-checked')).toBe('true');+ fireEvent.click(screen.getByText('Save'));+ await waitFor(() => expect(updatePostConfig).toHaveBeenCalled());+ const payload = updatePostConfig.mock.calls[0][0];+ expect(payload.cognitive.enabled).toBe(true);+ expect(payload.cognitive.drillTypes['digit-span'].enabled).toBe(true);+ });++ it('Cognitive "Disable all" leaves the domain toggle alone', () => {+ render(<PostDrillConfig config={config} onSaved={vi.fn()} onBack={vi.fn()} />);+ expect(screen.getByRole('switch', { name: 'Cognitive drills' }).getAttribute('aria-checked')).toBe('true');+ fireEvent.click(screen.getByLabelText('Disable all Cognitive drills'));+ expect(screen.getByRole('switch', { name: 'Cognitive drills' }).getAttribute('aria-checked')).toBe('true');+ });+it('LLM "Enable all" is blocked without a chosen provider — no toggles flip, an error toast fires', async () => {const toastModule = await import('../../ui/Toast');render(<PostDrillConfig config={config} onSaved={vi.fn()} onBack={vi.fn()} />);@@ -347,5 +371,24 @@ describe('PostDrillConfig', () => {fireEvent.click(screen.getByLabelText('Disable all LLM drills'));expect(screen.getByRole('switch', { name: 'Reframe' }).getAttribute('aria-checked')).toBe('false');});++ it('LLM "Enable all" also turns the LLM domain toggle back on when it was off', async () => {+ // Same domain-on rule as cognitive: bulk-enable must not leave+ // llmDrills.enabled=false or the launcher ignores the enabled drills.+ getProviders.mockResolvedValue({+ providers: [{ id: 'prov-1', name: 'Test Provider', type: 'api', enabled: true, models: [] }],+ });+ render(<PostDrillConfig config={config} onSaved={vi.fn()} onBack={vi.fn()} />);+ await waitFor(() => expect(getProviders).toHaveBeenCalled());+ const providerSelect = screen.getByLabelText('Provider');+ await waitFor(() => expect(providerSelect.querySelectorAll('option')).toHaveLength(2));+ fireEvent.change(providerSelect, { target: { value: 'prov-1' } });+ // Turn the LLM section off (provider selection survives in state).+ fireEvent.click(screen.getByRole('switch', { name: 'Wit & Memory (LLM) drills' }));+ expect(screen.getByRole('switch', { name: 'Wit & Memory (LLM) drills' }).getAttribute('aria-checked')).toBe('false');+ fireEvent.click(screen.getByLabelText('Enable all LLM drills'));+ expect(screen.getByRole('switch', { name: 'Wit & Memory (LLM) drills' }).getAttribute('aria-checked')).toBe('true');+ expect(screen.getByRole('switch', { name: 'Reframe' }).getAttribute('aria-checked')).toBe('true');+ });});});