Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions packages/plugins/semantic-search/src/sdk/tool-search-index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,45 @@ describe("ToolSearchIndex manifest snapshot", () => {
}),
);

it.effect("scans the create-time manifest snapshot when the live manifest changes", () =>
Effect.gen(function* () {
const [tool] = makeTools(1);
expect(tool).toBeDefined();
if (tool === undefined) return;
Comment thread
aryasaatvik marked this conversation as resolved.
let liveManifests = [manifestForTool(tool, "fp-at-create", "source-at-create")];
const counters = { manifest: 0 };
const executor: Pick<Executor, "tools" | "cache"> = {
tools: {
list: () => Effect.succeed([tool]),
manifest: () => {
counters.manifest++;
return Effect.succeed(liveManifests);
},
schema: () => Effect.succeed(null),
},
cache: makeMemoryCache(),
};
const base = makeBase(executor as Executor);

yield* create({ ...base, runId: "run-snapshot-stability", partitionCount: 1 });
liveManifests = [manifestForTool(tool, "fp-after-create", "source-after-create")];

const scanned = yield* scan({
...base,
runId: "run-snapshot-stability",
partition: 0,
limit: 10,
});

expect(scanned).toMatchObject({ processed: 1, changed: 1, skipped: 0 });
expect(counters.manifest).toBe(1);
expect([...base.jobs.data.values()][0]).toMatchObject({
fingerprint: "fp-at-create",
sourceRevision: "source-at-create",
});
}),
);

it.effect("fails the scan when the run snapshot is missing (no D1 fallback)", () =>
Effect.gen(function* () {
const { executor, counters } = makeCountingExecutor(makeTools(2));
Expand Down
Loading