Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ const ReadyTerminalSurface = memo(function ReadyTerminalSurface({
if (NativeTerminalSurfaceView) {
return (
<View style={props.style}>
{/* oxlint-disable-next-line react/static-components -- The resolver returns a cached native component with stable identity. */}
<NativeTerminalSurfaceView
ref={nativeRef}
appearanceScheme={themeAppearance}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ function setup() {
// Mirrors the draft screen applying its route project on mount, before the provider's effects run.
useEffect(() => {
if (props.pickOnMount) value.setProject(props.pickOnMount);
// oxlint-disable-next-line react/exhaustive-effect-dependencies -- picks once on mount; setProject changes every render
}, []);
return null;
}
Expand Down
1 change: 1 addition & 0 deletions apps/mobile/src/features/threads/thread-work-log.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,7 @@ function HighlightedCodeText({
let offset = 0;
const highlighted = lines?.flatMap((line, lineIndex) => {
const separator = lineIndex > 0 ? "\n" : "";
// oxlint-disable-next-line react/immutability -- flatMap runs synchronously during render
offset += separator.length;
return [
separator,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ function WorkflowScript(props: { readonly script: string }) {
let offset = 0;
const highlighted = lines?.slice(0, shownLines).flatMap((line, lineIndex) => {
const separator = lineIndex > 0 ? "\n" : "";
// oxlint-disable-next-line react/immutability -- flatMap runs synchronously during render
offset += separator.length;
return [
separator,
Expand Down
1 change: 1 addition & 0 deletions apps/mobile/src/native/HighlightedCodeBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export function HighlightedCodeBlock(props: {
>
{lines?.flatMap((line, lineIndex) => {
const separator = lineIndex > 0 ? "\n" : "";
// oxlint-disable-next-line react/immutability -- flatMap runs synchronously during render
offset += separator.length;
return [
separator,
Expand Down
10 changes: 6 additions & 4 deletions apps/server/src/orchestration-v2/Orchestrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12936,10 +12936,12 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
if (Option.isNone(session) || session.value.hasPendingBackgroundWorkForThread === undefined) {
return false;
}
return yield* session.value
.hasPendingBackgroundWorkForThread(providerThread)
// A failed probe cannot confirm that the work ended.
.pipe(Effect.catchCause(() => Effect.succeed(true)));
return yield* (
session.value
.hasPendingBackgroundWorkForThread(providerThread)
// A failed probe cannot confirm that the work ended.
.pipe(Effect.catchCause(() => Effect.succeed(true)))
);
});
for (const item of pendingBackgroundTurnItems({
turnItems: input.projection.turnItems,
Expand Down
9 changes: 4 additions & 5 deletions apps/server/src/orchestration-v2/PullRequestWatchReactor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -990,11 +990,10 @@ export const make = Effect.gen(function* () {
yield* forkParked(
Stream.runForEach(engine.streamDomainEvents, (event) => {
if (event.type !== "thread.pull-request-synced") return Effect.void;
const unread = visibleThreadPullRequests(event.payload.pullRequests ?? []).flatMap(
(link) =>
link.watch === undefined || lives.has(lifeKeyOf(event.threadId, link, link.watch))
? []
: [threadPullRequestKeyOf(link)],
const unread = visibleThreadPullRequests(event.payload.pullRequests ?? []).flatMap((link) =>
link.watch === undefined || lives.has(lifeKeyOf(event.threadId, link, link.watch))
? []
: [threadPullRequestKeyOf(link)],
);
return Effect.forEach(new Set(unread), readOnChange, { discard: true });
}).pipe(Effect.catchCause(logFailure("pull request watch event stream failed", {}))),
Expand Down
12 changes: 6 additions & 6 deletions apps/server/src/orchestration-v2/ThreadSettlementService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -650,12 +650,12 @@ const makeHarness = Effect.fn("makeThreadSettlementHarness")(function* (options:
]);
return yield* (
options.pullRequestSummary?.(input, readOptions) ??
Effect.succeed(
makePullRequestSummary({
...input,
state: "open",
}),
)
Effect.succeed(
makePullRequestSummary({
...input,
state: "open",
}),
)
);
});

Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/project/ProjectCloneTracker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe("ProjectCloneTracker", () => {
Effect.gen(function* () {
yield* (
options?.onProgress?.({ stage: "receiving", percent: 40, detail: "1 MiB" }) ??
Effect.void
Effect.void
);
yield* Deferred.await(release);
return { cwd: input.destinationPath, remoteUrl: input.remoteUrl ?? "", repository: null };
Expand Down
29 changes: 14 additions & 15 deletions apps/server/src/pullRequest/PullRequestService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2911,21 +2911,20 @@ export const make = Effect.gen(function* () {
);
}
return viewerPermissionsOf(project, input, "labelCandidates").pipe(
Effect.flatMap(
(viewer): Effect.Effect<PullRequestLabelCandidateList, PullRequestError> =>
viewer.labels === false
? Effect.fail(
new PullRequestOperationError({
operation: "labelCandidates",
detail: LABEL_CHANGE_REFUSAL,
}),
)
: list({
cwd: project.project.workspaceRoot,
repository: project.repository,
host: project.host,
number: input.number,
}).pipe(Effect.mapError(toPullRequestError("labelCandidates"))),
Effect.flatMap((viewer): Effect.Effect<PullRequestLabelCandidateList, PullRequestError> =>
viewer.labels === false
? Effect.fail(
new PullRequestOperationError({
operation: "labelCandidates",
detail: LABEL_CHANGE_REFUSAL,
}),
)
: list({
cwd: project.project.workspaceRoot,
repository: project.repository,
host: project.host,
number: input.number,
}).pipe(Effect.mapError(toPullRequestError("labelCandidates"))),
),
);
}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, expect, it } from "vitest";
import { describe, expect, it } from "vite-plus/test";

import {
gitattributesDirectories,
Expand Down
8 changes: 4 additions & 4 deletions apps/server/src/terminal/Manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2777,10 +2777,10 @@ export const makeWithOptions = Effect.fn("TerminalManager.makeWithOptions")(func
if (!candidate) {
return yield* (
lastError ??
new PtyAdapter.PtySpawnError({
adapter: "terminal-manager",
attemptedShells: [],
})
new PtyAdapter.PtySpawnError({
adapter: "terminal-manager",
attemptedShells: [],
})
);
}

Expand Down
2 changes: 0 additions & 2 deletions apps/web/src/components/CommandPalette.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,6 @@ function OpenCommandPaletteDialog(props: {
),
)
: null;
// oxlint-disable-next-line react/purity -- runs in an event handler (oxc#27309)
const now = new Date().toISOString();
const openableThreads = threads.filter(
(thread) => thread.settledOverride !== "settled" && !effectiveSnoozed(thread, { now }),
Expand Down Expand Up @@ -2329,7 +2328,6 @@ function OpenCommandPaletteDialog(props: {
input: {
projectId: newProjectId(),
title: inferProjectTitleFromPath(destinationPath),
// oxlint-disable-next-line react/purity -- runs in an event handler (oxc#27309)
createdAt: new Date().toISOString(),
remoteUrl: addProjectCloneFlow.remoteUrl,
destinationPath,
Expand Down
1 change: 0 additions & 1 deletion apps/web/src/components/CommandPaletteThreadItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ export function useCommandPaletteThreadItems(input: {
const isOpen =
activeThread?.environmentId === thread.environmentId && activeThread.id === thread.id;
if (threadSearchQuery.trim().length > 0 && !threadSearchQuery.startsWith(">") && !isOpen) {
// oxlint-disable-next-line react/purity -- runs in an event handler (oxc#27309)
claimThreadOpen(thread.environmentId, thread.id, Date.now());
}
if (
Expand Down
9 changes: 1 addition & 8 deletions apps/web/src/components/chat/ChatHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,7 @@ export const ChatHeader = memo(function ChatHeader({
document.fonts.removeEventListener("loadingdone", measure);
stopObserving();
};
}, [
// oxlint-disable-next-line react/exhaustive-effect-dependencies -- Title, font and rename changes resize the breadcrumb text without resizing the list, so it re-measures.
activeProjectName,
activeThreadTitle,
parentThreadLink,
interfaceFont,
isRenamingTitle,
]);
}, [activeProjectName, activeThreadTitle, parentThreadLink, interfaceFont, isRenamingTitle]);
const renameCommittedRef = useRef(false);
const startRename = () => {
if (
Expand Down
1 change: 0 additions & 1 deletion apps/web/src/components/chat/ComposerImageThumbnail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export const ComposerImageThumbnail = memo(function ComposerImageThumbnail({
const cached = readComposerImageThumbnail(file);
if (file.size <= MAX_COMPRESSIBLE_SOURCE_BYTES && !isHeicImageFile(file) && !cached) {
localUrl = URL.createObjectURL(file);
// oxlint-disable-next-line react/set-state-in-effect -- the blob URL is created and revoked by this effect
setPreview({ file, src: localUrl });
}
if (cached === undefined) {
Expand Down
7 changes: 1 addition & 6 deletions apps/web/src/components/chat/ModelPickerSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,7 @@ export const ModelPickerSidebar = memo(function ModelPickerSidebar(props: {
return;
}
setSelectedIndicatorTop(selectedItem.offsetTop + selectedItem.offsetHeight / 2 - 10);
}, [
// oxlint-disable-next-line react/exhaustive-effect-dependencies -- Adding, removing or reordering providers moves the selected item, so the indicator re-measures.
props.instanceEntries,
props.selectedInstanceId,
showFavorites,
]);
}, [props.instanceEntries, props.selectedInstanceId, showFavorites]);

return (
<Toolbar.Root
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
type PullRequestDetailView,
} from "@t3tools/contracts";
import { expect, it, vi } from "vite-plus/test";
import { userEvent } from "vite-plus/test/browser";
import appCss from "~/index.css?inline";
import { DraftId, useComposerDraftStore } from "~/composerDraftStore";
import { act, fakeTimers, render } from "../../../test/render";
Expand Down Expand Up @@ -190,7 +189,8 @@ it("reads the first diff page once the pointer rests on the Code tab", async ()
const code = screen.getByRole("button", { name: "Code", exact: true });
await expect.element(code).toBeVisible();

await userEvent.hover(code);
// userEvent actions advance fake timers while they run, which would skip past the rest delay.
await act(() => code.element().dispatchEvent(new PointerEvent("pointerover", { bubbles: true })));
await act(() => vi.advanceTimersByTime(149));
expect(reads.diff).toEqual([]);
await act(() => vi.advanceTimersByTime(1));
Expand Down
9 changes: 4 additions & 5 deletions apps/web/src/components/sidebar/updateEverythingRun.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,10 @@ export function retryFailedUpdateRunServers(
options: { readonly quiet: boolean },
) => Promise<ServerUpdateOutcome>,
): void {
const failed = (appAtomRegistry.get(updateEverythingRunAtom)?.machines ?? []).flatMap(
(machine) =>
machine.result === "failed" && machine.server !== null
? [{ target: machine.server, providerFailure: machine.providerFailure }]
: [],
const failed = (appAtomRegistry.get(updateEverythingRunAtom)?.machines ?? []).flatMap((machine) =>
machine.result === "failed" && machine.server !== null
? [{ target: machine.server, providerFailure: machine.providerFailure }]
: [],
);
const pending: typeof failed = [];
for (const entry of failed) {
Expand Down
2 changes: 0 additions & 2 deletions apps/web/src/hooks/useThreadActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,6 @@ export function useThreadActions() {
);
}
const resolved = resolveThreadTarget(target);
// oxlint-disable-next-line react/purity -- runs in an event handler (oxc#27309)
const nowIso = new Date().toISOString();
const wokeAt = resolved ? threadWokeAt(resolved.thread, { now: nowIso }) : null;
const undoPlan = ThreadUndo.planThreadUndo("settle", resolved?.thread);
Expand Down Expand Up @@ -963,7 +962,6 @@ export function useThreadActions() {
);
}
const resolved = resolveThreadTarget(target);
// oxlint-disable-next-line react/purity -- runs in an event handler (oxc#27309)
if (resolved && !canSnooze(resolved.thread, { now: new Date().toISOString() })) {
return AsyncResult.failure(
Cause.fail(
Expand Down
2 changes: 1 addition & 1 deletion apps/web/test/environmentHttpTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export async function installEnvironmentHttpTest(scenario: EnvironmentHttpTestSc
calls.pairingCredential.push(payload);
return yield* (
scenario.pairingCredential?.(payload) ??
unexpectedEndpoint("auth.pairingCredential")
unexpectedEndpoint("auth.pairingCredential")
);
}),
)
Expand Down
106 changes: 55 additions & 51 deletions infra/relay/src/environments/ManagedEndpointAllocations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,33 +248,35 @@ const make = Effect.gen(function* () {
input: ReserveManagedEndpointAllocationInput,
) {
const now = DateTime.formatIso(yield* DateTime.now);
const inserted = yield* db
.insert(relayManagedEndpointAllocations)
.values({
...input,
createdAt: now,
updatedAt: now,
})
// Refreshing updatedAt makes a re-reserved row count toward the tunnel limit again.
.onConflictDoUpdate({
target: [
relayManagedEndpointAllocations.userId,
relayManagedEndpointAllocations.environmentId,
],
set: { updatedAt: now },
})
.returning(allocationSelection)
.pipe(
Effect.mapError(
(cause) =>
new ManagedEndpointAllocationPersistenceError({
operation: "reserve",
stage: "database-request",
...input,
cause,
}),
),
);
const inserted = yield* (
db
.insert(relayManagedEndpointAllocations)
.values({
...input,
createdAt: now,
updatedAt: now,
})
// Refreshing updatedAt makes a re-reserved row count toward the tunnel limit again.
.onConflictDoUpdate({
target: [
relayManagedEndpointAllocations.userId,
relayManagedEndpointAllocations.environmentId,
],
set: { updatedAt: now },
})
.returning(allocationSelection)
.pipe(
Effect.mapError(
(cause) =>
new ManagedEndpointAllocationPersistenceError({
operation: "reserve",
stage: "database-request",
...input,
cause,
}),
),
)
);

const allocation = inserted[0];
if (allocation === undefined) {
Expand Down Expand Up @@ -582,30 +584,32 @@ const make = Effect.gen(function* () {
claimDeprovision: Effect.fn("relay.managed_endpoint_allocations.claim_deprovision")(function* (
input: ClaimManagedEndpointDeprovisionInput,
) {
const claimed = yield* db
.update(relayManagedEndpointAllocations)
// Claims move only the generation: the tunnel limit reads updatedAt as the last provisioning write.
.set({ generation: sql`${relayManagedEndpointAllocations.generation} + 1` })
.where(
and(
whereAllocation(input),
eq(relayManagedEndpointAllocations.generation, input.generation),
),
)
.returning({ generation: relayManagedEndpointAllocations.generation })
.pipe(
Effect.map((rows) => rows[0]?.generation ?? null),
Effect.mapError(
(cause) =>
new ManagedEndpointAllocationPersistenceError({
operation: "claim-deprovision",
stage: "database-request",
userId: input.userId,
environmentId: input.environmentId,
cause,
}),
),
);
const claimed = yield* (
db
.update(relayManagedEndpointAllocations)
// Claims move only the generation: the tunnel limit reads updatedAt as the last provisioning write.
.set({ generation: sql`${relayManagedEndpointAllocations.generation} + 1` })
.where(
and(
whereAllocation(input),
eq(relayManagedEndpointAllocations.generation, input.generation),
),
)
.returning({ generation: relayManagedEndpointAllocations.generation })
.pipe(
Effect.map((rows) => rows[0]?.generation ?? null),
Effect.mapError(
(cause) =>
new ManagedEndpointAllocationPersistenceError({
operation: "claim-deprovision",
stage: "database-request",
userId: input.userId,
environmentId: input.environmentId,
cause,
}),
),
)
);
return claimed;
}),
removeClaimed: Effect.fn("relay.managed_endpoint_allocations.remove_claimed")(function* (
Expand Down
Loading
Loading