Skip to content

Commit 4f53d02

Browse files
chore(lint): enforce unnecessaryPipeChain
1 parent d046f9b commit 4f53d02

6 files changed

Lines changed: 63 additions & 68 deletions

File tree

‎apps/server/scripts/acp-mock-agent.ts‎

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -937,21 +937,20 @@ const program = Effect.gen(function* () {
937937
},
938938
});
939939
});
940-
yield* Effect.sleep("1200 millis")
941-
.pipe(
942-
Effect.andThen(
943-
Effect.sync(() => {
944-
writeJsonRpcNotification("_x.ai/task_completed", {
945-
sessionId: cancelledSessionId,
946-
update: {
947-
sessionUpdate: "task_completed",
948-
task_snapshot: { task_id: "task-bg-1", command: "sleep 30" },
949-
},
950-
});
951-
}),
952-
),
953-
)
954-
.pipe(Effect.forkDetach);
940+
yield* Effect.sleep("1200 millis").pipe(
941+
Effect.andThen(
942+
Effect.sync(() => {
943+
writeJsonRpcNotification("_x.ai/task_completed", {
944+
sessionId: cancelledSessionId,
945+
update: {
946+
sessionUpdate: "task_completed",
947+
task_snapshot: { task_id: "task-bg-1", command: "sleep 30" },
948+
},
949+
});
950+
}),
951+
),
952+
Effect.forkDetach,
953+
);
955954
}
956955
}),
957956
);

‎apps/server/src/mcp/toolkits/pullRequests/handlers.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,10 @@ const make = Effect.gen(function* () {
220220
if (threadId === undefined) {
221221
return yield* new PullRequestThreadRequiredError();
222222
}
223-
const thread = yield* engine
224-
.getThreadShell(threadId)
225-
.pipe(Effect.map(Option.fromNullishOr))
226-
.pipe(Effect.mapError((cause) => new Failure({ cause })));
223+
const thread = yield* engine.getThreadShell(threadId).pipe(
224+
Effect.map(Option.fromNullishOr),
225+
Effect.mapError((cause) => new Failure({ cause })),
226+
);
227227
if (Option.isNone(thread) || thread.value.deletedAt !== null) {
228228
return yield* new PullRequestThreadNotFoundError({ threadId });
229229
}

‎apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,12 +1359,11 @@ describe("ClaudeAdapterV2 resume compaction", () => {
13591359
assert.equal(planEvent.value.plan.markdown, longPlan.trim());
13601360
}
13611361
}
1362-
const requestEvent = yield* runtime.events
1363-
.pipe(
1364-
Stream.filter((event) => event.type === "runtime_request.updated"),
1365-
Stream.runHead,
1366-
)
1367-
.pipe(Effect.forkScoped);
1362+
const requestEvent = yield* runtime.events.pipe(
1363+
Stream.filter((event) => event.type === "runtime_request.updated"),
1364+
Stream.runHead,
1365+
Effect.forkScoped,
1366+
);
13681367
const controller = new AbortController();
13691368
const dialog = yield* Effect.promise(() =>
13701369
callback!(

‎apps/server/src/orchestration-v2/ThreadManagementService.ts‎

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -724,28 +724,27 @@ const make = Effect.gen(function* () {
724724
fields,
725725
filter,
726726
) =>
727-
ensureProjectionTranscript(input.threadId)
728-
.pipe(Effect.andThen(orchestrator.getThreadRecords(input.threadId, fields, filter)))
729-
.pipe(
730-
Effect.mapError(
731-
(cause) =>
732-
new ThreadManagementProjectionLoadError({
733-
projectId: input.projectId,
734-
threadId: input.threadId,
735-
cause,
736-
}),
737-
),
738-
Effect.flatMap((projection) =>
739-
projection.thread.projectId === input.projectId && projection.thread.deletedAt === null
740-
? Effect.succeed(projection)
741-
: Effect.fail(
742-
new ThreadManagementThreadNotFoundError({
743-
projectId: input.projectId,
744-
threadId: input.threadId,
745-
}),
746-
),
747-
),
748-
);
727+
ensureProjectionTranscript(input.threadId).pipe(
728+
Effect.andThen(orchestrator.getThreadRecords(input.threadId, fields, filter)),
729+
Effect.mapError(
730+
(cause) =>
731+
new ThreadManagementProjectionLoadError({
732+
projectId: input.projectId,
733+
threadId: input.threadId,
734+
cause,
735+
}),
736+
),
737+
Effect.flatMap((projection) =>
738+
projection.thread.projectId === input.projectId && projection.thread.deletedAt === null
739+
? Effect.succeed(projection)
740+
: Effect.fail(
741+
new ThreadManagementThreadNotFoundError({
742+
projectId: input.projectId,
743+
threadId: input.threadId,
744+
}),
745+
),
746+
),
747+
);
749748

750749
const listProjectThreads: ThreadManagementServiceShape["listProjectThreads"] = (input) =>
751750
orchestrator.getShellSnapshot({ projectId: input.projectId, location: "active" }).pipe(

‎apps/server/src/usage/UsageService.ts‎

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -623,30 +623,27 @@ export const make = Effect.gen(function* () {
623623
const scans = Effect.forEach(
624624
scanReaders,
625625
({ driver, reader }) =>
626-
usageInstances(driver, settings)
627-
.pipe(
628-
Effect.flatMap((instances) =>
629-
reader.scan({ instances, settings, windowStartMs, retentionCutoffMs, awaitRefresh }),
630-
),
631-
)
632-
.pipe(
633-
Effect.flatMap((sources) =>
634-
Effect.forEach(sources, ({ volumeId, ...source }) =>
635-
Effect.map(
636-
volumeId === undefined
637-
? Effect.promise(() => readDirectoryVolumeId(source.dir))
638-
: Effect.succeed(volumeId),
639-
(resolved): ScannedDir => ({
640-
...source,
641-
files: source.files?.map((file) => ({ ...file, malformedRecords: 0 })) ?? null,
642-
provider: reader.provider,
643-
volumeId: resolved,
644-
}),
645-
),
626+
usageInstances(driver, settings).pipe(
627+
Effect.flatMap((instances) =>
628+
reader.scan({ instances, settings, windowStartMs, retentionCutoffMs, awaitRefresh }),
629+
),
630+
Effect.flatMap((sources) =>
631+
Effect.forEach(sources, ({ volumeId, ...source }) =>
632+
Effect.map(
633+
volumeId === undefined
634+
? Effect.promise(() => readDirectoryVolumeId(source.dir))
635+
: Effect.succeed(volumeId),
636+
(resolved): ScannedDir => ({
637+
...source,
638+
files: source.files?.map((file) => ({ ...file, malformedRecords: 0 })) ?? null,
639+
provider: reader.provider,
640+
volumeId: resolved,
641+
}),
646642
),
647643
),
648-
Effect.provideContext(readerContext),
649644
),
645+
Effect.provideContext(readerContext),
646+
),
650647
{ concurrency: "unbounded" },
651648
);
652649

‎tsconfig.base.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"namespaceImportPackages": ["@effect/platform-node", "effect"],
2525
"effectFn": ["span", "inferred-span", "suggested-span"],
2626
"diagnosticSeverity": {
27+
"unnecessaryPipeChain": "error",
2728
"effectSucceedWithVoid": "error",
2829
"returnEffectInGen": "off",
2930
"effectFnOpportunity": "suggestion",

0 commit comments

Comments
 (0)