Skip to content
Open
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 @@ -211,6 +211,7 @@ export function extractTableRows(body: string | null | undefined): string[][] {
rows.push(cells);
j += 1;
}
i = j - 1;
}
return rows;
}
Expand Down
1 change: 1 addition & 0 deletions src/review/screenshot-table-gate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ export function extractTableRows(body: string | null | undefined): string[][] {
rows.push(cells);
j += 1;
}
i = j - 1;
}
return rows;
}
Expand Down
9 changes: 9 additions & 0 deletions test/unit/screenshot-table-gate-engine.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
DEFAULT_SCREENSHOT_TABLE_GATE,
evaluateScreenshotTableGate,
extractTableRowImageUrls,
extractTableRows,
hasCommittedImageFile,
hasImageBearingMarkdownTable,
hasImageOutsideTable,
Expand Down Expand Up @@ -322,6 +323,14 @@ describe("requiredScreenshotMatrixPairs (#4535)", () => {
});
});

describe("extractTableRows", () => {
it("extracts a crafted separator-only table once instead of duplicating overlapping regions", () => {
const body = Array.from({ length: 40 }, () => "| --- |").join("\n");

expect(extractTableRows(body)).toHaveLength(38);
});
});

describe("missingScreenshotMatrixPairs (#4535)", () => {
const FULL_MATRIX_BODY = [
"| Viewport · Theme | Before | After |",
Expand Down
9 changes: 9 additions & 0 deletions test/unit/screenshot-table-gate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
DEFAULT_SCREENSHOT_TABLE_GATE,
evaluateScreenshotTableGate,
extractTableRowImageUrls,
extractTableRows,
hasCommittedImageFile,
hasImageBearingMarkdownTable,
hasImageOutsideTable,
Expand Down Expand Up @@ -321,6 +322,14 @@ describe("requiredScreenshotMatrixPairs (#4535)", () => {
});
});

describe("extractTableRows", () => {
it("extracts a crafted separator-only table once instead of duplicating overlapping regions", () => {
const body = Array.from({ length: 40 }, () => "| --- |").join("\n");

expect(extractTableRows(body)).toHaveLength(38);
});
});

describe("missingScreenshotMatrixPairs (#4535)", () => {
const FULL_MATRIX_BODY = [
"| Viewport · Theme | Before | After |",
Expand Down
93 changes: 74 additions & 19 deletions worker-configuration.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable */
// Generated by Wrangler by running `wrangler types` (hash: 31e2a5aa781186e51d85d560f8a9f25b)
// Runtime types generated with workerd@1.20260701.1 2026-05-28 nodejs_compat
// Runtime types generated with workerd@1.20260708.1 2026-05-28 nodejs_compat
interface __BaseEnv_Env {
DB: D1Database;
JOBS: Queue;
Expand Down Expand Up @@ -619,7 +619,7 @@ declare abstract class DurableObjectNamespace<T extends Rpc.DurableObjectBranded
getByName(name: string, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;
jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace<T>;
}
type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high";
type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high" | "us";
interface DurableObjectNamespaceNewUniqueIdOptions {
jurisdiction?: DurableObjectJurisdiction;
}
Expand Down Expand Up @@ -12314,6 +12314,13 @@ interface ForwardableEmailMessage extends EmailMessage {
* @returns A promise that resolves when the email message is replied.
*/
reply(message: EmailMessage): Promise<EmailSendResult>;
/**
* Reply to the sender of this email message with a message built from the given
* fields. Threading headers (In-Reply-To/References) are set automatically.
* @param builder The reply message contents.
* @returns A promise that resolves when the email message is replied.
*/
reply(builder: EmailReplyMessageBuilder): Promise<EmailSendResult>;
}
/** A file attachment for an email message */
type EmailAttachment = {
Expand All @@ -12334,23 +12341,46 @@ interface EmailAddress {
name: string;
email: string;
}
/**
* Recipient fields for `SendEmail.send()`. At least one of `to`, `cc`, or
* `bcc` must be provided.
*/
type EmailDestinations = {
to?: string | EmailAddress | (string | EmailAddress)[];
cc?: string | EmailAddress | (string | EmailAddress)[];
bcc?: string | EmailAddress | (string | EmailAddress)[];
} & ({
to: string | EmailAddress | (string | EmailAddress)[];
} | {
cc: string | EmailAddress | (string | EmailAddress)[];
} | {
bcc: string | EmailAddress | (string | EmailAddress)[];
});
/**
* Fields shared by all composed emails (no recipients). Used directly by
* `ForwardableEmailMessage.reply()`, which always replies to the original
* sender, and extended by `EmailMessageBuilder` for `SendEmail.send()`.
*/
interface EmailReplyMessageBuilder {
from: string | EmailAddress;
subject: string;
replyTo?: string | EmailAddress;
headers?: Record<string, string>;
text?: string;
html?: string;
attachments?: EmailAttachment[];
}
/**
* Fields for composing an email without constructing raw MIME, for
* `SendEmail.send()`. Requires at least one of `to`, `cc`, or `bcc`.
*/
type EmailMessageBuilder = EmailReplyMessageBuilder & EmailDestinations;
/**
* A binding that allows a Worker to send email messages.
*/
interface SendEmail {
send(message: EmailMessage): Promise<EmailSendResult>;
send(builder: {
from: string | EmailAddress;
to: string | EmailAddress | (string | EmailAddress)[];
subject: string;
replyTo?: string | EmailAddress;
cc?: string | EmailAddress | (string | EmailAddress)[];
bcc?: string | EmailAddress | (string | EmailAddress)[];
headers?: Record<string, string>;
text?: string;
html?: string;
attachments?: EmailAttachment[];
}): Promise<EmailSendResult>;
send(builder: EmailMessageBuilder): Promise<EmailSendResult>;
}
declare abstract class EmailEvent extends ExtendableEvent {
readonly message: ForwardableEmailMessage;
Expand Down Expand Up @@ -13172,14 +13202,19 @@ declare namespace CloudflareWorkersModule {
export type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
export type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number;
export type WorkflowDelayDuration = WorkflowSleepDuration;
export type WorkflowDynamicDelayContext = {
ctx: WorkflowStepContext<WorkflowDelayFunction>;
error: Error;
};
export type WorkflowDelayFunction = (input: WorkflowDynamicDelayContext) => WorkflowDelayDuration | Promise<WorkflowDelayDuration>;
export type WorkflowTimeoutDuration = WorkflowSleepDuration;
export type WorkflowRetentionDuration = WorkflowSleepDuration;
export type WorkflowBackoff = 'constant' | 'linear' | 'exponential';
export type WorkflowStepSensitivity = 'output';
export type WorkflowStepConfig = {
retries?: {
limit: number;
delay: WorkflowDelayDuration | number;
delay: WorkflowDelayDuration | number | WorkflowDelayFunction;
backoff?: WorkflowBackoff;
};
timeout?: WorkflowTimeoutDuration | number;
Expand All @@ -13205,13 +13240,22 @@ declare namespace CloudflareWorkersModule {
type: string;
sensitive?: WorkflowStepSensitivity;
};
export type WorkflowStepContext = {
export type WorkflowStepContext<Delay = WorkflowDelayDuration | number> = {
step: {
name: string;
count: number;
};
attempt: number;
config: WorkflowStepConfig;
config: {
retries?: {
limit: number;
backoff?: WorkflowBackoff;
} & (Delay extends WorkflowDelayFunction ? {} : {
delay: WorkflowDelayDuration | number;
});
timeout?: WorkflowTimeoutDuration | number;
sensitive?: WorkflowStepSensitivity;
};
};
export type WorkflowRollbackContext<T = unknown> = {
ctx: WorkflowStepContext;
Expand All @@ -13227,7 +13271,9 @@ declare namespace CloudflareWorkersModule {
};
export abstract class WorkflowStep {
do<T extends Rpc.Serializable<T>>(name: string, callback: (ctx: WorkflowStepContext) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;
do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfig, callback: (ctx: WorkflowStepContext) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;
do<T extends Rpc.Serializable<T>, const C extends WorkflowStepConfig>(name: string, config: C, callback: (ctx: WorkflowStepContext<C['retries'] extends {
delay: infer D;
} ? D : WorkflowDelayDuration | number>) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;
sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
waitForEvent<T extends Rpc.Serializable<T>>(name: string, options: {
Expand Down Expand Up @@ -14137,6 +14183,7 @@ declare namespace TailStream {
readonly dispatchNamespace?: string;
readonly entrypoint?: string;
readonly executionModel: string;
readonly durableObjectId?: string;
readonly scriptName?: string;
readonly scriptTags?: string[];
readonly scriptVersion?: ScriptVersion;
Expand Down Expand Up @@ -14691,6 +14738,13 @@ interface WorkflowError {
code?: number;
message: string;
}
interface WorkflowInstanceTerminateOptions {
/**
* If true, run registered rollback handlers before terminating the instance.
* Only steps that registered rollback handlers are rolled back.
*/
rollback?: boolean;
}
interface WorkflowInstanceRestartOptions {
/**
* Restart from a specific step. If omitted, the instance restarts from the beginning.
Expand Down Expand Up @@ -14724,8 +14778,9 @@ declare abstract class WorkflowInstance {
public resume(): Promise<void>;
/**
* Terminate the instance. If it is errored, terminated or complete, an error will be thrown.
* @param options Options for termination, including whether registered rollback handlers should run.
*/
public terminate(): Promise<void>;
public terminate(options?: WorkflowInstanceTerminateOptions): Promise<void>;
/**
* Restart the instance. Optionally restart from a specific step, preserving
* cached results for all steps before it.
Expand Down
Loading