mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-16 13:00:55 +00:00
🛼 fix: Keep BYOM Workspace Diagnostics Out of Composer Layout
Some checks are pending
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Codegraph E2E Votes / vote (full suite) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
Some checks are pending
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Codegraph E2E Votes / vote (full suite) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
This commit is contained in:
parent
6f4e36665e
commit
179ff350ec
2 changed files with 108 additions and 9 deletions
|
|
@ -380,10 +380,23 @@ function GitContext({
|
|||
);
|
||||
}
|
||||
|
||||
function WorkspaceRequirements({ id, requirements }: { id: string; requirements: string[] }) {
|
||||
function WorkspaceRequirements({
|
||||
id,
|
||||
requirements,
|
||||
visible = false,
|
||||
}: {
|
||||
id: string;
|
||||
requirements: string[];
|
||||
visible?: boolean;
|
||||
}) {
|
||||
if (requirements.length === 0) return null;
|
||||
return (
|
||||
<div id={id} role="status" aria-live="polite" className="text-text-secondary text-xs">
|
||||
<div
|
||||
id={id}
|
||||
role={visible ? undefined : 'status'}
|
||||
aria-live={visible ? undefined : 'polite'}
|
||||
className={visible ? 'text-text-secondary px-2.5 pb-2 text-xs' : 'sr-only'}
|
||||
>
|
||||
{requirements.map((requirement) => (
|
||||
<p key={requirement}>{requirement}</p>
|
||||
))}
|
||||
|
|
@ -653,6 +666,8 @@ export default function CodeWorkspaceMenu({
|
|||
) {
|
||||
requirements.unshift(localize('com_ui_code_workspace_graph_requirement'));
|
||||
}
|
||||
const details = [...requirements, ...checkoutSummaries];
|
||||
const description = details.join(' ');
|
||||
|
||||
if (workspace.locked && transition == null) {
|
||||
/** A sealed decision with no transition on offer only reports where this chat runs: without a
|
||||
|
|
@ -675,9 +690,9 @@ export default function CodeWorkspaceMenu({
|
|||
</span>
|
||||
</span>
|
||||
)}
|
||||
<div className="flex min-w-0 flex-col items-start gap-1">
|
||||
<div className="flex min-w-0 items-center">
|
||||
<TooltipAnchor
|
||||
description={requirements.join(' ') || recovery}
|
||||
description={description || recovery}
|
||||
render={
|
||||
<button
|
||||
type="button"
|
||||
|
|
@ -803,11 +818,9 @@ export default function CodeWorkspaceMenu({
|
|||
</Ariakit.MenuProvider>
|
||||
)}
|
||||
<Ariakit.MenuProvider store={menuStore}>
|
||||
<div className="flex min-w-0 flex-col items-start gap-1">
|
||||
<div className="flex min-w-0 items-center">
|
||||
<TooltipAnchor
|
||||
description={
|
||||
transitionText?.info ?? (requirements.join(' ') || localize('com_ui_code_workspace'))
|
||||
}
|
||||
description={transitionText?.info ?? (description || localize('com_ui_code_workspace'))}
|
||||
render={
|
||||
<Ariakit.MenuButton
|
||||
disabled={buttonDisabled}
|
||||
|
|
@ -1013,6 +1026,7 @@ export default function CodeWorkspaceMenu({
|
|||
))}
|
||||
</>
|
||||
)}
|
||||
<WorkspaceRequirements id={`${requirementsId}-details`} requirements={details} visible />
|
||||
<Ariakit.MenuSeparator className="border-border-light my-1 h-0 w-full border-t" />
|
||||
<Ariakit.MenuItem
|
||||
disabled={buttonDisabled || isRefreshing}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { AxiosError } from 'axios';
|
|||
import { Provider, createStore } from 'jotai';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { dataService } from 'librechat-data-provider';
|
||||
import { render, screen, waitFor } from '@testing-library/react';
|
||||
import { render, screen, within, waitFor } from '@testing-library/react';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import type { TConversation } from 'librechat-data-provider';
|
||||
import type { AxiosResponse } from 'axios';
|
||||
|
|
@ -620,6 +620,91 @@ describe('CodeWorkspaceMenu', () => {
|
|||
}
|
||||
});
|
||||
|
||||
test.each([false, true])(
|
||||
'keeps changing workspace requirements out of the composer layout (locked: %s)',
|
||||
(locked) => {
|
||||
const requiredBy = [
|
||||
{ id: 'lia', name: 'Lia' },
|
||||
{ id: 'reviewer', name: 'PR Reviewer' },
|
||||
];
|
||||
const graph = workspace({ locked });
|
||||
const setter = jest.fn();
|
||||
const { rerenderMenu } = renderMenu(
|
||||
<CodeWorkspaceMenu setConversation={setter} workspace={graph} disabled={false} />,
|
||||
);
|
||||
for (const state of ['loading', 'choose', 'unavailable', 'missing'] as const) {
|
||||
const pending = workspace({
|
||||
locked,
|
||||
state,
|
||||
canSubmit: false,
|
||||
environments: [{ environment, state, workspaces: [], requiredBy }],
|
||||
});
|
||||
rerenderMenu(
|
||||
<CodeWorkspaceMenu setConversation={setter} workspace={pending} disabled={false} />,
|
||||
);
|
||||
const button = screen.getByTestId(
|
||||
locked ? 'code-workspace-locked-status' : 'code-workspace',
|
||||
);
|
||||
const requirements = document.getElementById(button.getAttribute('aria-describedby')!);
|
||||
expect(requirements).toHaveClass('sr-only');
|
||||
expect(requirements).toHaveAttribute('role', 'status');
|
||||
expect(requirements).toHaveAttribute('aria-live', 'polite');
|
||||
expect(requirements).toHaveTextContent('Lia');
|
||||
expect(requirements).toHaveTextContent('PR Reviewer');
|
||||
expect(button.parentElement).not.toHaveClass('flex-col');
|
||||
}
|
||||
rerenderMenu(
|
||||
<CodeWorkspaceMenu setConversation={setter} workspace={graph} disabled={false} />,
|
||||
);
|
||||
expect(screen.queryByText(/Every coding agent/)).not.toBeInTheDocument();
|
||||
expect(setter).not.toHaveBeenCalled();
|
||||
},
|
||||
);
|
||||
|
||||
test('shows pending workspace requirements in the menu without a second live region', async () => {
|
||||
const graph = workspace({ state: 'loading', canSubmit: false });
|
||||
graph.environments[0] = {
|
||||
environment,
|
||||
state: 'loading',
|
||||
workspaces: [],
|
||||
requiredBy: [
|
||||
{ id: 'lia', name: 'Lia' },
|
||||
{ id: 'reviewer', name: 'PR Reviewer' },
|
||||
],
|
||||
};
|
||||
renderMenu(
|
||||
<CodeWorkspaceMenu setConversation={jest.fn()} workspace={graph} disabled={false} />,
|
||||
);
|
||||
await userEvent.click(screen.getByTestId('code-workspace'));
|
||||
const detail = within(screen.getByRole('menu')).getByText(
|
||||
'Every coding agent in this chat needs a workspace, including subagents.',
|
||||
);
|
||||
expect(detail).toBeVisible();
|
||||
expect(detail.parentElement).not.toHaveClass('sr-only');
|
||||
expect(detail.parentElement).not.toHaveAttribute('aria-live');
|
||||
expect(screen.getAllByRole('status')).toHaveLength(1);
|
||||
});
|
||||
|
||||
test('keeps multi-machine checkout summaries in the menu instead of extra composer rows', async () => {
|
||||
const graph = workspace();
|
||||
graph.environments[0].selected!.checkout = 'source';
|
||||
graph.environments.push({
|
||||
environment: { ...environment, id: 'reviewer-vm', name: 'Reviewer VM' },
|
||||
state: 'ready',
|
||||
workspaces: [{ id: 'review', name: 'Review' }],
|
||||
selected: { environmentId: 'reviewer-vm', workspaceId: 'review', checkout: 'isolated' },
|
||||
});
|
||||
renderMenu(
|
||||
<CodeWorkspaceMenu setConversation={jest.fn()} workspace={graph} disabled={false} />,
|
||||
);
|
||||
const summary = 'Reviewer VM · Review · com_ui_code_checkout_isolated';
|
||||
expect(screen.getByText(summary).parentElement).toHaveClass('sr-only');
|
||||
await userEvent.click(screen.getByTestId('code-workspace'));
|
||||
const detail = within(screen.getByRole('menu')).getByText(summary);
|
||||
expect(detail).toBeVisible();
|
||||
expect(detail.parentElement).not.toHaveClass('sr-only');
|
||||
});
|
||||
|
||||
test('explains the missing reviewer workspace while the selected primary workspace is ready', async () => {
|
||||
const reviewerMachine = { ...environment, id: 'reviewer-vm', name: 'Danny Skynet Trusted VM' };
|
||||
const graph = workspace({ state: 'choose', canSubmit: false });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue