@devries-cameron20 / t3code-1 / commits / 2931461619
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

chore(lint): enforce t3code/no-inline-schema-compile (#25113)

Julius Marminge committed Oct 25, 2026 at 23:01 UTC 2931461619133d3e4d53a08d487746216a0f6e64
17 files changed +88 -48
apps/server/src/assets/AssetAccess.test.ts
+6 -2
@@ -1416,8 +1416,10 @@ describe("AssetAccess", () => {
1416 },
1417 ]);
1418 return Effect.gen(function* () {
1419 + const decodeAssetCreateUrlInput = Schema.decodeEffect(AssetCreateUrlInput);
1420 +
1421 // Every client and server release spells the resource this way on the wire.
1420 - const { resource } = yield* Schema.decodeEffect(AssetCreateUrlInput)({
1422 + const { resource } = yield* decodeAssetCreateUrlInput({
1423 resource: { _tag: "github-media", cwd: "/repo", url },
1424 });
1425 const issued = yield* issueAssetUrl({ resource });
@@ -1446,6 +1448,8 @@ describe("AssetAccess", () => {
1448
1449 it.effect("refuses media no host keeps behind a credential, without echoing the URL", () =>
1450 Effect.gen(function* () {
1451 + const encodeAssetAccessError = Schema.encodeEffect(Schema.fromJsonString(AssetAccessError));
1452 +
1453 for (const url of [
1454 "https://example.com/shot.png",
1455 "https://example.com/shot.png?token=private-media-token",
@@ -1454,7 +1458,7 @@ describe("AssetAccess", () => {
1458 resource: { _tag: SOURCE_CONTROL_MEDIA_ASSET, cwd: "/repo", url },
1459 }).pipe(Effect.flip);
1460 expect(error._tag).toBe("AssetGitHubMediaUrlValidationError");
1457 - const encoded = yield* Schema.encodeEffect(Schema.fromJsonString(AssetAccessError))(error);
1461 + const encoded = yield* encodeAssetAccessError(error);
1462 expect(encoded).not.toContain(url);
1463 }
1464 }).pipe(Effect.provide(layerTest)),
apps/server/src/auth/RpcAuthorization.ts
+4 -2
@@ -234,9 +234,10 @@ const SettingsUpdate = Schema.Struct({
234 patch: ServerSettingsPatch,
235 providerInstanceMutation: Schema.optionalKey(ProviderInstanceMutation),
236 });
237 +const decodeSettingsUpdate = Schema.decodeUnknownSync(SettingsUpdate);
238
239 const requiredScopesForSettingsUpdate = (payload: unknown) => {
239 - const input = Schema.decodeUnknownSync(SettingsUpdate)(payload);
240 + const input = decodeSettingsUpdate(payload);
241 const scopes = requiredScopesForServerSettingsPatch(input.patch);
242 if (input.providerInstanceMutation === undefined) return scopes;
243 return Object.values(input.patch).every((value) => value === undefined)
@@ -245,6 +246,7 @@ const requiredScopesForSettingsUpdate = (payload: unknown) => {
246 };
247
248 const decodeProjectMutation = Schema.decodeUnknownSync(ProjectMutation);
249 +const decodeAssetCreateUrlInput = Schema.decodeUnknownSync(AssetCreateUrlInput);
250
251 const requiredScopesForRpcCall = (
252 method: string,
@@ -254,7 +256,7 @@ const requiredScopesForRpcCall = (
256 return [AuthEnvironmentMaintainScope, AuthDiagnosticsReadScope];
257 }
258 if (method === WS_METHODS.assetsCreateUrl) {
257 - const { resource } = Schema.decodeUnknownSync(AssetCreateUrlInput)(payload);
259 + const { resource } = decodeAssetCreateUrlInput(payload);
260 return [
261 resource._tag === "workspace-file" ||
262 resource._tag === "media-file" ||
apps/server/src/provider/ClaudeCapabilitiesProbe.test.ts
+3 -1
@@ -13,6 +13,8 @@ import {
13
14 vi.mock("@anthropic-ai/claude-agent-sdk", { spy: true });
15
16 +const decodeClaudeSettings = Schema.decodeEffect(ClaudeSettings);
17 +
18 it("drops strict MCP mode, and only that, next to an administrator's managed-mcp.json", () => {
19 const options = buildClaudeCapabilitiesProbeQueryOptions({
20 executablePath: "/usr/bin/claude",
@@ -31,7 +33,7 @@ it("drops strict MCP mode, and only that, next to an administrator's managed-mcp
33 it.effect("reports a deleted worktree's scan as finished, not pending", () =>
34 Effect.gen(function* () {
35 const snapshot = yield* probeClaudeWorkspaceSnapshot(
34 - yield* Schema.decodeEffect(ClaudeSettings)({}),
36 + yield* decodeClaudeSettings({}),
37 { skills: [], slashCommands: [] } as unknown as ServerProvider,
38 "/nonexistent/t3-deleted-worktree",
39 { HOME: "/nonexistent/t3-home" },
apps/server/src/provider/acp/AntigravityProtocol.ts
+2 -3
@@ -228,6 +228,7 @@ function sanitizeToolValue(value: unknown, budget: ToolPayloadBudget, depth: num
228 export function sanitizeAntigravityToolPayload(payload: unknown): unknown {
229 return sanitizeToolValue(payload, { nodes: 512, text: 64_000 }, 0);
230 }
231 +const isJsonRecord = Schema.is(Schema.Record(Schema.String, Schema.Json));
232
233 export function normalizeAntigravitySessionUpdate(
234 notification: EffectAcpSchema.SessionNotification,
@@ -256,9 +257,7 @@ export function normalizeAntigravitySessionUpdate(
257 ? { rawOutput: sanitizeAntigravityToolPayload(update.rawOutput) }
258 : {}),
259 ...(update.content !== undefined ? { content: content ?? [] } : {}),
259 - ...(update._meta !== undefined
260 - ? { _meta: Schema.is(Schema.Record(Schema.String, Schema.Json))(meta) ? meta : null }
261 - : {}),
260 + ...(update._meta !== undefined ? { _meta: isJsonRecord(meta) ? meta : null } : {}),
261 },
262 };
263 }
apps/server/src/serverSettings.test.ts
+7 -3
@@ -1737,10 +1737,14 @@ it.layer(NodeServices.layer)("server settings", (it) => {
1737 runOnWorktreeCreate: false,
1738 };
1739 const model = createModelSelection(ProviderInstanceId.make("codex"), "gpt-5.5");
1740 - const modelJson = yield* Schema.encodeEffect(Schema.fromJsonString(ModelSelection))(model);
1741 - const scriptsJson = yield* Schema.encodeEffect(
1740 + const encodeModelSelection = Schema.encodeEffect(Schema.fromJsonString(ModelSelection));
1741 +
1742 + const modelJson = yield* encodeModelSelection(model);
1743 + const encodeProjectScripts = Schema.encodeEffect(
1744 Schema.fromJsonString(Schema.Array(ProjectScript)),
1743 - )([script]);
1745 + );
1746 +
1747 + const scriptsJson = yield* encodeProjectScripts([script]);
1748 for (const [projectId, modelColumn, envMode, autoPull, scripts] of [
1749 [legacyProject, modelJson, "worktree", 1, scriptsJson],
1750 [scriptedProject, null, null, 0, scriptsJson],
apps/server/src/vcs/GitVcsDriverCore.test.ts
+3 -1
@@ -1781,9 +1781,11 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
1781 baseRef: initialBranch,
1782 });
1783 const branch = preview.sources.find((source) => source.kind === "branch-range")!;
1784 + const decodeReviewDiffPreviewInput = Schema.decodeEffect(ReviewDiffPreviewInput);
1785 +
1786 for (const path of ["renamed.md", "[literal].txt", " leading.txt", "mode-only.sh"]) {
1787 const stat = branch.files!.find((file) => file.path === path)!;
1786 - const request = yield* Schema.decodeEffect(ReviewDiffPreviewInput)({
1788 + const request = yield* decodeReviewDiffPreviewInput({
1789 cwd,
1790 baseRef: initialBranch,
1791 file: { path, previousPath: stat.previousPath, sourceKind: "branch-range" },
packages/client-runtime/src/state/boundedThreadSnapshotHttp.test.ts
+6 -2
@@ -120,8 +120,12 @@ const boundedBody = (compact: boolean) => ({
120 });
121 const BoundedJson = Schema.toCodecJson(OrchestrationV2ThreadBoundedSnapshot);
122 const idTableBody = () => {
123 - const snapshot = Schema.decodeSync(BoundedJson)(boundedBody(true));
124 - return Schema.encodeSync(BoundedJson)({ ...snapshot, idTable: true });
123 + const decodeBoundedJson = Schema.decodeSync(BoundedJson);
124 +
125 + const snapshot = decodeBoundedJson(boundedBody(true));
126 + const encodeBoundedJson = Schema.encodeSync(BoundedJson);
127 +
128 + return encodeBoundedJson({ ...snapshot, idTable: true });
129 };
130
131 describe("boundedThreadSnapshotLoader", () => {
packages/contracts/src/auth.test.ts
+9 -3
@@ -14,8 +14,12 @@ import {
14
15 describe("authorization grants", () => {
16 it("decodes legacy review credentials without offering them in new grants", () => {
17 - expect(Schema.decodeSync(AuthEnvironmentScopes)(["review:write"])).toEqual(["review:write"]);
18 - expect(() => Schema.decodeUnknownSync(AuthGrantScopes)(["review:write"])).toThrow();
17 + const decodeAuthEnvironmentScopes = Schema.decodeSync(AuthEnvironmentScopes);
18 +
19 + expect(decodeAuthEnvironmentScopes(["review:write"])).toEqual(["review:write"]);
20 + const decodeAuthGrantScopes = Schema.decodeUnknownSync(AuthGrantScopes);
21 +
22 + expect(() => decodeAuthGrantScopes(["review:write"])).toThrow();
23 expect(AuthStandardClientScopes).not.toContain("review:write");
24 });
25
@@ -52,7 +56,9 @@ describe("authorization grants", () => {
56 });
57
58 it("ignores unknown response permissions without falling back to broader scopes", () => {
55 - const session = Schema.decodeUnknownSync(AuthSessionState)({
59 + const decodeAuthSessionState = Schema.decodeUnknownSync(AuthSessionState);
60 +
61 + const session = decodeAuthSessionState({
62 authenticated: true,
63 auth: {
64 policy: "loopback-browser",
packages/contracts/src/baseSchemas.test.ts
+3 -7
@@ -34,14 +34,10 @@ describe("ForwardCompatibleArray", () => {
34 const Named = ForwardCompatibleArray(Schema.Struct({ name: TrimmedNonEmptyString }));
35
36 it("drops an element it cannot encode instead of failing the array", () => {
37 + const encodeNamed = Schema.encodeUnknownSync(Schema.toCodecJson(Named));
38 +
39 const wire = JSON.parse(
38 - JSON.stringify(
39 - Schema.encodeUnknownSync(Schema.toCodecJson(Named))([
40 - { name: "a" },
41 - { name: " " },
42 - { name: "b" },
43 - ]),
44 - ),
40 + JSON.stringify(encodeNamed([{ name: "a" }, { name: " " }, { name: "b" }])),
41 );
42 expect(wire).toEqual([{ name: "a" }, { name: "b" }]);
43 expect(fromWire(Named)(wire)).toEqual([{ name: "a" }, { name: "b" }]);
packages/contracts/src/composerContext.test.ts
+5 -1
@@ -178,7 +178,11 @@ describe("OrchestrationMessageContext", () => {
178 });
179
180 it("sends a message without the records the wire cannot carry", () => {
181 - const wire = Schema.encodeUnknownSync(Schema.toCodecJson(OrchestrationMessageContext))({
181 + const encodeOrchestrationMessageContext = Schema.encodeUnknownSync(
182 + Schema.toCodecJson(OrchestrationMessageContext),
183 + );
184 +
185 + const wire = encodeOrchestrationMessageContext({
186 version: 1,
187 records: [
188 decodeContext({ version: 1, records: [knownRecords.terminal] }).records[0],
packages/effect-acp/src/client.ts
+2 -1
@@ -722,6 +722,7 @@ function normalizePermissionRequest(
722 ...(request._meta === undefined ? {} : { _meta: request._meta }),
723 };
724 }
725 +const decodeMessageMcpNotification = Schema.decodeUnknownEffect(AcpSchemaV2.MessageMcpNotification);
726
727 export const make = Effect.fn("effect-acp/AcpClient.make")(function* (
728 stdio: AcpProtocol.AcpStdio,
@@ -1267,7 +1268,7 @@ export const make = Effect.fn("effect-acp/AcpClient.make")(function* (
1268 handleMcpNotification: (handler) =>
1269 Effect.sync(() => {
1270 extNotificationHandlers.set(CLIENT_METHODS.mcp_message, (params) =>
1270 - Schema.decodeUnknownEffect(AcpSchemaV2.MessageMcpNotification)(params).pipe(
1271 + decodeMessageMcpNotification(params).pipe(
1272 Effect.mapError(() => AcpError.AcpRequestError.invalidParams()),
1273 Effect.flatMap(handler),
1274 ),
packages/effect-acp/src/errors.test.ts
+6 -3
@@ -126,14 +126,17 @@ describe("effect-acp errors", () => {
126 it.effect("summarizes schema issues by path without payload values", () =>
127 Effect.gen(function* () {
128 const secret = "acp-summary-secret";
129 - const cause = yield* Schema.decodeUnknownEffect(
129 + const decodeStruct = Schema.decodeUnknownEffect(
130 Schema.Struct({
131 update: Schema.Struct({ used: Schema.Number, size: Schema.Number }),
132 env: Schema.Record(Schema.String, Schema.Number),
133 }),
134 - )({ update: { size: secret }, env: { [`${secret} key`]: secret } }, { errors: "all" }).pipe(
135 - Effect.flip,
134 );
135 +
136 + const cause = yield* decodeStruct(
137 + { update: { size: secret }, env: { [`${secret} key`]: secret } },
138 + { errors: "all" },
139 + ).pipe(Effect.flip);
140 const error = AcpError.AcpProtocolParseError.fromSchemaError(
141 "decode-notification-payload",
142 "session/update",
packages/effect-acp/src/protocol.test.ts
+4 -3
@@ -496,10 +496,11 @@ it.layer(NodeServices.layer)("effect-acp protocol", (it) => {
496 headers: [],
497 }),
498 );
499 -
500 - const response = yield* Schema.decodeEffect(Schema.fromJsonString(JsonRpcErrorResponse))(
501 - yield* Queue.take(output),
499 + const decodeJsonRpcErrorResponse = Schema.decodeEffect(
500 + Schema.fromJsonString(JsonRpcErrorResponse),
501 );
502 +
503 + const response = yield* decodeJsonRpcErrorResponse(yield* Queue.take(output));
504 assert.equal(response.id, 9);
505 assert.equal(response.error.code, -32603);
506 }),
packages/effect-acp/src/schema.test.ts
+6 -4
@@ -15,9 +15,11 @@ describe("pinned ACP wire schemas", () => {
15
16 it("keeps v1 command inputs compatible with native agents", () => {
17 const command = { name: "plan", description: "Make a plan", input: { hint: "Task" } };
18 - expect(Schema.is(V1.AvailableCommand)(command)).toBe(true);
19 - expect(
20 - Schema.is(V2.AvailableCommand)({ ...command, input: { type: "text", hint: "Task" } }),
21 - ).toBe(true);
18 + const isAvailableCommand = Schema.is(V1.AvailableCommand);
19 +
20 + expect(isAvailableCommand(command)).toBe(true);
21 + const isAvailableCommand2 = Schema.is(V2.AvailableCommand);
22 +
23 + expect(isAvailableCommand2({ ...command, input: { type: "text", hint: "Task" } })).toBe(true);
24 });
25 });
packages/effect-codex-app-server/src/schema.test.ts
+19 -10
@@ -45,21 +45,29 @@ it("accepts Codex 0.150 multi-agent values", () => {
45 for (const schema of schemas) {
46 assert.equal(Schema.is(schema)("completed"), true);
47 }
48 + const isServerNotificationCollabAgentTool = Schema.is(
49 + CodexSchema.ServerNotification__CollabAgentTool,
50 + );
51 +
52 + const isV2ThreadResumeResponseCollabAgentTool = Schema.is(
53 + CodexSchema.V2ThreadResumeResponse__CollabAgentTool,
54 + );
55
56 for (const tool of ["sendMessage", "followupTask", "interruptAgent", "listAgents"]) {
50 - assert.equal(Schema.is(CodexSchema.ServerNotification__CollabAgentTool)(tool), true);
51 - assert.equal(Schema.is(CodexSchema.V2ThreadResumeResponse__CollabAgentTool)(tool), true);
57 + assert.equal(isServerNotificationCollabAgentTool(tool), true);
58 + assert.equal(isV2ThreadResumeResponseCollabAgentTool(tool), true);
59 }
53 -
54 - assert.equal(
55 - Schema.is(CodexSchema.ServerNotification__CollabAgentToolCallStatus)("interrupted"),
56 - true,
60 + const isServerNotificationCollabAgentToolCallStatus = Schema.is(
61 + CodexSchema.ServerNotification__CollabAgentToolCallStatus,
62 );
58 - assert.equal(
59 - Schema.is(CodexSchema.V2ThreadResumeResponse__CollabAgentToolCallStatus)("interrupted"),
60 - true,
63 +
64 + assert.equal(isServerNotificationCollabAgentToolCallStatus("interrupted"), true);
65 + const isV2ThreadResumeResponseCollabAgentToolCallStatus = Schema.is(
66 + CodexSchema.V2ThreadResumeResponse__CollabAgentToolCallStatus,
67 );
68
69 + assert.equal(isV2ThreadResumeResponseCollabAgentToolCallStatus("interrupted"), true);
70 +
71 const resumeResponse = {
72 approvalPolicy: "never",
73 approvalsReviewer: "user",
@@ -99,8 +107,9 @@ it("accepts Codex 0.150 multi-agent values", () => {
107 updatedAt: 0,
108 },
109 };
110 + const isV2ThreadResumeResponse = Schema.is(CodexSchema.V2ThreadResumeResponse);
111
103 - assert.equal(Schema.is(CodexSchema.V2ThreadResumeResponse)(resumeResponse), true);
112 + assert.equal(isV2ThreadResumeResponse(resumeResponse), true);
113 });
114
115 it("accepts Codex misalignment policy errors for thread responses", () => {
packages/shared/src/otelEnvironment.ts
+2 -1
@@ -138,12 +138,13 @@ const NOT_EXPORTED = "so the signals it configures are not exported";
138
139 const endpoint = (name: string) =>
140 readOrWarn(name, parseHttpUrl, `${name} is not an http or https URL, ${NOT_EXPORTED}`);
141 +const decodeOtlpProtocol = Schema.decodeUnknownOption(OtlpProtocol);
142
143 // The specification reads enum values case-insensitively.
144 const protocol = (name: string) =>
145 readOrWarn(
146 name,
146 - (raw) => Schema.decodeUnknownOption(OtlpProtocol)(raw.toLowerCase()),
147 + (raw) => decodeOtlpProtocol(raw.toLowerCase()),
148 `${name} is not http/protobuf or http/json, ${NOT_EXPORTED}`,
149 );
150
vite.config.ts
+1 -1
@@ -278,7 +278,7 @@ export default defineConfig({
278 { paths: [...RESTRICTED_IMPORT_PATHS, RESTRICTED_PULL_REQUEST_GLYPH_IMPORTS] },
279 ],
280 "t3code/no-global-process-runtime": "error",
281 - "t3code/no-inline-schema-compile": "warn",
281 + "t3code/no-inline-schema-compile": "error",
282 "t3code/no-low-value-comments": "error",
283 "t3code/no-manual-effect-runtime-in-tests": "error",
284 "t3code/no-native-title-tooltip": "error",