Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

fix(ok): reject config mutations before initial sync (#4387)

Nick Gomez962a4d32acf3
diff --git a/.changeset/prevent-unsynced-config-writes.md b/.changeset/prevent-unsynced-config-writes.md
new file mode 100644
index 000000000..bdc64b932
--- /dev/null
+++ b/.changeset/prevent-unsynced-config-writes.md
@@ -0,0 +1,5 @@
+---
+"@inkeep/open-knowledge": patch
+---
+
+Fix a bug where clicking `Enable terminal` while project settings were loading could leave the terminal off. `Enable terminal`, sidebar view toggles, skill pinning, and `Reset view filters` refuse settings changes until the relevant settings load. The theme picker in `AI tools & CLI` still works locally when shared settings are unavailable; otherwise it waits for them to load. A rejected settings write leaves the current theme in place. Native View-menu actions remain available and report a loading notice during this window.
diff --git a/knip.config.ts b/knip.config.ts
index 64cd89860..802352af8 100644
--- a/knip.config.ts
+++ b/knip.config.ts
@@ -139,15 +139,11 @@ export default {
'packages/server': {
entry: ['src/**/*.test.ts', 'src/parse-worker.ts'],
project: 'src/**',
- ignoreDependencies: [
- '@types/shell-quote',
- ],
+ ignoreDependencies: ['@types/shell-quote'],
},
'packages/cli': {
entry: ['src/**/*.test.ts', 'scripts/*.ts', 'tests/**/*.ts', 'src/parse-worker.ts'],
- ignoreDependencies: [
- 'yjs',
- ],
+ ignoreDependencies: ['yjs'],
},
'packages/desktop': {
entry: [
diff --git a/packages/app/src/components/FileSidebar.dom.test.tsx b/packages/app/src/components/FileSidebar.dom.test.tsx
index 89b1e8d04..208982f6b 100644
--- a/packages/app/src/components/FileSidebar.dom.test.tsx
+++ b/packages/app/src/components/FileSidebar.dom.test.tsx
@@ -106,6 +106,7 @@ let mergedConfig: {
appearance: { sidebar: { showHiddenFiles: false } },
};
let projectLocalBindingNull = false;
+let projectLocalSynced = true;
let sidebarSearchThrows = false;
let projectPatchResult: { ok: true } | { ok: false; error: unknown } = { ok: true };
let openInAgentSubmenuProps: Array<{
@@ -113,6 +114,7 @@ let openInAgentSubmenuProps: Array<{
}> = [];
let toastSuccesses: unknown[][] = [];
let toastErrors: unknown[][] = [];
+let toastInfos: unknown[][] = [];
let pillRenderErrors: unknown[][] = [];
const treeListeners = new Set<() => void>();
@@ -243,6 +245,7 @@ vi.doMock('@/components/ui/button', () => ({
vi.doMock('@/components/ui/context-menu', () => ({
ContextMenu: PassThrough,
ContextMenuContent: ({ children }: { children?: ReactNode }) => <div role="menu">{children}</div>,
+ ContextMenuGroup: ElementPassThrough,
ContextMenuItem: ({
children,
disabled,
@@ -271,12 +274,14 @@ vi.doMock('@/components/ui/context-menu', () => ({
children,
disabled,
onCheckedChange,
+ onSelect,
...props
}: {
checked?: boolean;
children?: ReactNode;
disabled?: boolean;
onCheckedChange?: (checked: boolean) => void;
+ onSelect?: (event: Event) => void;
[key: string]: unknown;
}) => (
<button
@@ -285,7 +290,9 @@ vi.doMock('@/components/ui/context-menu', () => ({
aria-checked={checked ? 'true' : 'false'}
disabled={disabled}
onClick={() => {
- if (!disabled) onCheckedChange?.(!checked);
+ if (disabled) return;
+ onSelect?.(new Event('menu.itemSelect', { cancelable: true }));
+ onCheckedChange?.(!checked);
}}
{...props}
>
@@ -306,12 +313,14 @@ vi.doMock('@/components/ui/dropdown-menu', () => ({
children,
disabled,
onCheckedChange,
+ onSelect,
...props
}: {
checked?: boolean;
children?: ReactNode;
disabled?: boolean;
onCheckedChange?: (checked: boolean) => void;
+ onSelect?: (event: Event) => void;
[key: string]: unknown;
}) => (
<button
@@ -320,7 +329,9 @@ vi.doMock('@/components/ui/dropdown-menu', () => ({
aria-checked={checked ? 'true' : 'false'}
disabled={disabled}
onClick={() => {
- if (!disabled) onCheckedChange?.(!checked);
+ if (disabled) return;
+ onSelect?.(new Event('menu.itemSelect', { cancelable: true }));
+ onCheckedChange?.(!checked);
}}
{...props}
>
@@ -419,6 +430,7 @@ vi.doMock('@/hooks/use-folder-config', () => ({
vi.doMock('@/lib/config-provider', () => ({
useConfigContext: () => ({
merged: mergedConfig,
+ projectLocalSynced,
projectLocalBinding: projectLocalBindingNull
? null
: {
@@ -434,6 +446,7 @@ vi.doMock('@/lib/use-workspace', () => ({
vi.doMock('sonner', () => ({
toast: {
error: (...args: unknown[]) => toastErrors.push(args),
+ info: (...args: unknown[]) => toastInfos.push(args),
success: (...args: unknown[]) => toastSuccesses.push(args),
},
}));
@@ -460,11 +473,13 @@ describe('FileSidebar runtime behavior', () => {
hasTemplates = true;
mergedConfig = { appearance: { sidebar: { showHiddenFiles: false } } };
projectLocalBindingNull = false;
+ projectLocalSynced = true;
sidebarSearchThrows = false;
projectPatchResult = { ok: true };
openInAgentSubmenuProps = [];
toastSuccesses = [];
toastErrors = [];
+ toastInfos = [];
pillRenderErrors = [];
treeListeners.clear();
for (const fn of [
@@ -738,32 +753,77 @@ describe('FileSidebar runtime behavior', () => {
});
});
- test('Show checkboxes disable while the project-local binding is unavailable', async () => {
+ test('Show checkboxes explain why they are disabled while project settings load', async () => {
+ const user = userEvent.setup();
projectLocalBindingNull = true;
await renderSidebar();
const menu = screen.getByTestId('tree-options-menu');
- for (const id of [
+ const treeCheckboxes = [
'tree-options-show-hidden-files',
'tree-options-show-ok-folders',
'tree-options-show-only-markdown-files',
'tree-options-show-skills',
- ]) {
- const checkbox = within(menu).getByTestId(id) as HTMLButtonElement;
- expect(checkbox.disabled).toBe(true);
- fireEvent.click(checkbox);
- }
- for (const id of [
+ 'tree-options-group-skills',
+ ].map((id) => within(menu).getByTestId(id) as HTMLButtonElement);
+ const contextCheckboxes = [
'empty-space-menu-show-hidden-files',
'empty-space-menu-show-ok-folders',
'empty-space-menu-show-only-markdown-files',
'empty-space-menu-show-skills-section',
- ]) {
- const checkbox = screen.getByTestId(id) as HTMLButtonElement;
- expect(checkbox.disabled).toBe(true);
+ ].map((id) => screen.getByTestId(id) as HTMLButtonElement);
+
+ for (const checkbox of [...treeCheckboxes, ...contextCheckboxes]) {
+ expect(checkbox.disabled).toBe(false);
+ expect(checkbox.getAttribute('aria-disabled')).toBe('true');
+ const descriptionId = checkbox.getAttribute('aria-describedby');
+ expect(descriptionId).toBeTruthy();
+ expect(document.getElementById(descriptionId ?? '')?.textContent).toBe(
+ 'Settings are still loading. Try again in a moment.',
+ );
fireEvent.click(checkbox);
}
+ expect(toastInfos).toHaveLength(9);
+ for (const args of toastInfos) {
+ expect(args).toEqual([
+ 'Settings are still loading. Try again in a moment.',
+ { id: 'sidebar-settings-not-ready' },
+ ]);
+ }
+ await user.hover(treeCheckboxes[0]?.parentElement as HTMLElement);
+ expect(
+ await screen.findByRole('tooltip', {
+ name: 'Settings are still loading. Try again in a moment.',
+ }),
+ ).toBeTruthy();
+ expect(projectLocalPatch).not.toHaveBeenCalled();
+ });
+
+ test('Show checkboxes reject input until the project-local binding first syncs', async () => {
+ projectLocalSynced = false;
+ const rendered = await renderSidebar();
+ const checkbox = within(screen.getByTestId('tree-options-menu')).getByTestId(
+ 'tree-options-show-hidden-files',
+ ) as HTMLButtonElement;
+
+ expect(checkbox.disabled).toBe(false);
+ expect(checkbox.getAttribute('aria-disabled')).toBe('true');
+ fireEvent.click(checkbox);
expect(projectLocalPatch).not.toHaveBeenCalled();
+
+ projectLocalSynced = true;
+ const { FileSidebar } = await import('./FileSidebar');
+ rendered.rerender(<FileSidebar onOpenSearch={onOpenSearch} />);
+
+ const readyCheckbox = within(screen.getByTestId('tree-options-menu')).getByTestId(
+ 'tree-options-show-hidden-files',
+ ) as HTMLButtonElement;
+ expect(readyCheckbox.disabled).toBe(false);
+ expect(readyCheckbox.getAttribute('aria-disabled')).toBeNull();
+ fireEvent.click(readyCheckbox);
+ expect(projectLocalPatch).toHaveBeenCalledWith({
+ appearance: { sidebar: { showHiddenFiles: true } },
+ });
});
test('a rejected visibility patch surfaces the settings toast', async () => {
@@ -801,11 +861,13 @@ describe('FileSidebar runtime behavior', () => {
'empty-space-menu-expand-all',
'empty-space-menu-collapse-all',
];
- const positions = itemIds.map((id) => {
- const element = screen.getByTestId(id);
- return Array.from(element.parentElement?.children ?? []).indexOf(element);
- });
- expect(positions).toEqual([...positions].sort((a, b) => a - b));
+ const items = itemIds.map((id) => screen.getByTestId(id));
+ for (const [index, item] of items.entries()) {
+ const next = items[index + 1];
+ if (next) {
+ expect(item.compareDocumentPosition(next) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
+ }
+ }
fireEvent.click(screen.getByTestId('empty-space-menu-new-file'));
fireEvent.click(screen.getByTestId('empty-space-menu-new-from-template'));
diff --git a/packages/app/src/components/FileSidebar.menu-action.dom.test.tsx b/packages/app/src/components/FileSidebar.menu-action.dom.test.tsx
index b5dcec282..91f186bba 100644
--- a/packages/app/src/components/FileSidebar.menu-action.dom.test.tsx
+++ b/packages/app/src/components/FileSidebar.menu-action.dom.test.tsx
@@ -1,4 +1,5 @@
-import { cleanup, render, waitFor } from '@testing-library/react';
+import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
import { type ReactNode, useEffect } from 'react';
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
import { __resetSkillsSectionVisibleCacheForTests } from '@/components/skills-section-visible-cache';
@@ -73,6 +74,7 @@ const projectLocalPatch = vi.fn((_patch: unknown) => ({ ok: true as const }));
const projectLocalBindingStub = { patch: projectLocalPatch };
const DEFAULT_MERGED_CONFIG = { appearance: { sidebar: { showHiddenFiles: false } } };
let mergedConfig: { appearance?: { sidebar?: Record<string, boolean> } } = DEFAULT_MERGED_CONFIG;
+let projectLocalSynced = true;
let menuActionCallback: ((action: MenuAction) => void) | null = null;
vi.doMock('@/lib/perf', () => ({
@@ -124,48 +126,6 @@ vi.doMock('@/components/SkillsSidebarSection', () => ({
SkillsSidebarSection: () => null,
}));
-vi.doMock('@/components/ui/context-menu', () => ({
- ContextMenu: PassThrough,
- ContextMenuCheckboxItem: Button,
- ContextMenuContent: ElementPassThrough,
- ContextMenuItem: Button,
- ContextMenuSeparator: () => <hr />,
- ContextMenuSub: PassThrough,
- ContextMenuSubContent: ElementPassThrough,
- ContextMenuSubTrigger: Button,
- ContextMenuTrigger: PassThrough,
-}));
-
-vi.doMock('@/components/ui/dropdown-menu', () => ({
- DropdownMenu: PassThrough,
- DropdownMenuCheckboxItem: ({
- checked,
- children,
- onCheckedChange: _onCheckedChange,
- ...props
- }: {
- checked?: boolean;
- children?: ReactNode;
- onCheckedChange?: (checked: boolean) => void;
- [key: string]: unknown;
- }) => (
- <button
- type="button"
- role="menuitemcheckbox"
- aria-checked={checked ? 'true' : 'false'}
- {...props}
- >
- {children}
- </button>
- ),
- DropdownMenuContent: ElementPassThrough,
- DropdownMenuGroup: ElementPassThrough,
- DropdownMenuItem: Button,
- DropdownMenuLabel: ElementPassThrough,
- DropdownMenuSeparator: () => null,
- DropdownMenuTrigger: PassThrough,
-}));
-
vi.doMock('@/components/handoff/OpenInAgentEmptySpaceSubmenu', () => ({
OpenInAgentEmptySpaceSubmenu: () => null,
}));
@@ -236,6 +196,7 @@ vi.doMock('@/hooks/use-folder-config', () => ({
vi.doMock('@/lib/config-provider', () => ({
useConfigContext: () => ({
projectLocalBinding: projectLocalBindingStub,
+ projectLocalSynced,
merged: mergedConfig,
}),
}));
@@ -248,8 +209,8 @@ vi.doMock('@/lib/use-workspace', () => ({
useWorkspace: () => workspaceStub,
}));
-const toastInfoMock = vi.fn((_msg: string) => {});
-const toastErrorMock = vi.fn((_msg: string) => {});
+const toastInfoMock = vi.fn((_msg: string, _options?: { id?: string }) => {});
+const toastErrorMock = vi.fn((_msg: string, _options?: { description?: string }) => {});
vi.doMock('sonner', () => ({
toast: {
error: toastErrorMock,
@@ -279,6 +240,7 @@ describe('FileSidebar menu-action runtime routing', () => {
menuActionCallback = null;
activeTarget = ACTIVE_TARGET;
mergedConfig = DEFAULT_MERGED_CONFIG;
+ projectLocalSynced = true;
noAgentsInstalled = false;
__resetSkillsSectionVisibleCacheForTests();
if (typeof localStorage !== 'undefined') localStorage.clear();
@@ -584,6 +546,104 @@ describe('FileSidebar menu-action runtime routing', () => {
});
});
+ test('rejects a native view-toggle action until the project-local binding first syncs', async () => {
+ projectLocalSynced = false;
+ const rendered = renderSidebar();
+ await waitFor(() => expect(menuActionCallback).not.toBeNull());
+
+ menuActionCallback?.('toggle-show-hidden-files' as MenuAction);
+ expect(projectLocalPatch).not.toHaveBeenCalled();
+ expect(toastInfoMock).toHaveBeenCalledWith(
+ 'Settings are still loading. Try again in a moment.',
+ { id: 'sidebar-settings-not-ready' },
+ );
+
+ projectLocalSynced = true;
+ rendered.rerender(<FileSidebar onOpenSearch={() => {}} />);
+ menuActionCallback?.('toggle-show-hidden-files' as MenuAction);
+ expect(projectLocalPatch).toHaveBeenCalledWith({
+ appearance: { sidebar: { showHiddenFiles: true } },
+ });
+ });
+
+ test('a real tree-options checkbox stays in roving focus, refuses Enter, and keeps focus when ready', async () => {
+ const user = userEvent.setup();
+ projectLocalSynced = false;
+ const rendered = renderSidebar();
+
+ await user.click(screen.getByRole('button', { name: 'Tree view options' }));
+ const menu = await screen.findByTestId('tree-options-menu');
+ const pending = within(menu).getByTestId('tree-options-show-hidden-files');
+ expect(pending.getAttribute('aria-disabled')).toBe('true');
+ expect(pending.getAttribute('data-disabled')).toBeNull();
+
+ menu.focus();
+ await user.keyboard('h');
+ expect(document.activeElement).toBe(pending);
+ expect(
+ await screen.findByRole('tooltip', {
+ name: 'Settings are still loading. Try again in a moment.',
+ }),
+ ).toBeTruthy();
+
+ await user.keyboard('{Enter}');
+ expect(projectLocalPatch).not.toHaveBeenCalled();
+ expect(toastInfoMock).toHaveBeenCalledWith(
+ 'Settings are still loading. Try again in a moment.',
+ { id: 'sidebar-settings-not-ready' },
+ );
+ expect(screen.getByTestId('tree-options-menu')).toBeTruthy();
+ expect(document.activeElement).toBe(pending);
+
+ await user.keyboard('{Enter}');
+ expect(toastInfoMock).toHaveBeenNthCalledWith(
+ 2,
+ 'Settings are still loading. Try again in a moment.',
+ { id: 'sidebar-settings-not-ready' },
+ );
+
+ projectLocalSynced = true;
+ rendered.rerender(<FileSidebar onOpenSearch={() => {}} />);
+
+ const ready = within(screen.getByTestId('tree-options-menu')).getByTestId(
+ 'tree-options-show-hidden-files',
+ );
+ expect(ready).toBe(pending);
+ expect(ready.getAttribute('aria-disabled')).toBeNull();
+ expect(document.activeElement).toBe(ready);
+ });
+
+ test('a real empty-space context checkbox refuses repeated Enter with one stable notice id', async () => {
+ const user = userEvent.setup();
+ projectLocalSynced = false;
+ renderSidebar();
+
+ fireEvent.contextMenu(screen.getByTestId('file-tree-stub'), { clientX: 10, clientY: 10 });
+ const menu = await screen.findByRole('menu');
+ const pending = await screen.findByTestId('empty-space-menu-show-hidden-files');
+ expect(pending.getAttribute('aria-disabled')).toBe('true');
+ expect(pending.getAttribute('data-disabled')).toBeNull();
+
+ menu.focus();
+ await user.keyboard('Show h');
+ await waitFor(() => expect(document.activeElement).toBe(pending));
+
+ await user.keyboard('{Enter}{Enter}');
+ expect(projectLocalPatch).not.toHaveBeenCalled();
+ expect(toastInfoMock).toHaveBeenNthCalledWith(
+ 1,
+ 'Settings are still loading. Try again in a moment.',
+ { id: 'sidebar-settings-not-ready' },
+ );
+ expect(toastInfoMock).toHaveBeenNthCalledWith(
+ 2,
+ 'Settings are still loading. Try again in a moment.',
+ { id: 'sidebar-settings-not-ready' },
+ );
+ expect(screen.getByRole('menu')).toBeTruthy();
+ expect(document.activeElement).toBe(pending);
+ });
+
test('visibility toggles read the latest merged config across a flip round-trip', async () => {
const toggleRoundTrips = [
{ action: 'toggle-show-hidden-files', key: 'showHiddenFiles', defaultValue: false },
diff --git a/packages/app/src/components/FileSidebar.share.dom.test.tsx b/packages/app/src/components/FileSidebar.share.dom.test.tsx
index 499da520e..c1dbc40de 100644
--- a/packages/app/src/components/FileSidebar.share.dom.test.tsx
+++ b/packages/app/src/components/FileSidebar.share.dom.test.tsx
@@ -109,6 +109,7 @@ vi.doMock('@/components/ui/context-menu', () => ({
ContextMenu: PassThrough,
ContextMenuCheckboxItem: Button,
ContextMenuContent: ElementPassThrough,
+ ContextMenuGroup: ElementPassThrough,
ContextMenuItem: Button,
ContextMenuSeparator: () => <hr />,
ContextMenuSub: PassThrough,
diff --git a/packages/app/src/components/FileSidebar.tsx b/packages/app/src/components/FileSidebar.tsx
index 05563caed..822a2bd90 100644
--- a/packages/app/src/components/FileSidebar.tsx
+++ b/packages/app/src/components/FileSidebar.tsx
@@ -14,7 +14,15 @@ import {
SquarePen,
UnfoldVertical,
} from 'lucide-react';
-import { type FC, type MouseEventHandler, useEffect, useRef, useState } from 'react';
+import {
+ type FC,
+ type MouseEventHandler,
+ type ReactElement,
+ useEffect,
+ useId,
+ useRef,
+ useState,
+} from 'react';
import { ErrorBoundary } from 'react-error-boundary';
import { toast } from 'sonner';
import { ConflictsSection } from '@/components/ConflictsSection';
@@ -52,6 +60,7 @@ import {
ContextMenu,
ContextMenuCheckboxItem,
ContextMenuContent,
+ ContextMenuGroup,
ContextMenuItem,
ContextMenuSeparator,
ContextMenuSub,
@@ -99,6 +108,7 @@ import {
useDefaultRegisteredAgent,
useRegisteredAgents,
} from '@/lib/acp/registered-agents';
+import { useSettingsLoadingReason } from '@/lib/config-context';
import { useConfigContext } from '@/lib/config-provider';
import { subscribeToCreateTopLevelFile } from '@/lib/create-file-events';
import {
@@ -162,8 +172,24 @@ const ToolbarDropdownTrigger: FC<ToolbarButtonProps> = ({ icon: Icon, label, ...
);
};
+function SettingsLoadingMenuGroupTooltip({
+ children,
+ reason,
+}: {
+ children: ReactElement;
+ reason: string | null;
+}) {
+ return (
+ <Tooltip>
+ <TooltipTrigger asChild>{children}</TooltipTrigger>
+ {reason === null ? null : <TooltipContent>{reason}</TooltipContent>}
+ </Tooltip>
+ );
+}
+
function FileSidebarInner({ onOpenSearch }: FileSidebarProps) {
const { t } = useLingui();
+ const settingsLoadingReasonId = useId();
const [tree, setTree] = useState<FileTreeHandle | null>(null);
const { activeDocName, activeTarget } = useDocumentContext();
@@ -238,7 +264,10 @@ function FileSidebarInner({ onOpenSearch }: FileSidebarProps) {
const registeredAgents = useRegisteredAgents();
const defaultRegisteredAgent = useDefaultRegisteredAgent();
const stickyAgentId = useStickyAgent();
- const { projectLocalBinding, merged } = useConfigContext();
+ const { projectLocalBinding, projectLocalSynced, merged } = useConfigContext();
+ const projectLocalBindingReady = projectLocalSynced && projectLocalBinding !== null;
+ const settingsLoadingReason = useSettingsLoadingReason();
+ const pendingSettingsReason = projectLocalBindingReady ? null : settingsLoadingReason;
const showHiddenFiles = merged?.appearance?.sidebar?.showHiddenFiles ?? false;
const showOkFolders = merged?.appearance?.sidebar?.showOkFolders ?? false;
const showOnlyMarkdownFiles = merged?.appearance?.sidebar?.showOnlyMarkdownFiles ?? false;
@@ -326,7 +355,10 @@ function FileSidebarInner({ onOpenSearch }: FileSidebarProps) {
showSkillsSection?: boolean;
showSkillGroups?: boolean;
}) => {
- if (projectLocalBinding === null) return;
+ if (!projectLocalBindingReady) {
+ toast.info(settingsLoadingReason, { id: 'sidebar-settings-not-ready' });
+ return;
+ }
const result = projectLocalBinding.patch({ appearance: { sidebar } });
if (!result.ok) {
console.warn('[FileSidebar] sidebar visibility toggle rejected:', humanFormat(result.error));
@@ -335,6 +367,9 @@ function FileSidebarInner({ onOpenSearch }: FileSidebarProps) {
});
}
};
+ const preventPendingSettingsSelection = (event: Event) => {
+ if (!projectLocalBindingReady) event.preventDefault();
+ };
const handleEmptySpaceExpandAll = () => {
tree?.expandAll();
};
@@ -366,7 +401,7 @@ function FileSidebarInner({ onOpenSearch }: FileSidebarProps) {
sidebarState,
]);
- // biome-ignore lint/correctness/useExhaustiveDependencies: patchSidebarVisibility is behaviorally stable — it reads only projectLocalBinding + t, both already deps; listing the helper itself would re-create the subscription every render (sibling pattern: CommandPalette's refreshSemanticStatus).
+ // biome-ignore lint/correctness/useExhaustiveDependencies: patchSidebarVisibility is behaviorally stable — its binding, readiness, and t inputs are already deps; listing the helper itself would re-create the subscription every render (sibling pattern: CommandPalette's refreshSemanticStatus).
useEffect(() => {
return subscribeLocalMenuAction((action) => {
const isOkManagedTarget =
@@ -529,6 +564,8 @@ function FileSidebarInner({ onOpenSearch }: FileSidebarProps) {
activeTarget,
initialCreateDir,
projectLocalBinding,
+ projectLocalBindingReady,
+ settingsLoadingReason,
showHiddenFiles,
showOkFolders,
showOnlyMarkdownFiles,
@@ -546,6 +583,11 @@ function FileSidebarInner({ onOpenSearch }: FileSidebarProps) {
return (
<Sidebar variant="inset">
+ {pendingSettingsReason ? (
+ <span id={settingsLoadingReasonId} className="sr-only">
+ {pendingSettingsReason}
+ </span>
+ ) : null}
{}
<ContextMenu>
<ContextMenuTrigger asChild>
@@ -647,65 +689,91 @@ function FileSidebarInner({ onOpenSearch }: FileSidebarProps) {
) : null}
{showTreeStateSection ? <DropdownMenuSeparator /> : null}
{}
- <DropdownMenuGroup aria-label={t`Show`}>
- <DropdownMenuLabel>
- <Trans>Show</Trans>
- </DropdownMenuLabel>
- <DropdownMenuCheckboxItem
- checked={showHiddenFiles}
- onCheckedChange={(checked) =>
- patchSidebarVisibility({ showHiddenFiles: checked })
- }
- disabled={projectLocalBinding === null}
- data-testid="tree-options-show-hidden-files"
- >
- <Trans>Hidden files</Trans>
- </DropdownMenuCheckboxItem>
- <DropdownMenuCheckboxItem
- checked={showOkFolders}
- onCheckedChange={(checked) =>
- patchSidebarVisibility({ showOkFolders: checked })
- }
- disabled={projectLocalBinding === null}
- data-testid="tree-options-show-ok-folders"
- >
- <Trans>.ok folders</Trans>
- </DropdownMenuCheckboxItem>
- <DropdownMenuCheckboxItem
- checked={showOnlyMarkdownFiles}
- onCheckedChange={(checked) =>
- patchSidebarVisibility({ showOnlyMarkdownFiles: checked })
- }
- disabled={projectLocalBinding === null}
- data-testid="tree-options-show-only-markdown-files"
- >
- <Trans>Only markdown files</Trans>
- </DropdownMenuCheckboxItem>
- <DropdownMenuCheckboxItem
- checked={showSkillsSection}
- onCheckedChange={(checked) =>
- patchSidebarVisibility({ showSkillsSection: checked })
- }
- disabled={projectLocalBinding === null}
- data-testid="tree-options-show-skills"
- >
- <Trans>Skills Studio</Trans>
- </DropdownMenuCheckboxItem>
- </DropdownMenuGroup>
- {}
- {showSkillsSection ? (
- <>
- <DropdownMenuSeparator />
+ <SettingsLoadingMenuGroupTooltip reason={pendingSettingsReason}>
+ <DropdownMenuGroup aria-label={t`Show`}>
+ <DropdownMenuLabel>
+ <Trans>Show</Trans>
+ </DropdownMenuLabel>
<DropdownMenuCheckboxItem
- checked={showSkillGroups}
+ checked={showHiddenFiles}
onCheckedChange={(checked) =>
- patchSidebarVisibility({ showSkillGroups: checked })
+ patchSidebarVisibility({ showHiddenFiles: checked })
+ }
+ aria-disabled={pendingSettingsReason ? true : undefined}
+ onSelect={preventPendingSettingsSelection}
+ aria-describedby={
+ pendingSettingsReason ? settingsLoadingReasonId : undefined
}
- disabled={projectLocalBinding === null}
- data-testid="tree-options-group-skills"
+ data-testid="tree-options-show-hidden-files"
>
- <Trans>Group skills by source</Trans>
+ <Trans>Hidden files</Trans>
</DropdownMenuCheckboxItem>
+ <DropdownMenuCheckboxItem
+ checked={showOkFolders}
+ onCheckedChange={(checked) =>
+ patchSidebarVisibility({ showOkFolders: checked })
+ }
+ aria-disabled={pendingSettingsReason ? true : undefined}
+ onSelect={preventPendingSettingsSelection}
+ aria-describedby={
+ pendingSettingsReason ? settingsLoadingReasonId : undefined
+ }
+ data-testid="tree-options-show-ok-folders"
+ >
+ <Trans>.ok folders</Trans>
+ </DropdownMenuCheckboxItem>
+ <DropdownMenuCheckboxItem
+ checked={showOnlyMarkdownFiles}
+ onCheckedChange={(checked) =>
+ patchSidebarVisibility({ showOnlyMarkdownFiles: checked })
+ }
+ aria-disabled={pendingSettingsReason ? true : undefined}
+ onSelect={preventPendingSettingsSelection}
+ aria-describedby={
+ pendingSettingsReason ? settingsLoadingReasonId : undefined
+ }
+ data-testid="tree-options-show-only-markdown-files"
+ >
+ <Trans>Only markdown files</Trans>
+ </DropdownMenuCheckboxItem>
+ <DropdownMenuCheckboxItem
+ checked={showSkillsSection}
+ onCheckedChange={(checked) =>
+ patchSidebarVisibility({ showSkillsSection: checked })
+ }
+ aria-disabled={pendingSettingsReason ? true : undefined}
+ onSelect={preventPendingSettingsSelection}
+ aria-describedby={
+ pendingSettingsReason ? settingsLoadingReasonId : undefined
+ }
+ data-testid="tree-options-show-skills"
+ >
+ <Trans>Skills Studio</Trans>
+ </DropdownMenuCheckboxItem>
+ </DropdownMenuGroup>
+ </SettingsLoadingMenuGroupTooltip>
+ {}
+ {showSkillsSection ? (
+ <>
+ <DropdownMenuSeparator />
+ <SettingsLoadingMenuGroupTooltip reason={pendingSettingsReason}>
+ <DropdownMenuGroup>
+ <DropdownMenuCheckboxItem
+ checked={showSkillGroups}
+ onCheckedChange={(checked) =>
+ patchSidebarVisibility({ showSkillGroups: checked })
+ }
+ aria-disabled={pendingSettingsReason ? true : undefined}
+ onSelect={preventPendingSettingsSelection}
+ aria-describedby={
+ pendingSettingsReason ? settingsLoadingReasonId : undefined
+ }
+ data-testid="tree-options-group-skills"
+ >
+ <Trans>Group skills by source</Trans>
+ </DropdownMenuCheckboxItem>
+ </DropdownMenuGroup>
+ </SettingsLoadingMenuGroupTooltip>
</>
) : null}
</DropdownMenuContent>
@@ -857,40 +925,54 @@ function FileSidebarInner({ onOpenSearch }: FileSidebarProps) {
) : null}
</ContextMenuItem>
<ContextMenuSeparator />
- <ContextMenuCheckboxItem
- checked={showHiddenFiles}
- onCheckedChange={(checked) => patchSidebarVisibility({ showHiddenFiles: checked })}
- disabled={projectLocalBinding === null}
- data-testid="empty-space-menu-show-hidden-files"
- >
- <Trans>Show hidden files</Trans>
- </ContextMenuCheckboxItem>
- <ContextMenuCheckboxItem
- checked={showOkFolders}
- onCheckedChange={(checked) => patchSidebarVisibility({ showOkFolders: checked })}
- disabled={projectLocalBinding === null}
- data-testid="empty-space-menu-show-ok-folders"
- >
- <Trans>Show .ok folders</Trans>
- </ContextMenuCheckboxItem>
- <ContextMenuCheckboxItem
- checked={showOnlyMarkdownFiles}
- onCheckedChange={(checked) =>
- patchSidebarVisibility({ showOnlyMarkdownFiles: checked })
- }
- disabled={projectLocalBinding === null}
- data-testid="empty-space-menu-show-only-markdown-files"
- >
- <Trans>Show only markdown files</Trans>
- </ContextMenuCheckboxItem>
- <ContextMenuCheckboxItem
- checked={showSkillsSection}
- onCheckedChange={(checked) => patchSidebarVisibility({ showSkillsSection: checked })}
- disabled={projectLocalBinding === null}
- data-testid="empty-space-menu-show-skills-section"
- >
- <Trans>Skills section</Trans>
- </ContextMenuCheckboxItem>
+ <SettingsLoadingMenuGroupTooltip reason={pendingSettingsReason}>
+ <ContextMenuGroup>
+ <ContextMenuCheckboxItem
+ checked={showHiddenFiles}
+ onCheckedChange={(checked) => patchSidebarVisibility({ showHiddenFiles: checked })}
+ aria-disabled={pendingSettingsReason ? true : undefined}
+ onSelect={preventPendingSettingsSelection}
+ aria-describedby={pendingSettingsReason ? settingsLoadingReasonId : undefined}
+ data-testid="empty-space-menu-show-hidden-files"
+ >
+ <Trans>Show hidden files</Trans>
+ </ContextMenuCheckboxItem>
+ <ContextMenuCheckboxItem
+ checked={showOkFolders}
+ onCheckedChange={(checked) => patchSidebarVisibility({ showOkFolders: checked })}
+ aria-disabled={pendingSettingsReason ? true : undefined}
+ onSelect={preventPendingSettingsSelection}
+ aria-describedby={pendingSettingsReason ? settingsLoadingReasonId : undefined}
+ data-testid="empty-space-menu-show-ok-folders"
+ >
+ <Trans>Show .ok folders</Trans>
+ </ContextMenuCheckboxItem>
+ <ContextMenuCheckboxItem
+ checked={showOnlyMarkdownFiles}
+ onCheckedChange={(checked) =>
+ patchSidebarVisibility({ showOnlyMarkdownFiles: checked })
+ }
+ aria-disabled={pendingSettingsReason ? true : undefined}
+ onSelect={preventPendingSettingsSelection}
+ aria-describedby={pendingSettingsReason ? settingsLoadingReasonId : undefined}
+ data-testid="empty-space-menu-show-only-markdown-files"
+ >
+ <Trans>Show only markdown files</Trans>
+ </ContextMenuCheckboxItem>
+ <ContextMenuCheckboxItem
+ checked={showSkillsSection}
+ onCheckedChange={(checked) =>
+ patchSidebarVisibility({ showSkillsSection: checked })
+ }
+ aria-disabled={pendingSettingsReason ? true : undefined}
+ onSelect={preventPendingSettingsSelection}
+ aria-describedby={pendingSettingsReason ? settingsLoadingReasonId : undefined}
+ data-testid="empty-space-menu-show-skills-section"
+ >
+ <Trans>Skills section</Trans>
+ </ContextMenuCheckboxItem>
+ </ContextMenuGroup>
+ </SettingsLoadingMenuGroupTooltip>
{showTreeStateSection ? <ContextMenuSeparator /> : null}
{showExpandAll ? (
<ContextMenuItem
diff --git a/packages/app/src/components/FileTreeFilteredToZeroNotice.dom.test.tsx b/packages/app/src/components/FileTreeFilteredToZeroNotice.dom.test.tsx
index 0cbd74d74..bf9f662c9 100644
--- a/packages/app/src/components/FileTreeFilteredToZeroNotice.dom.test.tsx
+++ b/packages/app/src/components/FileTreeFilteredToZeroNotice.dom.test.tsx
@@ -11,6 +11,7 @@ vi.doMock('@lingui/react/macro', () => ({
}));
let projectLocalBindingNull = false;
+let projectLocalSynced = true;
let patchResultOk = true;
const patchCalls: unknown[] = [];
const toastErrors: unknown[][] = [];
@@ -18,6 +19,7 @@ const toastErrors: unknown[][] = [];
vi.doMock('@/lib/config-provider', () => ({
useConfigContext: () => ({
merged: null,
+ projectLocalSynced,
projectLocalBinding: projectLocalBindingNull
? null
: {
@@ -45,6 +47,7 @@ const resetButton = () => screen.queryByTestId('reset-view-filters');
describe('FileTreeFilteredToZeroNotice', () => {
beforeEach(() => {
projectLocalBindingNull = false;
+ projectLocalSynced = true;
patchResultOk = true;
patchCalls.length = 0;
toastErrors.length = 0;
@@ -86,6 +89,28 @@ describe('FileTreeFilteredToZeroNotice', () => {
expect(patchCalls).toEqual([]);
});
+ test('reset rejects input until the project-local binding first syncs', () => {
+ projectLocalSynced = false;
+ const rendered = render(<FileTreeFilteredToZeroNotice />);
+
+ const syncingButton = resetButton() as HTMLButtonElement;
+ const pendingReason = screen.getByText('Settings are still loading. Try again in a moment.');
+ expect(syncingButton.disabled).toBe(true);
+ expect(syncingButton.getAttribute('aria-describedby')).toBe(pendingReason.id);
+ fireEvent.click(syncingButton);
+ expect(patchCalls).toEqual([]);
+
+ projectLocalSynced = true;
+ rendered.rerender(<FileTreeFilteredToZeroNotice />);
+
+ const readyButton = resetButton() as HTMLButtonElement;
+ expect(readyButton.disabled).toBe(false);
+ expect(readyButton.getAttribute('aria-describedby')).toBeNull();
+ expect(screen.queryByText('Settings are still loading. Try again in a moment.')).toBeNull();
+ fireEvent.click(readyButton);
+ expect(patchCalls).toHaveLength(1);
+ });
+
test('a rejected patch surfaces the shared settings toast', () => {
patchResultOk = false;
render(<FileTreeFilteredToZeroNotice />);
diff --git a/packages/app/src/components/FileTreeFilteredToZeroNotice.tsx b/packages/app/src/components/FileTreeFilteredToZeroNotice.tsx
index 322f70ed5..0858fe2a9 100644
--- a/packages/app/src/components/FileTreeFilteredToZeroNotice.tsx
+++ b/packages/app/src/components/FileTreeFilteredToZeroNotice.tsx
@@ -1,16 +1,21 @@
import { humanFormat } from '@inkeep/open-knowledge-core';
import { useLingui } from '@lingui/react/macro';
+import { useId } from 'react';
import { toast } from 'sonner';
import { Button } from '@/components/ui/button';
import { Empty, EmptyContent, EmptyDescription } from '@/components/ui/empty';
+import { useSettingsLoadingReason } from '@/lib/config-context';
import { useConfigContext } from '@/lib/config-provider';
export function FileTreeFilteredToZeroNotice() {
const { t } = useLingui();
- const { projectLocalBinding } = useConfigContext();
+ const { projectLocalBinding, projectLocalSynced } = useConfigContext();
+ const projectLocalBindingReady = projectLocalSynced && projectLocalBinding !== null;
+ const pendingReasonId = useId();
+ const settingsLoadingReason = useSettingsLoadingReason();
const handleReset = () => {
- if (projectLocalBinding === null) return;
+ if (!projectLocalBindingReady) return;
const result = projectLocalBinding.patch({
appearance: {
sidebar: {
@@ -41,12 +46,18 @@ export function FileTreeFilteredToZeroNotice() {
variant="link"
size="sm"
className="font-mono uppercase"
- disabled={projectLocalBinding === null}
+ disabled={!projectLocalBindingReady}
+ aria-describedby={!projectLocalBindingReady ? pendingReasonId : undefined}
onClick={handleReset}
data-testid="reset-view-filters"
>
{t`Reset view filters`}
</Button>
+ {!projectLocalBindingReady ? (
+ <p id={pendingReasonId} className="text-xs text-muted-foreground">
+ {settingsLoadingReason}
+ </p>
+ ) : null}
</EmptyContent>
</Empty>
);
diff --git a/packages/app/src/components/McpConsentDialog.dom.test.tsx b/packages/app/src/components/McpConsentDialog.dom.test.tsx
index 4a253ff5f..49520f978 100644
--- a/packages/app/src/components/McpConsentDialog.dom.test.tsx
+++ b/packages/app/src/components/McpConsentDialog.dom.test.tsx
@@ -105,11 +105,13 @@ function makeHarness({
skipResult = async () => ({ ok: true as const }),
snapshot = payload,
userBinding,
+ userSynced,
}: {
confirmResult?: (editorIds: readonly string[]) => Promise<OkMcpWiringResult>;
skipResult?: () => Promise<OkMcpWiringResult>;
snapshot?: OkMcpWiringShowPayload;
userBinding?: { patch: (patch: unknown) => unknown } | null;
+ userSynced?: boolean;
} = {}) {
const confirmCalls: RecordedConfirm[] = [];
const skipCalls: string[] = [];
@@ -150,6 +152,7 @@ function makeHarness({
toastMessages,
snapshot,
userBinding,
+ userSynced,
};
}
@@ -179,7 +182,11 @@ async function renderDialog(harness = makeHarness()) {
harness.userBinding === undefined ? (
body
) : (
- <ConfigContext.Provider value={{ userBinding: harness.userBinding } as never}>
+ <ConfigContext.Provider
+ value={
+ { userBinding: harness.userBinding, userSynced: harness.userSynced ?? false } as never
+ }
+ >
{body}
</ConfigContext.Provider>
),
@@ -950,7 +957,7 @@ describe('McpConsentDialog theme picker', () => {
test('canonicalizes the pick into user config when a binding is mounted', async () => {
const patch = vi.fn(() => ({ ok: true as const, value: { effective: {}, appliedPaths: [] } }));
- await renderDialog(makeHarness({ userBinding: { patch } }));
+ await renderDialog(makeHarness({ userBinding: { patch }, userSynced: true }));
await userEvent.click(screen.getByTestId('theme-picker-dark'));
@@ -959,20 +966,52 @@ describe('McpConsentDialog theme picker', () => {
test('a failed config write is reported without taking the dialog down', async () => {
const patch = vi.fn(() => ({ ok: false as const, error: { message: 'read-only' } }));
- const harness = await renderDialog(makeHarness({ userBinding: { patch } }));
+ const harness = await renderDialog(makeHarness({ userBinding: { patch }, userSynced: true }));
await userEvent.click(screen.getByTestId('theme-picker-dark'));
- expect(themeState.setTheme).toHaveBeenCalledWith('dark');
+ expect(themeState.setTheme).not.toHaveBeenCalled();
expect(harness.toastErrors).toEqual(["Couldn't save your theme preference."]);
expect(screen.getByTestId('mcp-consent-add')).toBeTruthy();
});
- test('a pick still applies in a window with no config binding', async () => {
- await renderDialog(makeHarness({ userBinding: null }));
+ test('a navigator window with no config provider still applies a local theme pick', async () => {
+ await renderDialog();
await userEvent.click(screen.getByTestId('theme-picker-dark'));
expect(themeState.setTheme).toHaveBeenCalledWith('dark');
});
+
+ test('a window with a config provider but no binding still applies a local theme pick', async () => {
+ await renderDialog(makeHarness({ userBinding: null, userSynced: false }));
+
+ const choice = screen.getByTestId('theme-picker-dark');
+ expect(choice.getAttribute('data-disabled')).toBeNull();
+ await userEvent.click(choice);
+
+ expect(themeState.setTheme).toHaveBeenCalledWith('dark');
+ expect(screen.queryByText('Settings are still loading. Try again in a moment.')).toBeNull();
+ });
+
+ test('theme input is rejected until the mounted user binding first syncs, then persists and applies', async () => {
+ const patch = vi.fn(() => ({ ok: true as const, value: { effective: {}, appliedPaths: [] } }));
+ await renderDialog(makeHarness({ userBinding: { patch }, userSynced: false }));
+
+ const syncingChoice = screen.getByTestId('theme-picker-dark');
+ const syncingPicker = screen.getByTestId('theme-picker');
+ expect(syncingChoice.getAttribute('data-disabled')).not.toBeNull();
+ fireEvent.click(syncingChoice);
+ expect(patch).not.toHaveBeenCalled();
+ expect(themeState.setTheme).not.toHaveBeenCalled();
+ const pendingReason = screen.getByText('Settings are still loading. Try again in a moment.');
+ expect(syncingPicker.getAttribute('aria-describedby')).toBe(pendingReason.id);
+
+ cleanup();
+ await renderDialog(makeHarness({ userBinding: { patch }, userSynced: true }));
+ await userEvent.click(screen.getByTestId('theme-picker-dark'));
+
+ expect(patch).toHaveBeenCalledWith({ appearance: { theme: 'dark' } });
+ expect(themeState.setTheme).toHaveBeenCalledWith('dark');
+ });
});
diff --git a/packages/app/src/components/McpConsentDialogBody.tsx b/packages/app/src/components/McpConsentDialogBody.tsx
index bc0c6d5cc..7f8300966 100644
--- a/packages/app/src/components/McpConsentDialogBody.tsx
+++ b/packages/app/src/components/McpConsentDialogBody.tsx
@@ -30,7 +30,7 @@ import {
DialogTitle,
} from '@/components/ui/dialog';
import { Label } from '@/components/ui/label';
-import { useConfigContextOptional } from '@/lib/config-context';
+import { useConfigContextOptional, useSettingsLoadingReason } from '@/lib/config-context';
import type { OkMcpWiringShowPayload } from '@/lib/desktop-bridge-types';
import { type McpConsentStore, mcpConsentStore } from '@/lib/mcp-consent-store';
import { formatToolList } from '@/lib/tool-list-format';
@@ -155,18 +155,27 @@ function McpConsentDialogForm({ payload, store, toast }: McpConsentDialogFormPro
const { theme, setTheme } = useTheme();
const themePreference = narrowThemePreference(theme);
const configContext = useConfigContextOptional();
+ const readyUserBinding = configContext?.userSynced ? configContext.userBinding : null;
+ const themeBindingPending =
+ configContext !== null && configContext.userBinding !== null && !configContext.userSynced;
function commitTheme(next: ThemePreference): void {
- setTheme(next);
- const binding = configContext?.userBinding;
- if (!binding) return;
- const result = binding.patch({ appearance: { theme: next } });
+ if (configContext === null || configContext.userBinding === null) {
+ setTheme(next);
+ return;
+ }
+ if (readyUserBinding === null) return;
+ const result = readyUserBinding.patch({ appearance: { theme: next } });
if (!result.ok) {
toast.error(t`Couldn't save your theme preference.`);
+ return;
}
+ setTheme(next);
}
const [busy, setBusy] = useState(false);
const idPrefix = useId();
+ const themePendingReasonId = `${idPrefix}-theme-pending`;
+ const settingsLoadingReason = useSettingsLoadingReason();
const showReplaceWarning = connectChecked && replacing.length > 0;
async function onContinue() {
@@ -502,9 +511,15 @@ function McpConsentDialogForm({ payload, store, toast }: McpConsentDialogFormPro
<ThemePicker
value={themePreference}
onValueChange={commitTheme}
- disabled={busy}
+ disabled={busy || themeBindingPending}
aria-label={t`Choose your theme`}
+ aria-describedby={themeBindingPending ? themePendingReasonId : undefined}
/>
+ {themeBindingPending ? (
+ <p id={themePendingReasonId} className={SECTION_SUBTEXT}>
+ {settingsLoadingReason}
+ </p>
+ ) : null}
</div>
</Surface.Body>
<Surface.Footer className="sm:justify-between">
diff --git a/packages/app/src/components/ShareFreshnessWarning.dom.test.tsx b/packages/app/src/components/ShareFreshnessWarning.dom.test.tsx
index eb5dba42a..59e5430a8 100644
--- a/packages/app/src/components/ShareFreshnessWarning.dom.test.tsx
+++ b/packages/app/src/components/ShareFreshnessWarning.dom.test.tsx
@@ -14,6 +14,7 @@ vi.doMock('@/lib/config-provider', () => ({
return { ok: true };
},
},
+ projectLocalSynced: true,
}),
}));
diff --git a/packages/app/src/components/ShareReceiveMissDialog.dom.test.tsx b/packages/app/src/components/ShareReceiveMissDialog.dom.test.tsx
index a3b0aae9a..c6a519043 100644
--- a/packages/app/src/components/ShareReceiveMissDialog.dom.test.tsx
+++ b/packages/app/src/components/ShareReceiveMissDialog.dom.test.tsx
@@ -19,6 +19,7 @@ vi.doMock('@/lib/config-provider', () => ({
return configPatchResult;
},
},
+ projectLocalSynced: true,
}),
}));
diff --git a/packages/app/src/components/ShareReceiveMissPanel.dom.test.tsx b/packages/app/src/components/ShareReceiveMissPanel.dom.test.tsx
index 321957130..aecbd7254 100644
--- a/packages/app/src/components/ShareReceiveMissPanel.dom.test.tsx
+++ b/packages/app/src/components/ShareReceiveMissPanel.dom.test.tsx
@@ -14,6 +14,7 @@ vi.doMock('@/lib/config-provider', () => ({
return { ok: true };
},
},
+ projectLocalSynced: true,
}),
}));
diff --git a/packages/app/src/components/SkillsSidebarSection.pin-keyboard.dom.test.tsx b/packages/app/src/components/SkillsSidebarSection.pin-keyboard.dom.test.tsx
new file mode 100644
index 000000000..ee2bba0d1
--- /dev/null
+++ b/packages/app/src/components/SkillsSidebarSection.pin-keyboard.dom.test.tsx
@@ -0,0 +1,163 @@
+import type { SkillsListEntry } from '@inkeep/open-knowledge-core';
+import * as actualLinguiMacro from '@lingui/react/macro';
+import { cleanup, render, screen, waitFor } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import type { ReactNode } from 'react';
+import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
+import { DropdownMenuItem } from '@/components/ui/dropdown-menu';
+import { TooltipProvider } from '@/components/ui/tooltip';
+import { renderLinguiTemplate } from '@/test-utils/lingui-mock';
+
+const skill: SkillsListEntry = {
+ name: 'alpha',
+ scope: 'global',
+ path: '/tmp/alpha',
+ installed: true,
+ hosts: [],
+};
+
+const userPatch = vi.fn((_patch: unknown) => ({ ok: true as const }));
+const toastInfo = vi.fn((_message: string, _options?: { id?: string }) => {});
+const closeContextMenu = vi.fn((_options: { restoreFocus: boolean }) => {});
+
+const model = {
+ focusPath: () => {},
+ getItem: () => undefined,
+ getSelectedPaths: () => [],
+ subscribe: () => () => {},
+};
+
+vi.doMock('@lingui/react/macro', () => ({
+ ...actualLinguiMacro,
+ Trans: ({ children }: { children?: ReactNode }) => <>{children}</>,
+ useLingui: () => ({ t: renderLinguiTemplate }),
+}));
+
+vi.doMock('@pierre/trees/react', () => ({
+ useFileTree: () => ({ model }),
+}));
+
+vi.doMock('@/components/OkFileTree', () => ({
+ OkFileTree: ({
+ renderContextMenu,
+ }: {
+ renderContextMenu: (
+ item: { path: string },
+ context: { close: (options: { restoreFocus: boolean }) => void },
+ ) => ReactNode;
+ }) => <div>{renderContextMenu({ path: 'GLOBAL/alpha' }, { close: closeContextMenu })}</div>,
+}));
+
+vi.doMock('@/components/skill-actions', () => ({
+ useSkillActions: () => ({}),
+ SkillContextMenuItems: () => (
+ <DropdownMenuItem data-testid="skills-menu-anchor">Actions</DropdownMenuItem>
+ ),
+ SkillFileContextMenuItems: () => null,
+ SkillManagedContextMenuItems: () => null,
+ SkillRevealMenuItem: () => null,
+}));
+
+vi.doMock('@/components/SkillBulkDeleteDialog', () => ({
+ SkillBulkDeleteDialog: () => null,
+}));
+
+vi.doMock('@/hooks/use-skills', () => ({
+ useSkills: () => ({ status: 'ready', data: [skill] }),
+}));
+
+vi.doMock('@/editor/DocumentContext', () => ({
+ useDocumentContext: () => ({
+ openTarget: () => {},
+ activeDocName: null,
+ activeTarget: null,
+ openTabs: [],
+ activateTab: () => {},
+ }),
+}));
+
+vi.doMock('@/lib/config-provider', () => ({
+ useConfigContext: () => ({
+ merged: null,
+ userBinding: { patch: userPatch },
+ userSynced: false,
+ projectLocalBinding: { patch: vi.fn(() => ({ ok: true as const })) },
+ projectLocalSynced: true,
+ }),
+}));
+
+vi.doMock('sonner', () => ({
+ toast: {
+ error: vi.fn(),
+ info: toastInfo,
+ success: vi.fn(),
+ },
+}));
+
+vi.doMock('@/hooks/use-create-blank-skill', () => ({
+ useCreateBlankSkill: () => ({ createBlank: () => {}, creating: false }),
+}));
+
+vi.doMock('@/hooks/use-open-skill', () => ({ useOpenSkill: () => () => {} }));
+vi.doMock('@/hooks/use-open-skill-for-edit', () => ({
+ useOpenSkillForEdit: () => () => Promise.resolve({ ok: true }),
+}));
+
+vi.doMock('@/lib/skill-scope', () => ({
+ SKILL_SCOPE_ORDER: ['global', 'project'],
+ skillDir: () => '',
+ skillDisplayName: (name: string) => name,
+ skillNameSetsByScope: () => ({ global: new Set(['alpha']), project: new Set() }),
+ useSkillScopeDescriptions: () => ({ global: 'Global', project: 'Project' }),
+ useSkillScopeLabels: () => ({ global: 'GLOBAL', project: 'PROJECT' }),
+}));
+
+vi.doMock('@/lib/skills-api', () => ({
+ fetchSkillPreview: () => Promise.resolve({ ok: true, files: [] }),
+ listDetectedSkills: () => Promise.resolve({ ok: true, skills: [] }),
+}));
+
+const { SkillsSidebarSection } = await import('./SkillsSidebarSection');
+
+describe('SkillsSidebarSection pending pin keyboard behavior', () => {
+ beforeEach(() => {
+ userPatch.mockClear();
+ toastInfo.mockClear();
+ closeContextMenu.mockClear();
+ });
+
+ afterEach(() => cleanup());
+
+ test('real Radix Enter and Space reach the pending guard without writing', async () => {
+ const user = userEvent.setup();
+ render(<SkillsSidebarSection dockExpanded />, { wrapper: TooltipProvider });
+
+ const menu = await screen.findByRole('menu');
+ const pin = await screen.findByRole('menuitem', { name: 'Pin to top' });
+ expect(pin.getAttribute('aria-disabled')).toBe('true');
+
+ menu.focus();
+ await user.keyboard('{ArrowDown}{ArrowDown}');
+ await waitFor(() => expect(document.activeElement).toBe(pin));
+
+ await user.keyboard('{Enter}');
+ expect(userPatch).not.toHaveBeenCalled();
+ expect(toastInfo).toHaveBeenNthCalledWith(
+ 1,
+ 'Settings are still loading. Try again in a moment.',
+ { id: 'pin-not-ready-global' },
+ );
+ expect(closeContextMenu).not.toHaveBeenCalled();
+ expect(document.activeElement).toBe(pin);
+
+ await user.keyboard(' ');
+ expect(userPatch).not.toHaveBeenCalled();
+ expect(toastInfo).toHaveBeenNthCalledWith(
+ 2,
+ 'Settings are still loading. Try again in a moment.',
+ { id: 'pin-not-ready-global' },
+ );
+ expect(closeContextMenu).not.toHaveBeenCalled();
+ expect(document.activeElement).toBe(pin);
+ });
+});
diff --git a/packages/app/src/components/SkillsSidebarSection.sync.dom.test.tsx b/packages/app/src/components/SkillsSidebarSection.sync.dom.test.tsx
new file mode 100644
index 000000000..dc54ed71e
--- /dev/null
+++ b/packages/app/src/components/SkillsSidebarSection.sync.dom.test.tsx
@@ -0,0 +1,227 @@
+import * as actualLinguiMacro from '@lingui/react/macro';
+import { cleanup, fireEvent, render, screen } from '@testing-library/react';
+import type { ReactNode } from 'react';
+import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
+import { Button } from '@/components/ui/button';
+import { renderLinguiTemplate } from '@/test-utils/lingui-mock';
+
+const userPatch = vi.fn((_patch: unknown) => ({ ok: true as const }));
+const projectLocalPatch = vi.fn((_patch: unknown) => ({ ok: true as const }));
+const toastError = vi.fn((_message: string, _options?: { description?: string }) => {});
+const toastInfo = vi.fn((_message: string, _options?: { id?: string }) => {});
+let userSynced = false;
+let projectLocalSynced = false;
+let onTogglePinFromTree:
+ | ((scope: 'global' | 'project', name: string, pinned: boolean) => void)
+ | null = null;
+let merged: {
+ appearance?: { sidebar?: { pinnedGlobalSkills?: string[]; pinnedProjectSkills?: string[] } };
+} | null = null;
+
+vi.doMock('@lingui/react/macro', () => ({
+ ...actualLinguiMacro,
+ Trans: ({ children }: { children?: ReactNode }) => <>{children}</>,
+ useLingui: () => ({ t: renderLinguiTemplate }),
+}));
+
+vi.doMock('@/hooks/use-skills', () => ({
+ useSkills: () => ({ status: 'ready', data: [] }),
+}));
+
+vi.doMock('@/editor/DocumentContext', () => ({
+ useDocumentContext: () => ({
+ openTarget: () => {},
+ activeDocName: null,
+ activeTarget: null,
+ openTabs: [],
+ activateTab: () => {},
+ }),
+}));
+
+vi.doMock('@/lib/config-provider', () => ({
+ useConfigContext: () => ({
+ merged,
+ userBinding: { patch: userPatch },
+ userSynced,
+ projectLocalBinding: { patch: projectLocalPatch },
+ projectLocalSynced,
+ }),
+}));
+
+vi.doMock('sonner', () => ({
+ toast: { error: toastError, info: toastInfo },
+}));
+
+vi.doMock('@/components/skill-actions', () => ({
+ useSkillActions: () => ({}),
+}));
+
+vi.doMock('@/hooks/use-create-blank-skill', () => ({
+ useCreateBlankSkill: () => ({ createBlank: () => {}, creating: false }),
+}));
+
+vi.doMock('@/hooks/use-open-skill', () => ({ useOpenSkill: () => () => {} }));
+vi.doMock('@/hooks/use-open-skill-for-edit', () => ({
+ useOpenSkillForEdit: () => () => Promise.resolve({ ok: true }),
+}));
+vi.doMock('@/lib/skill-scope', () => ({
+ SKILL_SCOPE_ORDER: ['global', 'project'],
+ skillDir: () => '',
+ skillNameSetsByScope: () => ({ global: new Set(), project: new Set() }),
+ useSkillScopeDescriptions: () => ({ global: 'Global', project: 'Project' }),
+ useSkillScopeLabels: () => ({ global: 'Global', project: 'Project' }),
+}));
+vi.doMock('@/lib/skills-tree-paths', () => ({
+ buildSkillsTreePaths: () => ({
+ paths: [],
+ expanded: [],
+ activePath: undefined,
+ skillByPrefix: new Map(),
+ detectedByPrefix: new Map(),
+ groupByPrefix: new Map(),
+ pinnedPrefixes: new Set(),
+ }),
+ detectedId: () => '',
+ isSkillDocActive: () => false,
+}));
+
+vi.doMock('@/lib/skills-api', () => ({
+ fetchSkillPreview: () => Promise.resolve({ ok: true, files: [] }),
+ listDetectedSkills: () => Promise.resolve({ ok: true, skills: [] }),
+}));
+
+vi.doMock('@/components/SkillsTree', () => ({
+ SkillsTree: (props: {
+ pinningReadyByScope: Record<'global' | 'project', boolean>;
+ onTogglePin: (scope: 'global' | 'project', name: string, pinned: boolean) => void;
+ }) => {
+ onTogglePinFromTree = props.onTogglePin;
+ return (
+ <>
+ <Button
+ data-testid="pin-global"
+ disabled={!props.pinningReadyByScope.global}
+ onClick={() => props.onTogglePin('global', 'alpha', true)}
+ >
+ Pin global
+ </Button>
+ <Button
+ data-testid="pin-project"
+ disabled={!props.pinningReadyByScope.project}
+ onClick={() => props.onTogglePin('project', 'beta', true)}
+ >
+ Pin project
+ </Button>
+ </>
+ );
+ },
+}));
+
+const { SkillsSidebarSection } = await import('./SkillsSidebarSection');
+const { emitSkillScopeMoved } = await import('@/lib/documents-events');
+
+describe('SkillsSidebarSection config readiness', () => {
+ beforeEach(() => {
+ userSynced = false;
+ projectLocalSynced = false;
+ onTogglePinFromTree = null;
+ merged = null;
+ userPatch.mockClear();
+ projectLocalPatch.mockClear();
+ toastError.mockClear();
+ toastInfo.mockClear();
+ });
+
+ afterEach(() => cleanup());
+
+ test('pin actions become ready independently for their named scope', () => {
+ const rendered = render(<SkillsSidebarSection dockExpanded />);
+
+ const globalPending = screen.getByTestId('pin-global') as HTMLButtonElement;
+ const projectPending = screen.getByTestId('pin-project') as HTMLButtonElement;
+ expect(globalPending.disabled).toBe(true);
+ expect(projectPending.disabled).toBe(true);
+ fireEvent.click(globalPending);
+ fireEvent.click(projectPending);
+ onTogglePinFromTree?.('global', 'alpha', true);
+ onTogglePinFromTree?.('project', 'beta', true);
+ expect(userPatch).not.toHaveBeenCalled();
+ expect(projectLocalPatch).not.toHaveBeenCalled();
+ expect(toastInfo).toHaveBeenCalledWith('Settings are still loading. Try again in a moment.', {
+ id: 'pin-not-ready-global',
+ });
+ expect(toastInfo).toHaveBeenCalledWith('Settings are still loading. Try again in a moment.', {
+ id: 'pin-not-ready-project',
+ });
+
+ userSynced = true;
+ rendered.rerender(<SkillsSidebarSection dockExpanded />);
+
+ fireEvent.click(screen.getByTestId('pin-global'));
+ fireEvent.click(screen.getByTestId('pin-project'));
+ expect(userPatch).toHaveBeenCalledWith({
+ appearance: { sidebar: { pinnedGlobalSkills: ['alpha'] } },
+ });
+ expect(projectLocalPatch).not.toHaveBeenCalled();
+
+ projectLocalSynced = true;
+ rendered.rerender(<SkillsSidebarSection dockExpanded />);
+ fireEvent.click(screen.getByTestId('pin-project'));
+ expect(projectLocalPatch).toHaveBeenCalledWith({
+ appearance: { sidebar: { pinnedProjectSkills: ['beta'] } },
+ });
+ });
+
+ test.each([
+ {
+ pendingScope: 'destination',
+ name: 'alpha',
+ fromScope: 'global' as const,
+ toScope: 'project' as const,
+ mergedConfig: { appearance: { sidebar: { pinnedGlobalSkills: ['alpha'] } } },
+ globalReady: true,
+ projectReady: false,
+ },
+ {
+ pendingScope: 'source',
+ name: 'beta',
+ fromScope: 'project' as const,
+ toScope: 'global' as const,
+ mergedConfig: { appearance: { sidebar: { pinnedProjectSkills: ['beta'] } } },
+ globalReady: true,
+ projectReady: false,
+ },
+ ])(
+ 'a scope-moved pin refuses the event without writes when its $pendingScope scope is pending',
+ ({ name, fromScope, toScope, mergedConfig, globalReady, projectReady }) => {
+ merged = mergedConfig;
+ userSynced = globalReady;
+ projectLocalSynced = projectReady;
+ render(<SkillsSidebarSection dockExpanded />);
+
+ emitSkillScopeMoved({ name, fromScope, toScope });
+
+ expect(userPatch).not.toHaveBeenCalled();
+ expect(projectLocalPatch).not.toHaveBeenCalled();
+ expect(toastInfo).toHaveBeenCalledWith(
+ `${name} moved, but its pin did not. Pin it again after settings finish loading.`,
+ );
+ },
+ );
+
+ test('a scope-moved pin updates both documents when both scopes are ready', () => {
+ merged = { appearance: { sidebar: { pinnedGlobalSkills: ['alpha'] } } };
+ userSynced = true;
+ projectLocalSynced = true;
+ render(<SkillsSidebarSection dockExpanded />);
+
+ emitSkillScopeMoved({ name: 'alpha', fromScope: 'global', toScope: 'project' });
+
+ expect(userPatch).toHaveBeenCalledWith({
+ appearance: { sidebar: { pinnedGlobalSkills: [] } },
+ });
+ expect(projectLocalPatch).toHaveBeenCalledWith({
+ appearance: { sidebar: { pinnedProjectSkills: ['alpha'] } },
+ });
+ });
+});
diff --git a/packages/app/src/components/SkillsSidebarSection.tsx b/packages/app/src/components/SkillsSidebarSection.tsx
index a7af2fc85..0d890f055 100644
--- a/packages/app/src/components/SkillsSidebarSection.tsx
+++ b/packages/app/src/components/SkillsSidebarSection.tsx
@@ -1,5 +1,6 @@
import {
type CatalogSkill,
+ type ConfigBinding,
catalogRawScopeToOkScope,
externalSkillLiveDocName,
humanFormat,
@@ -21,6 +22,7 @@ import { useCreateBlankSkill } from '@/hooks/use-create-blank-skill';
import { useOpenSkill } from '@/hooks/use-open-skill';
import { useOpenSkillForEdit } from '@/hooks/use-open-skill-for-edit';
import { useSkills } from '@/hooks/use-skills';
+import { useSettingsLoadingReason } from '@/lib/config-context';
import { useConfigContext } from '@/lib/config-provider';
import {
hashFromDocName,
@@ -50,8 +52,10 @@ const ImportSkillDialog = lazy(() =>
export function SkillsSidebarSection({ dockExpanded = false }: { dockExpanded?: boolean } = {}) {
const state = useSkills();
+ const { t } = useLingui();
const { openTarget, activeDocName, activeTarget, openTabs, activateTab } = useDocumentContext();
- const { merged, userBinding, projectLocalBinding } = useConfigContext();
+ const { merged, userBinding, userSynced, projectLocalBinding, projectLocalSynced } =
+ useConfigContext();
const tabBehavior: 'append' | 'replace-active' =
(merged?.editor?.previewTabs ?? true) ? 'replace-active' : 'append';
const showSkillGroups = merged?.appearance?.sidebar?.showSkillGroups ?? true;
@@ -59,9 +63,21 @@ export function SkillsSidebarSection({ dockExpanded = false }: { dockExpanded?:
project: readPins(merged, 'project'),
global: readPins(merged, 'global'),
};
+ const pinBindingByScope: Record<SkillScope, ConfigBinding | null> = {
+ global: userSynced ? userBinding : null,
+ project: projectLocalSynced ? projectLocalBinding : null,
+ };
+ const pinningReadyByScope: Record<SkillScope, boolean> = {
+ global: pinBindingByScope.global !== null,
+ project: pinBindingByScope.project !== null,
+ };
+ const settingsLoadingReason = useSettingsLoadingReason();
const togglePinned = (scope: SkillScope, name: string, pinned: boolean) => {
- const binding = scope === 'global' ? userBinding : projectLocalBinding;
- if (binding === null) return;
+ const binding = pinBindingByScope[scope];
+ if (binding === null) {
+ toast.info(settingsLoadingReason, { id: `pin-not-ready-${scope}` });
+ return;
+ }
const next = togglePin(pinnedByScope[scope], name, pinned);
const result = binding.patch({ appearance: { sidebar: { [PIN_FIELD[scope]]: next } } });
if (!result.ok) {
@@ -74,7 +90,6 @@ export function SkillsSidebarSection({ dockExpanded = false }: { dockExpanded?:
const openSkill = useOpenSkill();
const openSkillForEdit = useOpenSkillForEdit();
const actions = useSkillActions();
- const { t } = useLingui();
const scopeLabel = useSkillScopeLabels();
const scopeDescription = useSkillScopeDescriptions();
@@ -86,14 +101,27 @@ export function SkillsSidebarSection({ dockExpanded = false }: { dockExpanded?:
useEffect(() => {
pinnedByScopeRef.current = pinnedByScope;
});
+ const pinningReadyByScopeRef = useRef(pinningReadyByScope);
+ useEffect(() => {
+ pinningReadyByScopeRef.current = pinningReadyByScope;
+ });
useEffect(
() =>
subscribeToSkillScopeMoved(({ name, fromScope, toScope }) => {
if (!pinnedByScopeRef.current[fromScope].has(name)) return;
+ if (
+ !pinningReadyByScopeRef.current[fromScope] ||
+ !pinningReadyByScopeRef.current[toScope]
+ ) {
+ toast.info(
+ t`${name} moved, but its pin did not. Pin it again after settings finish loading.`,
+ );
+ return;
+ }
togglePinnedRef.current(fromScope, name, false);
togglePinnedRef.current(toScope, name, true);
}),
- [],
+ [t],
);
const skills = state.status === 'ready' ? state.data : [];
@@ -369,6 +397,7 @@ export function SkillsSidebarSection({ dockExpanded = false }: { dockExpanded?:
onExpandedChange={setUserExpanded}
sort={skillSort}
pinnedPrefixes={pinnedPrefixes}
+ pinningReadyByScope={pinningReadyByScope}
isPinned={(scope, name) => pinnedByScope[scope].has(name)}
onTogglePin={togglePinned}
skillByPrefix={skillByPrefix}
diff --git a/packages/app/src/components/SkillsTree.pin-readiness.dom.test.tsx b/packages/app/src/components/SkillsTree.pin-readiness.dom.test.tsx
new file mode 100644
index 000000000..cbe28cdec
--- /dev/null
+++ b/packages/app/src/components/SkillsTree.pin-readiness.dom.test.tsx
@@ -0,0 +1,188 @@
+import type { SkillScope, SkillsListEntry } from '@inkeep/open-knowledge-core';
+import * as actualLinguiMacro from '@lingui/react/macro';
+import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import type { ReactNode } from 'react';
+import { afterEach, describe, expect, test, vi } from 'vitest';
+import type { SkillActions } from '@/components/skill-actions';
+import { DropdownMenuItem } from '@/components/ui/dropdown-menu';
+import { TooltipProvider } from '@/components/ui/tooltip';
+import { renderLinguiTemplate } from '@/test-utils/lingui-mock';
+
+const model = {
+ focusPath: () => {},
+ getItem: () => undefined,
+ getSelectedPaths: () => [],
+ subscribe: () => () => {},
+};
+let contextMenuPath = 'GLOBAL/alpha';
+
+vi.doMock('@lingui/react/macro', () => ({
+ ...actualLinguiMacro,
+ Trans: ({ children }: { children?: ReactNode }) => <>{children}</>,
+ useLingui: () => ({ t: renderLinguiTemplate }),
+}));
+
+vi.doMock('@pierre/trees/react', () => ({
+ useFileTree: () => ({ model }),
+}));
+
+vi.doMock('@/components/OkFileTree', () => ({
+ OkFileTree: ({
+ renderContextMenu,
+ }: {
+ renderContextMenu: (
+ item: { path: string },
+ context: { close: (options: { restoreFocus: boolean }) => void },
+ ) => ReactNode;
+ }) => <div>{renderContextMenu({ path: contextMenuPath }, { close: () => {} })}</div>,
+}));
+
+vi.doMock('@/components/skill-actions', () => ({
+ SkillContextMenuItems: () => (
+ <DropdownMenuItem data-testid="skills-menu-anchor">Actions</DropdownMenuItem>
+ ),
+ SkillFileContextMenuItems: () => null,
+ SkillManagedContextMenuItems: () => null,
+ SkillRevealMenuItem: () => null,
+}));
+
+vi.doMock('@/components/SkillBulkDeleteDialog', () => ({
+ SkillBulkDeleteDialog: () => null,
+}));
+
+vi.doMock('@/hooks/use-open-skill', () => ({
+ useOpenSkill: () => () => {},
+}));
+
+const { SkillsTree } = await import('./SkillsTree');
+
+const skill: SkillsListEntry = {
+ name: 'alpha',
+ scope: 'global',
+ path: '/tmp/alpha',
+ installed: true,
+ hosts: [],
+};
+const projectSkill: SkillsListEntry = {
+ name: 'beta',
+ scope: 'project',
+ path: '/tmp/beta',
+ installed: true,
+ hosts: [],
+};
+
+function tree(
+ pinningReadyByScope: Record<SkillScope, boolean>,
+ onTogglePin: ReturnType<typeof vi.fn>,
+) {
+ return (
+ <SkillsTree
+ paths={['GLOBAL/alpha', 'PROJECT/beta']}
+ activePath={undefined}
+ initialExpandedPaths={[]}
+ onExpandedChange={() => {}}
+ sort={() => 0}
+ skillByPrefix={
+ new Map([
+ ['GLOBAL/alpha', skill],
+ ['PROJECT/beta', projectSkill],
+ ])
+ }
+ detectedByPrefix={new Map()}
+ groupByPrefix={new Map()}
+ pinnedPrefixes={new Set()}
+ pinningReadyByScope={pinningReadyByScope}
+ labelToScope={
+ new Map([
+ ['GLOBAL', 'global'],
+ ['PROJECT', 'project'],
+ ])
+ }
+ scopeDescription={{ global: 'Global', project: 'Project' }}
+ existingNames={{ global: new Set(['alpha']), project: new Set() }}
+ actions={{} as SkillActions}
+ onOpenSkillMd={() => {}}
+ onOpenFile={() => {}}
+ onOpenDetected={() => {}}
+ onOpenManaged={() => {}}
+ onNewSkill={() => {}}
+ onAddSkill={() => {}}
+ isPinned={() => false}
+ onTogglePin={onTogglePin}
+ />
+ );
+}
+
+function renderTree(
+ pinningReadyByScope: Record<SkillScope, boolean>,
+ onTogglePin: ReturnType<typeof vi.fn>,
+) {
+ const rendered = render(tree(pinningReadyByScope, onTogglePin), { wrapper: TooltipProvider });
+ return {
+ ...rendered,
+ rerenderTree: (next: Record<SkillScope, boolean>) => rendered.rerender(tree(next, onTogglePin)),
+ };
+}
+
+describe('SkillsTree pin readiness', () => {
+ afterEach(() => cleanup());
+
+ test('real global and project rows use their own scope readiness and explain a pending pin', async () => {
+ const user = userEvent.setup();
+ const onTogglePin = vi.fn();
+ contextMenuPath = 'GLOBAL/alpha';
+ const globalTree = renderTree({ global: true, project: false }, onTogglePin);
+
+ const globalItem = screen.getByRole('menuitem', { name: 'Pin to top' });
+ expect(globalItem.getAttribute('data-disabled')).toBeNull();
+ fireEvent.click(globalItem);
+ expect(onTogglePin).toHaveBeenCalledWith('global', 'alpha', true);
+
+ globalTree.unmount();
+ onTogglePin.mockClear();
+ contextMenuPath = 'PROJECT/beta';
+ const projectTree = renderTree({ global: true, project: false }, onTogglePin);
+
+ const pendingItem = screen.getByRole('menuitem', { name: 'Pin to top' });
+ expect(pendingItem.getAttribute('data-disabled')).toBeNull();
+ expect(pendingItem.getAttribute('aria-disabled')).toBe('true');
+ const descriptionId = pendingItem.getAttribute('aria-describedby');
+ expect(descriptionId).toBeTruthy();
+ expect(document.getElementById(descriptionId ?? '')?.textContent).toBe(
+ 'Settings are still loading. Try again in a moment.',
+ );
+ const menu = screen.getByRole('menu');
+ expect(document.activeElement).toBe(menu);
+ await user.keyboard('{ArrowDown}');
+ await waitFor(() =>
+ expect(document.activeElement).toBe(screen.getByTestId('skills-menu-anchor')),
+ );
+ await user.keyboard('{ArrowDown}');
+ await waitFor(() => expect(document.activeElement).toBe(pendingItem));
+ expect(
+ await screen.findByRole('tooltip', {
+ name: 'Settings are still loading. Try again in a moment.',
+ }),
+ ).toBeTruthy();
+ await user.keyboard('{Enter}');
+ expect(onTogglePin).toHaveBeenCalledWith('project', 'beta', true);
+ expect(document.activeElement).toBe(pendingItem);
+
+ onTogglePin.mockClear();
+ await user.keyboard(' ');
+ expect(onTogglePin).toHaveBeenCalledWith('project', 'beta', true);
+ expect(document.activeElement).toBe(pendingItem);
+
+ onTogglePin.mockClear();
+ projectTree.rerenderTree({ global: true, project: true });
+
+ const readyItem = screen.getByRole('menuitem', { name: 'Pin to top' });
+ expect(readyItem).toBe(pendingItem);
+ expect(readyItem.getAttribute('data-disabled')).toBeNull();
+ expect(readyItem.getAttribute('aria-disabled')).toBeNull();
+ expect(document.activeElement).toBe(readyItem);
+ fireEvent.click(readyItem);
+ expect(onTogglePin).toHaveBeenCalledWith('project', 'beta', true);
+ });
+});
diff --git a/packages/app/src/components/SkillsTree.tsx b/packages/app/src/components/SkillsTree.tsx
index 62155ad95..98fdfc8ed 100644
--- a/packages/app/src/components/SkillsTree.tsx
+++ b/packages/app/src/components/SkillsTree.tsx
@@ -25,7 +25,7 @@ import {
} from 'lucide-react';
import { __iconNode as packageIcon } from 'lucide-react/dist/esm/icons/package';
import { useTheme } from 'next-themes';
-import { type ReactNode, useEffect, useRef, useState } from 'react';
+import { type ReactNode, useEffect, useId, useRef, useState } from 'react';
import { toast } from 'sonner';
import { AgentBrandIcon } from '@/components/AgentIconCluster';
import { createFileTreeStyle } from '@/components/file-tree-density';
@@ -70,6 +70,7 @@ import {
import {
DropdownMenu,
DropdownMenuContent,
+ DropdownMenuGroup,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuSeparator,
@@ -78,8 +79,10 @@ import {
DropdownMenuSubTrigger,
DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu';
+import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
import { asDirectoryHandle } from '@/components/use-selection-mirror';
import { useOpenSkill } from '@/hooks/use-open-skill';
+import { useSettingsLoadingReason } from '@/lib/config-context';
import { openExternalUrl } from '@/lib/external-link';
import { scheduleClipboardWrite } from '@/lib/share/clipboard-adapter';
import { groupDeletableSkills, groupUpdatableSkills } from '@/lib/skill-group-update';
@@ -218,18 +221,41 @@ function PinMenuItem({
scope,
name,
pinned,
+ pending,
onToggle,
}: {
scope: SkillScope;
name: string;
pinned: boolean;
+ pending: boolean;
onToggle: (scope: SkillScope, name: string, pinned: boolean) => void;
}) {
+ const loadingReasonId = useId();
+ const loadingReason = useSettingsLoadingReason();
return (
- <DropdownMenuItem onSelect={() => onToggle(scope, name, !pinned)}>
- {pinned ? <PinOff aria-hidden /> : <Pin aria-hidden />}
- {pinned ? <Trans>Unpin</Trans> : <Trans>Pin to top</Trans>}
- </DropdownMenuItem>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <DropdownMenuGroup>
+ <DropdownMenuItem
+ aria-disabled={pending || undefined}
+ aria-describedby={pending ? loadingReasonId : undefined}
+ onSelect={(event) => {
+ if (pending) event.preventDefault();
+ onToggle(scope, name, !pinned);
+ }}
+ >
+ {pinned ? <PinOff aria-hidden /> : <Pin aria-hidden />}
+ {pinned ? <Trans>Unpin</Trans> : <Trans>Pin to top</Trans>}
+ </DropdownMenuItem>
+ {pending ? (
+ <span id={loadingReasonId} className="sr-only">
+ {loadingReason}
+ </span>
+ ) : null}
+ </DropdownMenuGroup>
+ </TooltipTrigger>
+ {pending ? <TooltipContent>{loadingReason}</TooltipContent> : null}
+ </Tooltip>
);
}
@@ -243,6 +269,7 @@ export function SkillsTree({
detectedByPrefix,
groupByPrefix,
pinnedPrefixes,
+ pinningReadyByScope,
labelToScope,
scopeDescription,
existingNames,
@@ -265,6 +292,7 @@ export function SkillsTree({
detectedByPrefix: Map<string, CatalogSkill>;
groupByPrefix: ReadonlyMap<string, ProvenanceBucket>;
pinnedPrefixes: ReadonlySet<string>;
+ pinningReadyByScope: Record<SkillScope, boolean>;
labelToScope: Map<string, SkillScope>;
scopeDescription: Record<SkillScope, string>;
existingNames: Record<SkillScope, Set<string>>;
@@ -1391,6 +1419,7 @@ export function SkillsTree({
scope={scope}
name={d.name}
pinned={isPinned(scope, d.name)}
+ pending={!pinningReadyByScope[scope]}
onToggle={onTogglePin}
/>
</>
@@ -1411,6 +1440,7 @@ export function SkillsTree({
scope={scope}
name={skill.name}
pinned={isPinned(scope, skill.name)}
+ pending={!pinningReadyByScope[scope]}
onToggle={onTogglePin}
/>
</>
@@ -1430,6 +1460,7 @@ export function SkillsTree({
scope={scope}
name={skill.name}
pinned={isPinned(scope, skill.name)}
+ pending={!pinningReadyByScope[scope]}
onToggle={onTogglePin}
/>
</>
diff --git a/packages/app/src/components/TerminalGate.dom.test.tsx b/packages/app/src/components/TerminalGate.dom.test.tsx
index 34a07afe3..c551ca144 100644
--- a/packages/app/src/components/TerminalGate.dom.test.tsx
+++ b/packages/app/src/components/TerminalGate.dom.test.tsx
@@ -287,13 +287,40 @@ describe('TerminalGate', () => {
expect(notice()).toBeNull();
});
- test('re-enable with no writer yet surfaces an actionable toast, no crash', () => {
+ test('keeps re-enable unavailable during a replacement binding sync, then enables it', () => {
consentState = { enabled: false, synced: true };
+ const readyWriter = writerImpl;
+ const view = renderGate();
+
+ consentState = { enabled: null, synced: false };
writerImpl = null;
- renderGate();
- act(() => screen.getByRole('button', { name: 'Enable terminal' }).click());
+ view.rerender(<TerminalGate bridge={bridge} />);
+
+ const syncingButton = screen.getByRole('button', { name: 'Enable terminal' });
+ expect((syncingButton as HTMLButtonElement).disabled).toBe(true);
+ const pendingReason = screen.getByText(
+ 'Terminal settings not loaded yet — try again in a moment.',
+ );
+ expect(pendingReason.textContent).toBe(
+ 'Terminal settings not loaded yet — try again in a moment.',
+ );
+ expect(pendingReason.getAttribute('role')).toBeNull();
+ expect(syncingButton.getAttribute('aria-describedby')).toBe(pendingReason.id);
+ act(() => syncingButton.click());
expect(writerCalls).toEqual([]);
- expect(toastErrors.length).toBe(1);
+ expect(toastErrors).toEqual([]);
+
+ consentState = { enabled: false, synced: true };
+ writerImpl = readyWriter;
+ view.rerender(<TerminalGate bridge={bridge} />);
+
+ const readyButton = screen.getByRole('button', { name: 'Enable terminal' });
+ expect((readyButton as HTMLButtonElement).disabled).toBe(false);
+ expect(
+ screen.queryByText('Terminal settings not loaded yet — try again in a moment.'),
+ ).toBeNull();
+ act(() => readyButton.click());
+ expect(writerCalls).toEqual([true]);
});
test('a writer that fails to persist surfaces a toast and never mounts the shell', () => {
diff --git a/packages/app/src/components/TerminalGate.tsx b/packages/app/src/components/TerminalGate.tsx
index 7f46ceece..7a120fe72 100644
--- a/packages/app/src/components/TerminalGate.tsx
+++ b/packages/app/src/components/TerminalGate.tsx
@@ -1,5 +1,5 @@
import { useLingui } from '@lingui/react/macro';
-import { Suspense, useEffect, useState } from 'react';
+import { Suspense, useEffect, useId, useState } from 'react';
import { ErrorBoundary, type FallbackProps } from 'react-error-boundary';
import { toast } from 'sonner';
import { Button } from '@/components/ui/button';
@@ -95,7 +95,7 @@ export function TerminalGate({
}
return optedOut ? (
- <TerminalNotEnabledNotice onEnable={handleEnable} />
+ <TerminalNotEnabledNotice enableDisabled={writer === null} onEnable={handleEnable} />
) : (
<TerminalStartingNotice />
);
@@ -120,11 +120,13 @@ function TerminalErrorFallback({ error }: FallbackProps) {
}
interface TerminalNotEnabledNoticeProps {
+ readonly enableDisabled: boolean;
readonly onEnable: () => void;
}
-function TerminalNotEnabledNotice({ onEnable }: TerminalNotEnabledNoticeProps) {
+function TerminalNotEnabledNotice({ enableDisabled, onEnable }: TerminalNotEnabledNoticeProps) {
const { t } = useLingui();
+ const pendingReasonId = useId();
return (
<section
aria-label={t`Terminal disabled`}
@@ -133,7 +135,18 @@ function TerminalNotEnabledNotice({ onEnable }: TerminalNotEnabledNoticeProps) {
<p className="max-w-sm text-sm text-foreground">
{t`The terminal is turned off for this project. Turn it back on to run commands here.`}
</p>
- <Button onClick={onEnable}>{t`Enable terminal`}</Button>
+ <Button
+ disabled={enableDisabled}
+ aria-describedby={enableDisabled ? pendingReasonId : undefined}
+ onClick={onEnable}
+ >
+ {t`Enable terminal`}
+ </Button>
+ {enableDisabled ? (
+ <p id={pendingReasonId} className="text-xs text-muted-foreground">
+ {t`Terminal settings not loaded yet — try again in a moment.`}
+ </p>
+ ) : null}
<p className="text-xs text-muted-foreground">{t`You can also manage this in Settings.`}</p>
</section>
);
diff --git a/packages/app/src/components/ui/context-menu.tsx b/packages/app/src/components/ui/context-menu.tsx
index bd955965c..b001ae6fd 100644
--- a/packages/app/src/components/ui/context-menu.tsx
+++ b/packages/app/src/components/ui/context-menu.tsx
@@ -71,7 +71,7 @@ function ContextMenuItem({
data-inset={inset}
data-variant={variant}
className={cn(
- "group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive",
+ "group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 aria-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive",
className,
)}
{...props}
@@ -133,7 +133,7 @@ function ContextMenuCheckboxItem({
data-slot="context-menu-checkbox-item"
data-inset={inset}
className={cn(
- "relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ "relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 aria-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
className,
)}
checked={checked}
diff --git a/packages/app/src/components/ui/dropdown-menu.tsx b/packages/app/src/components/ui/dropdown-menu.tsx
index 44aa4b3ae..3a96ef976 100644
--- a/packages/app/src/components/ui/dropdown-menu.tsx
+++ b/packages/app/src/components/ui/dropdown-menu.tsx
@@ -60,7 +60,7 @@ function DropdownMenuItem({
data-inset={inset}
data-variant={variant}
className={cn(
- "group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",
+ "group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 aria-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",
className,
)}
{...props}
@@ -82,7 +82,7 @@ function DropdownMenuCheckboxItem({
data-slot="dropdown-menu-checkbox-item"
data-inset={inset}
className={cn(
- "relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ "relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 aria-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
className,
)}
checked={checked}
diff --git a/packages/app/src/hooks/use-enable-sync-with-confirm.dom.test.tsx b/packages/app/src/hooks/use-enable-sync-with-confirm.dom.test.tsx
index 3c5c9cce7..e99013cdc 100644
--- a/packages/app/src/hooks/use-enable-sync-with-confirm.dom.test.tsx
+++ b/packages/app/src/hooks/use-enable-sync-with-confirm.dom.test.tsx
@@ -13,21 +13,41 @@ vi.doMock('@lingui/react/macro', () => ({
}));
const toastErrors: string[] = [];
+const toastInfos: Array<{ message: string; id: string | number | undefined }> = [];
vi.doMock('sonner', () => ({
toast: {
error: (message: string) => toastErrors.push(message),
+ info: (message: string, options?: { id?: string | number }) =>
+ toastInfos.push({ message, id: options?.id }),
},
}));
+const syncSettingsNotReadyInfo = {
+ message: 'Sync settings not yet loaded — try again in a moment',
+ id: 'sync-settings-not-ready',
+};
+
+function expectRepeatedSyncSettingsNotReadyInfo(): void {
+ expect(toastInfos).toEqual([syncSettingsNotReadyInfo, syncSettingsNotReadyInfo]);
+ expect(toastErrors).toEqual([]);
+}
+
let projectLocalBinding: null | {
patch: (patch: unknown) => { ok: true } | { ok: false; error: unknown };
} = null;
+let projectLocalSynced = true;
let projectBinding: null | {
patch: (patch: unknown) => { ok: true } | { ok: false; error: unknown };
} = null;
+let projectSynced = true;
vi.doMock('@/lib/config-provider', () => ({
- useConfigContext: () => ({ projectBinding, projectLocalBinding }),
+ useConfigContext: () => ({
+ projectBinding,
+ projectSynced,
+ projectLocalBinding,
+ projectLocalSynced,
+ }),
}));
type Writer = ((enabled: boolean) => { ok: true } | { ok: false; error: string }) | null;
@@ -81,6 +101,40 @@ function DefaultWriterProbe() {
return <div data-testid="default-writer-present">{String(latestDefaultWriter !== null)}</div>;
}
+type IntervalWriter =
+ | ((next: {
+ pullIntervalSeconds: number;
+ pushIntervalSeconds: number;
+ }) => { ok: true } | { ok: false; error: string })
+ | null;
+let latestIntervalWriter: IntervalWriter | undefined;
+
+function IntervalWriterProbe() {
+ if (!hooks) throw new Error('hooks not loaded');
+ latestIntervalWriter = hooks.useSyncIntervalWriter();
+ return <div data-testid="interval-writer-present">{String(latestIntervalWriter !== null)}</div>;
+}
+
+type AutoSyncPatch = {
+ mode?: SyncMode;
+ enabled?: null;
+ resumeMode?: Exclude<SyncMode, 'off'> | null;
+};
+type AutoSyncPatchWriter =
+ | ((patch: AutoSyncPatch) => { ok: true } | { ok: false; error: string })
+ | null;
+let latestAutoSyncPatchWriter: AutoSyncPatchWriter | undefined;
+
+function AutoSyncPatchWriterProbe() {
+ if (!hooks) throw new Error('hooks not loaded');
+ latestAutoSyncPatchWriter = hooks.useAutoSyncPatchWriter();
+ return (
+ <div data-testid="auto-sync-patch-writer-present">
+ {String(latestAutoSyncPatchWriter !== null)}
+ </div>
+ );
+}
+
type ModeSelectionState = {
confirmOpen: boolean;
pendingMode: 'follow' | 'full' | null;
@@ -111,6 +165,17 @@ function ModeSelectionProbe({
);
}
+type BadgeControlsState = {
+ onModeSelect: (next: SyncMode) => void;
+};
+let latestBadgeControls: BadgeControlsState | null = null;
+
+function BadgeControlsProbe({ mode }: { mode: SyncMode }) {
+ if (!hooks) throw new Error('hooks not loaded');
+ latestBadgeControls = hooks.useBadgeSyncControls({ mode }, 0);
+ return null;
+}
+
describe('useEnableSyncWithConfirm runtime behavior', () => {
let consoleErrorSpy: ReturnType<typeof spyOn>;
@@ -120,10 +185,16 @@ describe('useEnableSyncWithConfirm runtime behavior', () => {
latestWriter = undefined;
latestModeWriter = undefined;
latestDefaultWriter = undefined;
+ latestIntervalWriter = undefined;
+ latestAutoSyncPatchWriter = undefined;
latestModeSelection = null;
+ latestBadgeControls = null;
projectLocalBinding = null;
+ projectLocalSynced = true;
projectBinding = null;
+ projectSynced = true;
toastErrors.length = 0;
+ toastInfos.length = 0;
consoleErrorSpy?.mockRestore();
});
@@ -133,6 +204,8 @@ describe('useEnableSyncWithConfirm runtime behavior', () => {
expect(typeof mod.useSyncEnabledWriter).toBe('function');
expect(typeof mod.useSyncModeWriter).toBe('function');
expect(typeof mod.useSyncDefaultWriter).toBe('function');
+ expect(typeof mod.useSyncIntervalWriter).toBe('function');
+ expect(typeof mod.useAutoSyncPatchWriter).toBe('function');
});
test('off to on opens confirmation and writes true only after confirm', async () => {
@@ -187,6 +260,22 @@ describe('useEnableSyncWithConfirm runtime behavior', () => {
expect(screen.getByTestId('confirm-open').textContent).toBe('true');
expect(toastErrors).toEqual(['Failed to enable sync — branch is protected']);
+ expect(toastInfos).toEqual([]);
+ });
+
+ test('an unavailable writer reports the loading wait as information', async () => {
+ await loadHooks();
+ render(<ConfirmProbe writer={null} />);
+
+ await act(async () => {
+ latestConfirmState?.onToggleRequest(true);
+ });
+ await act(async () => {
+ latestConfirmState?.onConfirm();
+ latestConfirmState?.onConfirm();
+ });
+
+ expectRepeatedSyncSettingsNotReadyInfo();
});
test('fires opts.onEnabled once, only after a successful confirm', async () => {
@@ -228,6 +317,7 @@ describe('useSyncEnabledWriter runtime behavior', () => {
cleanup();
latestWriter = undefined;
projectLocalBinding = null;
+ projectLocalSynced = true;
});
test('returns null until the project-local binding mounts', async () => {
@@ -239,7 +329,24 @@ describe('useSyncEnabledWriter runtime behavior', () => {
expect(latestWriter).toBeNull();
});
- test('patches both autoSync.mode and the legacy enabled leaf so a set mode cannot mask the enable', async () => {
+ test('returns null while the project-local binding awaits its first sync', async () => {
+ await loadHooks();
+ const patches: unknown[] = [];
+ projectLocalBinding = {
+ patch: (patch: unknown) => {
+ patches.push(patch);
+ return { ok: true };
+ },
+ };
+ projectLocalSynced = false;
+ render(<WriterProbe />);
+
+ expect(latestWriter).toBeNull();
+ latestWriter?.(true);
+ expect(patches).toEqual([]);
+ });
+
+ test('after first sync, patches both autoSync.mode and the legacy enabled leaf', async () => {
await loadHooks();
const patches: unknown[] = [];
projectLocalBinding = {
@@ -248,6 +355,7 @@ describe('useSyncEnabledWriter runtime behavior', () => {
return { ok: true };
},
};
+ projectLocalSynced = true;
render(<WriterProbe />);
expect(latestWriter?.(true)).toEqual({ ok: true });
@@ -277,6 +385,7 @@ describe('useSyncModeWriter runtime behavior', () => {
cleanup();
latestModeWriter = undefined;
projectLocalBinding = null;
+ projectLocalSynced = true;
});
test('returns null until the project-local binding mounts', async () => {
@@ -288,7 +397,7 @@ describe('useSyncModeWriter runtime behavior', () => {
expect(latestModeWriter).toBeNull();
});
- test('patches autoSync.mode on the project-local binding', async () => {
+ test('returns null while the project-local binding awaits its first sync', async () => {
await loadHooks();
const patches: unknown[] = [];
projectLocalBinding = {
@@ -297,6 +406,24 @@ describe('useSyncModeWriter runtime behavior', () => {
return { ok: true };
},
};
+ projectLocalSynced = false;
+ render(<ModeWriterProbe />);
+
+ expect(latestModeWriter).toBeNull();
+ latestModeWriter?.('full');
+ expect(patches).toEqual([]);
+ });
+
+ test('after first sync, patches autoSync.mode on the project-local binding', async () => {
+ await loadHooks();
+ const patches: unknown[] = [];
+ projectLocalBinding = {
+ patch: (patch: unknown) => {
+ patches.push(patch);
+ return { ok: true };
+ },
+ };
+ projectLocalSynced = true;
render(<ModeWriterProbe />);
expect(latestModeWriter?.('follow')).toEqual({ ok: true });
@@ -322,7 +449,9 @@ describe('useSyncDefaultWriter runtime behavior', () => {
cleanup();
latestDefaultWriter = undefined;
projectBinding = null;
+ projectSynced = true;
projectLocalBinding = null;
+ projectLocalSynced = true;
});
test('returns null until the committed project binding mounts', async () => {
@@ -334,7 +463,24 @@ describe('useSyncDefaultWriter runtime behavior', () => {
expect(latestDefaultWriter).toBeNull();
});
- test('patches autoSync.default on the COMMITTED project binding, not project-local', async () => {
+ test('returns null while the committed project binding awaits its first sync', async () => {
+ await loadHooks();
+ const patches: unknown[] = [];
+ projectBinding = {
+ patch: (patch: unknown) => {
+ patches.push(patch);
+ return { ok: true };
+ },
+ };
+ projectSynced = false;
+ render(<DefaultWriterProbe />);
+
+ expect(latestDefaultWriter).toBeNull();
+ latestDefaultWriter?.(true);
+ expect(patches).toEqual([]);
+ });
+
+ test('after first sync, patches autoSync.default on the committed project binding', async () => {
await loadHooks();
const committedPatches: unknown[] = [];
const localPatches: unknown[] = [];
@@ -344,6 +490,7 @@ describe('useSyncDefaultWriter runtime behavior', () => {
return { ok: true };
},
};
+ projectSynced = true;
projectLocalBinding = {
patch: (patch: unknown) => {
localPatches.push(patch);
@@ -393,6 +540,94 @@ describe('useSyncDefaultWriter runtime behavior', () => {
});
});
+describe('useSyncIntervalWriter runtime behavior', () => {
+ afterEach(() => {
+ cleanup();
+ latestIntervalWriter = undefined;
+ projectLocalBinding = null;
+ projectLocalSynced = true;
+ });
+
+ test('returns null while the project-local binding awaits its first sync', async () => {
+ await loadHooks();
+ const patches: unknown[] = [];
+ projectLocalBinding = {
+ patch: (patch: unknown) => {
+ patches.push(patch);
+ return { ok: true };
+ },
+ };
+ projectLocalSynced = false;
+ render(<IntervalWriterProbe />);
+
+ expect(latestIntervalWriter).toBeNull();
+ latestIntervalWriter?.({ pullIntervalSeconds: 120, pushIntervalSeconds: 45 });
+ expect(patches).toEqual([]);
+ });
+
+ test('patches both intervals after the project-local binding completes its first sync', async () => {
+ await loadHooks();
+ const patches: unknown[] = [];
+ projectLocalBinding = {
+ patch: (patch: unknown) => {
+ patches.push(patch);
+ return { ok: true };
+ },
+ };
+ projectLocalSynced = true;
+ render(<IntervalWriterProbe />);
+
+ expect(latestIntervalWriter?.({ pullIntervalSeconds: 120, pushIntervalSeconds: 45 })).toEqual({
+ ok: true,
+ });
+ expect(patches).toEqual([{ autoSync: { pullIntervalSeconds: 120, pushIntervalSeconds: 45 } }]);
+ });
+});
+
+describe('useAutoSyncPatchWriter runtime behavior', () => {
+ afterEach(() => {
+ cleanup();
+ latestAutoSyncPatchWriter = undefined;
+ projectLocalBinding = null;
+ projectLocalSynced = true;
+ });
+
+ test('returns null while the project-local binding awaits its first sync', async () => {
+ await loadHooks();
+ const patches: unknown[] = [];
+ projectLocalBinding = {
+ patch: (patch: unknown) => {
+ patches.push(patch);
+ return { ok: true };
+ },
+ };
+ projectLocalSynced = false;
+ render(<AutoSyncPatchWriterProbe />);
+
+ expect(latestAutoSyncPatchWriter).toBeNull();
+ latestAutoSyncPatchWriter?.({ mode: 'full', enabled: null, resumeMode: null });
+ expect(patches).toEqual([]);
+ });
+
+ test('patches autoSync after the project-local binding completes its first sync', async () => {
+ await loadHooks();
+ const patches: unknown[] = [];
+ projectLocalBinding = {
+ patch: (patch: unknown) => {
+ patches.push(patch);
+ return { ok: true };
+ },
+ };
+ projectLocalSynced = true;
+ render(<AutoSyncPatchWriterProbe />);
+
+ expect(latestAutoSyncPatchWriter?.({ mode: 'full', enabled: null, resumeMode: null })).toEqual({
+ ok: true,
+ });
+ expect(patches).toEqual([{ autoSync: { mode: 'full', enabled: null, resumeMode: null } }]);
+ });
+});
+
describe('useSyncModeSelection runtime behavior', () => {
let consoleErrorSpy: ReturnType<typeof spyOn> | undefined;
@@ -401,6 +636,7 @@ describe('useSyncModeSelection runtime behavior', () => {
latestModeSelection = null;
projectLocalBinding = null;
toastErrors.length = 0;
+ toastInfos.length = 0;
consoleErrorSpy?.mockRestore();
consoleErrorSpy = undefined;
});
@@ -496,6 +732,7 @@ describe('useSyncModeSelection runtime behavior', () => {
expect(screen.getByTestId('mode-selection').textContent).toBe('true:full');
expect(toastErrors).toEqual(['Failed to update sync mode — branch is protected']);
+ expect(toastInfos).toEqual([]);
});
test('fires opts.onApplied with the confirmed mode after a successful write', async () => {
@@ -570,16 +807,75 @@ describe('useSyncModeSelection runtime behavior', () => {
render(
<ModeSelectionProbe
writer={null}
- currentMode="full"
+ currentMode="off"
onApplied={(mode) => applied.push(mode)}
/>,
);
await act(async () => {
- latestModeSelection?.onModeSelect('off');
+ latestModeSelection?.onModeSelect('full');
+ });
+ await act(async () => {
+ latestModeSelection?.onConfirm();
+ latestModeSelection?.onConfirm();
});
expect(applied).toEqual([]);
- expect(toastErrors).toEqual(['Sync settings not yet loaded — try again in a moment']);
+ expectRepeatedSyncSettingsNotReadyInfo();
+ });
+});
+
+describe('useBadgeSyncControls loading feedback', () => {
+ let consoleErrorSpy: ReturnType<typeof spyOn> | undefined;
+
+ afterEach(() => {
+ cleanup();
+ latestBadgeControls = null;
+ projectLocalBinding = null;
+ projectLocalSynced = true;
+ toastErrors.length = 0;
+ toastInfos.length = 0;
+ consoleErrorSpy?.mockRestore();
+ consoleErrorSpy = undefined;
+ });
+
+ test('an unavailable writer reports the loading wait as information', async () => {
+ await loadHooks();
+ const patches: unknown[] = [];
+ projectLocalBinding = {
+ patch: (patch: unknown) => {
+ patches.push(patch);
+ return { ok: true };
+ },
+ };
+ projectLocalSynced = false;
+ render(<BadgeControlsProbe mode="full" />);
+
+ await act(async () => {
+ latestBadgeControls?.onModeSelect('off');
+ latestBadgeControls?.onModeSelect('off');
+ });
+
+ expect(patches).toEqual([]);
+ expectRepeatedSyncSettingsNotReadyInfo();
+ });
+
+ test('an actual patch failure remains an error', async () => {
+ await loadHooks();
+ consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
+ projectLocalBinding = {
+ patch: () => ({ ok: false, error: { code: 'WRITE_ERROR', detail: 'disk denied' } }),
+ };
+ projectLocalSynced = true;
+ render(<BadgeControlsProbe mode="full" />);
+
+ await act(async () => {
+ latestBadgeControls?.onModeSelect('off');
+ });
+
+ expect(toastErrors).toEqual([
+ 'Failed to update sync — Failed to write config file: disk denied',
+ ]);
+ expect(toastInfos).toEqual([]);
});
});
diff --git a/packages/app/src/hooks/use-enable-sync-with-confirm.ts b/packages/app/src/hooks/use-enable-sync-with-confirm.ts
index 031fda767..2f4a7e796 100644
--- a/packages/app/src/hooks/use-enable-sync-with-confirm.ts
+++ b/packages/app/src/hooks/use-enable-sync-with-confirm.ts
@@ -14,8 +14,8 @@ import { useConfigContext } from '@/lib/config-provider';
type SyncEnabledWriter = (enabled: boolean) => { ok: true } | { ok: false; error: string };
export function useSyncEnabledWriter(): SyncEnabledWriter | null {
- const { projectLocalBinding } = useConfigContext();
- if (projectLocalBinding === null) return null;
+ const { projectLocalBinding, projectLocalSynced } = useConfigContext();
+ if (projectLocalBinding === null || !projectLocalSynced) return null;
return (enabled: boolean) => {
const mode: SyncMode = enabled ? 'full' : 'off';
const result = projectLocalBinding.patch({ autoSync: { mode, enabled } });
@@ -26,8 +26,8 @@ export function useSyncEnabledWriter(): SyncEnabledWriter | null {
type SyncModeWriter = (mode: SyncMode) => { ok: true } | { ok: false; error: string };
export function useSyncModeWriter(): SyncModeWriter | null {
- const { projectLocalBinding } = useConfigContext();
- if (projectLocalBinding === null) return null;
+ const { projectLocalBinding, projectLocalSynced } = useConfigContext();
+ if (projectLocalBinding === null || !projectLocalSynced) return null;
return (mode: SyncMode) => {
const result = projectLocalBinding.patch({ autoSync: { mode, enabled: null } });
return result.ok ? { ok: true } : { ok: false, error: humanFormat(result.error) };
@@ -39,8 +39,8 @@ type SyncDefaultWriter = (
) => { ok: true } | { ok: false; error: string };
export function useSyncDefaultWriter(): SyncDefaultWriter | null {
- const { projectBinding } = useConfigContext();
- if (projectBinding === null) return null;
+ const { projectBinding, projectSynced } = useConfigContext();
+ if (projectBinding === null || !projectSynced) return null;
return (next: boolean | SyncMode | null) => {
const result = projectBinding.patch({ autoSync: { default: next } });
return result.ok ? { ok: true } : { ok: false, error: humanFormat(result.error) };
@@ -53,8 +53,8 @@ type SyncIntervalWriter = (next: {
}) => { ok: true } | { ok: false; error: string };
export function useSyncIntervalWriter(): SyncIntervalWriter | null {
- const { projectLocalBinding } = useConfigContext();
- if (projectLocalBinding === null) return null;
+ const { projectLocalBinding, projectLocalSynced } = useConfigContext();
+ if (projectLocalBinding === null || !projectLocalSynced) return null;
return (next) => {
const result = projectLocalBinding.patch({ autoSync: next });
return result.ok ? { ok: true } : { ok: false, error: humanFormat(result.error) };
@@ -77,7 +77,9 @@ export function useEnableSyncWithConfirm(
function applyEnabled(next: boolean): boolean {
if (writer === null) {
- toast.error(t`Sync settings not yet loaded — try again in a moment`);
+ toast.info(t`Sync settings not yet loaded — try again in a moment`, {
+ id: 'sync-settings-not-ready',
+ });
return false;
}
const result = writer(next);
@@ -132,7 +134,9 @@ export function useSyncModeSelection(
function applyMode(next: SyncMode): boolean {
if (writer === null) {
- toast.error(t`Sync settings not yet loaded — try again in a moment`);
+ toast.info(t`Sync settings not yet loaded — try again in a moment`, {
+ id: 'sync-settings-not-ready',
+ });
return false;
}
const result = writer(next);
@@ -170,8 +174,8 @@ type AutoSyncPatch = { mode?: SyncMode; enabled?: null; resumeMode?: SyncActiveM
type AutoSyncPatchWriter = (patch: AutoSyncPatch) => { ok: true } | { ok: false; error: string };
export function useAutoSyncPatchWriter(): AutoSyncPatchWriter | null {
- const { projectLocalBinding } = useConfigContext();
- if (projectLocalBinding === null) return null;
+ const { projectLocalBinding, projectLocalSynced } = useConfigContext();
+ if (projectLocalBinding === null || !projectLocalSynced) return null;
return (patch: AutoSyncPatch) => {
const result = projectLocalBinding.patch({ autoSync: patch });
return result.ok ? { ok: true } : { ok: false, error: humanFormat(result.error) };
@@ -207,7 +211,9 @@ export function useBadgeSyncControls(
function apply(patch: AutoSyncPatch): boolean {
if (writer === null) {
- toast.error(t`Sync settings not yet loaded — try again in a moment`);
+ toast.info(t`Sync settings not yet loaded — try again in a moment`, {
+ id: 'sync-settings-not-ready',
+ });
return false;
}
const result = writer(patch);
diff --git a/packages/app/src/hooks/use-terminal-enabled.dom.test.tsx b/packages/app/src/hooks/use-terminal-enabled.dom.test.tsx
index b722afc77..8cc0c1978 100644
--- a/packages/app/src/hooks/use-terminal-enabled.dom.test.tsx
+++ b/packages/app/src/hooks/use-terminal-enabled.dom.test.tsx
@@ -116,9 +116,17 @@ describe('useTerminalEnabledWriter', () => {
expect(captured?.writer).toBeNull();
});
- test('grant patches terminal.enabled true on the project-local binding', () => {
+ test('is null while a replacement project-local binding awaits its first sync', () => {
const { binding, patches } = makeFakeBinding({ ok: true });
- renderWith({ ...emptyContext, projectLocalBinding: binding });
+ renderWith({ ...emptyContext, projectLocalBinding: binding, projectLocalSynced: false });
+
+ expect(captured?.writer).toBeNull();
+ expect(patches).toEqual([]);
+ });
+
+ test('after first sync, grant patches terminal.enabled true on the project-local binding', () => {
+ const { binding, patches } = makeFakeBinding({ ok: true });
+ renderWith({ ...emptyContext, projectLocalBinding: binding, projectLocalSynced: true });
const result = captured?.writer?.(true);
expect(result).toEqual({ ok: true });
@@ -127,7 +135,7 @@ describe('useTerminalEnabledWriter', () => {
test('revoke patches terminal.enabled false on the project-local binding', () => {
const { binding, patches } = makeFakeBinding({ ok: true });
- renderWith({ ...emptyContext, projectLocalBinding: binding });
+ renderWith({ ...emptyContext, projectLocalBinding: binding, projectLocalSynced: true });
const result = captured?.writer?.(false);
expect(result).toEqual({ ok: true });
@@ -139,7 +147,7 @@ describe('useTerminalEnabledWriter', () => {
ok: false,
error: { code: 'WRITE_ERROR', detail: 'disk full' },
});
- renderWith({ ...emptyContext, projectLocalBinding: binding });
+ renderWith({ ...emptyContext, projectLocalBinding: binding, projectLocalSynced: true });
const result = captured?.writer?.(true);
expect(result?.ok).toBe(false);
@@ -148,7 +156,7 @@ describe('useTerminalEnabledWriter', () => {
test('a successful grant records the shell-consent-granted event once', () => {
const { binding } = makeFakeBinding({ ok: true });
- renderWith({ ...emptyContext, projectLocalBinding: binding });
+ renderWith({ ...emptyContext, projectLocalBinding: binding, projectLocalSynced: true });
captured?.writer?.(true);
expect(consentGrants).toHaveLength(1);
@@ -156,7 +164,7 @@ describe('useTerminalEnabledWriter', () => {
test('a revoke does not record a consent grant', () => {
const { binding } = makeFakeBinding({ ok: true });
- renderWith({ ...emptyContext, projectLocalBinding: binding });
+ renderWith({ ...emptyContext, projectLocalBinding: binding, projectLocalSynced: true });
captured?.writer?.(false);
expect(consentGrants).toEqual([]);
@@ -167,7 +175,7 @@ describe('useTerminalEnabledWriter', () => {
ok: false,
error: { code: 'WRITE_ERROR', detail: 'disk full' },
});
- renderWith({ ...emptyContext, projectLocalBinding: binding });
+ renderWith({ ...emptyContext, projectLocalBinding: binding, projectLocalSynced: true });
captured?.writer?.(true);
expect(consentGrants).toEqual([]);
diff --git a/packages/app/src/hooks/use-terminal-enabled.ts b/packages/app/src/hooks/use-terminal-enabled.ts
index 6925bcb24..bc5474177 100644
--- a/packages/app/src/hooks/use-terminal-enabled.ts
+++ b/packages/app/src/hooks/use-terminal-enabled.ts
@@ -20,8 +20,8 @@ export function useTerminalConsentState(): TerminalConsentState {
}
export function useTerminalEnabledWriter(): TerminalEnabledWriter | null {
- const { projectLocalBinding } = useConfigContext();
- if (projectLocalBinding === null) return null;
+ const { projectLocalBinding, projectLocalSynced } = useConfigContext();
+ if (projectLocalBinding === null || !projectLocalSynced) return null;
return (enabled: boolean) => {
const result = projectLocalBinding.patch({ terminal: { enabled } });
if (result.ok && enabled) recordShellConsentGranted();
diff --git a/packages/app/src/lib/config-context.ts b/packages/app/src/lib/config-context.ts
index 42e697358..3e2b45707 100644
--- a/packages/app/src/lib/config-context.ts
+++ b/packages/app/src/lib/config-context.ts
@@ -1,4 +1,5 @@
import type { Config, ConfigBinding, OkignoreBinding } from '@inkeep/open-knowledge-core';
+import { useLingui } from '@lingui/react/macro';
import { createContext, use } from 'react';
export interface ConfigContextValue {
@@ -29,3 +30,8 @@ export function useConfigContext(): ConfigContextValue {
export function useConfigContextOptional(): ConfigContextValue | null {
return use(ConfigContext);
}
+
+export function useSettingsLoadingReason(): string {
+ const { t } = useLingui();
+ return t`Settings are still loading. Try again in a moment.`;
+}
diff --git a/packages/app/src/locales/ar/messages.json b/packages/app/src/locales/ar/messages.json
index 8758126a6..69e6a3d82 100644
--- a/packages/app/src/locales/ar/messages.json
+++ b/packages/app/src/locales/ar/messages.json
@@ -199,6 +199,7 @@
"حدّد مكوّنات الكتل وكتل المصدر الاحتياطية أو ادخلها أو غادرها من حدود لوحة المفاتيح."
],
"0t0bbC": ["تعذّر حفظ تفضيل المزامنة: ", ["detail"]],
+ "0tV-rz": ["لا تزال الإعدادات قيد التحميل. أعد المحاولة بعد قليل."],
"0uTHCg": ["ابدأ مشروع OpenKnowledge جديدًا."],
"0wkh7o": ["سجلات OpenKnowledge، بما في ذلك النشاط عبر المشاريع."],
"0wswKc": ["خط أفقي يفصل بين الأقسام."],
@@ -5492,6 +5493,11 @@
"seeS6l": ["هل تعدّ OpenKnowledge في هذا المجلد؟"],
"sgmRY8": ["تم تخطي تنزيل ", ["0"], "."],
"shNd9t": ["قائمة أوامر الشرطة المائلة"],
+ "shRu04": [
+ "تم نقل ",
+ ["name"],
+ "، لكن لم ينتقل التثبيت معه. أعد تثبيته بعد اكتمال تحميل الإعدادات."
+ ],
"skf5Ix": ["زد أو قلّل إزاحة أسطر محرر المصدر."],
"skvOCc": ["الملف موجود في ", ["trashNoun"], "؛ سيقوم مراقب الملفات بالمطابقة."],
"sn5BEU": [
diff --git a/packages/app/src/locales/ar/messages.po b/packages/app/src/locales/ar/messages.po
index 273d4cad2..d5599a2da 100644
--- a/packages/app/src/locales/ar/messages.po
+++ b/packages/app/src/locales/ar/messages.po
@@ -940,6 +940,10 @@ msgstr "{name} ليس له مسار يمكن تحديده — لا يستطيع
msgid "{name} is outside the workspace. Move it into your project first."
msgstr "{name} خارج مساحة العمل. انقله إلى مشروعك أولًا."
+#: src/components/SkillsSidebarSection.tsx
+msgid "{name} moved, but its pin did not. Pin it again after settings finish loading."
+msgstr "تم نقل {name}، لكن لم ينتقل التثبيت معه. أعد تثبيته بعد اكتمال تحميل الإعدادات."
+
#: src/components/GraphPanel.tsx
msgid "{nodeCount, plural, one {# node} other {# nodes}}"
msgstr "{nodeCount, plural, zero {# عقدة} one {عقدة واحدة} two {عقدتان} few {# عقد} many {# عقدةً} other {# عقدة}}"
@@ -12565,6 +12569,10 @@ msgstr "الإعدادات"
msgid "Settings and integrations were cleaned up."
msgstr "تمت إزالة الإعدادات والتكاملات."
+#: src/lib/config-context.ts
+msgid "Settings are still loading. Try again in a moment."
+msgstr "لا تزال الإعدادات قيد التحميل. أعد المحاولة بعد قليل."
+
#: src/components/settings/SettingsDialogShell.tsx
msgid "Settings content"
msgstr "محتوى الإعدادات"
diff --git a/packages/app/src/locales/bn/messages.json b/packages/app/src/locales/bn/messages.json
index 3eb82600e..65d2a2f4a 100644
--- a/packages/app/src/locales/bn/messages.json
+++ b/packages/app/src/locales/bn/messages.json
@@ -141,6 +141,7 @@
"কীবোর্ডের সীমানা থেকে ব্লক কম্পোনেন্ট ও ফলব্যাক সোর্স ব্লক নির্বাচন করুন, তাতে ঢুকুন, বা বেরিয়ে আসুন।"
],
"0t0bbC": ["সিঙ্ক পছন্দ সংরক্ষণ করা যায়নি: ", ["detail"]],
+ "0tV-rz": ["সেটিংস এখনও লোড হচ্ছে। একটু পরে আবার চেষ্টা করুন।"],
"0uTHCg": ["একটি নতুন OpenKnowledge প্রকল্প শুরু করুন।"],
"0wkh7o": ["OpenKnowledge লগ, যাতে বিভিন্ন প্রজেক্টের কার্যকলাপ অন্তর্ভুক্ত থাকে।"],
"0wswKc": ["বিভাগ ভাগ করে দেওয়া অনুভূমিক রেখা।"],
@@ -4669,6 +4670,7 @@
"seeS6l": ["এই ফোল্ডারে OpenKnowledge সেট আপ করবেন?"],
"sgmRY8": [["0"], " ডাউনলোড এড়িয়ে যাওয়া হয়েছে।"],
"shNd9t": ["স্ল্যাশ কমান্ড মেনু"],
+ "shRu04": [["name"], " সরানো হয়েছে, কিন্তু এর পিন সরেনি। সেটিংস লোড হওয়া শেষ হলে আবার পিন করুন।"],
"skf5Ix": ["সোর্স সম্পাদকের লাইনগুলো ভেতরে বা বাইরে নিন।"],
"skvOCc": ["ফাইলটি আপনার ", ["trashNoun"], "-এ আছে; ফাইল-ওয়াচার মিলিয়ে নেবে।"],
"sn5BEU": [
diff --git a/packages/app/src/locales/bn/messages.po b/packages/app/src/locales/bn/messages.po
index cdd4938f6..b29b4776c 100644
--- a/packages/app/src/locales/bn/messages.po
+++ b/packages/app/src/locales/bn/messages.po
@@ -940,6 +940,10 @@ msgstr "{name}-এর কোনো সমাধানযোগ্য পাথ
msgid "{name} is outside the workspace. Move it into your project first."
msgstr "{name} ওয়ার্কস্পেসের বাইরে আছে। আগে এটি আপনার প্রকল্পে সরান।"
+#: src/components/SkillsSidebarSection.tsx
+msgid "{name} moved, but its pin did not. Pin it again after settings finish loading."
+msgstr "{name} সরানো হয়েছে, কিন্তু এর পিন সরেনি। সেটিংস লোড হওয়া শেষ হলে আবার পিন করুন।"
+
#: src/components/GraphPanel.tsx
msgid "{nodeCount, plural, one {# node} other {# nodes}}"
msgstr "{nodeCount, plural, one {# নোড} other {# নোড}}"
@@ -12561,6 +12565,10 @@ msgstr "সেটিং"
msgid "Settings and integrations were cleaned up."
msgstr "সেটিংস এবং ইন্টিগ্রেশন সরানো হয়েছে।"
+#: src/lib/config-context.ts
+msgid "Settings are still loading. Try again in a moment."
+msgstr "সেটিংস এখনও লোড হচ্ছে। একটু পরে আবার চেষ্টা করুন।"
+
#: src/components/settings/SettingsDialogShell.tsx
msgid "Settings content"
msgstr "সেটিং-এর বিষয়বস্তু"
diff --git a/packages/app/src/locales/en/messages.json b/packages/app/src/locales/en/messages.json
index e00fe9c3b..dd27d1e39 100644
--- a/packages/app/src/locales/en/messages.json
+++ b/packages/app/src/locales/en/messages.json
@@ -145,6 +145,7 @@
"Select, enter, or leave block components and fallback source blocks from keyboard boundaries."
],
"0t0bbC": ["Could not save sync preference: ", ["detail"]],
+ "0tV-rz": ["Settings are still loading. Try again in a moment."],
"0uTHCg": ["Start a new OpenKnowledge project."],
"0wkh7o": ["OpenKnowledge logs, including activity across projects."],
"0wswKc": ["Horizontal rule that divides sections."],
@@ -4836,6 +4837,10 @@
"seeS6l": ["Setup OpenKnowledge in this folder?"],
"sgmRY8": ["Skipped downloading ", ["0"], "."],
"shNd9t": ["Slash command menu"],
+ "shRu04": [
+ ["name"],
+ " moved, but its pin did not. Pin it again after settings finish loading."
+ ],
"skf5Ix": ["Indent or outdent source editor lines."],
"skvOCc": ["The file is in your ", ["trashNoun"], "; the file-watcher will reconcile."],
"sn5BEU": [
diff --git a/packages/app/src/locales/en/messages.po b/packages/app/src/locales/en/messages.po
index 69e8eba2e..ecde63b94 100644
--- a/packages/app/src/locales/en/messages.po
+++ b/packages/app/src/locales/en/messages.po
@@ -940,6 +940,10 @@ msgstr "{name} has no resolvable path — the agent can only read files inside t
msgid "{name} is outside the workspace. Move it into your project first."
msgstr "{name} is outside the workspace. Move it into your project first."
+#: src/components/SkillsSidebarSection.tsx
+msgid "{name} moved, but its pin did not. Pin it again after settings finish loading."
+msgstr "{name} moved, but its pin did not. Pin it again after settings finish loading."
+
#: src/components/GraphPanel.tsx
msgid "{nodeCount, plural, one {# node} other {# nodes}}"
msgstr "{nodeCount, plural, one {# node} other {# nodes}}"
@@ -12565,6 +12569,10 @@ msgstr "Settings"
msgid "Settings and integrations were cleaned up."
msgstr "Settings and integrations were cleaned up."
+#: src/lib/config-context.ts
+msgid "Settings are still loading. Try again in a moment."
+msgstr "Settings are still loading. Try again in a moment."
+
#: src/components/settings/SettingsDialogShell.tsx
msgid "Settings content"
msgstr "Settings content"
diff --git a/packages/app/src/locales/es/messages.json b/packages/app/src/locales/es/messages.json
index 40ed1492f..d7c93e429 100644
--- a/packages/app/src/locales/es/messages.json
+++ b/packages/app/src/locales/es/messages.json
@@ -175,6 +175,7 @@
"Selecciona, entra o sale de componentes de bloque y bloques de código alternativos desde los límites del teclado."
],
"0t0bbC": ["No se pudo guardar la preferencia de sincronización: ", ["detail"]],
+ "0tV-rz": ["Los ajustes todavía se están cargando. Inténtalo de nuevo en un momento."],
"0uTHCg": ["Empieza un proyecto de OpenKnowledge."],
"0wkh7o": ["Registros de OpenKnowledge, incluida actividad de varios proyectos."],
"0wswKc": ["Línea horizontal que separa secciones."],
@@ -5572,6 +5573,11 @@
"seeS6l": ["¿Configurar OpenKnowledge en esta carpeta?"],
"sgmRY8": ["Se omitió la descarga de ", ["0"], "."],
"shNd9t": ["Menú de comandos de barra"],
+ "shRu04": [
+ "Se movió ",
+ ["name"],
+ ", pero su fijación no. Vuelve a fijarlo cuando terminen de cargarse los ajustes."
+ ],
"skf5Ix": ["Aumenta o reduce la sangría de las líneas del editor de código."],
"skvOCc": [
"El archivo está en tu ",
diff --git a/packages/app/src/locales/es/messages.po b/packages/app/src/locales/es/messages.po
index 07ab4f296..4792fe24a 100644
--- a/packages/app/src/locales/es/messages.po
+++ b/packages/app/src/locales/es/messages.po
@@ -940,6 +940,10 @@ msgstr "{name} no tiene una ruta resoluble — el agente solo puede leer archivo
msgid "{name} is outside the workspace. Move it into your project first."
msgstr "{name} está fuera del espacio de trabajo. Muévelo primero a tu proyecto."
+#: src/components/SkillsSidebarSection.tsx
+msgid "{name} moved, but its pin did not. Pin it again after settings finish loading."
+msgstr "Se movió {name}, pero su fijación no. Vuelve a fijarlo cuando terminen de cargarse los ajustes."
+
#: src/components/GraphPanel.tsx
msgid "{nodeCount, plural, one {# node} other {# nodes}}"
msgstr "{nodeCount, plural, one {# nodo} many {# nodos} other {# nodos}}"
@@ -12565,6 +12569,10 @@ msgstr "Ajustes"
msgid "Settings and integrations were cleaned up."
msgstr "Se eliminaron los ajustes y las integraciones."
+#: src/lib/config-context.ts
+msgid "Settings are still loading. Try again in a moment."
+msgstr "Los ajustes todavía se están cargando. Inténtalo de nuevo en un momento."
+
#: src/components/settings/SettingsDialogShell.tsx
msgid "Settings content"
msgstr "Contenido de los ajustes"
diff --git a/packages/app/src/locales/fr/messages.json b/packages/app/src/locales/fr/messages.json
index de3f40a1a..d54d7cb6c 100644
--- a/packages/app/src/locales/fr/messages.json
+++ b/packages/app/src/locales/fr/messages.json
@@ -177,6 +177,7 @@
"Sélectionnez, entrez dans ou quittez les composants de bloc et les blocs source de repli depuis les limites clavier."
],
"0t0bbC": ["Impossible d'enregistrer la préférence de synchronisation : ", ["detail"]],
+ "0tV-rz": ["Les paramètres sont toujours en cours de chargement. Réessayez dans un instant."],
"0uTHCg": ["Démarrez un nouveau projet OpenKnowledge."],
"0wkh7o": ["Journaux OpenKnowledge, y compris l’activité de plusieurs projets."],
"0wswKc": ["Filet horizontal qui sépare les sections."],
@@ -5639,6 +5640,10 @@
"seeS6l": ["Configurer OpenKnowledge dans ce dossier ?"],
"sgmRY8": ["Téléchargement de ", ["0"], " ignoré."],
"shNd9t": ["Menu des commandes slash"],
+ "shRu04": [
+ ["name"],
+ " a été déplacé, mais pas son épingle. Épinglez-le de nouveau une fois les paramètres chargés."
+ ],
"skf5Ix": ["Augmente ou réduit le retrait des lignes de l'éditeur de source."],
"skvOCc": [
"Le fichier est dans votre ",
diff --git a/packages/app/src/locales/fr/messages.po b/packages/app/src/locales/fr/messages.po
index 394d122cb..6928805b4 100644
--- a/packages/app/src/locales/fr/messages.po
+++ b/packages/app/src/locales/fr/messages.po
@@ -940,6 +940,10 @@ msgstr "{name} n'a pas de chemin résoluble — l'agent ne peut lire que les fic
msgid "{name} is outside the workspace. Move it into your project first."
msgstr "{name} se trouve hors de l'espace de travail. Déplacez-le d'abord dans votre projet."
+#: src/components/SkillsSidebarSection.tsx
+msgid "{name} moved, but its pin did not. Pin it again after settings finish loading."
+msgstr "{name} a été déplacé, mais pas son épingle. Épinglez-le de nouveau une fois les paramètres chargés."
+
#: src/components/GraphPanel.tsx
msgid "{nodeCount, plural, one {# node} other {# nodes}}"
msgstr "{nodeCount, plural, one {# nœud} many {# nœuds} other {# nœuds}}"
@@ -12565,6 +12569,10 @@ msgstr "Paramètres"
msgid "Settings and integrations were cleaned up."
msgstr "Les réglages et les intégrations ont été supprimés."
+#: src/lib/config-context.ts
+msgid "Settings are still loading. Try again in a moment."
+msgstr "Les paramètres sont toujours en cours de chargement. Réessayez dans un instant."
+
#: src/components/settings/SettingsDialogShell.tsx
msgid "Settings content"
msgstr "Contenu des paramètres"
diff --git a/packages/app/src/locales/hi/messages.json b/packages/app/src/locales/hi/messages.json
index e025af0de..7524daea9 100644
--- a/packages/app/src/locales/hi/messages.json
+++ b/packages/app/src/locales/hi/messages.json
@@ -143,6 +143,7 @@
"0rwwOn": ["टैग के अनुसार"],
"0s8-e8": ["कीबोर्ड सीमाओं से ब्लॉक कंपोनेंट और फ़ॉलबैक स्रोत ब्लॉक चुनें, उनमें जाएँ, या उनसे बाहर आएँ।"],
"0t0bbC": ["सिंक वरीयता नहीं सहेजी जा सकी: ", ["detail"]],
+ "0tV-rz": ["सेटिंग अभी भी लोड हो रही हैं। कुछ देर बाद फिर कोशिश करें।"],
"0uTHCg": ["एक नया OpenKnowledge प्रोजेक्ट शुरू करें।"],
"0wkh7o": ["OpenKnowledge लॉग, जिनमें अलग-अलग प्रोजेक्ट की गतिविधि शामिल है।"],
"0wswKc": ["अनुभागों को विभाजित करने वाली क्षैतिज रेखा।"],
@@ -4655,6 +4656,10 @@
"seeS6l": ["इस फ़ोल्डर में OpenKnowledge सेट अप करें?"],
"sgmRY8": [["0"], " डाउनलोड करना छोड़ दिया गया।"],
"shNd9t": ["स्लैश कमांड मेन्यू"],
+ "shRu04": [
+ ["name"],
+ " को स्थानांतरित कर दिया गया, लेकिन उसका पिन साथ नहीं गया। सेटिंग लोड होने के बाद उसे फिर से पिन करें।"
+ ],
"skf5Ix": ["स्रोत संपादक की पंक्तियों को अंदर या बाहर करें।"],
"skvOCc": ["फ़ाइल आपके ", ["trashNoun"], " में है; फ़ाइल-वॉचर इसे मिला देगा।"],
"sn5BEU": [
diff --git a/packages/app/src/locales/hi/messages.po b/packages/app/src/locales/hi/messages.po
index 759d8953b..e929fe649 100644
--- a/packages/app/src/locales/hi/messages.po
+++ b/packages/app/src/locales/hi/messages.po
@@ -940,6 +940,10 @@ msgstr "{name} का कोई हल करने योग्य पथ न
msgid "{name} is outside the workspace. Move it into your project first."
msgstr "{name} कार्यक्षेत्र के बाहर है। पहले इसे अपने प्रोजेक्ट में ले जाएँ।"
+#: src/components/SkillsSidebarSection.tsx
+msgid "{name} moved, but its pin did not. Pin it again after settings finish loading."
+msgstr "{name} को स्थानांतरित कर दिया गया, लेकिन उसका पिन साथ नहीं गया। सेटिंग लोड होने के बाद उसे फिर से पिन करें।"
+
#: src/components/GraphPanel.tsx
msgid "{nodeCount, plural, one {# node} other {# nodes}}"
msgstr "{nodeCount, plural, one {# नोड} other {# नोड}}"
@@ -12561,6 +12565,10 @@ msgstr "सेटिंग"
msgid "Settings and integrations were cleaned up."
msgstr "सेटिंग और इंटीग्रेशन हटा दिए गए।"
+#: src/lib/config-context.ts
+msgid "Settings are still loading. Try again in a moment."
+msgstr "सेटिंग अभी भी लोड हो रही हैं। कुछ देर बाद फिर कोशिश करें।"
+
#: src/components/settings/SettingsDialogShell.tsx
msgid "Settings content"
msgstr "सेटिंग सामग्री"
diff --git a/packages/app/src/locales/id/messages.json b/packages/app/src/locales/id/messages.json
index 63c69f980..9cbab0833 100644
--- a/packages/app/src/locales/id/messages.json
+++ b/packages/app/src/locales/id/messages.json
@@ -143,6 +143,7 @@
"Memilih, masuk, atau keluar dari komponen blok dan blok sumber cadangan dari batas papan ketik."
],
"0t0bbC": ["Preferensi sinkronisasi tidak dapat disimpan: ", ["detail"]],
+ "0tV-rz": ["Pengaturan masih dimuat. Coba lagi sebentar."],
"0uTHCg": ["Mulai proyek OpenKnowledge baru."],
"0wkh7o": ["Log OpenKnowledge, termasuk aktivitas lintas proyek."],
"0wswKc": ["Garis mendatar yang memisahkan bagian."],
@@ -4857,6 +4858,10 @@
"seeS6l": ["Siapkan OpenKnowledge di folder ini?"],
"sgmRY8": ["Unduhan ", ["0"], " dilewati."],
"shNd9t": ["Menu perintah garis miring"],
+ "shRu04": [
+ ["name"],
+ " telah dipindahkan, tetapi sematannya tidak ikut berpindah. Sematkan lagi setelah pengaturan selesai dimuat."
+ ],
"skf5Ix": ["Menambah atau mengurangi indentasi baris penyunting sumber."],
"skvOCc": ["Berkas ada di ", ["trashNoun"], " Anda; pengawas berkas akan menyelaraskannya."],
"sn5BEU": [
diff --git a/packages/app/src/locales/id/messages.po b/packages/app/src/locales/id/messages.po
index b7be4df7f..93c332d5b 100644
--- a/packages/app/src/locales/id/messages.po
+++ b/packages/app/src/locales/id/messages.po
@@ -940,6 +940,10 @@ msgstr "{name} tidak memiliki jalur yang dapat diuraikan — agen hanya bisa mem
msgid "{name} is outside the workspace. Move it into your project first."
msgstr "{name} berada di luar ruang kerja. Pindahkan dulu ke proyek Anda."
+#: src/components/SkillsSidebarSection.tsx
+msgid "{name} moved, but its pin did not. Pin it again after settings finish loading."
+msgstr "{name} telah dipindahkan, tetapi sematannya tidak ikut berpindah. Sematkan lagi setelah pengaturan selesai dimuat."
+
#: src/components/GraphPanel.tsx
msgid "{nodeCount, plural, one {# node} other {# nodes}}"
msgstr "{nodeCount, plural, other {# simpul}}"
@@ -12561,6 +12565,10 @@ msgstr "Pengaturan"
msgid "Settings and integrations were cleaned up."
msgstr "Pengaturan dan integrasi telah dihapus."
+#: src/lib/config-context.ts
+msgid "Settings are still loading. Try again in a moment."
+msgstr "Pengaturan masih dimuat. Coba lagi sebentar."
+
#: src/components/settings/SettingsDialogShell.tsx
msgid "Settings content"
msgstr "Isi pengaturan"
diff --git a/packages/app/src/locales/ko/messages.json b/packages/app/src/locales/ko/messages.json
index 8f5604700..57ea6b58b 100644
--- a/packages/app/src/locales/ko/messages.json
+++ b/packages/app/src/locales/ko/messages.json
@@ -135,6 +135,7 @@
"0rwwOn": ["태그순"],
"0s8-e8": ["블록 경계에서 블록 구성 요소와 대체 소스 블록을 선택, 입력 또는 빠져나갑니다."],
"0t0bbC": ["동기화 환경설정을 저장할 수 없습니다: ", ["detail"]],
+ "0tV-rz": ["설정을 아직 불러오는 중입니다. 잠시 후 다시 시도하세요."],
"0uTHCg": ["새 OpenKnowledge 프로젝트를 시작합니다."],
"0wkh7o": ["여러 프로젝트의 활동을 포함한 OpenKnowledge 로그입니다."],
"0wswKc": ["섹션을 나누는 가로줄입니다."],
@@ -4640,6 +4641,10 @@
"seeS6l": ["이 폴더에 OpenKnowledge를 설정하시겠습니까?"],
"sgmRY8": [["0"], " 다운로드 건너뜀."],
"shNd9t": ["슬래시 명령 메뉴"],
+ "shRu04": [
+ ["name"],
+ "은(는) 이동했지만 고정 상태는 함께 이동하지 않았습니다. 설정을 모두 불러온 후 다시 고정하세요."
+ ],
"skf5Ix": ["현재 소스 편집기 줄의 들여쓰기 또는 내어쓰기를 조정합니다."],
"skvOCc": ["파일이 ", ["trashNoun"], "에 있습니다. 파일 감시자가 상태를 조정합니다."],
"sn5BEU": [
diff --git a/packages/app/src/locales/ko/messages.po b/packages/app/src/locales/ko/messages.po
index 5885dc6b6..750fd7acc 100644
--- a/packages/app/src/locales/ko/messages.po
+++ b/packages/app/src/locales/ko/messages.po
@@ -940,6 +940,10 @@ msgstr "{name}의 경로를 확인할 수 없습니다. 에이전트는 워크
msgid "{name} is outside the workspace. Move it into your project first."
msgstr "{name}이(가) 워크스페이스 밖에 있습니다. 먼저 프로젝트 안으로 옮기세요."
+#: src/components/SkillsSidebarSection.tsx
+msgid "{name} moved, but its pin did not. Pin it again after settings finish loading."
+msgstr "{name}은(는) 이동했지만 고정 상태는 함께 이동하지 않았습니다. 설정을 모두 불러온 후 다시 고정하세요."
+
#: src/components/GraphPanel.tsx
msgid "{nodeCount, plural, one {# node} other {# nodes}}"
msgstr "{nodeCount, plural, other {노드 #개}}"
@@ -12565,6 +12569,10 @@ msgstr "설정"
msgid "Settings and integrations were cleaned up."
msgstr "설정과 연동을 정리했습니다."
+#: src/lib/config-context.ts
+msgid "Settings are still loading. Try again in a moment."
+msgstr "설정을 아직 불러오는 중입니다. 잠시 후 다시 시도하세요."
+
#: src/components/settings/SettingsDialogShell.tsx
msgid "Settings content"
msgstr "설정 콘텐츠"
diff --git a/packages/app/src/locales/pseudo/messages.json b/packages/app/src/locales/pseudo/messages.json
index ce1586ce5..82bc4c833 100644
--- a/packages/app/src/locales/pseudo/messages.json
+++ b/packages/app/src/locales/pseudo/messages.json
@@ -145,6 +145,7 @@
"Śēĺēćţ, ēńţēŕ, ōŕ ĺēàvē ƀĺōćķ ćōḿƥōńēńţś àńď ƒàĺĺƀàćķ śōũŕćē ƀĺōćķś ƒŕōḿ ķēŷƀōàŕď ƀōũńďàŕĩēś."
],
"0t0bbC": ["Ćōũĺď ńōţ śàvē śŷńć ƥŕēƒēŕēńćē: ", ["detail"]],
+ "0tV-rz": ["Śēţţĩńĝś àŕē śţĩĺĺ ĺōàďĩńĝ. Ţŕŷ àĝàĩń ĩń à ḿōḿēńţ."],
"0uTHCg": ["Śţàŕţ à ńēŵ ŌƥēńĶńōŵĺēďĝē ƥŕōĴēćţ."],
"0wkh7o": ["ŌƥēńĶńōŵĺēďĝē ĺōĝś, ĩńćĺũďĩńĝ àćţĩvĩţŷ àćŕōśś ƥŕōĴēćţś."],
"0wswKc": ["Ĥōŕĩźōńţàĺ ŕũĺē ţĥàţ ďĩvĩďēś śēćţĩōńś."],
@@ -4836,6 +4837,10 @@
"seeS6l": ["Śēţũƥ ŌƥēńĶńōŵĺēďĝē ĩń ţĥĩś ƒōĺďēŕ?"],
"sgmRY8": ["Śķĩƥƥēď ďōŵńĺōàďĩńĝ ", ["0"], "."],
"shNd9t": ["Śĺàśĥ ćōḿḿàńď ḿēńũ"],
+ "shRu04": [
+ ["name"],
+ " ḿōvēď, ƀũţ ĩţś ƥĩń ďĩď ńōţ. Ƥĩń ĩţ àĝàĩń àƒţēŕ śēţţĩńĝś ƒĩńĩśĥ ĺōàďĩńĝ."
+ ],
"skf5Ix": ["Ĩńďēńţ ōŕ ōũţďēńţ śōũŕćē ēďĩţōŕ ĺĩńēś."],
"skvOCc": ["Ţĥē ƒĩĺē ĩś ĩń ŷōũŕ ", ["trashNoun"], "; ţĥē ƒĩĺē-ŵàţćĥēŕ ŵĩĺĺ ŕēćōńćĩĺē."],
"sn5BEU": [
diff --git a/packages/app/src/locales/pseudo/messages.po b/packages/app/src/locales/pseudo/messages.po
index a18c95875..96c949ceb 100644
--- a/packages/app/src/locales/pseudo/messages.po
+++ b/packages/app/src/locales/pseudo/messages.po
@@ -940,6 +940,10 @@ msgstr ""
msgid "{name} is outside the workspace. Move it into your project first."
msgstr ""
+#: src/components/SkillsSidebarSection.tsx
+msgid "{name} moved, but its pin did not. Pin it again after settings finish loading."
+msgstr ""
+
#: src/components/GraphPanel.tsx
msgid "{nodeCount, plural, one {# node} other {# nodes}}"
msgstr ""
@@ -12561,6 +12565,10 @@ msgstr ""
msgid "Settings and integrations were cleaned up."
msgstr ""
+#: src/lib/config-context.ts
+msgid "Settings are still loading. Try again in a moment."
+msgstr ""
+
#: src/components/settings/SettingsDialogShell.tsx
msgid "Settings content"
msgstr ""
diff --git a/packages/app/src/locales/pt-BR/messages.json b/packages/app/src/locales/pt-BR/messages.json
index 8ea5e57d0..75813dc53 100644
--- a/packages/app/src/locales/pt-BR/messages.json
+++ b/packages/app/src/locales/pt-BR/messages.json
@@ -175,6 +175,7 @@
"Seleciona, entra ou sai de componentes de bloco e blocos de código alternativos a partir dos limites do teclado."
],
"0t0bbC": ["Não foi possível salvar a preferência de sincronização: ", ["detail"]],
+ "0tV-rz": ["As configurações ainda estão carregando. Tente de novo em instantes."],
"0uTHCg": ["Comece um projeto do OpenKnowledge."],
"0wkh7o": ["Logs do OpenKnowledge, incluindo atividade de vários projetos."],
"0wswKc": ["Linha horizontal que separa seções."],
@@ -5472,6 +5473,10 @@
"seeS6l": ["Configurar o OpenKnowledge nesta pasta?"],
"sgmRY8": ["O download de ", ["0"], " foi pulado."],
"shNd9t": ["Menu de comandos de barra"],
+ "shRu04": [
+ ["name"],
+ " foi movido, mas a fixação não foi movida junto. Fixe-o novamente quando as configurações terminarem de carregar."
+ ],
"skf5Ix": ["Aumenta ou diminui o recuo das linhas do editor de código."],
"skvOCc": [
"O arquivo está no seu ",
diff --git a/packages/app/src/locales/pt-BR/messages.po b/packages/app/src/locales/pt-BR/messages.po
index b43e33913..0c2d18127 100644
--- a/packages/app/src/locales/pt-BR/messages.po
+++ b/packages/app/src/locales/pt-BR/messages.po
@@ -940,6 +940,10 @@ msgstr "{name} não tem um caminho resolvível — o agente só consegue ler arq
msgid "{name} is outside the workspace. Move it into your project first."
msgstr "{name} está fora do espaço de trabalho. Mova-o para o seu projeto primeiro."
+#: src/components/SkillsSidebarSection.tsx
+msgid "{name} moved, but its pin did not. Pin it again after settings finish loading."
+msgstr "{name} foi movido, mas a fixação não foi movida junto. Fixe-o novamente quando as configurações terminarem de carregar."
+
#: src/components/GraphPanel.tsx
msgid "{nodeCount, plural, one {# node} other {# nodes}}"
msgstr "{nodeCount, plural, one {# nó} many {# nós} other {# nós}}"
@@ -12561,6 +12565,10 @@ msgstr "Configurações"
msgid "Settings and integrations were cleaned up."
msgstr "As configurações e integrações foram removidas."
+#: src/lib/config-context.ts
+msgid "Settings are still loading. Try again in a moment."
+msgstr "As configurações ainda estão carregando. Tente de novo em instantes."
+
#: src/components/settings/SettingsDialogShell.tsx
msgid "Settings content"
msgstr "Conteúdo das configurações"
diff --git a/packages/app/src/locales/ur/messages.json b/packages/app/src/locales/ur/messages.json
index f14b4b7fc..837c09b80 100644
--- a/packages/app/src/locales/ur/messages.json
+++ b/packages/app/src/locales/ur/messages.json
@@ -143,6 +143,7 @@
"کی بورڈ کی حدود سے بلاک اجزاء اور متبادل سورس بلاکس منتخب کریں، ان میں داخل ہوں یا ان سے نکلیں۔"
],
"0t0bbC": ["مطابقت پذیری کی ترجیح محفوظ نہیں ہو سکی: ", ["detail"]],
+ "0tV-rz": ["ترتیبات ابھی لوڈ ہو رہی ہیں۔ تھوڑی دیر بعد دوبارہ کوشش کریں۔"],
"0uTHCg": ["نیا OpenKnowledge پروجیکٹ شروع کریں۔"],
"0wkh7o": ["OpenKnowledge لاگز، جن میں مختلف پروجیکٹس کی سرگرمی شامل ہے۔"],
"0wswKc": ["افقی لکیر جو سیکشنز کو الگ کرتی ہے۔"],
@@ -4918,6 +4919,10 @@
"seeS6l": ["اس فولڈر میں OpenKnowledge ترتیب دیں؟"],
"sgmRY8": [["0"], " کا ڈاؤن لوڈ چھوڑ دیا گیا۔"],
"shNd9t": ["سلیش کمانڈ کا مینو"],
+ "shRu04": [
+ ["name"],
+ " منتقل ہو گیا، لیکن اس کی پن ساتھ منتقل نہیں ہوئی۔ ترتیبات لوڈ ہونے کے بعد اسے دوبارہ پن کریں۔"
+ ],
"skf5Ix": ["سورس ایڈیٹر کی سطروں کی اندروں یا باہر کی جگہ بدلیں۔"],
"skvOCc": ["فائل آپ کے ", ["trashNoun"], " میں ہے؛ فائل واچر ہم آہنگ کر دے گا۔"],
"sn5BEU": [
diff --git a/packages/app/src/locales/ur/messages.po b/packages/app/src/locales/ur/messages.po
index 24e8a93b0..d30b73dc8 100644
--- a/packages/app/src/locales/ur/messages.po
+++ b/packages/app/src/locales/ur/messages.po
@@ -940,6 +940,10 @@ msgstr "{name} کا کوئی قابلِ حل راستہ نہیں — ایجنٹ
msgid "{name} is outside the workspace. Move it into your project first."
msgstr "{name} ورک اسپیس سے باہر ہے۔ پہلے اسے اپنے پروجیکٹ میں منتقل کریں۔"
+#: src/components/SkillsSidebarSection.tsx
+msgid "{name} moved, but its pin did not. Pin it again after settings finish loading."
+msgstr "{name} منتقل ہو گیا، لیکن اس کی پن ساتھ منتقل نہیں ہوئی۔ ترتیبات لوڈ ہونے کے بعد اسے دوبارہ پن کریں۔"
+
#: src/components/GraphPanel.tsx
msgid "{nodeCount, plural, one {# node} other {# nodes}}"
msgstr "{nodeCount, plural, one {# نوڈ} other {# نوڈز}}"
@@ -12565,6 +12569,10 @@ msgstr "ترتیبات"
msgid "Settings and integrations were cleaned up."
msgstr "ترتیبات اور انضمام ہٹا دیے گئے۔"
+#: src/lib/config-context.ts
+msgid "Settings are still loading. Try again in a moment."
+msgstr "ترتیبات ابھی لوڈ ہو رہی ہیں۔ تھوڑی دیر بعد دوبارہ کوشش کریں۔"
+
#: src/components/settings/SettingsDialogShell.tsx
msgid "Settings content"
msgstr "ترتیبات کا مواد"
diff --git a/packages/app/src/locales/zh-Hans/messages.json b/packages/app/src/locales/zh-Hans/messages.json
index 2f7161a9d..3c0f2caed 100644
--- a/packages/app/src/locales/zh-Hans/messages.json
+++ b/packages/app/src/locales/zh-Hans/messages.json
@@ -132,6 +132,7 @@
"0rwwOn": ["按标签"],
"0s8-e8": ["从键盘边界选中、进入或离开块组件和回退源码块。"],
"0t0bbC": ["无法保存同步偏好:", ["detail"]],
+ "0tV-rz": ["设置仍在加载中。请稍后再试。"],
"0uTHCg": ["开始一个新的 OpenKnowledge 项目。"],
"0wkh7o": ["OpenKnowledge 日志,包括跨项目的活动。"],
"0wswKc": ["用于分隔章节的水平分割线。"],
@@ -4214,6 +4215,7 @@
"seeS6l": ["要在这个文件夹中设置 OpenKnowledge 吗?"],
"sgmRY8": ["已跳过下载 ", ["0"], "。"],
"shNd9t": ["斜杠命令菜单"],
+ "shRu04": [["name"], " 已移动,但置顶状态未随之移动。设置加载完成后,请重新置顶。"],
"skf5Ix": ["增加或减少源码编辑器中各行的缩进。"],
"skvOCc": ["文件已在你的", ["trashNoun"], "中;文件监视器将进行同步。"],
"sn5BEU": [
diff --git a/packages/app/src/locales/zh-Hans/messages.po b/packages/app/src/locales/zh-Hans/messages.po
index 9902cdd56..3dce23b5b 100644
--- a/packages/app/src/locales/zh-Hans/messages.po
+++ b/packages/app/src/locales/zh-Hans/messages.po
@@ -940,6 +940,10 @@ msgstr "{name} 没有可解析的路径 — 智能体只能读取工作区内的
msgid "{name} is outside the workspace. Move it into your project first."
msgstr "{name} 位于工作区之外。请先将它移入你的项目。"
+#: src/components/SkillsSidebarSection.tsx
+msgid "{name} moved, but its pin did not. Pin it again after settings finish loading."
+msgstr "{name} 已移动,但置顶状态未随之移动。设置加载完成后,请重新置顶。"
+
#: src/components/GraphPanel.tsx
msgid "{nodeCount, plural, one {# node} other {# nodes}}"
msgstr "{nodeCount, plural, other {# 个节点}}"
@@ -12565,6 +12569,10 @@ msgstr "设置"
msgid "Settings and integrations were cleaned up."
msgstr "已清理设置和集成。"
+#: src/lib/config-context.ts
+msgid "Settings are still loading. Try again in a moment."
+msgstr "设置仍在加载中。请稍后再试。"
+
#: src/components/settings/SettingsDialogShell.tsx
msgid "Settings content"
msgstr "设置内容"
diff --git a/packages/app/src/locales/zh-Hant/messages.json b/packages/app/src/locales/zh-Hant/messages.json
index 14ee25f46..957ad39db 100644
--- a/packages/app/src/locales/zh-Hant/messages.json
+++ b/packages/app/src/locales/zh-Hant/messages.json
@@ -132,6 +132,7 @@
"0rwwOn": ["依標籤"],
"0s8-e8": ["從鍵盤邊界選取、進入或離開區塊元件和備用的原始碼區塊。"],
"0t0bbC": ["無法儲存同步偏好設定:", ["detail"]],
+ "0tV-rz": ["設定仍在載入中。請稍候再試。"],
"0uTHCg": ["開始一個新的 OpenKnowledge 專案。"],
"0wkh7o": ["OpenKnowledge 紀錄,包括跨專案的活動。"],
"0wswKc": ["用來分隔章節的水平分隔線。"],
@@ -4234,6 +4235,7 @@
"seeS6l": ["要在這個資料夾中設定 OpenKnowledge 嗎?"],
"sgmRY8": ["已略過下載 ", ["0"], "。"],
"shNd9t": ["斜線指令選單"],
+ "shRu04": [["name"], " 已移動,但置頂狀態未隨之移動。設定載入完成後,請重新置頂。"],
"skf5Ix": ["增加或減少原始碼編輯器中各行的縮排。"],
"skvOCc": ["檔案已在你的", ["trashNoun"], "中;檔案監看程式會進行同步。"],
"sn5BEU": [
diff --git a/packages/app/src/locales/zh-Hant/messages.po b/packages/app/src/locales/zh-Hant/messages.po
index 6ef8495fa..0155febef 100644
--- a/packages/app/src/locales/zh-Hant/messages.po
+++ b/packages/app/src/locales/zh-Hant/messages.po
@@ -940,6 +940,10 @@ msgstr "{name} 沒有可解析的路徑 — 智慧代理只能讀取工作區內
msgid "{name} is outside the workspace. Move it into your project first."
msgstr "{name} 位於工作區之外。請先將它移入你的專案。"
+#: src/components/SkillsSidebarSection.tsx
+msgid "{name} moved, but its pin did not. Pin it again after settings finish loading."
+msgstr "{name} 已移動,但置頂狀態未隨之移動。設定載入完成後,請重新置頂。"
+
#: src/components/GraphPanel.tsx
msgid "{nodeCount, plural, one {# node} other {# nodes}}"
msgstr "{nodeCount, plural, other {# 個節點}}"
@@ -12565,6 +12569,10 @@ msgstr "設定"
msgid "Settings and integrations were cleaned up."
msgstr "已清理設定和整合。"
+#: src/lib/config-context.ts
+msgid "Settings are still loading. Try again in a moment."
+msgstr "設定仍在載入中。請稍候再試。"
+
#: src/components/settings/SettingsDialogShell.tsx
msgid "Settings content"
msgstr "設定內容"
diff --git a/packages/app/tests/integration/bug3-source-mode-writeback.test.ts b/packages/app/tests/integration/bug3-source-mode-writeback.test.ts
index a28cc2b18..8a60e5826 100644
--- a/packages/app/tests/integration/bug3-source-mode-writeback.test.ts
+++ b/packages/app/tests/integration/bug3-source-mode-writeback.test.ts
@@ -1,4 +1,3 @@
-
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import { setTimeout as wait } from 'node:timers/promises';
diff --git a/packages/app/tests/integration/indented-jsx-byte-sacred.test.ts b/packages/app/tests/integration/indented-jsx-byte-sacred.test.ts
index 4fc2c11f9..6fcdc23f2 100644
--- a/packages/app/tests/integration/indented-jsx-byte-sacred.test.ts
+++ b/packages/app/tests/integration/indented-jsx-byte-sacred.test.ts
@@ -1,4 +1,3 @@
-
import { setTimeout as wait } from 'node:timers/promises';
import { normalizeBridge } from '@inkeep/open-knowledge-core';
import { updateYFragment } from '@tiptap/y-tiptap';
diff --git a/packages/app/tests/integration/interior-edit-freshness.test.ts b/packages/app/tests/integration/interior-edit-freshness.test.ts
index 9f2f6feb6..40b5cdfd6 100644
--- a/packages/app/tests/integration/interior-edit-freshness.test.ts
+++ b/packages/app/tests/integration/interior-edit-freshness.test.ts
@@ -1,4 +1,3 @@
-
import { setTimeout as wait } from 'node:timers/promises';
import { updateYFragment, yXmlFragmentToProseMirrorRootNode } from '@tiptap/y-tiptap';
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
diff --git a/packages/app/tests/integration/keystroke-cadence-danger-space.test.ts b/packages/app/tests/integration/keystroke-cadence-danger-space.test.ts
index 2a085742b..93666af70 100644
--- a/packages/app/tests/integration/keystroke-cadence-danger-space.test.ts
+++ b/packages/app/tests/integration/keystroke-cadence-danger-space.test.ts
@@ -1,4 +1,3 @@
-
import { setTimeout as wait } from 'node:timers/promises';
import { updateYFragment, yXmlFragmentToProseMirrorRootNode } from '@tiptap/y-tiptap';
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
diff --git a/packages/app/tests/integration/producer-guard-wiring.test.ts b/packages/app/tests/integration/producer-guard-wiring.test.ts
index 878d5196b..867598d34 100644
--- a/packages/app/tests/integration/producer-guard-wiring.test.ts
+++ b/packages/app/tests/integration/producer-guard-wiring.test.ts
@@ -1,4 +1,3 @@
-
import { setTimeout as wait } from 'node:timers/promises';
import { updateYFragment, yXmlFragmentToProseMirrorRootNode } from '@tiptap/y-tiptap';
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
diff --git a/packages/app/tests/integration/qa-039-reconciliation-counters-http.test.ts b/packages/app/tests/integration/qa-039-reconciliation-counters-http.test.ts
index 4ada3cf26..0970ac12f 100644
--- a/packages/app/tests/integration/qa-039-reconciliation-counters-http.test.ts
+++ b/packages/app/tests/integration/qa-039-reconciliation-counters-http.test.ts
@@ -1,4 +1,3 @@
-
import { randomUUID } from 'node:crypto';
import { afterEach, describe, expect, test } from 'vitest';
import { agentWriteMd, createTestServer, type TestServer } from './test-harness';
diff --git a/packages/app/tests/integration/qa-045-restore-after-gc.test.ts b/packages/app/tests/integration/qa-045-restore-after-gc.test.ts
index cbe2b705f..b632185e1 100644
--- a/packages/app/tests/integration/qa-045-restore-after-gc.test.ts
+++ b/packages/app/tests/integration/qa-045-restore-after-gc.test.ts
@@ -1,4 +1,3 @@
-
import { execFileSync } from 'node:child_process';
import { randomUUID } from 'node:crypto';
import { join } from 'node:path';
diff --git a/packages/app/tests/integration/qa-050-rollback-undo-shipped-path.test.ts b/packages/app/tests/integration/qa-050-rollback-undo-shipped-path.test.ts
index 89bc9b4d9..c530ce4ba 100644
--- a/packages/app/tests/integration/qa-050-rollback-undo-shipped-path.test.ts
+++ b/packages/app/tests/integration/qa-050-rollback-undo-shipped-path.test.ts
@@ -1,4 +1,3 @@
-
import { randomUUID } from 'node:crypto';
import { afterAll, afterEach, beforeAll, describe, expect, test } from 'vitest';
import type * as Y from 'yjs';
diff --git a/packages/app/tests/integration/undo-after-rollback.test.ts b/packages/app/tests/integration/undo-after-rollback.test.ts
index a78aeb0e4..d3767adc9 100644
--- a/packages/app/tests/integration/undo-after-rollback.test.ts
+++ b/packages/app/tests/integration/undo-after-rollback.test.ts
@@ -1,4 +1,3 @@
-
import { ROLLBACK_ORIGIN } from '@inkeep/open-knowledge-server';
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
import * as Y from 'yjs';
diff --git a/packages/app/tests/integration/undo-recycle-reset.test.ts b/packages/app/tests/integration/undo-recycle-reset.test.ts
index e7cc69c3f..b076f955c 100644
--- a/packages/app/tests/integration/undo-recycle-reset.test.ts
+++ b/packages/app/tests/integration/undo-recycle-reset.test.ts
@@ -1,4 +1,3 @@
-
import { writeFileSync } from 'node:fs';
import { join } from 'node:path';
import { setTimeout as wait } from 'node:timers/promises';
diff --git a/packages/app/tests/integration/undo-rederive-survival.test.ts b/packages/app/tests/integration/undo-rederive-survival.test.ts
index 9ddcd0730..7935e35f8 100644
--- a/packages/app/tests/integration/undo-rederive-survival.test.ts
+++ b/packages/app/tests/integration/undo-rederive-survival.test.ts
@@ -1,4 +1,3 @@
-
import { prependFrontmatter } from '@inkeep/open-knowledge-core';
import { Plugin, PluginKey } from '@tiptap/pm/state';
import { updateYFragment, yXmlFragmentToProseMirrorRootNode } from '@tiptap/y-tiptap';
diff --git a/packages/core/src/bridge/compose.ts b/packages/core/src/bridge/compose.ts
index 2a597ec3d..f4cc8a286 100644
--- a/packages/core/src/bridge/compose.ts
+++ b/packages/core/src/bridge/compose.ts
@@ -1,4 +1,3 @@
-
import { prependFrontmatter, stripFrontmatter } from '../extensions/frontmatter.ts';
export type ComposeAdjustment = 'none' | 'body' | 'frontmatter' | 'unresolved';
diff --git a/packages/core/src/bridge/doc-boundary-space.ts b/packages/core/src/bridge/doc-boundary-space.ts
index 01ef76a9f..8fb428b90 100644
--- a/packages/core/src/bridge/doc-boundary-space.ts
+++ b/packages/core/src/bridge/doc-boundary-space.ts
@@ -1,4 +1,3 @@
-
import { FRONTMATTER_RE, stripFrontmatter } from '../extensions/frontmatter.ts';
import { carriedEdgeEmpties, type DocEdgeEmpties } from '../markdown/doc-edge-blank-runs.ts';
diff --git a/packages/core/src/config/bind-config-doc.test.ts b/packages/core/src/config/bind-config-doc.test.ts
index 3198ba1aa..3b4a254f1 100644
--- a/packages/core/src/config/bind-config-doc.test.ts
+++ b/packages/core/src/config/bind-config-doc.test.ts
@@ -1,4 +1,5 @@
import { afterEach, beforeEach, describe, expect, test } from 'vitest';
+import { parseDocument } from 'yaml';
import * as Y from 'yjs';
import { bindConfigDoc, type ConfigDocProvider } from './bind-config-doc.ts';
import { isKnownConfigError } from './errors.ts';
@@ -28,6 +29,36 @@ function createMockProvider(doc: Y.Doc): ConfigDocProvider & {
let doc: Y.Doc;
let provider: ReturnType<typeof createMockProvider>;
+function bindSyncedConfigDoc(scope: Parameters<typeof bindConfigDoc>[1]) {
+ const binding = bindConfigDoc(provider, scope);
+ provider.emitSynced();
+ return binding;
+}
+
+const configScopeReadinessCases = [
+ {
+ scope: 'user',
+ seed: 'appearance:\n theme: light\n',
+ patch: { appearance: { theme: 'dark' } },
+ initial: { appearance: { theme: 'light' } },
+ patched: { appearance: { theme: 'dark' } },
+ },
+ {
+ scope: 'project',
+ seed: 'content:\n dir: .\n',
+ patch: { content: { dir: 'docs' } },
+ initial: { content: { dir: '.' } },
+ patched: { content: { dir: 'docs' } },
+ },
+ {
+ scope: 'project-local',
+ seed: 'terminal:\n enabled: false\n',
+ patch: { terminal: { enabled: true } },
+ initial: { terminal: { enabled: false } },
+ patched: { terminal: { enabled: true } },
+ },
+] as const;
+
beforeEach(() => {
doc = new Y.Doc();
provider = createMockProvider(doc);
@@ -86,8 +117,8 @@ describe('bindConfigDoc — current()', () => {
});
describe('bindConfigDoc — patch()', () => {
- test('writes scalar to empty Y.Text + returns effective config', () => {
- const binding = bindConfigDoc(provider, 'user');
+ test('writes scalar to synced empty Y.Text + returns effective config', () => {
+ const binding = bindSyncedConfigDoc('user');
const result = binding.patch({ appearance: { theme: 'dark' } });
expect(result.ok).toBe(true);
@@ -101,8 +132,8 @@ describe('bindConfigDoc — patch()', () => {
binding.dispose();
});
- test('writes editor.wordWrap to empty Y.Text + returns effective config', () => {
- const binding = bindConfigDoc(provider, 'user');
+ test('writes editor.wordWrap to synced empty Y.Text + returns effective config', () => {
+ const binding = bindSyncedConfigDoc('user');
const result = binding.patch({ editor: { wordWrap: false } });
expect(result.ok).toBe(true);
@@ -116,8 +147,8 @@ describe('bindConfigDoc — patch()', () => {
binding.dispose();
});
- test('writes editor.previewTabs to empty Y.Text + returns effective config', () => {
- const binding = bindConfigDoc(provider, 'user');
+ test('writes editor.previewTabs to synced empty Y.Text + returns effective config', () => {
+ const binding = bindSyncedConfigDoc('user');
const result = binding.patch({ editor: { previewTabs: false } });
expect(result.ok).toBe(true);
@@ -132,7 +163,7 @@ describe('bindConfigDoc — patch()', () => {
});
test('writes the sidebar view toggles via a project-local binding + returns effective config', () => {
- const binding = bindConfigDoc(provider, 'project-local');
+ const binding = bindSyncedConfigDoc('project-local');
const result = binding.patch({
appearance: {
sidebar: {
@@ -159,7 +190,7 @@ describe('bindConfigDoc — patch()', () => {
test('updates existing field + preserves comments via yaml@2 Document', () => {
const initial = '# Project config\ncontent:\n dir: old # original\n';
doc.getText('source').insert(0, initial);
- const binding = bindConfigDoc(provider, 'project');
+ const binding = bindSyncedConfigDoc('project');
const result = binding.patch({ content: { dir: 'new' } });
expect(result.ok).toBe(true);
@@ -174,7 +205,7 @@ describe('bindConfigDoc — patch()', () => {
test('rejects schema-invalid scalar; Y.Text untouched', () => {
doc.getText('source').insert(0, 'appearance:\n theme: dark\n');
const before = doc.getText('source').toString();
- const binding = bindConfigDoc(provider, 'user');
+ const binding = bindSyncedConfigDoc('user');
const result = binding.patch({ appearance: { theme: 'midnight' as 'dark' } });
expect(result.ok).toBe(false);
@@ -192,7 +223,7 @@ describe('bindConfigDoc — patch()', () => {
test('null-as-clear semantic via deleteIn', () => {
doc.getText('source').insert(0, 'appearance:\n theme: dark\n');
- const binding = bindConfigDoc(provider, 'user');
+ const binding = bindSyncedConfigDoc('user');
const result = binding.patch({ appearance: { theme: null } });
expect(result.ok).toBe(true);
@@ -205,7 +236,7 @@ describe('bindConfigDoc — patch()', () => {
test('self-heals from corrupt Y.Text — patch lands on a fresh doc, dropping the bad bytes', () => {
doc.getText('source').insert(0, 'theme: light\nappearance:\ntheme: light\n');
- const binding = bindConfigDoc(provider, 'project');
+ const binding = bindSyncedConfigDoc('project');
const result = binding.patch({ content: { dir: 'docs' } });
expect(result.ok).toBe(true);
@@ -219,7 +250,7 @@ describe('bindConfigDoc — patch()', () => {
test('self-heals from non-mapping top-level (e.g., scalar or array)', () => {
doc.getText('source').insert(0, '- not a mapping\n- also not\n');
- const binding = bindConfigDoc(provider, 'project');
+ const binding = bindSyncedConfigDoc('project');
const result = binding.patch({ content: { dir: 'docs' } });
expect(result.ok).toBe(true);
@@ -230,8 +261,8 @@ describe('bindConfigDoc — patch()', () => {
binding.dispose();
});
- test('after dispose, patch returns WRITE_ERROR', () => {
- const binding = bindConfigDoc(provider, 'project');
+ test('after dispose, patch returns the disposed WRITE_ERROR without mutating Y.Text', () => {
+ const binding = bindSyncedConfigDoc('project');
binding.dispose();
const result = binding.patch({ content: { dir: 'docs' } });
@@ -239,12 +270,111 @@ describe('bindConfigDoc — patch()', () => {
if (result.ok) throw new Error('expected err');
if (!isKnownConfigError(result.error)) throw new Error('not known error');
expect(result.error.code).toBe('WRITE_ERROR');
+ if (result.error.code !== 'WRITE_ERROR') throw new Error('expected WRITE_ERROR');
+ expect(result.error.detail).toContain('disposed');
+ expect(doc.getText('source').toString()).toBe('');
});
});
+describe('bindConfigDoc — initial sync write barrier', () => {
+ test.each(configScopeReadinessCases)(
+ '$scope binding rejects a patch before initial sync without corrupting the authoritative mapping',
+ ({ scope, seed, patch, initial }) => {
+ const serverDoc = new Y.Doc();
+ const clientDoc = new Y.Doc();
+ serverDoc.clientID = 1;
+ clientDoc.clientID = 2;
+ serverDoc.getText('source').insert(0, seed);
+ const clientProvider = createMockProvider(clientDoc);
+ const binding = bindConfigDoc(clientProvider, scope);
+
+ const result = binding.patch(patch);
+ const clientTextBeforeSync = clientDoc.getText('source').toString();
+ Y.applyUpdate(clientDoc, Y.encodeStateAsUpdate(serverDoc));
+ Y.applyUpdate(serverDoc, Y.encodeStateAsUpdate(clientDoc));
+ const merged = parseDocument(clientDoc.getText('source').toString());
+
+ expect.soft(result.ok).toBe(false);
+ if (result.ok) throw new Error('expected NOT_SYNCED');
+ expect.soft(isKnownConfigError(result.error)).toBe(true);
+ if (!isKnownConfigError(result.error)) throw new Error('expected known error');
+ expect.soft(result.error.code).toBe('NOT_SYNCED');
+ expect.soft(clientTextBeforeSync).toBe('');
+ expect.soft(merged.errors.map((error) => error.message)).toEqual([]);
+ expect.soft(merged.toJSON()).toEqual(initial);
+
+ binding.dispose();
+ serverDoc.destroy();
+ clientDoc.destroy();
+ },
+ );
+
+ test.each(configScopeReadinessCases)(
+ '$scope binding rejects a patch when authoritative bytes arrive before the first sync event',
+ ({ scope, seed, patch, initial }) => {
+ const serverDoc = new Y.Doc();
+ const clientDoc = new Y.Doc();
+ serverDoc.clientID = 1;
+ clientDoc.clientID = 2;
+ serverDoc.getText('source').insert(0, seed);
+ const clientProvider = createMockProvider(clientDoc);
+ const binding = bindConfigDoc(clientProvider, scope);
+
+ Y.applyUpdate(clientDoc, Y.encodeStateAsUpdate(serverDoc));
+ const beforePatch = clientDoc.getText('source').toString();
+ const result = binding.patch(patch);
+ const afterPatch = clientDoc.getText('source').toString();
+ const parsed = parseDocument(afterPatch);
+
+ expect.soft(binding.hasSynced()).toBe(false);
+ expect.soft(result.ok).toBe(false);
+ if (result.ok) throw new Error('expected NOT_SYNCED');
+ expect.soft(isKnownConfigError(result.error)).toBe(true);
+ if (!isKnownConfigError(result.error)) throw new Error('expected known error');
+ expect.soft(result.error.code).toBe('NOT_SYNCED');
+ expect.soft(afterPatch).toBe(beforePatch);
+ expect.soft(parsed.errors.map((error) => error.message)).toEqual([]);
+ expect.soft(parsed.toJSON()).toEqual(initial);
+
+ binding.dispose();
+ serverDoc.destroy();
+ clientDoc.destroy();
+ },
+ );
+
+ test.each(configScopeReadinessCases)(
+ '$scope binding accepts a patch after initial sync and converges to one valid mapping',
+ ({ scope, seed, patch, patched }) => {
+ const serverDoc = new Y.Doc();
+ const clientDoc = new Y.Doc();
+ serverDoc.clientID = 1;
+ clientDoc.clientID = 2;
+ serverDoc.getText('source').insert(0, seed);
+ const clientProvider = createMockProvider(clientDoc);
+ const binding = bindConfigDoc(clientProvider, scope);
+
+ Y.applyUpdate(clientDoc, Y.encodeStateAsUpdate(serverDoc));
+ clientProvider.emitSynced();
+ const result = binding.patch(patch);
+ Y.applyUpdate(serverDoc, Y.encodeStateAsUpdate(clientDoc));
+ Y.applyUpdate(clientDoc, Y.encodeStateAsUpdate(serverDoc));
+ const merged = parseDocument(clientDoc.getText('source').toString());
+
+ expect(binding.hasSynced()).toBe(true);
+ expect(result.ok).toBe(true);
+ expect(merged.errors.map((error) => error.message)).toEqual([]);
+ expect(merged.toJSON()).toEqual(patched);
+
+ binding.dispose();
+ serverDoc.destroy();
+ clientDoc.destroy();
+ },
+ );
+});
+
describe('bindConfigDoc — subscribe()', () => {
test('listener fires on Y.Text change after subscribe', () => {
- const binding = bindConfigDoc(provider, 'user');
+ const binding = bindSyncedConfigDoc('user');
const received: Array<unknown> = [];
const unsub = binding.subscribe((c) => {
@@ -291,7 +421,7 @@ describe('bindConfigDoc — subscribe()', () => {
});
test('listener exception is caught — does not break other listeners', () => {
- const binding = bindConfigDoc(provider, 'user');
+ const binding = bindSyncedConfigDoc('user');
const ok: Array<unknown> = [];
binding.subscribe(() => {
@@ -307,7 +437,7 @@ describe('bindConfigDoc — subscribe()', () => {
});
test('multiple subscribers fire in registration order', () => {
- const binding = bindConfigDoc(provider, 'user');
+ const binding = bindSyncedConfigDoc('user');
const order: number[] = [];
binding.subscribe(() => order.push(1));
@@ -466,7 +596,7 @@ describe('bindConfigDoc — dispose()', () => {
describe('bindConfigDoc — project-local scope', () => {
test('patch + current round-trip: writes and reads back through Y.Text', () => {
- const binding = bindConfigDoc(provider, 'project-local');
+ const binding = bindSyncedConfigDoc('project-local');
const result = binding.patch({ autoSync: { enabled: true } });
expect(result.ok).toBe(true);
@@ -483,7 +613,7 @@ describe('bindConfigDoc — project-local scope', () => {
});
test('subscribe fires on patch under project-local scope', () => {
- const binding = bindConfigDoc(provider, 'project-local');
+ const binding = bindSyncedConfigDoc('project-local');
const received: Array<unknown> = [];
binding.subscribe((c) => {
received.push(c.autoSync?.enabled);
@@ -501,7 +631,7 @@ describe('bindConfigDoc — project-local scope', () => {
describe('bindConfigDoc — scope-violation gate', () => {
test('user binding rejects a project-local field with SCOPE_VIOLATION; Y.Text untouched', () => {
const before = doc.getText('source').toString();
- const binding = bindConfigDoc(provider, 'user');
+ const binding = bindSyncedConfigDoc('user');
const result = binding.patch({ autoSync: { enabled: true } });
expect(result.ok).toBe(false);
@@ -519,7 +649,7 @@ describe('bindConfigDoc — scope-violation gate', () => {
});
test('project binding rejects a project-local field with SCOPE_VIOLATION', () => {
- const binding = bindConfigDoc(provider, 'project');
+ const binding = bindSyncedConfigDoc('project');
const result = binding.patch({ autoSync: { enabled: false } });
expect(result.ok).toBe(false);
if (result.ok) throw new Error('expected SCOPE_VIOLATION');
@@ -532,7 +662,7 @@ describe('bindConfigDoc — scope-violation gate', () => {
});
test('project-local binding rejects a user field (appearance.theme) with SCOPE_VIOLATION', () => {
- const binding = bindConfigDoc(provider, 'project-local');
+ const binding = bindSyncedConfigDoc('project-local');
const result = binding.patch({ appearance: { theme: 'dark' } });
expect(result.ok).toBe(false);
if (result.ok) throw new Error('expected SCOPE_VIOLATION');
@@ -544,7 +674,7 @@ describe('bindConfigDoc — scope-violation gate', () => {
});
test('project-local binding rejects a project field (content.dir) with SCOPE_VIOLATION', () => {
- const binding = bindConfigDoc(provider, 'project-local');
+ const binding = bindSyncedConfigDoc('project-local');
const result = binding.patch({ content: { dir: 'docs' } });
expect(result.ok).toBe(false);
if (result.ok) throw new Error('expected SCOPE_VIOLATION');
@@ -556,8 +686,8 @@ describe('bindConfigDoc — scope-violation gate', () => {
});
});
-describe('bindConfigDoc — multi-client / cross-process simulation (NR9 LWW)', () => {
- test('two simultaneous Y.Text replacements via Yjs delta sync — final state is one of the two', () => {
+describe('bindConfigDoc — multi-client / cross-process byte convergence', () => {
+ test('two simultaneous Y.Text replacements converge to identical bytes', () => {
const docA = new Y.Doc();
const docB = new Y.Doc();
const provA = createMockProvider(docA);
@@ -569,6 +699,8 @@ describe('bindConfigDoc — multi-client / cross-process simulation (NR9 LWW)',
const bindingA = bindConfigDoc(provA, 'user');
const bindingB = bindConfigDoc(provB, 'user');
+ provA.emitSynced();
+ provB.emitSynced();
const resA = bindingA.patch({ appearance: { theme: 'dark' } });
const resB = bindingB.patch({ appearance: { theme: 'light' } });
diff --git a/packages/core/src/config/bind-config-doc.ts b/packages/core/src/config/bind-config-doc.ts
index ec6ca976b..a7d6485d0 100644
--- a/packages/core/src/config/bind-config-doc.ts
+++ b/packages/core/src/config/bind-config-doc.ts
@@ -140,6 +140,12 @@ function bindConfigDocInner(
detail: `ConfigBinding (${scope}) has been disposed`,
});
}
+ if (!synced) {
+ return err({
+ code: 'NOT_SYNCED',
+ detail: `ConfigBinding (${scope}) has not completed initial sync`,
+ });
+ }
const scopeViolation = validatePatchScopes(patch, scope);
if (scopeViolation !== null) {
diff --git a/packages/core/src/config/errors.test.ts b/packages/core/src/config/errors.test.ts
index 6b4f28af4..6fb7a955e 100644
--- a/packages/core/src/config/errors.test.ts
+++ b/packages/core/src/config/errors.test.ts
@@ -59,6 +59,18 @@ describe('ConfigValidationErrorSchema', () => {
expect(parsed.code).toBe('MIXED_SCOPE');
});
+ test('parses NOT_SYNCED with diagnostic detail', () => {
+ const parsed = ConfigValidationErrorSchema.parse({
+ code: 'NOT_SYNCED',
+ detail: 'project-local binding is awaiting initial sync',
+ });
+ expect(parsed).toEqual({
+ code: 'NOT_SYNCED',
+ detail: 'project-local binding is awaiting initial sync',
+ });
+ expect(isKnownConfigError(parsed)).toBe(true);
+ });
+
test('forward-compat tail accepts unknown codes without throwing', () => {
const parsed = ConfigValidationErrorSchema.parse({
code: 'FUTURE_CODE_NOT_YET_KNOWN',
@@ -76,6 +88,7 @@ describe('ConfigValidationErrorSchema', () => {
'SCOPE_VIOLATION',
'NOT_AGENT_SETTABLE',
'MIXED_SCOPE',
+ 'NOT_SYNCED',
'WRITE_ERROR',
'OKIGNORE_INVALID',
'UNKNOWN',
@@ -274,6 +287,16 @@ describe('humanFormat', () => {
expect(out).toContain('one file at a time');
});
+ test('NOT_SYNCED describes a temporary loading state without exposing diagnostic detail', () => {
+ const out = humanFormat({
+ code: 'NOT_SYNCED',
+ detail: 'ConfigBinding (project-local) has not completed initial sync',
+ });
+ expect(out).toBe('Settings are still loading. Try again in a moment.');
+ expect(out).not.toContain('ConfigBinding');
+ expect(out).not.toContain('write config file');
+ });
+
test('UNKNOWN with message renders message; without message renders generic', () => {
expect(humanFormat({ code: 'UNKNOWN', message: 'boom' })).toBe('boom');
expect(humanFormat({ code: 'UNKNOWN' })).toBe('Unknown error.');
diff --git a/packages/core/src/config/errors.ts b/packages/core/src/config/errors.ts
index 6b98d0850..49ef66a7a 100644
--- a/packages/core/src/config/errors.ts
+++ b/packages/core/src/config/errors.ts
@@ -77,6 +77,10 @@ export const KnownConfigValidationErrorSchema = z.discriminatedUnion('code', [
),
}),
RemovedKeyErrorSchema,
+ z.object({
+ code: z.literal('NOT_SYNCED'),
+ detail: z.string(),
+ }),
z.object({
code: z.literal('WRITE_ERROR'),
detail: z.string(),
@@ -297,6 +301,8 @@ export function humanFormat(error: ConfigValidationError): string {
}
return lines.join('\n');
}
+ case 'NOT_SYNCED':
+ return 'Settings are still loading. Try again in a moment.';
case 'WRITE_ERROR':
return `Failed to write config file: ${error.detail}`;
case 'OKIGNORE_INVALID':
diff --git a/packages/core/src/markdown/comment-promoter.ts b/packages/core/src/markdown/comment-promoter.ts
index 20a68d2a1..bfbd5a2e8 100644
--- a/packages/core/src/markdown/comment-promoter.ts
+++ b/packages/core/src/markdown/comment-promoter.ts
@@ -1,4 +1,3 @@
-
import type { Nodes, Paragraph, PhrasingContent, Root, RootContent, Text } from 'mdast';
import { SKIP, visit } from 'unist-util-visit';
import type { VFile } from 'vfile';
diff --git a/packages/core/src/markdown/merged-walker.ts b/packages/core/src/markdown/merged-walker.ts
index fa3cfcd86..bfd7e3109 100644
--- a/packages/core/src/markdown/merged-walker.ts
+++ b/packages/core/src/markdown/merged-walker.ts
@@ -1,4 +1,3 @@
-
import type { Nodes, Parent, Root } from 'mdast';
import { SKIP, visit } from 'unist-util-visit';
import type { VFile } from 'vfile';
diff --git a/packages/core/src/markdown/safe-url.ts b/packages/core/src/markdown/safe-url.ts
index 8be632ba4..4d3250d3a 100644
--- a/packages/core/src/markdown/safe-url.ts
+++ b/packages/core/src/markdown/safe-url.ts
@@ -1,4 +1,3 @@
-
export const SAFE_URL_SCHEMES = ['https', 'http', 'mailto', 'tel', 'ftp', 'sms'] as const;
const SCHEME_ALT = SAFE_URL_SCHEMES.map((s) => `${s}:`).join('|');
diff --git a/packages/server/src/config-telemetry.test.ts b/packages/server/src/config-telemetry.test.ts
index ce8c95cf9..c1cb7f52e 100644
--- a/packages/server/src/config-telemetry.test.ts
+++ b/packages/server/src/config-telemetry.test.ts
@@ -110,10 +110,30 @@ describe('config-edit OTel spans', () => {
});
describe('config.patch + L1 config.validate (binding path)', () => {
+ it('distinguishes an initial-sync rejection from a write failure', () => {
+ const ydoc = new Y.Doc();
+ const mock = createMockProvider(ydoc);
+ const binding = bindConfigDoc(mock, 'project');
+
+ const result = binding.patch({ content: { dir: './notes' } } as ConfigPatch);
+ expect(result.ok).toBe(false);
+ if (result.ok) throw new Error('expected initial-sync rejection');
+ expect(result.error.code).toBe('NOT_SYNCED');
+
+ const patchSpan = requireSpan('config.patch');
+ expect(attr(patchSpan, 'config.outcome')).toBe('rejected');
+ expect(attr(patchSpan, 'config.error.code')).toBe('NOT_SYNCED');
+ expect(spansByName('config.validate')).toHaveLength(0);
+
+ binding.dispose();
+ ydoc.destroy();
+ });
+
it('emits config.patch + config.validate(L1) on a successful patch', () => {
const ydoc = new Y.Doc();
const mock = createMockProvider(ydoc);
const binding = bindConfigDoc(mock, 'project');
+ mock.emitSynced();
const result = binding.patch({
content: { dir: './notes' },
} as ConfigPatch);
@@ -136,6 +156,7 @@ describe('config-edit OTel spans', () => {
const ydoc = new Y.Doc();
const mock = createMockProvider(ydoc);
const binding = bindConfigDoc(mock, 'project');
+ mock.emitSynced();
const result = binding.patch({
content: { dir: 42 as unknown as string },
} as ConfigPatch);
@@ -269,6 +290,7 @@ describe('config-edit OTel spans', () => {
const mock = createMockProvider(ydoc);
expect(() => {
const binding = bindConfigDoc(mock, 'project');
+ mock.emitSynced();
binding.patch({ appearance: { theme: 'system' } } as ConfigPatch);
}).not.toThrow();
});