Skip to content

Commit a2f4df0

Browse files
test(server): prune low-value tests in apps/server (second pass) (pingdotgg#22592)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent eb10859 commit a2f4df0

91 files changed

Lines changed: 58 additions & 2809 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/server/scripts/migrate-dev-db.test.ts‎

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -194,33 +194,6 @@ it.layer(NodeServices.layer)("migrate-dev-db", (it) => {
194194
}),
195195
);
196196

197-
it.effect("fails loudly on a migration slot collision", () =>
198-
Effect.gen(function* () {
199-
const fs = yield* FileSystem.FileSystem;
200-
const sourceDir = yield* fs.makeTempDirectoryScoped({ prefix: "migrate-dev-db-slot-" });
201-
const destDir = yield* fs.makeTempDirectoryScoped({ prefix: "migrate-dev-db-slot-dest-" });
202-
const source = yield* createFixtureSource(sourceDir);
203-
yield* withDatabase(
204-
source,
205-
Effect.gen(function* () {
206-
const sql = yield* SqlClient.SqlClient;
207-
yield* sql`UPDATE effect_sql_migrations
208-
SET name = 'SomebodyElsesMigration' WHERE migration_id = 1`;
209-
}),
210-
);
211-
212-
const error = yield* runMigrateDevDb(
213-
{ baseDir: destDir, source, projects: 5, threadsPerProject: 10 },
214-
{ sharedHome: sourceDir },
215-
).pipe(Effect.flip);
216-
assert.equal(error._tag, "MigrateDevDbSlotCollisionError");
217-
if (error._tag === "MigrateDevDbSlotCollisionError") {
218-
assert.equal(error.slot, 1);
219-
assert.equal(error.appliedName, "SomebodyElsesMigration");
220-
}
221-
}),
222-
);
223-
224197
it.effect("refuses while a dev server holds the destination", () =>
225198
Effect.gen(function* () {
226199
const fs = yield* FileSystem.FileSystem;

‎apps/server/src/assets/AssetAccess.test.ts‎

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ describe("AssetAccess", () => {
163163
}).pipe(Effect.provide(NodeServices.layer)),
164164
);
165165

166+
// regression: #17026 apply host color scheme to saved MCP apps
166167
it.effect("preserves filesystem failures instead of reporting oversized HTML", () =>
167168
Effect.gen(function* () {
168169
const fileSystem = yield* FileSystem.FileSystem;
@@ -684,40 +685,6 @@ describe("AssetAccess", () => {
684685
}).pipe(Effect.provide(layerTest)),
685686
);
686687

687-
it.effect("issues draft workspace URLs without a thread", () =>
688-
Effect.gen(function* () {
689-
const fileSystem = yield* FileSystem.FileSystem;
690-
const path = yield* Path.Path;
691-
const root = yield* fileSystem.makeTempDirectoryScoped({
692-
prefix: "t3-asset-draft-",
693-
});
694-
const htmlPath = path.join(root, "report.html");
695-
const cssPath = path.join(root, "report.css");
696-
yield* fileSystem.writeFileString(htmlPath, '<link rel="stylesheet" href="report.css">');
697-
yield* fileSystem.writeFileString(cssPath, "body { color: red; }");
698-
const canonicalHtmlPath = yield* fileSystem.realPath(htmlPath);
699-
const canonicalCssPath = yield* fileSystem.realPath(cssPath);
700-
701-
const result = yield* issueAssetUrl({
702-
resource: { _tag: "draft-workspace-file", cwd: root, path: "report.html" },
703-
workspaceRoot: root,
704-
});
705-
const suffix = result.relativeUrl.slice(`${ASSET_ROUTE_PREFIX}/`.length);
706-
const separatorIndex = suffix.indexOf("/");
707-
const token = suffix.slice(0, separatorIndex);
708-
709-
expect(yield* resolveAsset(token, "report.html")).toEqual({
710-
kind: "file",
711-
path: canonicalHtmlPath,
712-
});
713-
expect(yield* resolveAsset(token, "report.css")).toEqual({
714-
kind: "file",
715-
path: canonicalCssPath,
716-
});
717-
expect(yield* resolveAsset(token, "../secret.txt")).toBeNull();
718-
}).pipe(Effect.provide(layerTest)),
719-
);
720-
721688
it.effect("previews workspace files with literal fragment characters in their paths", () =>
722689
Effect.gen(function* () {
723690
const fileSystem = yield* FileSystem.FileSystem;

‎apps/server/src/attachmentStore.test.ts‎

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
parseAttachmentUuid,
1414
planAttachmentClaim,
1515
parseThreadSegmentFromAttachmentId,
16-
resolveAttachmentPathById,
1716
sweepStalePendingAttachments,
1817
threadHtmlRenderAttachmentIds,
1918
} from "./attachmentStore.ts";
@@ -60,21 +59,6 @@ describe("attachmentStore", () => {
6059
expect(dashed && parseThreadSegmentFromAttachmentId(dashed)).toBe("thread-a");
6160
});
6261

63-
it("sanitizes thread ids when creating attachment ids", () => {
64-
const attachmentId = createAttachmentId("thread.folder/unsafe space");
65-
expect(attachmentId).toBeTruthy();
66-
if (!attachmentId) {
67-
return;
68-
}
69-
70-
const threadSegment = parseThreadSegmentFromAttachmentId(attachmentId);
71-
expect(threadSegment).toBeTruthy();
72-
expect(threadSegment).toMatch(/^[a-z0-9_-]+$/i);
73-
expect(threadSegment).not.toContain(".");
74-
expect(threadSegment).not.toContain("%");
75-
expect(threadSegment).not.toContain("/");
76-
});
77-
7862
it("parses exact thread segments from attachment ids without prefix collisions", () => {
7963
const fooId = "foo-00000000-0000-4000-8000-000000000001";
8064
const fooBarId = "foo-bar-00000000-0000-4000-8000-000000000002";
@@ -93,25 +77,6 @@ describe("attachmentStore", () => {
9377
);
9478
});
9579

96-
it("resolves attachment path by id using the extension that exists on disk", () => {
97-
const attachmentsDir = NodeFS.mkdtempSync(
98-
NodePath.join(NodeOS.tmpdir(), "t3code-attachment-store-"),
99-
);
100-
try {
101-
const attachmentId = "thread-1-attachment";
102-
const pngPath = NodePath.join(attachmentsDir, `${attachmentId}.png`);
103-
NodeFS.writeFileSync(pngPath, Buffer.from("hello"));
104-
105-
const resolved = resolveAttachmentPathById({
106-
attachmentsDir,
107-
attachmentId,
108-
});
109-
expect(resolved).toBe(pngPath);
110-
} finally {
111-
NodeFS.rmSync(attachmentsDir, { recursive: true, force: true });
112-
}
113-
});
114-
11580
it("plans pending attachment claims with direct filename lookups", () => {
11681
const attachmentsDir = NodeFS.mkdtempSync(
11782
NodePath.join(NodeOS.tmpdir(), "t3code-attachment-claim-"),

‎apps/server/src/auth/EnvironmentAuth.test.ts‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -255,26 +255,6 @@ it.layer(NodeServices.layer)("EnvironmentAuth.layer", (it) => {
255255
),
256256
);
257257

258-
it.effect("issues standard pairing credentials by default", () =>
259-
Effect.gen(function* () {
260-
const serverAuth = yield* EnvironmentAuth.EnvironmentAuth;
261-
const sessions = yield* SessionStore.SessionStore;
262-
263-
const pairingCredential = yield* serverAuth.issuePairingCredential();
264-
const exchanged = yield* serverAuth.createBrowserSession(
265-
pairingCredential.credential,
266-
requestMetadata,
267-
);
268-
const verified = yield* serverAuth.authenticateHttpRequest(
269-
makeCookieRequest(sessions.cookieName, exchanged.sessionToken),
270-
);
271-
272-
expect(verified.sessionId.length).toBeGreaterThan(0);
273-
expect(verified.scopes).toEqual(AuthStandardClientScopes);
274-
expect(verified.subject).toBe("one-time-token");
275-
}).pipe(Effect.provide(layerEnvironmentAuth())),
276-
);
277-
278258
it.effect("prefers a bearer token over a stale legacy cookie", () =>
279259
Effect.gen(function* () {
280260
const serverAuth = yield* EnvironmentAuth.EnvironmentAuth;

‎apps/server/src/auth/EnvironmentAuthPolicy.test.ts‎

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -79,23 +79,4 @@ it.layer(NodeServices.layer)("EnvironmentAuthPolicy.layer", (it) => {
7979
),
8080
),
8181
);
82-
83-
it.effect("isolates wildcard-bound web development sessions", () =>
84-
Effect.gen(function* () {
85-
const policy = yield* EnvironmentAuthPolicy.EnvironmentAuthPolicy;
86-
const descriptor = yield* policy.getDescriptor();
87-
88-
expect(descriptor.policy).toBe("remote-reachable");
89-
expect(descriptor.sessionCookieName).toMatch(/^t3_session_5775_[a-f0-9]{12}$/);
90-
}).pipe(
91-
Effect.provide(
92-
layerEnvironmentAuthPolicy({
93-
mode: "web",
94-
host: "0.0.0.0",
95-
port: 5775,
96-
devUrl: new URL("http://127.0.0.1:5736"),
97-
}),
98-
),
99-
),
100-
);
10182
});

‎apps/server/src/auth/PairingGrantStore.test.ts‎

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -124,27 +124,6 @@ it.layer(NodeServices.layer)("PairingGrantStore.layer", (it) => {
124124
}).pipe(Effect.provide(layerPairingGrantStore())),
125125
);
126126

127-
it.effect("seeds the desktop bootstrap credential as a reusable grant", () =>
128-
Effect.gen(function* () {
129-
const bootstrapCredentials = yield* PairingGrantStore.PairingGrantStore;
130-
const first = yield* bootstrapCredentials.consume("desktop-bootstrap-token");
131-
const second = yield* bootstrapCredentials.consume("desktop-bootstrap-token");
132-
const third = yield* bootstrapCredentials.consume("desktop-bootstrap-token");
133-
134-
expect(first.method).toBe("desktop-bootstrap");
135-
expect(first.scopes).toEqual(AuthStandardClientScopes);
136-
expect(first.subject).toBe("desktop-bootstrap");
137-
expect(second.method).toBe("desktop-bootstrap");
138-
expect(third.method).toBe("desktop-bootstrap");
139-
}).pipe(
140-
Effect.provide(
141-
layerPairingGrantStore({
142-
desktopBootstrapToken: "desktop-bootstrap-token",
143-
}),
144-
),
145-
),
146-
);
147-
148127
it.effect("reports seeded desktop bootstrap credentials as expired after their ttl", () =>
149128
Effect.gen(function* () {
150129
const bootstrapCredentials = yield* PairingGrantStore.PairingGrantStore;
@@ -228,31 +207,4 @@ it.layer(NodeServices.layer)("PairingGrantStore.layer", (it) => {
228207
}
229208
}).pipe(Effect.scoped, Effect.provide(layerPairingGrantStore())),
230209
);
231-
232-
it.effect("lists and revokes active pairing links", () =>
233-
Effect.gen(function* () {
234-
const bootstrapCredentials = yield* PairingGrantStore.PairingGrantStore;
235-
const first = yield* bootstrapCredentials.issueOneTimeToken();
236-
const second = yield* bootstrapCredentials.issueOneTimeToken({
237-
scopes: ["orchestration:read", "access:write"],
238-
});
239-
240-
const activeBeforeRevoke = yield* bootstrapCredentials.listActive();
241-
expect(activeBeforeRevoke.map((entry) => entry.id)).toContain(first.id);
242-
expect(activeBeforeRevoke.map((entry) => entry.id)).toContain(second.id);
243-
for (const entry of activeBeforeRevoke) {
244-
expect(entry).not.toHaveProperty("credential");
245-
}
246-
247-
const revoked = yield* bootstrapCredentials.revoke(first.id);
248-
const activeAfterRevoke = yield* bootstrapCredentials.listActive();
249-
const revokedConsume = yield* Effect.flip(bootstrapCredentials.consume(first.credential));
250-
251-
expect(revoked).toBe(true);
252-
expect(activeAfterRevoke.map((entry) => entry.id)).not.toContain(first.id);
253-
expect(activeAfterRevoke.map((entry) => entry.id)).toContain(second.id);
254-
expect(revokedConsume.message).toContain("no longer available");
255-
expect(revokedConsume._tag).toBe("UnavailableBootstrapCredentialError");
256-
}).pipe(Effect.provide(layerPairingGrantStore())),
257-
);
258210
});

0 commit comments

Comments
 (0)