refactor: isolate runtime contracts and enforce import boundaries (#6166)
* test: enforce Python import ownership boundaries * test: protect client import boundaries and rehome shared UI contracts * refactor: remove gateway and client dependency inversions * fix: detect dynamic imports in conditional expressions * refactor(tools): keep configuration contracts with their owners * docs: keep design guidance focused on ownership and checks * fix: preserve default threaded turn delivery
This commit is contained in:
1 parent
cd2a863710
commit
328e933d36
162 files changed
+3449
-1888
No files matched your search
@@ -7,7 +7,7 @@ import {
|
||||
defaultChannelFieldValues,
|
||||
} from "@/components/settings/channels/CredentialForm";
|
||||
import { channelSetup } from "@/components/settings/channels/ChannelIdentity";
|
||||
import type { ChannelConfigField } from "@/components/settings/channels/catalog";
|
||||
import type { ChannelConfigField } from "@/channel-plugins/catalog";
|
||||
|
||||
const fields: ChannelConfigField[] = [
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
formatMessageHoverTime,
|
||||
formatTurnLatency,
|
||||
relativeTime,
|
||||
} from "@/lib/format";
|
||||
} from "@/lib/format-time";
|
||||
|
||||
describe("localized format helpers", () => {
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { cleanup, fireEvent, render, screen, waitFor, within } from "@testing-li
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { LinearResetConnection } from "../../../nanobot/channels/linear/webui/LinearResetConnection";
|
||||
import type { ChannelConfigField } from "@/components/settings/channels/catalog";
|
||||
import type { ChannelConfigField } from "@/channel-plugins/catalog";
|
||||
|
||||
const { requestMutation } = vi.hoisted(() => ({ requestMutation: vi.fn() }));
|
||||
vi.mock("@/providers/ClientProvider", () => ({
|
||||
|
||||
@@ -5,7 +5,7 @@ import { MessageBlockMenuActions, MessageBubble } from "@/components/MessageBubb
|
||||
import { ThreadMessages } from "@/components/thread/ThreadMessages";
|
||||
import { setAppLanguage } from "@/i18n";
|
||||
import * as clipboard from "@/lib/clipboard";
|
||||
import { formatMessageEndTime } from "@/lib/format";
|
||||
import { formatMessageEndTime } from "@/lib/format-time";
|
||||
import type {
|
||||
CliAppInfo,
|
||||
McpPresetInfo,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { cleanup, fireEvent, render, screen } from "@testing-library/react";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { ThreadMessages } from "@/components/thread/ThreadMessages";
|
||||
import { fmtDateTime } from "@/lib/format";
|
||||
import { fmtDateTime } from "@/lib/format-time";
|
||||
|
||||
vi.mock("@/components/MarkdownText", () => ({ MarkdownText: ({ content }: { content: string }) => <p>{content}</p> }));
|
||||
afterEach(() => { cleanup(); vi.useRealTimers(); });
|
||||
|
||||
@@ -6,7 +6,7 @@ import i18n from "@/i18n";
|
||||
|
||||
const mocks = vi.hoisted(() => ({ action: vi.fn(), refresh: vi.fn(), config: "" }));
|
||||
vi.mock("@/providers/ClientProvider", () => ({ useClient: () => ({ client: { requestMutation: mocks.action } }) }));
|
||||
vi.mock("@/components/remote/RemoteInstances", () => ({ useRemoteConnections: () => ({ refresh: mocks.refresh, directory: { profiles: [{ id: "paired", paired: true, ssh_config: mocks.config }, { id: "ssh", name: "Team SSH", paired: false }] } }) }));
|
||||
vi.mock("@/components/remote/remote-context", () => ({ useRemoteConnections: () => ({ refresh: mocks.refresh, directory: { profiles: [{ id: "paired", paired: true, ssh_config: mocks.config }, { id: "ssh", name: "Team SSH", paired: false }] } }) }));
|
||||
|
||||
beforeEach(async () => { await i18n.changeLanguage("en"); mocks.action.mockReset().mockResolvedValue({}); mocks.refresh.mockReset().mockResolvedValue(undefined); mocks.config = ""; });
|
||||
afterEach(cleanup);
|
||||
|
||||
@@ -21,7 +21,7 @@ const mocks = vi.hoisted(() => {
|
||||
return { action, client, listeners, transportClient: null as NanobotClient | null, connect: vi.fn(), refresh: vi.fn(), cancel: vi.fn(), copy: vi.fn() };
|
||||
});
|
||||
vi.mock("@/providers/ClientProvider", () => ({ useClient: () => ({ client: mocks.transportClient ?? mocks.client }) }));
|
||||
vi.mock("@/components/remote/RemoteInstances", () => ({ useRemoteConnections: () => ({ connect: mocks.connect, refresh: mocks.refresh, cancel: mocks.cancel, directory: { profiles: [] } }) }));
|
||||
vi.mock("@/components/remote/remote-context", () => ({ useRemoteConnections: () => ({ connect: mocks.connect, refresh: mocks.refresh, cancel: mocks.cancel, directory: { profiles: [] } }) }));
|
||||
vi.mock("@/lib/clipboard", () => ({ copyTextToClipboard: mocks.copy }));
|
||||
const request = () => ({ id: "request-1", command: "nanobot remote pair nbpr1.public", expires: Date.now() / 1000 + 600 });
|
||||
const preview = { id: "request-1", host: "ubuntu@server", hostname: "team", fingerprint: "SHA256:trusted-server", authorized_until: Date.now() / 1000 + 86400, revoke_command: "nanobot remote revoke request-1" };
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { act, cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { RemoteInstances, useRemoteConnections } from "@/components/remote/RemoteInstances";
|
||||
import { RemoteInstances } from "@/components/remote/RemoteInstances";
|
||||
import { useRemoteConnections } from "@/components/remote/remote-context";
|
||||
import { RemoteConnectionsPage } from "@/components/remote/RemoteConnectionsPage";
|
||||
import { Sidebar } from "@/components/Sidebar";
|
||||
import { HOST_BRIDGE } from "@/components/remote/host-bridge";
|
||||
|
||||
Reference in new issue
Block a user