fix(engine): tighten workflow extension feedback fixes
This commit is contained in:
@@ -1221,6 +1221,7 @@ interface MoveTaskInternalOptions {
|
||||
movePolicyPreflight?: {
|
||||
fromColumn: string;
|
||||
toColumn: string;
|
||||
workflowSignature: string;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6387,6 +6388,7 @@ export class TaskStore extends EventEmitter<TaskStoreEvents> {
|
||||
if (task.column === toColumn) return undefined;
|
||||
|
||||
const workflowIr = this.resolveTaskWorkflowIrSync(id);
|
||||
const workflowSignature = serializeWorkflowIr(workflowIr);
|
||||
const bypassGuards = this.resolveWorkflowBypassGuards(moveSource, options);
|
||||
const fromColumn = task.column;
|
||||
if (this.shouldSkipWorkflowMovePolicies({ fromColumn, toColumn, moveSource, bypassGuards, options })) {
|
||||
@@ -6409,7 +6411,7 @@ export class TaskStore extends EventEmitter<TaskStoreEvents> {
|
||||
source: options?.workflowMoveSource ?? moveSource,
|
||||
metadata: options?.workflowMoveMetadata,
|
||||
});
|
||||
return { fromColumn, toColumn };
|
||||
return { fromColumn, toColumn, workflowSignature };
|
||||
}
|
||||
|
||||
private async evaluateWorkflowMovePolicies(input: WorkflowMovePolicyInput): Promise<void> {
|
||||
@@ -6615,7 +6617,8 @@ export class TaskStore extends EventEmitter<TaskStoreEvents> {
|
||||
if (!skipWorkflowMovePolicies) {
|
||||
if (
|
||||
internal.movePolicyPreflight?.fromColumn !== fromColumn ||
|
||||
internal.movePolicyPreflight?.toColumn !== toColumn
|
||||
internal.movePolicyPreflight?.toColumn !== toColumn ||
|
||||
internal.movePolicyPreflight?.workflowSignature !== serializeWorkflowIr(workflowIr)
|
||||
) {
|
||||
throw new TransitionRejectionError(
|
||||
makeTransitionRejection(
|
||||
|
||||
@@ -76,7 +76,7 @@ describe("workflow node-handler extensions", () => {
|
||||
schemaVersion: WORKFLOW_EXTENSION_SCHEMA_VERSION,
|
||||
fallback: "failClosed",
|
||||
handle: vi.fn().mockResolvedValue({
|
||||
outcome: "outcome:custom-route",
|
||||
outcome: "outcome:ignored-route",
|
||||
value: "needs-human",
|
||||
}),
|
||||
});
|
||||
@@ -93,7 +93,7 @@ describe("workflow node-handler extensions", () => {
|
||||
edges: [
|
||||
{ from: "start", to: "decide" },
|
||||
{ from: "decide", to: "human", condition: "outcome:needs-human" },
|
||||
{ from: "decide", to: "default", condition: "outcome:custom-route" },
|
||||
{ from: "decide", to: "default", condition: "outcome:ignored-route" },
|
||||
],
|
||||
};
|
||||
const prompt = vi.fn(async () => ({ outcome: "success" as const }));
|
||||
|
||||
Reference in New Issue
Block a user