Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(client): a reconnect snapshot keeps unchanged skills and providers identical #20855

Mergedjuliusmarmingemerged 1 commit intomain fromrefs/pull/20855/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 31 additions and 6 deletions.

x
0 of 2 viewed, 2 left
23 additions and 1 deletionpackages/client-runtime/src/state/serverConfigProjection.test.tsModified
View file
@@ -1,6 +1,8 @@
+import type { ServerConfig, ServerConfigStreamEvent } from "@t3tools/contracts";
+import * as Option from "effect/Option";
import { describe, expect, it } from "vite-plus/test";
​
-import { reuseUnchanged } from "./serverConfigProjection.ts";
+import { applyServerConfigProjection, reuseUnchanged } from "./serverConfigProjection.ts";
​
describe("reuseUnchanged", () => {
const provider = (checkedAt: string, skills: ReadonlyArray<string>) => ({
@@ -38,3 +40,23 @@
expect(dropped).toEqual({ a: 1 });
});
});
+​
+describe("applyServerConfigProjection snapshot", () => {
+ const snapshot = (checkedAt: string) =>
+ ({
+ type: "snapshot",
+ config: {
+ environment: { capabilities: {} },
+ providers: [{ instanceId: "claude", checkedAt, skills: [{ name: "review" }] }],
+ },
+ }) as unknown as ServerConfigStreamEvent;
+ const providersOf = (projection: ReturnType<typeof applyServerConfigProjection>) =>
+ (Option.getOrThrow(projection).config as ServerConfig).providers;
+​
+ it("keeps unchanged skills when a reconnect re-sends the config", () => {
+ const first = applyServerConfigProjection(Option.none(), snapshot("a"));
+ const second = applyServerConfigProjection(first, snapshot("b"));