Skip to content

Commit 8b92df3

Browse files
chore(lint): enforce t3code/no-inline-schema-compile
1 parent 92d4233 commit 8b92df3

17 files changed

Lines changed: 88 additions & 48 deletions

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,8 +1416,10 @@ describe("AssetAccess", () => {
14161416
},
14171417
]);
14181418
return Effect.gen(function* () {
1419+
const decodeAssetCreateUrlInput = Schema.decodeEffect(AssetCreateUrlInput);
1420+
14191421
// 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({
14211423
resource: { _tag: "github-media", cwd: "/repo", url },
14221424
});
14231425
const issued = yield* issueAssetUrl({ resource });
@@ -1446,6 +1448,8 @@ describe("AssetAccess", () => {
14461448

14471449
it.effect("refuses media no host keeps behind a credential, without echoing the URL", () =>
14481450
Effect.gen(function* () {
1451+
const encodeAssetAccessError = Schema.encodeEffect(Schema.fromJsonString(AssetAccessError));
1452+
14491453
for (const url of [
14501454
"https://example.com/shot.png",
14511455
"https://example.com/shot.png?token=private-media-token",
@@ -1454,7 +1458,7 @@ describe("AssetAccess", () => {
14541458
resource: { _tag: SOURCE_CONTROL_MEDIA_ASSET, cwd: "/repo", url },
14551459
}).pipe(Effect.flip);
14561460
expect(error._tag).toBe("AssetGitHubMediaUrlValidationError");
1457-
const encoded = yield* Schema.encodeEffect(Schema.fromJsonString(AssetAccessError))(error);
1461+
const encoded = yield* encodeAssetAccessError(error);
14581462
expect(encoded).not.toContain(url);
14591463
}
14601464
}).pipe(Effect.provide(layerTest)),

‎apps/server/src/auth/RpcAuthorization.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,10 @@ const SettingsUpdate = Schema.Struct({
234234
patch: ServerSettingsPatch,
235235
providerInstanceMutation: Schema.optionalKey(ProviderInstanceMutation),
236236
});
237+
const decodeSettingsUpdate = Schema.decodeUnknownSync(SettingsUpdate);
237238

238239
const requiredScopesForSettingsUpdate = (payload: unknown) => {
239-
const input = Schema.decodeUnknownSync(SettingsUpdate)(payload);
240+
const input = decodeSettingsUpdate(payload);
240241
const scopes = requiredScopesForServerSettingsPatch(input.patch);
241242
if (input.providerInstanceMutation === undefined) return scopes;
242243
return Object.values(input.patch).every((value) => value === undefined)
@@ -245,6 +246,7 @@ const requiredScopesForSettingsUpdate = (payload: unknown) => {
245246
};
246247

247248
const decodeProjectMutation = Schema.decodeUnknownSync(ProjectMutation);
249+
const decodeAssetCreateUrlInput = Schema.decodeUnknownSync(AssetCreateUrlInput);
248250

249251
const requiredScopesForRpcCall = (
250252
method: string,
@@ -254,7 +256,7 @@ const requiredScopesForRpcCall = (
254256
return [AuthEnvironmentMaintainScope, AuthDiagnosticsReadScope];
255257
}
256258
if (method === WS_METHODS.assetsCreateUrl) {
257-
const { resource } = Schema.decodeUnknownSync(AssetCreateUrlInput)(payload);
259+
const { resource } = decodeAssetCreateUrlInput(payload);
258260
return [
259261
resource._tag === "workspace-file" ||
260262
resource._tag === "media-file" ||

‎apps/server/src/provider/ClaudeCapabilitiesProbe.test.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313

1414
vi.mock("@anthropic-ai/claude-agent-sdk", { spy: true });
1515

16+
const decodeClaudeSettings = Schema.decodeEffect(ClaudeSettings);
17+
1618
it("drops strict MCP mode, and only that, next to an administrator's managed-mcp.json", () => {
1719
const options = buildClaudeCapabilitiesProbeQueryOptions({
1820
executablePath: "/usr/bin/claude",
@@ -31,7 +33,7 @@ it("drops strict MCP mode, and only that, next to an administrator's managed-mcp
3133
it.effect("reports a deleted worktree's scan as finished, not pending", () =>
3234
Effect.gen(function* () {
3335
const snapshot = yield* probeClaudeWorkspaceSnapshot(
34-
yield* Schema.decodeEffect(ClaudeSettings)({}),
36+
yield* decodeClaudeSettings({}),
3537
{ skills: [], slashCommands: [] } as unknown as ServerProvider,
3638
"/nonexistent/t3-deleted-worktree",
3739
{ HOME: "/nonexistent/t3-home" },

‎apps/server/src/provider/acp/AntigravityProtocol.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ function sanitizeToolValue(value: unknown, budget: ToolPayloadBudget, depth: num
228228
export function sanitizeAntigravityToolPayload(payload: unknown): unknown {
229229
return sanitizeToolValue(payload, { nodes: 512, text: 64_000 }, 0);
230230
}
231+
const isJsonRecord = Schema.is(Schema.Record(Schema.String, Schema.Json));
231232

232233
export function normalizeAntigravitySessionUpdate(
233234
notification: EffectAcpSchema.SessionNotification,
@@ -256,9 +257,7 @@ export function normalizeAntigravitySessionUpdate(
256257
? { rawOutput: sanitizeAntigravityToolPayload(update.rawOutput) }
257258
: {}),
258259
...(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 } : {}),
262261
},
263262
};
264263
}

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,10 +1737,14 @@ it.layer(NodeServices.layer)("server settings", (it) => {
17371737
runOnWorktreeCreate: false,
17381738
};
17391739
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(
17421744
Schema.fromJsonString(Schema.Array(ProjectScript)),
1743-
)([script]);
1745+
);
1746+
1747+
const scriptsJson = yield* encodeProjectScripts([script]);
17441748
for (const [projectId, modelColumn, envMode, autoPull, scripts] of [
17451749
[legacyProject, modelJson, "worktree", 1, scriptsJson],
17461750
[scriptedProject, null, null, 0, scriptsJson],

‎apps/server/src/vcs/GitVcsDriverCore.test.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1781,9 +1781,11 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
17811781
baseRef: initialBranch,
17821782
});
17831783
const branch = preview.sources.find((source) => source.kind === "branch-range")!;
1784+
const decodeReviewDiffPreviewInput = Schema.decodeEffect(ReviewDiffPreviewInput);
1785+
17841786
for (const path of ["renamed.md", "[literal].txt", " leading.txt", "mode-only.sh"]) {
17851787
const stat = branch.files!.find((file) => file.path === path)!;
1786-
const request = yield* Schema.decodeEffect(ReviewDiffPreviewInput)({
1788+
const request = yield* decodeReviewDiffPreviewInput({
17871789
cwd,
17881790
baseRef: initialBranch,
17891791
file: { path, previousPath: stat.previousPath, sourceKind: "branch-range" },

‎packages/client-runtime/src/state/boundedThreadSnapshotHttp.test.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,12 @@ const boundedBody = (compact: boolean) => ({
120120
});
121121
const BoundedJson = Schema.toCodecJson(OrchestrationV2ThreadBoundedSnapshot);
122122
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 });
125129
};
126130

127131
describe("boundedThreadSnapshotLoader", () => {

‎packages/contracts/src/auth.test.ts‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ import {
1414

1515
describe("authorization grants", () => {
1616
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();
1923
expect(AuthStandardClientScopes).not.toContain("review:write");
2024
});
2125

@@ -52,7 +56,9 @@ describe("authorization grants", () => {
5256
});
5357

5458
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({
5662
authenticated: true,
5763
auth: {
5864
policy: "loopback-browser",

‎packages/contracts/src/baseSchemas.test.ts‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,10 @@ describe("ForwardCompatibleArray", () => {
3434
const Named = ForwardCompatibleArray(Schema.Struct({ name: TrimmedNonEmptyString }));
3535

3636
it("drops an element it cannot encode instead of failing the array", () => {
37+
const encodeNamed = Schema.encodeUnknownSync(Schema.toCodecJson(Named));
38+
3739
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" }])),
4541
);
4642
expect(wire).toEqual([{ name: "a" }, { name: "b" }]);
4743
expect(fromWire(Named)(wire)).toEqual([{ name: "a" }, { name: "b" }]);

‎packages/contracts/src/composerContext.test.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,11 @@ describe("OrchestrationMessageContext", () => {
178178
});
179179

180180
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({
182186
version: 1,
183187
records: [
184188
decodeContext({ version: 1, records: [knownRecords.terminal] }).records[0],

0 commit comments

Comments
 (0)