Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
95 lines
3.0 KiB
TypeScript
95 lines
3.0 KiB
TypeScript
import { describe, expect, it, vi } from "vitest";
|
|
import { AGENT_CONTEXT_MENTION_PROVIDER_IDS } from "./agentContextMentionProvider";
|
|
import {
|
|
fetchAgentMentionFilterResult,
|
|
type AgentMentionProviderQueryInput
|
|
} from "./AgentMentionSearchIndex";
|
|
|
|
describe("fetchAgentMentionFilterResult provenance filtering", () => {
|
|
it("queries only the provenance-aware file provider for a member-only constraint", async () => {
|
|
const queryProviderMentionItemsById = vi.fn(
|
|
async (input: AgentMentionProviderQueryInput) =>
|
|
input.providerId ===
|
|
AGENT_CONTEXT_MENTION_PROVIDER_IDS.agentGeneratedFile
|
|
? [
|
|
{
|
|
directoryPath: "/workspace",
|
|
entryKind: "file" as const,
|
|
href: "/workspace/report.md",
|
|
kind: "file" as const,
|
|
name: "report.md",
|
|
path: "/workspace/report.md"
|
|
}
|
|
]
|
|
: [
|
|
{
|
|
directoryPath: "/workspace",
|
|
entryKind: "file" as const,
|
|
href: "/workspace/unfiltered.md",
|
|
kind: "file" as const,
|
|
name: "unfiltered.md",
|
|
path: "/workspace/unfiltered.md"
|
|
}
|
|
]
|
|
);
|
|
|
|
const result = await fetchAgentMentionFilterResult({
|
|
workspaceId: "workspace-1",
|
|
currentUserId: "user-1",
|
|
query: "report",
|
|
filter: "file",
|
|
sessionCwd: "/workspace",
|
|
sectionKey: "project:/workspace",
|
|
includeAgentGeneratedFiles: false,
|
|
fileLimit: 30,
|
|
currentFileSearchLimit: 30,
|
|
currentIssueSearchLimit: 30,
|
|
provenanceFilter: {
|
|
agentTargetIds: null,
|
|
memberIds: ["member-1"]
|
|
},
|
|
queryProviderMentionItemsById
|
|
});
|
|
|
|
expect(queryProviderMentionItemsById).toHaveBeenCalledTimes(1);
|
|
expect(queryProviderMentionItemsById).toHaveBeenCalledWith(
|
|
expect.objectContaining({
|
|
providerId: AGENT_CONTEXT_MENTION_PROVIDER_IDS.agentGeneratedFile,
|
|
provenanceFilter: {
|
|
agentTargetIds: null,
|
|
memberIds: ["member-1"]
|
|
}
|
|
})
|
|
);
|
|
expect(result.rawGroups.opened_files).toEqual([]);
|
|
expect(result.rawGroups.agent_generated_files).toEqual([
|
|
expect.objectContaining({ path: "/workspace/report.md" })
|
|
]);
|
|
});
|
|
|
|
it("fails closed for issue summaries under a member-only constraint", async () => {
|
|
const queryProviderMentionItemsById = vi.fn();
|
|
|
|
const result = await fetchAgentMentionFilterResult({
|
|
workspaceId: "workspace-1",
|
|
currentUserId: "user-1",
|
|
query: "task",
|
|
filter: "issue",
|
|
sessionCwd: "/workspace",
|
|
sectionKey: "project:/workspace",
|
|
includeAgentGeneratedFiles: false,
|
|
fileLimit: 30,
|
|
currentFileSearchLimit: 30,
|
|
currentIssueSearchLimit: 30,
|
|
provenanceFilter: {
|
|
agentTargetIds: null,
|
|
memberIds: ["member-1"]
|
|
},
|
|
queryProviderMentionItemsById
|
|
});
|
|
|
|
expect(queryProviderMentionItemsById).not.toHaveBeenCalled();
|
|
expect(result.rawGroups.issues).toEqual([]);
|
|
});
|
|
});
|