fix(sandbox): guard enable path and harden UI rendering performance (#341)

* fix(sandbox): guard enable path and harden UI rendering performance

* chore(deps): allow esbuild postinstall in pnpm onlyBuiltDependencies

* fix(sandbox): align availability reporting and address PR review feedback

* fix(sandbox): block planning without process attestation
This commit is contained in:
Chris Scott authored and GitHub committed 2026-08-27 08:58:23 -04:00
1 parent ba8e8f4b29
commit d63198ec8a
19 files changed
+501 -82

No files matched your search

@@ -528,4 +528,49 @@ describe('EventProvider questions', () => {
expect(screen.getByTestId('healthy')).toHaveTextContent('false')
})
})
it('does not re-render consumers for health notifications that only change lastEventAt', async () => {
let onHealthChange: (state: { isConnected: boolean; isHealthy: boolean; lastEventAt: number | null; isStalled: boolean }) => void = () => {}
mocks.subscribeGlobalMonitor.mockImplementation(({ onHealthChange: handler }) => {
onHealthChange = handler
return {
dispose: vi.fn(),
updateDirectories: vi.fn(),
reconnect: vi.fn(),
reportVisibility: vi.fn(),
}
})
let renderCount = 0
const Probe = () => {
renderCount += 1
const { isConnected } = useSSEHealth()
return <div data-testid="probe-connected">{String(isConnected)}</div>
}
render(<Probe />, { wrapper: createWrapper() })
await waitFor(() => {
expect(screen.getByTestId('probe-connected')).toHaveTextContent('false')
})
const initialRenderCount = renderCount
act(() => {
onHealthChange({ isConnected: true, isHealthy: true, lastEventAt: 1, isStalled: false })
})
await waitFor(() => {
expect(screen.getByTestId('probe-connected')).toHaveTextContent('true')
})
const afterBooleanChange = renderCount
act(() => {
onHealthChange({ isConnected: true, isHealthy: true, lastEventAt: 2, isStalled: false })
onHealthChange({ isConnected: true, isHealthy: true, lastEventAt: 3, isStalled: false })
})
expect(afterBooleanChange).toBe(initialRenderCount + 1)
expect(renderCount).toBe(afterBooleanChange)
})
})