History

Fix pre-existing TypeScript errors across the codebase

- database.test.ts: Remove assertions on non-existent workspaceDocId field (mapAnonymousContext no longer returns it) - executor-mcp.e2e.test.ts: Use internal.executorNode.runTask instead of api.executorNode.runTask (runTask is an internalAction) - executor-mcp.e2e.test.ts: Cast input to Request for .url access - credentialsNode.ts: Narrow string|null in async closure, add explicit return type and typed variables - tsconfig.json: Exclude apps/ from root tsconfig (web app has its own tsconfig with path aliases) - convex.config.ts: Add TODO comment noting actionCache can be removed

Rhys Sullivan committed 9 months ago

Commit da301371 parent 1d1b0385 files · +11 −11Browse files

Unified · Split

5 files
  1. executor/convex/convex.config.ts +2 −0
  2. executor/convex/credentialsNode.ts +5 −4
  3. executor/convex/database.test.ts +0 −2
  4. executor/convex/executor-mcp.e2e.test.ts +4 −4
  5. executor/tsconfig.json +0 −1
executor/convex/convex.config.ts+2−0
@@ -7,6 +7,8 @@ const app = defineApp(); · 6 unmodified lines
77
88 app.use(workOSAuthKit);
99 app.use(stripe);
10+// TODO: Remove actionCache component after confirming no deployments depend on it.
11+// All OpenAPI spec caching now uses Convex file storage (openApiSpecCache / workspaceToolCache tables).
1012 app.use(actionCache);
1113
1214 export default app;
executor/convex/credentialsNode.ts+5−4
@@ -115,9 +115,10 @@ async function upsertVaultObject(args: { · 114 unmodified lines
115115 const value = JSON.stringify(args.payload);
116116
117117 if (args.existingObjectId) {
118+ const objectId: string = args.existingObjectId;
118119 const updated = await withVaultRetry(async () => {
119120 return await workos.vault.updateObject({
120− id: args.existingObjectId,
121+ id: objectId,
121122 value,
122123 });
123124 });
@@ -147,7 +148,7 @@ export const upsertCredential = action({ · 23 unmodified lines
147148 provider: v.optional(credentialProviderValidator),
148149 secretJson: v.any(),
149150 },
150− handler: async (ctx, args) => {
151+ handler: async (ctx, args): Promise<Record<string, unknown>> => {
151152 const provider = args.provider ?? "managed";
152153 const actorId = normalizedActorId(args.scope, args.actorId);
153154 const submittedSecret = asRecord(args.secretJson);
@@ -166,13 +167,13 @@ export const upsertCredential = action({ · 12 unmodified lines
166167 throw new Error("Encrypted storage value looks like a GitHub token. Paste the token in the token field.");
167168 }
168169
169− const existing = await ctx.runQuery(api.database.resolveCredential, {
170+ const existing: Record<string, unknown> | null = await ctx.runQuery(api.database.resolveCredential, {
170171 workspaceId: args.workspaceId,
171172 sourceKey: args.sourceKey,
172173 scope: args.scope,
173174 ...(args.scope === "actor" ? { actorId } : {}),
174175 });
175− const existingObjectId = existing ? extractObjectId(asRecord(existing.secretJson)) : null;
176+ const existingObjectId: string | null = existing ? extractObjectId(asRecord(existing.secretJson)) : null;
176177
177178 const objectId = (() => {
178179 if (submittedObjectId) return submittedObjectId;
executor/convex/database.test.ts+0−2
@@ -90,7 +90,6 @@ test("anonymous bootstrap links guest account membership", async () => { · 89 unmodified lines
9090 expect(first.workspaceId).toContain("ws_");
9191 expect(first.actorId).toContain("anon_");
9292 expect(first.accountId).toBeDefined();
93− expect(first.workspaceDocId).toBeDefined();
9493 expect(first.userId).toBeDefined();
9594
9695 const again = await t.mutation(api.database.bootstrapAnonymousSession, {
@@ -99,7 +98,6 @@ test("anonymous bootstrap links guest account membership", async () => { · 2 unmodified lines
9998
10099 expect(again.sessionId).toBe(first.sessionId);
101100 expect(again.accountId).toBe(first.accountId);
102− expect(again.workspaceDocId).toBe(first.workspaceDocId);
103101 expect(again.userId).toBe(first.userId);
104102 });
105103
executor/convex/executor-mcp.e2e.test.ts+4−4
@@ -2,7 +2,7 @@ import { expect, test } from "bun:test"; · 1 unmodified line
22 import { convexTest } from "convex-test";
33 import { Client } from "@modelcontextprotocol/sdk/client/index.js";
44 import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
5−import { api } from "./_generated/api";
5+import { api, internal } from "./_generated/api";
66 import schema from "./schema";
77
88 function setup() {
@@ -24,7 +24,7 @@ function createMcpTransport(t: ReturnType<typeof setup>, workspaceId: string, ac · 15 unmodified lines
2424
2525 return new StreamableHTTPClientTransport(url, {
2626 fetch: async (input, init) => {
27− const raw = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
27+ const raw = typeof input === "string" ? input : input instanceof URL ? input.toString() : (input as Request).url;
2828 const parsed = new URL(raw);
2929 const path = `${parsed.pathname}${parsed.search}${parsed.hash}`;
3030 return await t.fetch(path, init);
@@ -82,7 +82,7 @@ test("MCP run_code survives delayed approval and completes", async () => { · 51 unmodified lines
8282 });
8383
8484 const taskId = await waitForTaskId(t, session.workspaceId);
85− const runTask = t.action(api.executorNode.runTask, { taskId });
85+ const runTask = t.action(internal.executorNode.runTask, { taskId });
8686
8787 const approvalId = await waitForPendingApproval(t, session.workspaceId, "admin.send_announcement");
8888
@@ -133,7 +133,7 @@ test("MCP run_code returns denied after approval denial", async () => { · 44 unmodified lines
133133 });
134134
135135 const taskId = await waitForTaskId(t, session.workspaceId);
136− const runTask = t.action(api.executorNode.runTask, { taskId });
136+ const runTask = t.action(internal.executorNode.runTask, { taskId });
137137
138138 const approvalId = await waitForPendingApproval(t, session.workspaceId, "admin.delete_data");
139139 await t.mutation(api.executor.resolveApproval, {
executor/tsconfig.json+0−1
@@ -16,7 +16,6 @@ · 15 unmodified lines
1616 "baseUrl": "."
1717 },
1818 "include": [
19− "apps/**/*.ts",
2019 "packages/**/*.ts",
2120 "convex/**/*.ts"
2221 ]