Skip to content
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
2 changes: 1 addition & 1 deletion src/Actions/DelayAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected function doExecute(WorkflowContext $context): ActionResult
return ActionResult::success([
'delayed_seconds' => $seconds,
'delayed_microseconds' => $microseconds,
'delayed_at' => (new \DateTime)->format('c'),
'delayed_at' => (new \DateTime('now', new \DateTimeZone('UTC')))->format('c'),
]);
}
}
2 changes: 1 addition & 1 deletion src/Actions/LogAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected function doExecute(WorkflowContext $context): ActionResult

return ActionResult::success([
'logged_message' => $processedMessage,
'logged_at' => (new \DateTime)->format('c'),
'logged_at' => (new \DateTime('now', new \DateTimeZone('UTC')))->format('c'),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep log timestamps on a single timezone basis

logged_at is now forced to UTC, but the same log entry still includes $context->toArray() where executed_at comes from WorkflowContext’s default process timezone and is formatted without an offset. On hosts not set to UTC, one record can contain mismatched clock bases, making event ordering and debugging unreliable. Consider deriving both fields from the same timezone-normalized source (or normalizing WorkflowContext serialization to UTC ISO-8601).

Useful? React with 👍 / 👎.

]);
}

Expand Down
24 changes: 0 additions & 24 deletions src/Core/Step.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* - **Configuration**: Step-specific parameters and settings
* - **Resilience**: Timeout and retry configuration for robust execution
* - **Conditional Logic**: Support for conditional step execution
* - **Compensation**: Rollback actions for error scenarios
*
* ## Usage Examples
*
Expand Down Expand Up @@ -62,7 +61,6 @@ class Step
* @param array<string, mixed> $config Step-specific configuration parameters
* @param string|null $timeout Maximum execution time (in seconds as string)
* @param int $retryAttempts Number of retry attempts on failure (0-10)
* @param string|null $compensationAction Action class for rollback scenarios
* @param array<string> $conditions Array of condition expressions for conditional execution
* @param array<string> $prerequisites Array of prerequisite step IDs that must complete first
*/
Expand All @@ -72,7 +70,6 @@ public function __construct(
private readonly array $config = [],
private readonly ?string $timeout = null,
private readonly int $retryAttempts = 0,
private readonly ?string $compensationAction = null,
private readonly array $conditions = [],
private readonly array $prerequisites = []
Comment on lines 71 to 74
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve Step compensation API compatibility

This constructor change removes the compensationAction slot from a public class that is instantiated directly by consumers, so upgrades can now fail at runtime with Unknown named parameter $compensationAction (or argument-type shifts for positional calls). The same commit also removes compensation accessors, so existing integrations that read compensation metadata now hit undefined-method fatals. If this removal is intended, it should be staged as a deprecation first (or done in a major release) to avoid breaking current users on a fix update.

Useful? React with 👍 / 👎.

) {}
Expand Down Expand Up @@ -127,16 +124,6 @@ public function getRetryAttempts(): int
return $this->retryAttempts;
}

/**
* Get the compensation action class for rollback scenarios.
*
* @return string|null Compensation action class name, or null if none
*/
public function getCompensationAction(): ?string
{
return $this->compensationAction;
}

/**
* Get the conditional expressions for this step.
*
Expand Down Expand Up @@ -167,16 +154,6 @@ public function hasAction(): bool
return $this->actionClass !== null;
}

/**
* Check if this step has a compensation action for rollback.
*
* @return bool True if a compensation action is defined
*/
public function hasCompensation(): bool
{
return $this->compensationAction !== null;
}

/**
* Determine if this step can execute based on its conditions.
*
Expand Down Expand Up @@ -244,7 +221,6 @@ public function toArray(): array
'config' => $this->config,
'timeout' => $this->timeout,
'retry_attempts' => $this->retryAttempts,
'compensation' => $this->compensationAction,
'conditions' => $this->conditions,
'prerequisites' => $this->prerequisites,
];
Expand Down
1 change: 0 additions & 1 deletion src/Core/WorkflowDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ private function processSteps(array $stepsData): array
config: $stepData['parameters'] ?? $stepData['config'] ?? [],
timeout: $stepData['timeout'] ?? null,
retryAttempts: $stepData['retry_attempts'] ?? 0,
compensationAction: $stepData['compensation'] ?? null,
conditions: $stepData['conditions'] ?? [],
prerequisites: $stepData['prerequisites'] ?? []
);
Expand Down
4 changes: 2 additions & 2 deletions src/Core/WorkflowEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ public function start(string $workflowId, array $definition, array $context = []
definition: $workflowDef,
state: WorkflowState::PENDING,
data: $context,
createdAt: new \DateTime,
updatedAt: new \DateTime
createdAt: new \DateTime('now', new \DateTimeZone('UTC')),
updatedAt: new \DateTime('now', new \DateTimeZone('UTC'))
);

// Save initial state
Expand Down
20 changes: 10 additions & 10 deletions src/Core/WorkflowInstance.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ public function __construct(
) {
$this->state = $state;
$this->data = $data;
$this->createdAt = $createdAt ?? new \DateTime;
$this->updatedAt = $updatedAt ?? new \DateTime;
$this->createdAt = $createdAt ?? new \DateTime('now', new \DateTimeZone('UTC'));
$this->updatedAt = $updatedAt ?? new \DateTime('now', new \DateTimeZone('UTC'));
}

/**
Expand Down Expand Up @@ -187,7 +187,7 @@ public function setState(WorkflowState $state): void
}

$this->state = $state;
$this->updatedAt = new \DateTime;
$this->updatedAt = new \DateTime('now', new \DateTimeZone('UTC'));
}

/**
Expand All @@ -208,7 +208,7 @@ public function getData(): array
public function setData(array $data): void
{
$this->data = $data;
$this->updatedAt = new \DateTime;
$this->updatedAt = new \DateTime('now', new \DateTimeZone('UTC'));
}

/**
Expand All @@ -219,7 +219,7 @@ public function setData(array $data): void
public function mergeData(array $data): void
{
$this->data = array_merge($this->data, $data);
$this->updatedAt = new \DateTime;
$this->updatedAt = new \DateTime('now', new \DateTimeZone('UTC'));
}

/**
Expand All @@ -240,7 +240,7 @@ public function getCurrentStepId(): ?string
public function setCurrentStepId(?string $stepId): void
{
$this->currentStepId = $stepId;
$this->updatedAt = new \DateTime;
$this->updatedAt = new \DateTime('now', new \DateTimeZone('UTC'));
}

/**
Expand All @@ -262,7 +262,7 @@ public function addCompletedStep(string $stepId): void
{
if (! in_array($stepId, $this->completedSteps)) {
$this->completedSteps[] = $stepId;
$this->updatedAt = new \DateTime;
$this->updatedAt = new \DateTime('now', new \DateTimeZone('UTC'));
}
}

Expand All @@ -287,9 +287,9 @@ public function addFailedStep(string $stepId, string $error): void
$this->failedSteps[] = [
'step_id' => $stepId,
'error' => $error,
'failed_at' => (new \DateTime)->format('c'),
'failed_at' => (new \DateTime('now', new \DateTimeZone('UTC')))->format('c'),
];
$this->updatedAt = new \DateTime;
$this->updatedAt = new \DateTime('now', new \DateTimeZone('UTC'));
}

/**
Expand All @@ -310,7 +310,7 @@ public function getErrorMessage(): ?string
public function setErrorMessage(?string $errorMessage): void
{
$this->errorMessage = $errorMessage;
$this->updatedAt = new \DateTime;
$this->updatedAt = new \DateTime('now', new \DateTimeZone('UTC'));
}

/**
Expand Down