Status: skip unused channel issue scan in JSON mode

This commit is contained in:
Vincent Koc
2026-03-15 19:43:42 -07:00
parent dd203c8eee
commit fdfefcaa11
2 changed files with 7 additions and 5 deletions

View File

@@ -4,6 +4,7 @@ const mocks = vi.hoisted(() => ({
readBestEffortConfig: vi.fn(),
resolveCommandSecretRefsViaGateway: vi.fn(),
buildChannelsTable: vi.fn(),
callGateway: vi.fn(),
getUpdateCheckResult: vi.fn(),
getAgentLocalStatuses: vi.fn(),
getStatusSummary: vi.fn(),
@@ -51,7 +52,7 @@ vi.mock("../infra/tailscale.js", () => ({
vi.mock("../gateway/call.js", () => ({
buildGatewayConnectionDetails: mocks.buildGatewayConnectionDetails,
callGateway: vi.fn(),
callGateway: mocks.callGateway,
}));
vi.mock("../gateway/probe.js", () => ({
@@ -245,6 +246,9 @@ describe("scanStatus", () => {
await scanStatus({ json: true }, {} as never);
expect(mocks.ensurePluginRegistryLoaded).toHaveBeenCalledWith({ scope: "channels" });
expect(mocks.callGateway).not.toHaveBeenCalledWith(
expect.objectContaining({ method: "channels.status" }),
);
});
it("preloads channel plugins for status --json when channel auth is env-only", async () => {

View File

@@ -247,11 +247,9 @@ async function scanStatusJsonFast(opts: {
const gatewaySelf = gatewayProbe?.presence
? pickGatewaySelfPresence(gatewayProbe.presence)
: null;
const channelsStatusPromise = resolveChannelsStatus({ cfg, gatewayReachable, opts });
const memoryPlugin = resolveMemoryPluginStatus(cfg);
const memoryPromise = resolveMemoryStatusSnapshot({ cfg, agentStatus, memoryPlugin });
const [channelsStatus, memory] = await Promise.all([channelsStatusPromise, memoryPromise]);
const channelIssues = channelsStatus ? collectChannelStatusIssues(channelsStatus) : [];
const memory = await memoryPromise;
return {
cfg,
@@ -270,7 +268,7 @@ async function scanStatusJsonFast(opts: {
gatewayProbe,
gatewayReachable,
gatewaySelf,
channelIssues,
channelIssues: [],
agentStatus,
channels: { rows: [], details: [] },
summary,