Configure lefthook formatter checks (#231)

* Add lefthook formatter checks

* Fix SDK mode hydration

* Stabilize SDK mode integration test
This commit is contained in:
Nathan Flurry 2026-03-10 23:03:11 -07:00 committed by GitHub
parent 0471214d65
commit d2346bafb3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
282 changed files with 5840 additions and 8399 deletions

View file

@ -23,12 +23,7 @@ interface PollingActorContext<TState extends PollingControlState> {
state: TState;
abortSignal: AbortSignal;
queue: {
nextBatch(options: {
names: readonly string[];
timeout: number;
count: number;
completable: true;
}): Promise<PollingQueueMessage[]>;
nextBatch(options: { names: readonly string[]; timeout: number; count: number; completable: true }): Promise<PollingQueueMessage[]>;
};
}
@ -39,21 +34,16 @@ interface RunPollingOptions<TState extends PollingControlState> {
export async function runPollingControlLoop<TState extends PollingControlState>(
c: PollingActorContext<TState>,
options: RunPollingOptions<TState>
options: RunPollingOptions<TState>,
): Promise<void> {
while (!c.abortSignal.aborted) {
const messages = normalizeMessages(
await c.queue.nextBatch({
names: [
options.control.start,
options.control.stop,
options.control.setInterval,
options.control.force
],
names: [options.control.start, options.control.stop, options.control.setInterval, options.control.force],
timeout: Math.max(500, c.state.intervalMs),
count: 16,
completable: true
})
completable: true,
}),
) as PollingQueueMessage[];
if (messages.length === 0) {
@ -94,12 +84,7 @@ export async function runPollingControlLoop<TState extends PollingControlState>(
interface WorkflowPollingActorContext<TState extends PollingControlState> {
state: TState;
loop(config: {
name: string;
historyEvery: number;
historyKeep: number;
run(ctx: WorkflowPollingActorContext<TState>): Promise<unknown>;
}): Promise<void>;
loop(config: { name: string; historyEvery: number; historyKeep: number; run(ctx: WorkflowPollingActorContext<TState>): Promise<unknown> }): Promise<void>;
}
interface WorkflowPollingQueueMessage extends PollingQueueMessage {}
@ -107,12 +92,15 @@ interface WorkflowPollingQueueMessage extends PollingQueueMessage {}
interface WorkflowPollingLoopContext<TState extends PollingControlState> {
state: TState;
queue: {
nextBatch(name: string, options: {
names: readonly string[];
timeout: number;
count: number;
completable: true;
}): Promise<WorkflowPollingQueueMessage[]>;
nextBatch(
name: string,
options: {
names: readonly string[];
timeout: number;
count: number;
completable: true;
},
): Promise<WorkflowPollingQueueMessage[]>;
};
step<T>(
nameOrConfig:
@ -138,12 +126,7 @@ export async function runWorkflowPollingLoop<TState extends PollingControlState>
const messages = normalizeMessages(
await loopCtx.queue.nextBatch("next-polling-control-batch", {
names: [
options.control.start,
options.control.stop,
options.control.setInterval,
options.control.force,
],
names: [options.control.start, options.control.stop, options.control.setInterval, options.control.force],
timeout: control.running ? control.intervalMs : 60_000,
count: 16,
completable: true,
@ -172,37 +155,35 @@ export async function runWorkflowPollingLoop<TState extends PollingControlState>
continue;
}
if (msg.name === options.control.stop) {
await loopCtx.step("control-stop", async () => {
loopCtx.state.running = false;
});
await msg.complete({ ok: true });
continue;
}
if (msg.name === options.control.setInterval) {
await loopCtx.step("control-set-interval", async () => {
const intervalMs = Number((msg.body as { intervalMs?: unknown })?.intervalMs);
loopCtx.state.intervalMs = Number.isFinite(intervalMs)
? Math.max(500, intervalMs)
: loopCtx.state.intervalMs;
});
await msg.complete({ ok: true });
continue;
}
if (msg.name === options.control.force) {
await loopCtx.step({
name: "control-force",
timeout: 5 * 60_000,
run: async () => {
await options.onPoll(loopCtx as unknown as PollingActorContext<TState>);
},
});
await msg.complete({ ok: true });
}
if (msg.name === options.control.stop) {
await loopCtx.step("control-stop", async () => {
loopCtx.state.running = false;
});
await msg.complete({ ok: true });
continue;
}
if (msg.name === options.control.setInterval) {
await loopCtx.step("control-set-interval", async () => {
const intervalMs = Number((msg.body as { intervalMs?: unknown })?.intervalMs);
loopCtx.state.intervalMs = Number.isFinite(intervalMs) ? Math.max(500, intervalMs) : loopCtx.state.intervalMs;
});
await msg.complete({ ok: true });
continue;
}
if (msg.name === options.control.force) {
await loopCtx.step({
name: "control-force",
timeout: 5 * 60_000,
run: async () => {
await options.onPoll(loopCtx as unknown as PollingActorContext<TState>);
},
});
await msg.complete({ ok: true });
}
}
return Loop.continue(undefined);
});
}