Skip to content

Validate action description in factories #2686

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 13, 2024
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 @@ -211,6 +211,13 @@ export class CommandRunnerImpl implements CommandRunner {

default: {
const action = this.actions[actionDescriptor.name];

// Ensure we don't miss any new actions. Needed because we don't have input validation.
// FIXME: remove once we have schema validation (#983)
if (action == null) {
throw new Error(`Unknown action: ${actionDescriptor.name}`);
}

this.finalStages = action.getFinalStages?.() ?? [];
this.noAutomaticTokenExpansion =
action.noAutomaticTokenExpansion ?? false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ export class MarkStageFactoryImpl implements MarkStageFactory {
return new TargetMarkStage(this.targetPipelineRunner, mark);
case "explicit":
return new ExplicitMarkStage(mark);
default: {
// Ensure we don't miss any new marks. Needed because we don't have input validation.
// FIXME: remove once we have schema validation (#983)
const _exhaustiveCheck: never = mark;
const { type } = mark;
throw new Error(`Unknown mark: ${type}`);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ export class ModifierStageFactoryImpl implements ModifierStageFactory {
throw Error(
`Unexpected modifier '${modifier.type}'; it should have been removed during inference`,
);
default: {
// Ensure we don't miss any new modifiers. Needed because we don't have input validation.
// FIXME: remove once we have schema validation (#983)
const _exhaustiveCheck: never = modifier;
const { type } = modifier;
throw new Error(`Unknown modifier: ${type}`);
}
}
}

Expand Down
Loading