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
18 changes: 13 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
]
},
"devDependencies": {
"@eslint/js": "^9.17.0",
"@eslint/js": "^10.0.1",
"@types/node": "^25.0.3",
"@vitest/coverage-v8": "^4.0.16",
"better-sqlite3": "^12.11.1",
Expand Down
8 changes: 5 additions & 3 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,14 @@ export async function loadAuthFile(rawPath: string): Promise<Record<string, unkn
authContent = await readFile(authPath, 'utf-8');
} catch (err) {
if ((err as NodeJS.ErrnoException).code === 'ENOENT') {
throw new Error(`auth file not found: ${authPath}`);
throw new Error(`auth file not found: ${authPath}`, { cause: err });
}
if ((err as NodeJS.ErrnoException).code === 'EISDIR') {
throw new Error(`auth path is a directory, not a file: ${authPath}`);
throw new Error(`auth path is a directory, not a file: ${authPath}`, { cause: err });
}
throw new Error(`could not read auth file ${authPath}: ${(err as Error).message}`);
throw new Error(`could not read auth file ${authPath}: ${(err as Error).message}`, {
cause: err,
});
}

let rawAuth: unknown;
Expand Down
4 changes: 2 additions & 2 deletions src/interpreter/executor-backfill.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ describe('resumable backfill pagination', () => {

it('a run after completion fetches nothing', async () => {
const log = new MemoryExecutionLog();
let offsets = mockApi();
mockApi();

let executionId: string | undefined;
let done = false;
Expand All @@ -134,7 +134,7 @@ describe('resumable backfill pagination', () => {

// Resume once more after the backfill is already complete.
vi.unstubAllGlobals();
offsets = mockApi();
const offsets = mockApi();
await execute(source, {
executionLog: log,
resumeFrom: executionId,
Expand Down
8 changes: 6 additions & 2 deletions src/interpreter/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,9 @@ export class MissionExecutor {
(s) => !isParallelStage(s) && s.action === error.action
);
if (targetIndex === -1) {
throw new Error(`Jump target action not found in pipeline: ${error.action}`);
throw new Error(`Jump target action not found in pipeline: ${error.action}`, {
cause: error,
});
}
this.log(`Jump to action '${error.action}' (stage ${targetIndex})`);
i = targetIndex - 1; // loop's i++ lands on the target stage
Expand Down Expand Up @@ -1179,7 +1181,9 @@ export class MissionExecutor {
const maxAttempts = error.backoff?.maxAttempts ?? MAX_RETRY_FALLBACK;
attempt++;
if (attempt >= maxAttempts) {
throw new Error(`Action ${action.name} exhausted ${maxAttempts} retry attempt(s)`);
throw new Error(`Action ${action.name} exhausted ${maxAttempts} retry attempt(s)`, {
cause: error,
});
}
const delay = this.computeRetryDelay(error.backoff, attempt);
this.log(`Action ${action.name}: retry ${attempt}/${maxAttempts} in ${delay}ms`);
Expand Down
4 changes: 3 additions & 1 deletion src/interpreter/source-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,9 @@ export class SourceManager {
}
this.log(`Loaded OAS spec for ${source.name}: ${oasSource.operations.size} operations`);
} catch (error) {
throw new Error(`Failed to load OAS spec for ${source.name}: ${(error as Error).message}`);
throw new Error(`Failed to load OAS spec for ${source.name}: ${(error as Error).message}`, {
cause: error,
});
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/parser/action-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,9 @@ export class ActionParser extends FetchParser {
this.consume(TokenType.ASSUME, "Expected 'assume'");
const condition = this.parseExpression();

let message: string | undefined;
const severity: ValidationConstraint['severity'] = 'error';

constraints.push({ type: 'ValidationConstraint', condition, message, severity });
constraints.push({ type: 'ValidationConstraint', condition, severity });
this.match(TokenType.COMMA);
}

Expand Down
3 changes: 1 addition & 2 deletions src/parser/fetch-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ export class FetchParser extends ScheduleParser {
protected parseFetchOptions(): Partial<FetchStep> {
let source: string | undefined;
let body: Expression | undefined;
let headers: Record<string, Expression> | undefined;
let paginate: PaginationConfig | undefined;
let until: Expression | undefined;
let retry: RetryConfig | undefined;
Expand Down Expand Up @@ -145,7 +144,7 @@ export class FetchParser extends ScheduleParser {
this.consume(TokenType.RBRACE, "Expected '}'");
}

return { source, body, headers, paginate, until, retry, since, backfill, allow };
return { source, body, paginate, until, retry, since, backfill, allow };
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/webhook/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ export class WebhookServer {

// Read the request body with a hard size cap to prevent an OOM from a
// large or slow-drip POST.
let rawBody = '';
let rawBody: string;
try {
rawBody = await this.readBody(req);
} catch (error) {
Expand Down
Loading