From 719a923ef74d768e4bb2e8206962b2108daacd39 Mon Sep 17 00:00:00 2001 From: Richard McDaniel <1130888+rmcdaniel@users.noreply.github.com> Date: Tue, 17 Nov 2026 04:07:17 +0000 Subject: [PATCH 1/4] feat(examples): bind genuine recurring Orders to their original billing periods --- .../provider-state-machines/Authority.php | 5 + .../provider-state-machines/BillingPeriod.php | 3 + .../provider-state-machines/MachineStore.php | 27 +- .../OrderBillingPeriodStore.php | 300 ++++++++++++++ .../OrderPeriodPaymentReceipt.php | 105 +++++ .../OrderPeriodPolicy.php | 66 +++ examples/provider-state-machines/README.md | 46 ++- .../provider-state-machines/bootstrap.php | 3 +- tests/Feature/V2/V2OrderBillingPeriodTest.php | 380 ++++++++++++++++++ .../V2/StateMachine/BillingPeriodTest.php | 5 +- .../V2/StateMachine/OrderPeriodPolicyTest.php | 121 ++++++ 11 files changed, 1051 insertions(+), 10 deletions(-) create mode 100644 examples/provider-state-machines/OrderBillingPeriodStore.php create mode 100644 examples/provider-state-machines/OrderPeriodPaymentReceipt.php create mode 100644 examples/provider-state-machines/OrderPeriodPolicy.php create mode 100644 tests/Feature/V2/V2OrderBillingPeriodTest.php create mode 100644 tests/Unit/V2/StateMachine/OrderPeriodPolicyTest.php diff --git a/examples/provider-state-machines/Authority.php b/examples/provider-state-machines/Authority.php index 3d7be60ac..a67de8b93 100644 --- a/examples/provider-state-machines/Authority.php +++ b/examples/provider-state-machines/Authority.php @@ -23,6 +23,8 @@ { public CartPolicy $cart; + public OrderPeriodPolicy $periods; + /** * @param list $subjects Canonical OrderTerms::subjectKey() grants. */ @@ -32,6 +34,7 @@ public function __construct( private array $subjects, private array $recipes = [], array $cartPurchases = [], + array $orderPeriods = [], ) { PortableDescriptor::identifier($principal, 'authenticated principal'); if (! array_is_list($subjects)) { @@ -59,6 +62,7 @@ public function __construct( } } $this->cart = new CartPolicy($this, $cartPurchases); + $this->periods = new OrderPeriodPolicy($this, $orderPeriods); } public function recipe(string $key): string @@ -76,6 +80,7 @@ public function grantFor(string $key, string $role): string return hash( 'sha256', BindingPlan::versionFor($this->recipe($key)) . ($this->cart->selected($key) ? '.cart-v1' : '') + . $this->periods->version($key) . ':' . $this->profile($key, $role)->fingerprint() ); } diff --git a/examples/provider-state-machines/BillingPeriod.php b/examples/provider-state-machines/BillingPeriod.php index c77e885d2..15a61b7f8 100644 --- a/examples/provider-state-machines/BillingPeriod.php +++ b/examples/provider-state-machines/BillingPeriod.php @@ -81,6 +81,9 @@ public function subjectKey(): string */ public function paymentDescriptor(): array { + if ($this->order !== null) { + return $this->order->descriptor('payment'); + } $identity = fn (string $operation): Identity => new Identity( $this->client, $this->subscription, diff --git a/examples/provider-state-machines/MachineStore.php b/examples/provider-state-machines/MachineStore.php index b654091d2..75c30eb29 100644 --- a/examples/provider-state-machines/MachineStore.php +++ b/examples/provider-state-machines/MachineStore.php @@ -34,8 +34,13 @@ public function __construct( public Authority $authority, private ?IncomingPaymentProvider $incoming = null, - private ?CodPaymentProvider $cod = null + private ?CodPaymentProvider $cod = null, + private ?OrderBillingPeriodStore $periods = null, ) { + if (($authority->periods->grants() !== [] && $periods === null) + || ($periods !== null && $periods->authority !== $authority)) { + throw new LogicException('Order-period workers must retain their original policy and admission assembly.'); + } } public static function configure( @@ -53,8 +58,12 @@ public static function configure( 'Native COD requires the same original provider and atomic physical carrier contract.' ); } - $store = new self($authority, $incoming, $cod); + $periods = $authority->periods->grants() === [] ? null : new OrderBillingPeriodStore($authority, $provider); + $store = new self($authority, $incoming, $cod, $periods); $app->instance(self::class, $store); + if ($periods !== null) { + $app->instance(OrderBillingPeriodStore::class, $periods); + } $app->instance(CartStore::class, new CartStore($authority, $provider, $incoming)); $app->instance(AssessmentStore::class, new AssessmentStore($authority, $provider)); $financial = new FinancialAuthority($authority); @@ -166,6 +175,7 @@ public function seed(OrderTerms $terms, ?CartPlan $cart = null): void 'root_run' => null, ]); $this->createSubject($key, 'order', false); + $this->periods?->seedRow($terms); if ($cart !== null) { app(CartStore::class)->seedRow($terms, $cart, hash('sha256', $payload)); } @@ -187,6 +197,7 @@ public function initialize(WorkflowRun $actual, array $arguments): array throw new LogicException('The native initialization has no authorized business subject.'); } $this->authority->authorize($key, $this->authority->principal); + $this->periods?->assertActor($actual, $key); [$assignment, $terms] = $this->authority->assignment($key); $root = $this->authority->subject($key, 'order'); $plan = $role === 'order' ? $this->rootPlan($actual, $args, $key, $assignment, $terms) @@ -383,6 +394,7 @@ private function handlers( $authority = $this->authority; $incoming = $this->incoming; $cod = $this->cod; + $periods = $this->periods; $handlers = [ 'provider.owner' => [ '1' => new OwnerOperation($authority), @@ -391,20 +403,27 @@ private function handlers( '1' => new RetainedOperation($provider, static function ( OperationContext $context, string $operation, - ) use ($authority, $funding): void { + ) use ($authority, $funding, $periods): void { $key = explode('.', $context->scope->key)[0]; if (FundingCatalogue::selected($authority->recipe($key))) { $funding->effect($context, $operation); } else { $authority->authorizeOperation($context, $operation); } + $periods?->authorizeEffect($context, $operation); }), ], 'provider.cart' => [ '1' => new CartLeaseOperation($provider, app(CartStore::class)->operation(...)), ], 'provider.shipment.full' => [ - '1' => new ShipmentOperation($provider, $physical->operation(...)), + '1' => new ShipmentOperation($provider, static function ( + OperationContext $context, + string $mode, + ) use ($physical, $periods): void { + $physical->operation($context, $mode); + $periods?->authorizeEffect($context, $mode); + }), ], ]; if ($incoming !== null) { diff --git a/examples/provider-state-machines/OrderBillingPeriodStore.php b/examples/provider-state-machines/OrderBillingPeriodStore.php new file mode 100644 index 000000000..68a0e2a76 --- /dev/null +++ b/examples/provider-state-machines/OrderBillingPeriodStore.php @@ -0,0 +1,300 @@ +db; + if (! $db instanceof Connection) { + throw new LogicException('Order periods require the original configured native SQL connection.'); + } + $this->assignments = new BillingPeriodAssignments($db, $authority->principal, $authority->periods->grants()); + $this->receipts = new OrderPeriodPaymentReceipt($authority, $provider); + } + + /** + * Called inside MachineStore's already-authorized Order seed transaction. + */ + public function seedRow(OrderTerms $terms): void + { + $period = $this->authority->periods->forOrder($terms->subjectKey()); + if ($period === null) { + return; + } + if ($this->authority->db->transactionLevel() !== 1 || WorkflowFiberContext::active() + || $period->order->toArray() !== $terms->toArray()) { + throw new LogicException('The period and genuine Order must be seeded in the same owned transaction.'); + } + $db = $this->authority->db; + $key = $period->subjectKey(); + $subscription = $this->assignments->subscriptionId($period); + $db->table('provider_billing_subscriptions') + ->insertOrIgnore([ + 'id' => $subscription, + 'principal' => $this->authority->principal, + 'authority_version' => $this->assignments->subscriptionVersion($period), + ]); + $this->assignments->subscription($period); + $db->table('provider_billing_periods') + ->insert([ + 'id' => $key, + 'subscription_id' => $subscription, + 'principal' => $this->authority->principal, + 'authority_version' => $this->assignments->version($period), + 'assignment' => PortableDescriptor::encode($period->toArray()), + 'assignment_sha256' => $period->fingerprint(), + ]); + $db->table('example_machine_subjects') + ->insert([ + 'id' => BillingPeriodAssignments::subjectId($key), + 'scope' => BillingPeriodStore::APPLICATION, + 'subject' => $key, + 'principal' => $this->authority->principal, + 'authority_version' => $this->assignments->version($period), + 'state' => 'received', + 'revision' => 1, + 'cancellation_requested' => false, + ]); + } + + public function admit(string $key): array + { + $period = $this->period($key); + $orderKey = $period->order->subjectKey(); + [$assignment] = $this->authority->assignment($orderKey); + $original = $this->authority->subject($orderKey, 'order'); + return $this->authority->db->transaction(function () use ($key, $period, $assignment, $original): array { + $subscription = $this->assignments->subscription($period); + $subject = $this->assignments->subject($key, $period, true); + $row = $this->authority->db->table('provider_billing_periods') + ->where('id', $key) + ->lockForUpdate() + ->sole(); + $this->assignments->assertAssignment($row, $period); + $order = $this->authority->db->table('example_machine_subjects') + ->where('id', $original->id) + ->lockForUpdate() + ->sole(); + $this->authority->assertGrant($order, $period->order->subjectKey(), 'order'); + $current = $this->authority->db->table('provider_machine_assignments') + ->where('id', $assignment->id) + ->lockForUpdate() + ->sole(); + if ($current->terms !== $assignment->terms || $current->terms_sha256 !== $assignment->terms_sha256) { + throw new LogicException('The original Order assignment changed during period admission.'); + } + if ($row->native_run !== null) { + $run = $this->assertRun($period, $row); + if ($current->root_run !== null && $current->root_run !== $run->id) { + throw new LogicException('The original Order acquired a different native owner.'); + } + return [ + 'accepted' => true, + 'runId' => $run->id, + 'existing' => true, + ]; + } + if ($current->root_run !== null) { + throw new LogicException('A foreign existing Order cannot become this period admission.'); + } + $now = Carbon::now()->getTimestamp(); + if ($now < $period->startsAt || $now >= $period->endsAt || (bool) $subject->cancellation_requested + || (bool) $order->cancellation_requested + || ($subscription->future_cutoff !== null && $period->startsAt >= (int) $subscription->future_cutoff)) { + return [ + 'accepted' => false, + 'runId' => null, + 'reason' => 'original_period_not_admissible', + ]; + } + $result = WorkflowStub::make(FundingCheckout::class, self::instance($period), Catalogue::NAMESPACE) + ->attemptStart($period->order->subjectKey(), StartOptions::rejectDuplicate()); + if (! $result->accepted() || ! is_string($result->runId())) { + throw new LogicException('An existing foreign native Order cannot be adopted by a billing period.'); + } + $receipt = $this->receipt($period, $result->runId()); + $this->authority->db->table('provider_billing_periods') + ->where('id', $key) + ->update([ + 'native_run' => $result->runId(), + 'admission_receipt' => $receipt, + 'admission_sha256' => hash('sha256', $receipt), + ]); + return [ + 'accepted' => true, + 'runId' => $result->runId(), + 'existing' => false, + ]; + }); + } + + public function assertActor(WorkflowRun $actual, string $orderKey): void + { + $period = $this->authority->periods->forOrder($orderKey); + if ($period === null) { + return; + } + $this->period($period->subjectKey()); + $row = $this->row($period); + $root = $this->assertRun($period, $row); + $arguments = $actual->workflowArguments(); + // MachineStore's existing childPlan then verifies the authoritative reservation, native + // admission and original scope. A WorkflowRun itself does not carry a parent-link column. + if ($actual->namespace !== Catalogue::NAMESPACE + || ($actual->id !== $root->id && (($arguments[1] ?? null) !== $root->id + || ! in_array($actual->workflow_class, [FundingPayment::class, FullShipment::class], true)))) { + throw new LogicException('The native actor is outside its original period Order graph.'); + } + } + + /** + * Existing native scope/descriptor authorization runs before this additional period fence. + */ + public function authorizeEffect(OperationContext $context, string $mode): void + { + $orderKey = explode('.', $context->scope->key)[0]; + $period = $this->authority->periods->forOrder($orderKey); + if ($period === null) { + return; + } + $this->authority->authorizeScope($context->scope, $this->authority->principal, $mode); + $this->assertActor(WorkflowRun::query()->findOrFail($context->originalRunId), $orderKey); + if ($mode !== 'forward') { + return; + } + $subject = $this->assignments->subject($period->subjectKey(), $period); + $subscription = $this->assignments->subscription($period); + if ((bool) $subject->cancellation_requested + || ($subscription->future_cutoff !== null && $period->startsAt >= (int) $subscription->future_cutoff)) { + throw new LogicException('The original billing period closed new forward effects.'); + } + $role = $context->scope->key === $orderKey ? 'order' : substr($context->scope->key, strlen($orderKey) + 1); + if ($role === 'payment') { + if (! $context->uncertainForward && Carbon::now()->getTimestamp() >= $period->paymentDeadline) { + throw new LogicException('The original period first-charge deadline has elapsed.'); + } + return; + } + $root = $this->assertRun($period, $this->row($period)); + $time = $this->receipts->confirmedAt($period, $root, false); + if ($time === null || $time >= $period->paymentDeadline) { + throw new LogicException('Order fulfillment requires this period original on-time payment.'); + } + } + + public function access(string $key): array + { + $period = $this->period($key); + $row = $this->row($period); + $root = $this->assertRun($period, $row); + $subject = $this->assignments->subject($key, $period); + $order = $this->authority->subject($period->order->subjectKey(), 'order'); + $subscription = $this->assignments->subscription($period); + $result = BillingPeriodPolicy::access( + $period, + Carbon::now()->getTimestamp(), + $this->receipts->confirmedAt($period, $root), + ); + if ((bool) $subject->cancellation_requested || (bool) $order->cancellation_requested + || ($subscription->future_cutoff !== null && $period->startsAt >= (int) $subscription->future_cutoff)) { + $result['access'] = false; + $result['state'] = 'cancelled'; + } + return [ + ...$result, + 'orderKey' => $period->order->subjectKey(), + 'originalRunId' => $root->id, + ]; + } + + public function cancelFuture(string $key, string $requestKey, int $cutoff): void + { + $this->period($key); + (new BillingPeriodStore( + $this->assignments->db, + $this->authority->principal, + $this->authority->periods->grants(), + $this->provider, + ))->cancelFuture($key, $requestKey, $cutoff); + } + + public function cancel(string $key, string $requestKey): array + { + $period = $this->period($key); + $root = $this->assertRun($period, $this->row($period)); + return (new CancellationStore($this->authority))->request($period->order->subjectKey(), $root->id, $requestKey); + } + + private function period(string $key): BillingPeriod + { + $period = $this->assignments->grant($key); + $terms = $period->order ?? throw new LogicException('A genuine original period Order is required.'); + $this->authority->authorize($terms->subjectKey(), $this->authority->principal); + $this->assignments->period($key); + return $period; + } + + private function row(BillingPeriod $period): object + { + $row = $this->authority->db->table('provider_billing_periods') + ->where('id', $period->subjectKey()) + ->sole(); + $this->assignments->assertAssignment($row, $period); + return $row; + } + + private function assertRun(BillingPeriod $period, object $row): WorkflowRun + { + if (! is_string($row->native_run)) { + throw new LogicException('The period has no original genuine Order admission.'); + } + $actual = WorkflowRun::query()->findOrFail($row->native_run); + $receipt = $this->receipt($period, $actual->id); + if ($actual->namespace !== Catalogue::NAMESPACE || $actual->workflow_class !== FundingCheckout::class + || $actual->workflow_instance_id !== self::instance($period) + || $actual->workflowArguments() !== [$period->order->subjectKey()] + || $row->admission_receipt !== $receipt || $row->admission_sha256 !== hash('sha256', $receipt)) { + throw new LogicException('The original period Order admission receipt changed.'); + } + return $actual; + } + + private function receipt(BillingPeriod $period, string $run): string + { + return PortableDescriptor::encode([ + 'period' => $period->fingerprint(), + 'order' => $period->order->subjectKey(), + 'namespace' => Catalogue::NAMESPACE, + 'instance' => self::instance($period), + 'run' => $run, + 'class' => FundingCheckout::class, + ]); + } + + private static function instance(BillingPeriod $period): string + { + return 'provider-order-' . $period->order->subjectKey(); + } +} diff --git a/examples/provider-state-machines/OrderPeriodPaymentReceipt.php b/examples/provider-state-machines/OrderPeriodPaymentReceipt.php new file mode 100644 index 000000000..ba2285f8c --- /dev/null +++ b/examples/provider-state-machines/OrderPeriodPaymentReceipt.php @@ -0,0 +1,105 @@ +order ?? throw new LogicException('An original Order is required.'); + $key = $terms->subjectKey(); + [$assignment, $original] = $this->authority->assignment($key); + if (PortableDescriptor::encode($original->toArray()) !== PortableDescriptor::encode($terms->toArray())) { + throw new LogicException('The period substituted its original Order terms.'); + } + if ($assignment->root_run === null) { + return null; + } + if ($assignment->root_run !== $root->id) { + throw new LogicException('The period substituted its original Order owner.'); + } + $actor = $this->authority->db->table('provider_machine_actors') + ->where('id', Authority::subjectId($key, 'payment'))->first(); + if ($actor === null) { + return null; + } + $payment = WorkflowRun::query()->findOrFail($actor->native_run); + [$actualActor, $subject, $plan] = $this->authority->actor($payment); + if ($actualActor->role !== 'payment' || $payment->workflow_class !== FundingPayment::class + || $plan->rootRun !== $root->id || $plan->recipe !== FundingCatalogue::IMMEDIATE) { + throw new LogicException('The period payment belongs to another original native graph.'); + } + if ($publication ? $subject->state !== 'paid' + : ! in_array($subject->state, ['ready', 'collected', 'paid'], true)) { + return null; + } + [, , , $rows] = (new FundingAuthority($this->authority))->rows($payment); + if ($rows['effect']['forward_status'] !== 'observed') { + throw new LogicException('The original Payment has no recorded capture outcome.'); + } + $request = Request::fromArray($terms->descriptor('payment')['forward']); + $receipt = $this->provider->timedLookup($request); + if ($receipt->observation->status !== Status::Confirmed + || $receipt->observation->effectId !== 'effect-' . $request->identity->key() + || $receipt->confirmedAt === null || $receipt->confirmedAt < $period->startsAt + || $receipt->confirmedAt > Carbon::now()->getTimestamp()) { + throw new LogicException('The original Order lacks its authoritative period payment receipt.'); + } + if ($publication) { + $this->assertPublication($key, $payment, $subject); + } + return $receipt->confirmedAt; + } + + private function assertPublication(string $key, WorkflowRun $payment, object $subject): void + { + $revision = (int) $subject->revision; + if ($revision < 2) { + throw new LogicException('The original paid revision is unavailable.'); + } + $execution = new ExecutionReference( + Catalogue::APPLICATION, + Authority::subjectName($key, 'payment'), + $payment->id . '.confirm-receipt.' . ($revision - 1), + $this->authority->profile($key, 'payment') + ->fingerprint(), + 'collected', + (string) ($revision - 1), + ); + $id = SqlBusinessStore::decisionId($execution, 'transition', $execution->executionId); + $row = $this->authority->db->table('example_machine_publications') + ->where('id', $id) + ->first(); + $expected = [ + 'execution' => $execution->toArray(), + 'transitionKey' => 'confirm-receipt', + 'state' => 'paid', + 'revision' => (string) $revision, + ]; + if ($row === null || $row->subject_id !== Authority::subjectId($key, 'payment') + || strlen($row->payload) > PortableDescriptor::MAX_BYTES + || PortableDescriptor::encode(json_decode($row->payload, true, flags: JSON_THROW_ON_ERROR)) + !== PortableDescriptor::encode($expected)) { + throw new LogicException('The original Order Payment publication is missing or substituted.'); + } + } +} diff --git a/examples/provider-state-machines/OrderPeriodPolicy.php b/examples/provider-state-machines/OrderPeriodPolicy.php new file mode 100644 index 000000000..23695c3d3 --- /dev/null +++ b/examples/provider-state-machines/OrderPeriodPolicy.php @@ -0,0 +1,66 @@ + $grants + */ + public function __construct( + private Authority $authority, + private array $grants = [], + ) { + if (! array_is_list($grants)) { + throw new LogicException('Order-period authority requires an explicit typed grant list.'); + } + $orders = []; + $periods = []; + foreach ($grants as $period) { + if (! $period instanceof BillingPeriod || $period->order === null) { + throw new LogicException('An Order-period grant requires its genuine original Order terms.'); + } + $key = $period->order->subjectKey(); + $authority->authorize($key, $authority->principal); + if ($authority->recipe($key) !== FundingCatalogue::IMMEDIATE + || $period->order->fulfillmentDeadline === null + || $period->order->fulfillmentDeadline <= $period->paymentDeadline + || isset($orders[$key]) || isset($periods[$period->subjectKey()])) { + throw new LogicException( + 'Each period needs its own Order and independent physical fulfillment budget.' + ); + } + $orders[$key] = true; + $periods[$period->subjectKey()] = true; + } + } + + public function forOrder(string $key): ?BillingPeriod + { + foreach ($this->grants as $period) { + if ($period->order->subjectKey() === $key) { + return $period; + } + } + return null; + } + + /** + * @return list + */ + public function grants(): array + { + return $this->grants; + } + + public function version(string $key): string + { + $period = $this->forOrder($key); + return $period === null ? '' : '.order-period-v1:' . $period->fingerprint(); + } +} diff --git a/examples/provider-state-machines/README.md b/examples/provider-state-machines/README.md index 372175190..2f0e7c1bc 100644 --- a/examples/provider-state-machines/README.md +++ b/examples/provider-state-machines/README.md @@ -542,8 +542,8 @@ matrix, installed recovery/upgrade acceptance or publication qualification. currency, start, end and payment deadline. A service-only period has no Order or Shipment. Where the application has a genuine Order for the period, its `OrderTerms` must retain the same client, period generation and money. The -association is part of the immutable assignment fingerprint; it is not a -provider payment identity or an admission receipt. This initial period +association is part of the immutable assignment fingerprint; it does not by +itself prove native admission. This initial period profile selects immediate capture. An associated Order cannot substitute an authorization, incoming transfer, COD or split-payment policy. @@ -578,7 +578,47 @@ connection, authenticated principal, explicit `BillingPeriod` grant list and that provider; call `BillingPeriodStore::configure($app, $store)` in both client and worker bootstrap. Seed each fixed assignment once, then use `$store->admit($period->subjectKey())`. A non-null Order assignment is refused -by this adapter; the genuine Order-per-period integration remains unfinished. +by this service-only adapter; use the genuine Order adapter below instead. + +For an Order-per-period application, install the business, provider and billing +schemas and allow the existing `provider-machines` namespace. Construct each +period with its genuine `OrderTerms`, selecting the common IMMEDIATE funding +recipe and a separate physical `fulfillmentDeadline` later than its payment +deadline. Give `Authority` the original Order subject keys, their IMMEDIATE +recipes and the explicit `orderPeriods: [$period, ...]` list. Configure +`MachineStore` normally in both client and worker bootstrap. It automatically +assembles `OrderBillingPeriodStore` and pins the immutable period policy in +the existing subject authority, so a replacement cannot omit that policy and +still load the protected Order. Seed the genuine Order with +`$machineStore->seed($period->order)`, then obtain the period adapter from the +container and call `admit($period->subjectKey())`. + +This admission atomically records the original period receipt and starts the +existing `FundingCheckout`; its actual `FundingPayment` and `FullShipment` +children retain the common routes, reservations and verified scope ownership. +The associated period's payment descriptor is that genuine Order's capture +and refund descriptor. It never creates a second service-only charge. Repeated +admission returns the original Order run rather than adopting a foreign run. + +`OrderBillingPeriodStore::access()` projects service entitlement separately +from the physical Order. Grace access does not reserve stock or authorize +Shipment. Only the original authoritative on-time provider capture can admit +those forward effects; protected `paid` publication additionally gates paid +access. A charge first dispatched at or after the original payment cutoff is +refused. Inspection of an already uncertain charge still reconciles that +original provider outcome. An on-time commit acknowledged after the cutoff +keeps its original time; genuinely late money remains factual paid money but +cannot reactivate access or start fulfillment. Physical fulfillment of an +on-time paid Order retains its separate original budget after the payment +cutoff. + +The Order adapter shares subscription/future-cancellation metadata with the +service-only adapter. `cancelFuture()` fences affected later periods without +refunding the paid current Order. `cancel()` addresses the original actual +Order's retained recovery, not a fabricated period scope. Cancellation before +genuine root initialization preserves the existing unresolved boundary until +that recorded owner initializes. These example adapters do not establish the +full customer matrix or installed-process/release qualification. The original owner and Payment duties are registered before provider dispatch. `payment-observed` is only a wake-up: recorded provider inspection determines diff --git a/examples/provider-state-machines/bootstrap.php b/examples/provider-state-machines/bootstrap.php index 87da045db..cca546078 100644 --- a/examples/provider-state-machines/bootstrap.php +++ b/examples/provider-state-machines/bootstrap.php @@ -24,7 +24,8 @@ require_once __DIR__ . '/CartLeaseOperation.php'; require_once __DIR__ . '/BindingPlan.php'; foreach ([ - 'CartPolicy', 'Authority', 'OwnerOperation', 'CartOrderReceipt', 'CartStore', 'MachineStore', 'AssessmentStore', 'CancellationStore', + 'CartPolicy', 'OrderPeriodPolicy', 'OrderPeriodPaymentReceipt', 'OrderBillingPeriodStore', + 'Authority', 'OwnerOperation', 'CartOrderReceipt', 'CartStore', 'MachineStore', 'AssessmentStore', 'CancellationStore', 'FinancialInspectionStore', 'FinancialInspectionActivity', 'FinancialAuthority', 'IncomingPaymentInspectionStore', 'IncomingPaymentInspectionActivity', 'CodInspectionStore', 'FundingPaymentExecution', 'CodFundingPayment', 'AdvanceBalancePayment', diff --git a/tests/Feature/V2/V2OrderBillingPeriodTest.php b/tests/Feature/V2/V2OrderBillingPeriodTest.php new file mode 100644 index 000000000..8d545a376 --- /dev/null +++ b/tests/Feature/V2/V2OrderBillingPeriodTest.php @@ -0,0 +1,380 @@ + [Catalogue::NAMESPACE], + 'workflows.v2.task_dispatch_mode' => 'queue', + 'queue.default' => 'redis', + ]); + foreach (['business-state-machines/schema.php', 'provider-state-machines/schema.php', + 'provider-state-machines/billing-schema.php'] as $schema) { + (require __DIR__ . '/../../../examples/' . $schema)(DB::connection()->getSchemaBuilder()); + } + $this->providerPath = tempnam(sys_get_temp_dir(), 'order-period-'); + $this->providerDb = new PDO('sqlite:' . $this->providerPath); + $this->provider = new Journal( + $this->providerDb, + 'shop-a', + static fn (): int => Carbon::now()->getTimestamp(), + captureEffectTimes: true, + ); + $this->provider->install(); + $this->provider->shipments() + ->install(); + } + + protected function tearDown(): void + { + foreach (['provider_billing_future_cancellations', 'provider_billing_admissions', + 'provider_billing_assessments', 'provider_billing_periods', 'provider_billing_subscriptions'] as $table) { + DB::connection()->getSchemaBuilder()->dropIfExists($table); + } + $this->tearDownFunding(); + } + + public static function policies(): array + { + return [[BillingPeriod::PAYMENT_FIRST], [BillingPeriod::GRACE]]; + } + + #[DataProvider('policies')] + public function testPaidPeriodUsesItsGenuineCommonOrderPaymentAndShipment(string $policy): void + { + $root = $this->startPeriodOrder($policy); + $this->assertSame('ready', $this->state('order'), $this->progress()); + $this->assertSame('paid', $this->state('payment'), $this->progress()); + $access = $this->periodStore->access($this->period->subjectKey()); + $this->assertTrue($access['access']); + $this->assertTrue($access['paidOnTime']); + $this->assertSame($this->terms->subjectKey(), $access['orderKey']); + $this->assertSame($root->runId(), $access['originalRunId']); + $this->assertSame(1, WorkflowRun::query()->where('workflow_class', FundingCheckout::class)->count()); + $this->assertSame(1, WorkflowRun::query()->where('workflow_class', FundingPayment::class)->count()); + $this->assertSame(0, WorkflowRun::query()->where('workflow_class', ServicePeriodPayment::class)->count()); + $this->assertSame($this->terms->descriptor('payment'), $this->period->paymentDescriptor()); + $before = $this->periodStore->admit($this->period->subjectKey()); + $this->assertTrue($before['existing']); + $this->assertSame($root->runId(), $before['runId']); + // Original paid money outlives its payment window. Physical fulfillment + // keeps its separate immutable budget rather than rewinding that window. + Carbon::setTestNow(Carbon::createFromTimestampUTC($this->period->paymentDeadline + 60)); + $this->assertTrue($this->periodStore->access($this->period->subjectKey())['access']); + $root->withRequestId('fulfill-original-period') + ->signal('fulfill'); + $this->pump(); + $this->assertSame('booked', $this->state('shipment'), $this->progress()); + $this->recordPhysical('handed-over'); + $this->recordPhysical('delivered'); + $this->assertSame('fulfilled', $this->state('order'), $this->progress()); + $charge = Request::fromArray($this->terms->descriptor('payment')['forward']); + $this->assertSame(1, $this->providerDb->query( + "SELECT COUNT(*) FROM provider_effects WHERE operation_id = '" . $charge->identity->key() . "'" + )->fetchColumn()); + } + + #[DataProvider('policies')] + public function testGraceAccessExpiresWithoutTurningAnUnpaidOrderIntoFulfillment(string $policy): void + { + $this->startPeriodOrder($policy, Status::Processing); + $access = $this->periodStore->access($this->period->subjectKey()); + $this->assertSame($policy === BillingPeriod::GRACE, $access['access']); + $this->assertFalse($access['paidOnTime']); + $this->assertSame(0, DB::table('provider_machine_actors')->where( + 'id', + Authority::subjectId($this->terms->subjectKey(), 'shipment') + )->count()); + Carbon::setTestNow(Carbon::createFromTimestampUTC($this->period->paymentDeadline)); + $this->assertFalse($this->periodStore->access($this->period->subjectKey())['access']); + $this->assertSame([], $this->effects()); + } + + #[DataProvider('policies')] + public function testFutureCancellationKeepsThePaidOriginalOrderAndRejectsTheNextPeriod(string $policy): void + { + $this->startPeriodOrder($policy); + $this->periodStore->cancelFuture( + $this->period->subjectKey(), + 'stop-next-order', + $this->nextPeriod->startsAt, + ); + $this->assertTrue($this->periodStore->access($this->period->subjectKey())['access']); + $this->assertNotContains('refund', $this->effects()); + Carbon::setTestNow(Carbon::createFromTimestampUTC($this->nextPeriod->startsAt)); + $this->assertFalse($this->periodStore->admit($this->nextPeriod->subjectKey())['accepted']); + $this->assertSame(1, WorkflowRun::query()->where('workflow_class', FundingCheckout::class)->count()); + } + + public function testReplacementWorkerCannotForgetTheOriginalPeriodPolicy(): void + { + $this->startPeriodOrder(BillingPeriod::PAYMENT_FIRST); + $authority = new Authority(DB::connection(), 'provider-worker', [$this->terms->subjectKey()], [ + $this->terms->subjectKey() => FundingCatalogue::IMMEDIATE, + ]); + DB::table('provider_machine_assignments')->where('id', $this->terms->subjectKey()) + ->update([ + 'terms' => '{invalid protected JSON', + ]); + $this->expectException(LogicException::class); + $this->expectExceptionMessage('The original subject authority or selected policy is unavailable.'); + $authority->assignment($this->terms->subjectKey()); + } + + public function testPaidAccessRejectsASubstitutedOriginalPaymentPublication(): void + { + $this->startPeriodOrder(BillingPeriod::PAYMENT_FIRST); + $rows = DB::table('example_machine_publications')->where( + 'subject_id', + Authority::subjectId($this->terms->subjectKey(), 'payment') + )->get(); + foreach ($rows as $row) { + $payload = json_decode($row->payload, true, flags: JSON_THROW_ON_ERROR); + if ($payload['state'] === 'paid') { + $payload['execution']['executionId'] = 'another-period.confirm-receipt.3'; + DB::table('example_machine_publications')->where('id', $row->id) + ->update([ + 'payload' => json_encode($payload, JSON_THROW_ON_ERROR), + ]); + } + } + $this->expectException(LogicException::class); + $this->expectExceptionMessage('The original Order Payment publication is missing or substituted.'); + $this->periodStore->access($this->period->subjectKey()); + } + + #[DataProvider('policies')] + public function testAnOnTimeCommitAcknowledgedAfterGraceKeepsTheOriginalOrder(string $policy): void + { + $root = $this->startPeriodOrder($policy, Status::Processing); + $charge = Request::fromArray($this->period->paymentDescriptor()['forward']); + Carbon::setTestNow(Carbon::createFromTimestampUTC($this->period->paymentDeadline - 1)); + $this->provider->resolve($charge, Status::Confirmed); + // Rebuild the host's policy/handlers while no native task is executing. + $this->store = MachineStore::configure($this->app, $this->store->authority, $this->provider); + $this->periodStore = $this->app->make(OrderBillingPeriodStore::class); + Carbon::setTestNow(Carbon::createFromTimestampUTC($this->period->paymentDeadline + 60)); + $this->signalPayment('delayed-original-ack'); + $this->assertSame('paid', $this->state('payment'), $this->progress()); + $this->assertSame('ready', $this->state('order'), $this->progress()); + $this->assertTrue($this->periodStore->access($this->period->subjectKey())['access']); + $this->assertSame($this->period->paymentDeadline - 1, $this->provider->timedLookup($charge)->confirmedAt); + $before = $this->effects(); + app(WorkflowReplayer::class)->replay($this->child('payment')); + $this->assertSame($before, $this->effects()); + $this->assertSame($root->runId(), $this->periodStore->admit($this->period->subjectKey())['runId']); + $this->assertSame( + 1, + count(array_filter($this->effects(), static fn (string $effect): bool => $effect === 'capture')) + ); + } + + #[DataProvider('policies')] + public function testLateOriginalMoneyDoesNotActivateAccessOrReserveStock(string $policy): void + { + $this->startPeriodOrder($policy, Status::Processing); + Carbon::setTestNow(Carbon::createFromTimestampUTC($this->period->paymentDeadline)); + $charge = Request::fromArray($this->period->paymentDescriptor()['forward']); + $this->provider->resolve($charge, Status::Confirmed); + $this->signalPayment('late-original-money'); + $this->assertSame('paid', $this->state('payment'), $this->progress()); + $value = $this->periodStore->access($this->period->subjectKey()); + $this->assertTrue($value['latePayment']); + $this->assertFalse($value['access']); + $this->assertNotContains('reserve', $this->effects()); + $this->assertNotContains('ship-book', $this->effects()); + $this->assertSame(['capture'], $this->effects()); + } + + public function testAQueuedOriginalOrderCannotFirstChargeAfterItsPaymentDeadline(): void + { + $this->startPeriodOrder(BillingPeriod::GRACE, pump: false); + $this->assertSame([], $this->effects()); + Carbon::setTestNow(Carbon::createFromTimestampUTC($this->period->paymentDeadline)); + $this->pump(); + $this->assertSame([], $this->effects()); + $this->assertSame(0, (int) $this->providerDb->query('SELECT COUNT(*) FROM provider_operations')->fetchColumn()); + $this->assertFalse($this->periodStore->access($this->period->subjectKey())['access']); + $this->assertNotSame('paid', $this->state('payment'), $this->progress()); + } + + public function testCancellationBeforeOriginalInitializationDoesNotInventAnEmptyScope(): void + { + $root = $this->startPeriodOrder(BillingPeriod::PAYMENT_FIRST, pump: false); + $result = $this->periodStore->cancel($this->period->subjectKey(), 'cancel-before-period-owner'); + $this->assertSame('unresolved', $result['status']); + $this->assertSame('original_scope_not_initialized', $result['reason']); + $this->assertSame([], $this->effects()); + $this->pump(); + $proof = (new ScopeRepository())->inspect( + $this->store->authority->plan($this->terms->subjectKey()) + ->rootScope() + ); + $this->assertSame('verified', $proof['status'], $this->progress()); + $this->assertSame([], $this->effects()); + $this->assertFalse($this->periodStore->access($this->period->subjectKey())['access']); + $this->assertSame($root->runId(), $this->periodStore->admit($this->period->subjectKey())['runId']); + } + + public function testRecoveryOfThePreviousPeriodCannotRefundTheNextOrdersMoney(): void + { + $first = $this->startPeriodOrder(BillingPeriod::PAYMENT_FIRST); + $originalTerms = $this->terms; + Carbon::setTestNow(Carbon::createFromTimestampUTC($this->nextPeriod->startsAt)); + $next = $this->periodStore->admit($this->nextPeriod->subjectKey()); + $this->pump(); + $this->assertNotSame($first->runId(), $next['runId']); + $this->assertTrue($this->periodStore->access($this->nextPeriod->subjectKey())['access']); + $this->periodStore->cancel($this->period->subjectKey(), 'original-order-period-only'); + $this->pump(); + $original = $this->store->authority->plan($originalTerms->subjectKey()); + $this->assertSame( + 'verified', + (new ScopeRepository())->inspect($original->rootScope())['status'], + $this->progress() + ); + $this->assertTrue($this->periodStore->access($this->nextPeriod->subjectKey())['access']); + $this->assertSame( + 'paid', + $this->store->authority->subject($this->nextPeriod->order->subjectKey(), 'payment') +->state + ); + $nextCharge = Request::fromArray($this->nextPeriod->paymentDescriptor()['forward']); + $this->assertFalse($this->provider->timedLookup($nextCharge)->observation->admissionClosed); + $this->assertSame( + 2, + count(array_filter($this->effects(), static fn (string $effect): bool => $effect === 'capture')) + ); + $this->assertSame( + 1, + count(array_filter($this->effects(), static fn (string $effect): bool => $effect === 'refund')) + ); + } + + private function signalPayment(string $request): void + { + WorkflowStub::loadRun($this->child('payment')->id, Catalogue::NAMESPACE) + ->withRequestId($request) + ->signal('reconcile-funding'); + $this->pump(); + } + + private function startPeriodOrder( + string $policy, + Status $payment = Status::Confirmed, + bool $pump = true + ): WorkflowStub { + $start = Carbon::now()->getTimestamp(); + $this->period = $this->orderPeriod('2026-01', $start, $policy); + $this->nextPeriod = $this->orderPeriod('2026-02', $this->period->endsAt, $policy); + $orders = [$this->period->order, $this->nextPeriod->order]; + $keys = array_map(static fn (OrderTerms $order): string => $order->subjectKey(), $orders); + $authority = new Authority( + DB::connection(), + 'provider-worker', + $keys, + array_fill_keys($keys, FundingCatalogue::IMMEDIATE), + orderPeriods: [$this->period, $this->nextPeriod], + ); + $this->store = MachineStore::configure($this->app, $authority, $this->provider); + $this->periodStore = $this->app->make(OrderBillingPeriodStore::class); + foreach ($orders as $terms) { + $this->store->seed($terms); + foreach ([ + $terms->descriptor('order'), + $terms->descriptor('payment'), + $terms->physicalDescriptor(), + ] as $graph) { + foreach ($graph as $value) { + $request = Request::fromArray($value); + $this->provider->plan($request, $request->action === 'capture' ? $payment : Status::Confirmed); + } + } + } + $this->terms = $this->period->order; + $result = $this->periodStore->admit($this->period->subjectKey()); + $root = WorkflowStub::loadRun($result['runId'], Catalogue::NAMESPACE); + if ($pump) { + $this->pump(); + } + return $root; + } + + private function orderPeriod(string $id, int $starts, string $policy): BillingPeriod + { + $args = [ + 'client' => 'shop-a', + 'subscription' => 'subscription-orders', + 'generation' => 'subscription-g1', + 'period' => $id, + 'amountMinor' => 1499, + 'currency' => 'USD', + 'startsAt' => $starts, + 'endsAt' => $starts + 2592000, + 'paymentDeadline' => BillingPeriod::graceDeadline($starts), + 'activationPolicy' => $policy, + 'accessDuringGrace' => $policy === BillingPeriod::GRACE, + ]; + $period = new BillingPeriod(...$args); + $order = new OrderTerms( + $period->client, + 'order-' . $id, + $period->ownerGeneration(), + $period->amountMinor, + $period->currency, + 'sku-1', + 2, + fulfillmentDeadline: $period->endsAt + 604800, + ); + return new BillingPeriod(...[ + ...$args, + 'order' => $order, + ]); + } +} diff --git a/tests/Unit/V2/StateMachine/BillingPeriodTest.php b/tests/Unit/V2/StateMachine/BillingPeriodTest.php index b268906e8..5007fc686 100644 --- a/tests/Unit/V2/StateMachine/BillingPeriodTest.php +++ b/tests/Unit/V2/StateMachine/BillingPeriodTest.php @@ -35,7 +35,7 @@ public function testServiceBillingDoesNotInventAnOrderOrShipment(): void $this->assertSame($period->fingerprint(), BillingPeriod::fromArray($period->toArray())->fingerprint()); } - public function testEachPeriodCanPinAGenuineDistinctOrderWithoutChangingItsPaymentIdentity(): void + public function testAnAssociatedPeriodUsesItsGenuineOrderPaymentInsteadOfASecondServiceCharge(): void { $period = $this->period(); $order = new OrderTerms('shop-a', 'actual-order-2026-11', $period->ownerGeneration(), 1499, 'USD', 'sku-a', 2); @@ -43,7 +43,8 @@ public function testEachPeriodCanPinAGenuineDistinctOrderWithoutChangingItsPayme $value['order'] = $order->toArray(); $associated = BillingPeriod::fromArray($value); $this->assertSame('actual-order-2026-11', $associated->order->subject); - $this->assertSame($period->paymentDescriptor(), $associated->paymentDescriptor()); + $this->assertSame($order->descriptor('payment'), $associated->paymentDescriptor()); + $this->assertNotSame($period->paymentDescriptor(), $associated->paymentDescriptor()); $this->assertNotSame($period->fingerprint(), $associated->fingerprint()); } diff --git a/tests/Unit/V2/StateMachine/OrderPeriodPolicyTest.php b/tests/Unit/V2/StateMachine/OrderPeriodPolicyTest.php new file mode 100644 index 000000000..1e6979baa --- /dev/null +++ b/tests/Unit/V2/StateMachine/OrderPeriodPolicyTest.php @@ -0,0 +1,121 @@ +period(); + if ($case !== 'service-only') { + $deadline = match ($case) { + 'missing-physical-budget' => null, + 'shared-payment-physical-deadline' => $period->paymentDeadline, + default => $period->endsAt + 3600, + }; + $value = $period->toArray(); + $value['order'] = (new OrderTerms( + 'shop-a', + 'original-order', + $period->ownerGeneration(), + 1499, + 'USD', + 'sku-1', + 2, + fulfillmentDeadline: $deadline + ))->toArray(); + $period = BillingPeriod::fromArray($value); + } + $key = $period->order?->subjectKey(); + $subjects = $key === null || $case === 'unassigned-order' ? [] : [$key]; + $db = $this->createMock(ConnectionInterface::class); + $db->method('transactionLevel') + ->willReturn(0); + $db->expects($this->never()) + ->method('table'); + $this->expectException(LogicException::class); + new Authority($db, 'period-worker', $subjects, $subjects === [] ? [] : [ + $key => $case === 'wrong-recipe' ? FundingCatalogue::AFTER_DELIVERY : FundingCatalogue::IMMEDIATE, + ], orderPeriods: $case === 'duplicate-period' ? [$period, $period] : [$period]); + } + + public function testAChangedImmutableAccessPolicyCannotReuseTheOriginalOrderGrant(): void + { + $period = $this->period(); + $value = $period->toArray(); + $value['order'] = (new OrderTerms( + 'shop-a', + 'original-order', + $period->ownerGeneration(), + 1499, + 'USD', + 'sku-1', + 2, + fulfillmentDeadline: $period->endsAt + 3600 + ))->toArray(); + $original = BillingPeriod::fromArray($value); + $value['accessDuringGrace'] = false; + $replacement = BillingPeriod::fromArray($value); + $key = $original->order->subjectKey(); + $db = $this->createStub(ConnectionInterface::class); + $db->method('transactionLevel') + ->willReturn(0); + $authority = static fn (BillingPeriod $grant): Authority => new Authority( + $db, + 'period-worker', + [$key], + [ + $key => FundingCatalogue::IMMEDIATE, + ], + orderPeriods: [$grant] + ); + $this->assertNotSame( + $authority($original) + ->grantFor($key, 'order'), + $authority($replacement) + ->grantFor($key, 'order') + ); + $this->assertSame( + $authority($original) + ->grantFor($key, 'order'), + $authority(BillingPeriod::fromArray($original->toArray()))->grantFor($key, 'order') + ); + } + + private function period(): BillingPeriod + { + return new BillingPeriod( + 'shop-a', + 'service-a', + 'subscription-g1', + '2026-01', + 1499, + 'USD', + 1000, + 3000000, + 865000, + BillingPeriod::GRACE, + true + ); + } +} From 20da8d69c1f70c42257e38cb3142eb9565607a62 Mon Sep 17 00:00:00 2001 From: Richard McDaniel <1130888+rmcdaniel@users.noreply.github.com> Date: Tue, 17 Nov 2026 04:19:05 +0000 Subject: [PATCH 2/4] refactor(examples): simplify original-period admission and receipt checks --- .../OrderBillingPeriodStore.php | 23 ++++++++----- .../OrderPeriodPaymentReceipt.php | 34 +++++++++++-------- .../OrderPeriodPolicy.php | 2 +- 3 files changed, 35 insertions(+), 24 deletions(-) diff --git a/examples/provider-state-machines/OrderBillingPeriodStore.php b/examples/provider-state-machines/OrderBillingPeriodStore.php index 68a0e2a76..e590b0a48 100644 --- a/examples/provider-state-machines/OrderBillingPeriodStore.php +++ b/examples/provider-state-machines/OrderBillingPeriodStore.php @@ -106,15 +106,7 @@ public function admit(string $key): array throw new LogicException('The original Order assignment changed during period admission.'); } if ($row->native_run !== null) { - $run = $this->assertRun($period, $row); - if ($current->root_run !== null && $current->root_run !== $run->id) { - throw new LogicException('The original Order acquired a different native owner.'); - } - return [ - 'accepted' => true, - 'runId' => $run->id, - 'existing' => true, - ]; + return $this->existingAdmission($period, $row, $current); } if ($current->root_run !== null) { throw new LogicException('A foreign existing Order cannot become this period admission.'); @@ -256,6 +248,19 @@ private function period(string $key): BillingPeriod return $period; } + private function existingAdmission(BillingPeriod $period, object $row, object $assignment): array + { + $run = $this->assertRun($period, $row); + if ($assignment->root_run !== null && $assignment->root_run !== $run->id) { + throw new LogicException('The original Order acquired a different native owner.'); + } + return [ + 'accepted' => true, + 'runId' => $run->id, + 'existing' => true, + ]; + } + private function row(BillingPeriod $period): object { $row = $this->authority->db->table('provider_billing_periods') diff --git a/examples/provider-state-machines/OrderPeriodPaymentReceipt.php b/examples/provider-state-machines/OrderPeriodPaymentReceipt.php index ba2285f8c..49a06377f 100644 --- a/examples/provider-state-machines/OrderPeriodPaymentReceipt.php +++ b/examples/provider-state-machines/OrderPeriodPaymentReceipt.php @@ -27,22 +27,10 @@ public function confirmedAt(BillingPeriod $period, WorkflowRun $root, bool $publ { $terms = $period->order ?? throw new LogicException('An original Order is required.'); $key = $terms->subjectKey(); - [$assignment, $original] = $this->authority->assignment($key); - if (PortableDescriptor::encode($original->toArray()) !== PortableDescriptor::encode($terms->toArray())) { - throw new LogicException('The period substituted its original Order terms.'); - } - if ($assignment->root_run === null) { - return null; - } - if ($assignment->root_run !== $root->id) { - throw new LogicException('The period substituted its original Order owner.'); - } - $actor = $this->authority->db->table('provider_machine_actors') - ->where('id', Authority::subjectId($key, 'payment'))->first(); - if ($actor === null) { + $payment = $this->originalPayment($terms, $root); + if ($payment === null) { return null; } - $payment = WorkflowRun::query()->findOrFail($actor->native_run); [$actualActor, $subject, $plan] = $this->authority->actor($payment); if ($actualActor->role !== 'payment' || $payment->workflow_class !== FundingPayment::class || $plan->rootRun !== $root->id || $plan->recipe !== FundingCatalogue::IMMEDIATE) { @@ -70,6 +58,24 @@ public function confirmedAt(BillingPeriod $period, WorkflowRun $root, bool $publ return $receipt->confirmedAt; } + private function originalPayment(OrderTerms $terms, WorkflowRun $root): ?WorkflowRun + { + $key = $terms->subjectKey(); + [$assignment, $original] = $this->authority->assignment($key); + if (PortableDescriptor::encode($original->toArray()) !== PortableDescriptor::encode($terms->toArray())) { + throw new LogicException('The period substituted its original Order terms.'); + } + if ($assignment->root_run === null) { + return null; + } + if ($assignment->root_run !== $root->id) { + throw new LogicException('The period substituted its original Order owner.'); + } + $actor = $this->authority->db->table('provider_machine_actors') + ->where('id', Authority::subjectId($key, 'payment'))->first(); + return $actor === null ? null : WorkflowRun::query()->findOrFail($actor->native_run); + } + private function assertPublication(string $key, WorkflowRun $payment, object $subject): void { $revision = (int) $subject->revision; diff --git a/examples/provider-state-machines/OrderPeriodPolicy.php b/examples/provider-state-machines/OrderPeriodPolicy.php index 23695c3d3..164819bdc 100644 --- a/examples/provider-state-machines/OrderPeriodPolicy.php +++ b/examples/provider-state-machines/OrderPeriodPolicy.php @@ -13,7 +13,7 @@ * @param list $grants */ public function __construct( - private Authority $authority, + Authority $authority, private array $grants = [], ) { if (! array_is_list($grants)) { From 569eb03bb385c490b80d1614b53cdd5433dfa346 Mon Sep 17 00:00:00 2001 From: Richard McDaniel <1130888+rmcdaniel@users.noreply.github.com> Date: Tue, 17 Nov 2026 04:26:59 +0000 Subject: [PATCH 3/4] fix(examples): preserve the original service-period payment identity --- examples/provider-state-machines/BillingPeriod.php | 3 --- examples/provider-state-machines/README.md | 6 ++++-- tests/Feature/V2/V2OrderBillingPeriodTest.php | 8 ++++---- tests/Unit/V2/StateMachine/BillingPeriodTest.php | 5 ++--- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/examples/provider-state-machines/BillingPeriod.php b/examples/provider-state-machines/BillingPeriod.php index 15a61b7f8..c77e885d2 100644 --- a/examples/provider-state-machines/BillingPeriod.php +++ b/examples/provider-state-machines/BillingPeriod.php @@ -81,9 +81,6 @@ public function subjectKey(): string */ public function paymentDescriptor(): array { - if ($this->order !== null) { - return $this->order->descriptor('payment'); - } $identity = fn (string $operation): Identity => new Identity( $this->client, $this->subscription, diff --git a/examples/provider-state-machines/README.md b/examples/provider-state-machines/README.md index 2f0e7c1bc..6fdf2fc89 100644 --- a/examples/provider-state-machines/README.md +++ b/examples/provider-state-machines/README.md @@ -596,8 +596,10 @@ container and call `admit($period->subjectKey())`. This admission atomically records the original period receipt and starts the existing `FundingCheckout`; its actual `FundingPayment` and `FullShipment` children retain the common routes, reservations and verified scope ownership. -The associated period's payment descriptor is that genuine Order's capture -and refund descriptor. It never creates a second service-only charge. Repeated +The adapter uses that genuine Order's capture and refund descriptor directly. +The existing `BillingPeriod::paymentDescriptor()` service identity remains +unchanged and is not used to charge an associated Order. No second service +charge is created. Repeated admission returns the original Order run rather than adopting a foreign run. `OrderBillingPeriodStore::access()` projects service entitlement separately diff --git a/tests/Feature/V2/V2OrderBillingPeriodTest.php b/tests/Feature/V2/V2OrderBillingPeriodTest.php index 8d545a376..7dd8bcc1d 100644 --- a/tests/Feature/V2/V2OrderBillingPeriodTest.php +++ b/tests/Feature/V2/V2OrderBillingPeriodTest.php @@ -99,7 +99,7 @@ public function testPaidPeriodUsesItsGenuineCommonOrderPaymentAndShipment(string $this->assertSame(1, WorkflowRun::query()->where('workflow_class', FundingCheckout::class)->count()); $this->assertSame(1, WorkflowRun::query()->where('workflow_class', FundingPayment::class)->count()); $this->assertSame(0, WorkflowRun::query()->where('workflow_class', ServicePeriodPayment::class)->count()); - $this->assertSame($this->terms->descriptor('payment'), $this->period->paymentDescriptor()); + $this->assertNotSame($this->terms->descriptor('payment'), $this->period->paymentDescriptor()); $before = $this->periodStore->admit($this->period->subjectKey()); $this->assertTrue($before['existing']); $this->assertSame($root->runId(), $before['runId']); @@ -193,7 +193,7 @@ public function testPaidAccessRejectsASubstitutedOriginalPaymentPublication(): v public function testAnOnTimeCommitAcknowledgedAfterGraceKeepsTheOriginalOrder(string $policy): void { $root = $this->startPeriodOrder($policy, Status::Processing); - $charge = Request::fromArray($this->period->paymentDescriptor()['forward']); + $charge = Request::fromArray($this->period->order->descriptor('payment')['forward']); Carbon::setTestNow(Carbon::createFromTimestampUTC($this->period->paymentDeadline - 1)); $this->provider->resolve($charge, Status::Confirmed); // Rebuild the host's policy/handlers while no native task is executing. @@ -220,7 +220,7 @@ public function testLateOriginalMoneyDoesNotActivateAccessOrReserveStock(string { $this->startPeriodOrder($policy, Status::Processing); Carbon::setTestNow(Carbon::createFromTimestampUTC($this->period->paymentDeadline)); - $charge = Request::fromArray($this->period->paymentDescriptor()['forward']); + $charge = Request::fromArray($this->period->order->descriptor('payment')['forward']); $this->provider->resolve($charge, Status::Confirmed); $this->signalPayment('late-original-money'); $this->assertSame('paid', $this->state('payment'), $this->progress()); @@ -285,7 +285,7 @@ public function testRecoveryOfThePreviousPeriodCannotRefundTheNextOrdersMoney(): $this->store->authority->subject($this->nextPeriod->order->subjectKey(), 'payment') ->state ); - $nextCharge = Request::fromArray($this->nextPeriod->paymentDescriptor()['forward']); + $nextCharge = Request::fromArray($this->nextPeriod->order->descriptor('payment')['forward']); $this->assertFalse($this->provider->timedLookup($nextCharge)->observation->admissionClosed); $this->assertSame( 2, diff --git a/tests/Unit/V2/StateMachine/BillingPeriodTest.php b/tests/Unit/V2/StateMachine/BillingPeriodTest.php index 5007fc686..b268906e8 100644 --- a/tests/Unit/V2/StateMachine/BillingPeriodTest.php +++ b/tests/Unit/V2/StateMachine/BillingPeriodTest.php @@ -35,7 +35,7 @@ public function testServiceBillingDoesNotInventAnOrderOrShipment(): void $this->assertSame($period->fingerprint(), BillingPeriod::fromArray($period->toArray())->fingerprint()); } - public function testAnAssociatedPeriodUsesItsGenuineOrderPaymentInsteadOfASecondServiceCharge(): void + public function testEachPeriodCanPinAGenuineDistinctOrderWithoutChangingItsPaymentIdentity(): void { $period = $this->period(); $order = new OrderTerms('shop-a', 'actual-order-2026-11', $period->ownerGeneration(), 1499, 'USD', 'sku-a', 2); @@ -43,8 +43,7 @@ public function testAnAssociatedPeriodUsesItsGenuineOrderPaymentInsteadOfASecond $value['order'] = $order->toArray(); $associated = BillingPeriod::fromArray($value); $this->assertSame('actual-order-2026-11', $associated->order->subject); - $this->assertSame($order->descriptor('payment'), $associated->paymentDescriptor()); - $this->assertNotSame($period->paymentDescriptor(), $associated->paymentDescriptor()); + $this->assertSame($period->paymentDescriptor(), $associated->paymentDescriptor()); $this->assertNotSame($period->fingerprint(), $associated->fingerprint()); } From 504f3cbdb499a415662331412c0f60df45e3e725 Mon Sep 17 00:00:00 2001 From: Richard McDaniel <1130888+rmcdaniel@users.noreply.github.com> Date: Tue, 17 Nov 2026 05:09:38 +0000 Subject: [PATCH 4/4] Require provider timing capability before Order admission and balance feature shards --- .github/feature-test-timings.json | 864 +++++++++--------- .github/feature-test-timings.md | 7 + .../providers/Journal.php | 16 + .../OrderBillingPeriodStore.php | 1 + examples/provider-state-machines/README.md | 6 + tests/Feature/V2/V2OrderBillingPeriodTest.php | 36 + .../ProviderEffectTimeCapabilityTest.php | 65 ++ 7 files changed, 565 insertions(+), 430 deletions(-) create mode 100644 .github/feature-test-timings.md create mode 100644 tests/Unit/V2/StateMachine/ProviderEffectTimeCapabilityTest.php diff --git a/.github/feature-test-timings.json b/.github/feature-test-timings.json index 0ceebd751..8b7601753 100644 --- a/.github/feature-test-timings.json +++ b/.github/feature-test-timings.json @@ -1,442 +1,446 @@ { "mysql": { - "tests/Feature/ActivityCompletionWakeTest.php": 4.095122, - "tests/Feature/ActivityDispatchBoundaryTest.php": 5.217607, - "tests/Feature/AiWorkflowTest.php": 10.121797, - "tests/Feature/AsyncWorkflowTest.php": 3.810782, - "tests/Feature/AwaitWithTimeoutWorkflowTest.php": 12.668776, - "tests/Feature/AwaitWorkflowTest.php": 6.181948, - "tests/Feature/Base64WorkflowTest.php": 10.668203, - "tests/Feature/ChildWorkflowSignalingTest.php": 7.476127, - "tests/Feature/ConcurrentWorkflowTest.php": 3.910835, - "tests/Feature/ContinueAsNewWorkflowTest.php": 2.58369, - "tests/Feature/ContinuedSignalRetirementTest.php": 15.812287, - "tests/Feature/DatabaseConnectionLifecycleTest.php": 0.061286, - "tests/Feature/DatabaseTruncationTest.php": 0.407531, - "tests/Feature/DispatchWorkflowInTransactionTest.php": 9.826793, - "tests/Feature/ExceptionLoggingReplayTest.php": 4.344952, - "tests/Feature/ExceptionWorkflowTest.php": 4.469664, - "tests/Feature/ExplicitQueueWorkerTest.php": 4.083662, - "tests/Feature/FailingWorkflowTest.php": 7.744834, - "tests/Feature/HeartbeatWorkflowTest.php": 10.503197, - "tests/Feature/MigrationTest.php": 51.50676, - "tests/Feature/NestedSignalRaceConditionTest.php": 7.701874, - "tests/Feature/ParentContinueAsNewChildWorkflowTest.php": 4.212506, - "tests/Feature/ParentWorkflowTest.php": 11.399151, - "tests/Feature/PendingContinuationTimerTest.php": 1.899986, - "tests/Feature/RaceConditionTest.php": 20.732575, - "tests/Feature/RetriesWorkflowTest.php": 6.599117, - "tests/Feature/SagaChildWorkflowTest.php": 4.833245, - "tests/Feature/SagaWorkflowTest.php": 1.998278, - "tests/Feature/SideEffectWorkflowTest.php": 0.542559, - "tests/Feature/SignalReplayTest.php": 26.633952, - "tests/Feature/StateChangedEventTest.php": 0.055008, - "tests/Feature/StateMachineWorkflowTest.php": 13.208445, - "tests/Feature/TimeoutWorkflowTest.php": 9.383533, - "tests/Feature/TimerWorkflowTest.php": 6.849553, - "tests/Feature/V2/ScheduleVisibilityQueryNativeStorageTest.php": 0.159571, - "tests/Feature/V2/ScheduleVisibilityQueryTest.php": 0.100437, - "tests/Feature/V2/TaskQueuePriorityFairnessTest.php": 4.581941, - "tests/Feature/V2/V2ActivityArgumentCodecTest.php": 4.645301, - "tests/Feature/V2/V2ActivityAttemptBudgetTest.php": 13.56259, - "tests/Feature/V2/V2ActivityEntryArgumentsTest.php": 11.851548, - "tests/Feature/V2/V2ActivityExceptionCodecTest.php": 4.783065, - "tests/Feature/V2/V2ActivityLeaseRepairLockTest.php": 3.233729, - "tests/Feature/V2/V2ActivityMetadataProjectionTest.php": 1.19315, - "tests/Feature/V2/V2ActivityOptionsTest.php": 11.024313, - "tests/Feature/V2/V2ActivityOutcomeHistoryRoleTest.php": 26.650859, - "tests/Feature/V2/V2ActivityTaskBridgeTest.php": 59.018701, - "tests/Feature/V2/V2ActivityTimeoutTest.php": 54.702612, - "tests/Feature/V2/V2AdvanceBalanceColdRecoveryTest.php": 268.498702, - "tests/Feature/V2/V2AdvanceBalanceMachineTest.php": 509.542893, - "tests/Feature/V2/V2AdvanceBalanceRefundTest.php": 626.834015, - "tests/Feature/V2/V2ArchiveWorkflowTest.php": 5.188205, - "tests/Feature/V2/V2AuthoredActivityRetryReplayTest.php": 6.574693, - "tests/Feature/V2/V2AuthorizedPaymentMachineTest.php": 322.463954, - "tests/Feature/V2/V2AvroAdapterCodecTest.php": 3.643629, - "tests/Feature/V2/V2AvroParitySuiteTest.php": 7.896392, - "tests/Feature/V2/V2AwaitWorkflowTest.php": 27.423261, - "tests/Feature/V2/V2BackfillMigrationLockTest.php": 47.649529, - "tests/Feature/V2/V2BankFundingMachineTest.php": 438.616565, - "tests/Feature/V2/V2BusinessCommitConcurrencyTest.php": 3.297001, - "tests/Feature/V2/V2CallerSuppliedReservationSnapshotTest.php": 0.612502, - "tests/Feature/V2/V2CancellationCascadeViewTest.php": 12.871441, - "tests/Feature/V2/V2CancellationCleanupOutcomeTest.php": 8.36449, - "tests/Feature/V2/V2CancellationRequestConcurrencyTest.php": 5.864895, - "tests/Feature/V2/V2CancellationScopeDeliveryTest.php": 86.787312, - "tests/Feature/V2/V2CancellationScopeDescendantsTest.php": 142.939953, - "tests/Feature/V2/V2CancellationScopeHistoryTest.php": 20.315507, - "tests/Feature/V2/V2CancellationScopeRequestsTest.php": 10.722175, - "tests/Feature/V2/V2CaptureCancellationMachineTest.php": 250.655006, - "tests/Feature/V2/V2CartCancellationMachineTest.php": 103.175654, - "tests/Feature/V2/V2CartCheckoutMachineTest.php": 372.213048, - "tests/Feature/V2/V2CartColdRecoveryTest.php": 449.410387, - "tests/Feature/V2/V2CartExpiryRefundMachineTest.php": 77.744045, + "tests/Feature/ActivityCompletionWakeTest.php": 3.978943, + "tests/Feature/ActivityDispatchBoundaryTest.php": 4.874045, + "tests/Feature/AiWorkflowTest.php": 3.40441, + "tests/Feature/AsyncWorkflowTest.php": 2.706522, + "tests/Feature/AwaitWithTimeoutWorkflowTest.php": 12.92422, + "tests/Feature/AwaitWorkflowTest.php": 10.871542, + "tests/Feature/Base64WorkflowTest.php": 6.825671, + "tests/Feature/ChildWorkflowSignalingTest.php": 9.161823, + "tests/Feature/ConcurrentWorkflowTest.php": 3.071828, + "tests/Feature/ContinueAsNewWorkflowTest.php": 0.580897, + "tests/Feature/ContinuedSignalRetirementTest.php": 16.055098, + "tests/Feature/DatabaseConnectionLifecycleTest.php": 0.04427, + "tests/Feature/DatabaseTruncationTest.php": 3.783342, + "tests/Feature/DispatchWorkflowInTransactionTest.php": 3.424044, + "tests/Feature/ExceptionLoggingReplayTest.php": 11.282231, + "tests/Feature/ExceptionWorkflowTest.php": 11.004529, + "tests/Feature/ExplicitQueueWorkerTest.php": 0.660644, + "tests/Feature/FailingWorkflowTest.php": 6.509929, + "tests/Feature/HeartbeatWorkflowTest.php": 10.504778, + "tests/Feature/MigrationTest.php": 50.239784, + "tests/Feature/NestedSignalRaceConditionTest.php": 3.38942, + "tests/Feature/ParentContinueAsNewChildWorkflowTest.php": 4.272772, + "tests/Feature/ParentWorkflowTest.php": 8.013671, + "tests/Feature/PendingContinuationTimerTest.php": 1.853936, + "tests/Feature/RaceConditionTest.php": 24.358485, + "tests/Feature/RetriesWorkflowTest.php": 6.55059, + "tests/Feature/SagaChildWorkflowTest.php": 1.301945, + "tests/Feature/SagaWorkflowTest.php": 1.959631, + "tests/Feature/SideEffectWorkflowTest.php": 0.411198, + "tests/Feature/SignalReplayTest.php": 29.465743, + "tests/Feature/StateChangedEventTest.php": 0.080172, + "tests/Feature/StateMachineWorkflowTest.php": 9.743074, + "tests/Feature/TimeoutWorkflowTest.php": 6.516092, + "tests/Feature/TimerWorkflowTest.php": 9.997338, + "tests/Feature/V2/ScheduleVisibilityQueryNativeStorageTest.php": 0.111499, + "tests/Feature/V2/ScheduleVisibilityQueryTest.php": 0.139113, + "tests/Feature/V2/TaskQueuePriorityFairnessTest.php": 1.760932, + "tests/Feature/V2/V2ActivityArgumentCodecTest.php": 7.651809, + "tests/Feature/V2/V2ActivityAttemptBudgetTest.php": 13.583035, + "tests/Feature/V2/V2ActivityEntryArgumentsTest.php": 8.236323, + "tests/Feature/V2/V2ActivityExceptionCodecTest.php": 6.396189, + "tests/Feature/V2/V2ActivityLeaseRepairLockTest.php": 3.766729, + "tests/Feature/V2/V2ActivityMetadataProjectionTest.php": 1.620708, + "tests/Feature/V2/V2ActivityOptionsTest.php": 7.916354, + "tests/Feature/V2/V2ActivityOutcomeHistoryRoleTest.php": 19.75849, + "tests/Feature/V2/V2ActivityTaskBridgeTest.php": 45.294639, + "tests/Feature/V2/V2ActivityTimeoutTest.php": 78.993736, + "tests/Feature/V2/V2AdvanceBalanceColdRecoveryTest.php": 130.90615, + "tests/Feature/V2/V2AdvanceBalanceMachineTest.php": 488.417584, + "tests/Feature/V2/V2AdvanceBalanceRefundTest.php": 595.651445, + "tests/Feature/V2/V2ArchiveWorkflowTest.php": 3.148936, + "tests/Feature/V2/V2AuthoredActivityRetryReplayTest.php": 5.642078, + "tests/Feature/V2/V2AuthorizedPaymentMachineTest.php": 200.891412, + "tests/Feature/V2/V2AvroAdapterCodecTest.php": 0.948843, + "tests/Feature/V2/V2AvroParitySuiteTest.php": 2.74069, + "tests/Feature/V2/V2AwaitWorkflowTest.php": 24.013871, + "tests/Feature/V2/V2BackfillMigrationLockTest.php": 53.814576, + "tests/Feature/V2/V2BankFundingMachineTest.php": 328.210401, + "tests/Feature/V2/V2BusinessCommitConcurrencyTest.php": 0.777732, + "tests/Feature/V2/V2CallerSuppliedReservationSnapshotTest.php": 1.772611, + "tests/Feature/V2/V2CancellationCascadeViewTest.php": 22.596218, + "tests/Feature/V2/V2CancellationCleanupOutcomeTest.php": 5.747423, + "tests/Feature/V2/V2CancellationRequestConcurrencyTest.php": 2.318008, + "tests/Feature/V2/V2CancellationScopeDeliveryTest.php": 86.336529, + "tests/Feature/V2/V2CancellationScopeDescendantsTest.php": 147.685706, + "tests/Feature/V2/V2CancellationScopeHistoryTest.php": 11.843334, + "tests/Feature/V2/V2CancellationScopeRequestsTest.php": 6.725639, + "tests/Feature/V2/V2CaptureCancellationMachineTest.php": 124.384713, + "tests/Feature/V2/V2CartCancellationMachineTest.php": 141.671618, + "tests/Feature/V2/V2CartCheckoutMachineTest.php": 356.96358, + "tests/Feature/V2/V2CartColdRecoveryTest.php": 313.394765, + "tests/Feature/V2/V2CartExpiryRefundMachineTest.php": 124.952043, "tests/Feature/V2/V2CartOrderAssociationConcurrencyTest.php": 0.001, - "tests/Feature/V2/V2CartOrderReceiptTest.php": 306.031511, - "tests/Feature/V2/V2CartUncertaintyMachineTest.php": 168.939231, - "tests/Feature/V2/V2ChildCancellationPolicyTest.php": 15.667934, - "tests/Feature/V2/V2ChildReservationConcurrencyTest.php": 2.012922, - "tests/Feature/V2/V2ChildReservationTest.php": 1.907128, - "tests/Feature/V2/V2ChildTerminalOutcomeTest.php": 10.15994, - "tests/Feature/V2/V2ChildWorkflowExternalOutputReplayTest.php": 0.262363, - "tests/Feature/V2/V2ChildWorkflowNamespaceProjectionTest.php": 0.251436, - "tests/Feature/V2/V2CodFundingMachineTest.php": 677.639361, - "tests/Feature/V2/V2CodMerchantSettlementTest.php": 160.755497, - "tests/Feature/V2/V2CommandDeadlockRetryTest.php": 5.938536, - "tests/Feature/V2/V2CommonFundingMachineTest.php": 425.976119, - "tests/Feature/V2/V2CommonReserveFirstProviderMachineTest.php": 145.87593, - "tests/Feature/V2/V2CompatibilityWorkflowTest.php": 11.403387, - "tests/Feature/V2/V2CompensationForwardAdmissionTest.php": 14.205825, - "tests/Feature/V2/V2CompensationInnoDbConcurrencyTest.php": 0.466897, - "tests/Feature/V2/V2CompensationRecoveryAuthorityTest.php": 83.011014, + "tests/Feature/V2/V2CartOrderReceiptTest.php": 223.060665, + "tests/Feature/V2/V2CartUncertaintyMachineTest.php": 182.927885, + "tests/Feature/V2/V2ChildCancellationPolicyTest.php": 8.689311, + "tests/Feature/V2/V2ChildReservationConcurrencyTest.php": 1.395565, + "tests/Feature/V2/V2ChildReservationTest.php": 4.586413, + "tests/Feature/V2/V2ChildTerminalOutcomeTest.php": 5.291189, + "tests/Feature/V2/V2ChildWorkflowExternalOutputReplayTest.php": 0.458093, + "tests/Feature/V2/V2ChildWorkflowNamespaceProjectionTest.php": 0.177864, + "tests/Feature/V2/V2CodFundingMachineTest.php": 341.169928, + "tests/Feature/V2/V2CodMerchantSettlementTest.php": 120.733419, + "tests/Feature/V2/V2CommandDeadlockRetryTest.php": 3.553453, + "tests/Feature/V2/V2CommonFundingMachineTest.php": 446.226441, + "tests/Feature/V2/V2CommonReserveFirstProviderMachineTest.php": 136.381503, + "tests/Feature/V2/V2CompatibilityWorkflowTest.php": 5.365382, + "tests/Feature/V2/V2CompensationForwardAdmissionTest.php": 7.996375, + "tests/Feature/V2/V2CompensationInnoDbConcurrencyTest.php": 0.592708, + "tests/Feature/V2/V2CompensationRecoveryAuthorityTest.php": 92.162758, "tests/Feature/V2/V2CompensationScopeConcurrencyTest.php": 0.001, - "tests/Feature/V2/V2CompensationScopeRunBoundaryTest.php": 28.768174, - "tests/Feature/V2/V2CompensationScopeTest.php": 221.806301, - "tests/Feature/V2/V2ConfiguredCoreModelsTest.php": 30.507929, - "tests/Feature/V2/V2ConfiguredStateMachineExampleTest.php": 263.136367, - "tests/Feature/V2/V2ContinueAsNewMetadataTest.php": 7.58084, - "tests/Feature/V2/V2ContinueAsNewOpenChildSupervisionTest.php": 8.352881, - "tests/Feature/V2/V2CooperativeParentCloseTest.php": 14.502245, - "tests/Feature/V2/V2DefaultConnectionRecoveryTest.php": 0.854311, - "tests/Feature/V2/V2DeliveryCaptureMachineTest.php": 272.295565, - "tests/Feature/V2/V2DependencyInjectionTest.php": 6.328396, - "tests/Feature/V2/V2DeterministicTimeReplayTest.php": 2.195659, - "tests/Feature/V2/V2DeterministicTimeTest.php": 2.040151, - "tests/Feature/V2/V2DuplicateStartPolicyTest.php": 4.433411, - "tests/Feature/V2/V2EmbeddedNamespaceIsolationTest.php": 10.248862, - "tests/Feature/V2/V2EmbeddedParallelChildConcurrencyTest.php": 8.222093, - "tests/Feature/V2/V2EmbeddedReplayRegressionCorpusTest.php": 140.253454, - "tests/Feature/V2/V2EntityReferenceTest.php": 14.383224, - "tests/Feature/V2/V2EntryMethodTest.php": 8.203718, - "tests/Feature/V2/V2FailedRunRedrivePlanTest.php": 1.388797, - "tests/Feature/V2/V2FailedRunRedriveTest.php": 308.03372, - "tests/Feature/V2/V2FailureMessageStorageMigrationTest.php": 1.307887, - "tests/Feature/V2/V2FinallyCleanupTest.php": 47.059234, - "tests/Feature/V2/V2FinancialInspectionTest.php": 16.55864, - "tests/Feature/V2/V2FinancialRetainedScopeTest.php": 27.041748, - "tests/Feature/V2/V2GoldenHistoryReplayTest.php": 0.590858, - "tests/Feature/V2/V2HistoryBudgetReplayTest.php": 8.838866, - "tests/Feature/V2/V2HistoryRecordedAtTimezoneTest.php": 1.42569, - "tests/Feature/V2/V2HistoryTimelineTest.php": 42.642654, - "tests/Feature/V2/V2InboxAfterParallelTest.php": 15.797004, - "tests/Feature/V2/V2IncomingPaymentInspectionTest.php": 23.462655, - "tests/Feature/V2/V2IncomingPaymentRetentionTest.php": 16.78492, - "tests/Feature/V2/V2LeasedSignalDeliveryTest.php": 5.524825, - "tests/Feature/V2/V2LegacyEventCompatibilityTest.php": 3.403884, - "tests/Feature/V2/V2LifecycleEventTest.php": 3.535299, - "tests/Feature/V2/V2LocalActivityTest.php": 2.74293, - "tests/Feature/V2/V2LocalEntityReferenceAuthorityTest.php": 11.021131, - "tests/Feature/V2/V2MachineDefinitionTest.php": 13.352282, - "tests/Feature/V2/V2MemoUpsertTest.php": 9.215135, - "tests/Feature/V2/V2MessageCursorContinueAsNewTest.php": 3.497231, - "tests/Feature/V2/V2MessageStreamAuthoringTest.php": 0.515764, - "tests/Feature/V2/V2MessageStreamReplayTest.php": 47.465188, - "tests/Feature/V2/V2NamespaceScopedLoadTest.php": 1.083544, - "tests/Feature/V2/V2NestedCompensationExampleTest.php": 62.341564, - "tests/Feature/V2/V2NexusCallerDeliveryTest.php": 0.646373, - "tests/Feature/V2/V2NonRetryableFailureTest.php": 4.786098, - "tests/Feature/V2/V2OpenOperationsAtCloseTest.php": 10.835287, - "tests/Feature/V2/V2OperatorMetricsTest.php": 65.120796, - "tests/Feature/V2/V2OperatorQueueVisibilityTest.php": 0.90881, - "tests/Feature/V2/V2ParentClosePolicyTest.php": 19.478727, - "tests/Feature/V2/V2PaymentFirstProviderMachineTest.php": 306.234649, - "tests/Feature/V2/V2PhysicalShipmentMachineTest.php": 280.392571, - "tests/Feature/V2/V2PortableCancellationDeliveryTest.php": 80.546318, - "tests/Feature/V2/V2PortableLocalActivityCheckpointTest.php": 12.190292, - "tests/Feature/V2/V2PortableLocalActivityCleanupTest.php": 13.0002, - "tests/Feature/V2/V2PortableLocalActivityControlTest.php": 22.682427, - "tests/Feature/V2/V2PortableLocalActivityOutcomeTest.php": 38.324201, - "tests/Feature/V2/V2PortableLocalActivityPreparationTest.php": 61.086875, - "tests/Feature/V2/V2PortableLocalActivityRecoveryTest.php": 34.093841, - "tests/Feature/V2/V2ProjectionTimestampTimezoneTest.php": 1.670333, - "tests/Feature/V2/V2ProviderRefundOutcomeTest.php": 147.532679, - "tests/Feature/V2/V2ProviderStateMachineExampleTest.php": 309.513871, - "tests/Feature/V2/V2PrunedHistoryExportTest.php": 3.542336, - "tests/Feature/V2/V2QueryWorkflowTest.php": 46.76737, - "tests/Feature/V2/V2RegisteredObligationCompensationTest.php": 31.752042, - "tests/Feature/V2/V2ReplayDiffTest.php": 7.637323, - "tests/Feature/V2/V2ResumeTaskSchedulingTest.php": 7.355887, - "tests/Feature/V2/V2RetainedProviderOperationTest.php": 5.579693, - "tests/Feature/V2/V2RunDetailViewTest.php": 33.373827, - "tests/Feature/V2/V2RunSummarySortKeyTest.php": 0.148626, - "tests/Feature/V2/V2RunTimerTaskHistoryRoleTest.php": 4.369403, - "tests/Feature/V2/V2SagaWorkflowTest.php": 22.535071, - "tests/Feature/V2/V2ScheduleAuditRetentionTest.php": 6.425952, - "tests/Feature/V2/V2ScheduleNamespaceInstanceIdTest.php": 2.180699, - "tests/Feature/V2/V2ScheduleTest.php": 38.226462, - "tests/Feature/V2/V2ScheduleTickBurstTest.php": 30.230594, - "tests/Feature/V2/V2ScheduleTimezoneTest.php": 13.270265, - "tests/Feature/V2/V2SchedulerDegradedModeTest.php": 3.005468, - "tests/Feature/V2/V2ScopedActivityCancellationTest.php": 50.32552, - "tests/Feature/V2/V2ScopedChildCancellationTest.php": 36.150632, - "tests/Feature/V2/V2ScopedLocalControlTest.php": 7.929566, - "tests/Feature/V2/V2ScopedTimerCancellationTest.php": 18.827571, - "tests/Feature/V2/V2ScopedWaitCancellationTest.php": 37.391771, - "tests/Feature/V2/V2SearchAttributeDatetimeRepairTest.php": 6.966489, - "tests/Feature/V2/V2SearchAttributeTest.php": 9.623506, - "tests/Feature/V2/V2ServiceDispatchTimestampMigrationTest.php": 15.098305, - "tests/Feature/V2/V2ServiceModeParallelChildBarrierTest.php": 32.667209, - "tests/Feature/V2/V2ServiceResponseReplayTest.php": 3.223725, - "tests/Feature/V2/V2SideEffectWorkflowTest.php": 18.124025, - "tests/Feature/V2/V2StandaloneActivityHostTest.php": 10.478018, - "tests/Feature/V2/V2StartNamespaceTest.php": 3.11253, - "tests/Feature/V2/V2StartSearchAttributeTest.php": 5.29654, - "tests/Feature/V2/V2StateMachineResourceBudgetTest.php": 15.884061, - "tests/Feature/V2/V2StructuralLimitTest.php": 57.990119, - "tests/Feature/V2/V2TaskDispatchHistoryRoleTest.php": 1.093831, - "tests/Feature/V2/V2TaskDispatchTest.php": 11.450658, - "tests/Feature/V2/V2TaskWatchdogRepairConcurrencyTest.php": 2.810726, - "tests/Feature/V2/V2TerminalReasonDiagnosticsTest.php": 19.91679, - "tests/Feature/V2/V2TimeoutCleanupAdmissionTest.php": 1.143789, - "tests/Feature/V2/V2TimeoutCleanupMigrationTest.php": 10.253693, - "tests/Feature/V2/V2TimeoutCleanupTest.php": 19.777547, - "tests/Feature/V2/V2TimerDeadlineMigrationTest.php": 35.238617, - "tests/Feature/V2/V2TimerWorkflowTest.php": 8.724579, - "tests/Feature/V2/V2UpdateBeforeCloseTest.php": 2.352422, - "tests/Feature/V2/V2UpdateTailCheckpointTest.php": 5.749997, - "tests/Feature/V2/V2UpdateWorkflowTest.php": 42.549671, - "tests/Feature/V2/V2UuidWorkflowTest.php": 0.59486, - "tests/Feature/V2/V2VersionUsageQueryTest.php": 4.057145, - "tests/Feature/V2/V2VersionWorkflowTest.php": 37.007571, - "tests/Feature/V2/V2WebhookPollAndControlPlaneTest.php": 2.165163, - "tests/Feature/V2/V2WebhookWorkflowTest.php": 78.866359, - "tests/Feature/V2/V2WorkflowControlPlaneTest.php": 21.836777, - "tests/Feature/V2/V2WorkflowEntryArgumentsTest.php": 10.09568, - "tests/Feature/V2/V2WorkflowReplayerTest.php": 2.824042, - "tests/Feature/V2/V2WorkflowRunRetentionCleanupTest.php": 7.344616, - "tests/Feature/V2/V2WorkflowStubContractTest.php": 0.549501, - "tests/Feature/V2/V2WorkflowStubFakeTest.php": 15.896903, - "tests/Feature/V2/V2WorkflowTaskBridgeTest.php": 251.368464, - "tests/Feature/V2/V2WorkflowTest.php": 148.231672, - "tests/Feature/V2/V2WorkflowTimeoutTest.php": 8.257278, - "tests/Feature/V2/V2WorkflowVersionPinningTest.php": 1.00212, - "tests/Feature/V2/WaterlineEngineSourceMysqlReadinessTest.php": 0.158135, - "tests/Feature/V2/WorkflowTaskFailureLivenessTest.php": 4.210449, - "tests/Feature/V2/WorkflowTaskSignalGapLockTest.php": 11.304597, - "tests/Feature/VersionWorkflowTest.php": 3.109242, - "tests/Feature/WebhookWorkflowTest.php": 4.67264, - "tests/Feature/WorkflowPollingTest.php": 20.785593, - "tests/Feature/WorkflowTest.php": 9.557568 + "tests/Feature/V2/V2CompensationScopeRunBoundaryTest.php": 27.017338, + "tests/Feature/V2/V2CompensationScopeTest.php": 167.670823, + "tests/Feature/V2/V2ConfiguredCoreModelsTest.php": 22.930525, + "tests/Feature/V2/V2ConfiguredStateMachineExampleTest.php": 436.078168, + "tests/Feature/V2/V2ContinueAsNewMetadataTest.php": 6.475753, + "tests/Feature/V2/V2ContinueAsNewOpenChildSupervisionTest.php": 8.418028, + "tests/Feature/V2/V2CooperativeParentCloseTest.php": 14.834195, + "tests/Feature/V2/V2DefaultConnectionRecoveryTest.php": 0.927002, + "tests/Feature/V2/V2DeliveryCaptureMachineTest.php": 274.378939, + "tests/Feature/V2/V2DependencyInjectionTest.php": 5.429273, + "tests/Feature/V2/V2DeterministicTimeReplayTest.php": 1.321847, + "tests/Feature/V2/V2DeterministicTimeTest.php": 1.470187, + "tests/Feature/V2/V2DuplicateStartPolicyTest.php": 8.877273, + "tests/Feature/V2/V2EmbeddedNamespaceIsolationTest.php": 7.025826, + "tests/Feature/V2/V2EmbeddedParallelChildConcurrencyTest.php": 14.834023, + "tests/Feature/V2/V2EmbeddedReplayRegressionCorpusTest.php": 148.982517, + "tests/Feature/V2/V2EntityReferenceTest.php": 16.907005, + "tests/Feature/V2/V2EntryMethodTest.php": 10.762319, + "tests/Feature/V2/V2FailedRunRedrivePlanTest.php": 1.333129, + "tests/Feature/V2/V2FailedRunRedriveTest.php": 309.688975, + "tests/Feature/V2/V2FailureMessageStorageMigrationTest.php": 1.342646, + "tests/Feature/V2/V2FinallyCleanupTest.php": 33.621484, + "tests/Feature/V2/V2FinancialInspectionTest.php": 29.999441, + "tests/Feature/V2/V2FinancialRetainedScopeTest.php": 24.603306, + "tests/Feature/V2/V2GoldenHistoryReplayTest.php": 0.606055, + "tests/Feature/V2/V2HistoryBudgetReplayTest.php": 8.763026, + "tests/Feature/V2/V2HistoryRecordedAtTimezoneTest.php": 1.170201, + "tests/Feature/V2/V2HistoryTimelineTest.php": 39.502468, + "tests/Feature/V2/V2InboxAfterParallelTest.php": 13.879436, + "tests/Feature/V2/V2IncomingPaymentInspectionTest.php": 18.750933, + "tests/Feature/V2/V2IncomingPaymentRetentionTest.php": 30.361063, + "tests/Feature/V2/V2LeasedSignalDeliveryTest.php": 5.230958, + "tests/Feature/V2/V2LegacyEventCompatibilityTest.php": 3.391107, + "tests/Feature/V2/V2LifecycleEventTest.php": 3.397291, + "tests/Feature/V2/V2LocalActivityTest.php": 1.151608, + "tests/Feature/V2/V2LocalEntityReferenceAuthorityTest.php": 5.640176, + "tests/Feature/V2/V2MachineDefinitionTest.php": 10.859139, + "tests/Feature/V2/V2MemoUpsertTest.php": 8.887959, + "tests/Feature/V2/V2MessageCursorContinueAsNewTest.php": 2.569592, + "tests/Feature/V2/V2MessageStreamAuthoringTest.php": 0.419578, + "tests/Feature/V2/V2MessageStreamReplayTest.php": 36.919088, + "tests/Feature/V2/V2NamespaceScopedLoadTest.php": 0.615463, + "tests/Feature/V2/V2NestedCompensationExampleTest.php": 50.197745, + "tests/Feature/V2/V2NexusCallerDeliveryTest.php": 0.93643, + "tests/Feature/V2/V2NonRetryableFailureTest.php": 5.463847, + "tests/Feature/V2/V2OpenOperationsAtCloseTest.php": 10.48657, + "tests/Feature/V2/V2OperatorMetricsTest.php": 42.440474, + "tests/Feature/V2/V2OperatorQueueVisibilityTest.php": 0.898974, + "tests/Feature/V2/V2OrderBillingPeriodTest.php": 284.93566, + "tests/Feature/V2/V2ParentClosePolicyTest.php": 19.893824, + "tests/Feature/V2/V2PaymentFirstProviderMachineTest.php": 190.276999, + "tests/Feature/V2/V2PhysicalShipmentMachineTest.php": 379.823765, + "tests/Feature/V2/V2PortableCancellationDeliveryTest.php": 78.894417, + "tests/Feature/V2/V2PortableLocalActivityCheckpointTest.php": 4.627232, + "tests/Feature/V2/V2PortableLocalActivityCleanupTest.php": 9.039858, + "tests/Feature/V2/V2PortableLocalActivityControlTest.php": 19.476074, + "tests/Feature/V2/V2PortableLocalActivityOutcomeTest.php": 38.184377, + "tests/Feature/V2/V2PortableLocalActivityPreparationTest.php": 44.992963, + "tests/Feature/V2/V2PortableLocalActivityRecoveryTest.php": 41.620381, + "tests/Feature/V2/V2ProjectionTimestampTimezoneTest.php": 2.244971, + "tests/Feature/V2/V2ProviderRefundOutcomeTest.php": 157.867088, + "tests/Feature/V2/V2ProviderStateMachineExampleTest.php": 535.765359, + "tests/Feature/V2/V2PrunedHistoryExportTest.php": 3.511523, + "tests/Feature/V2/V2QueryWorkflowTest.php": 40.679428, + "tests/Feature/V2/V2RegisteredObligationCompensationTest.php": 34.648074, + "tests/Feature/V2/V2ReplayDiffTest.php": 7.551988, + "tests/Feature/V2/V2ResumeTaskSchedulingTest.php": 3.48507, + "tests/Feature/V2/V2RetainedProviderOperationTest.php": 5.373367, + "tests/Feature/V2/V2RunDetailViewTest.php": 40.373619, + "tests/Feature/V2/V2RunSummarySortKeyTest.php": 0.107306, + "tests/Feature/V2/V2RunTimerTaskHistoryRoleTest.php": 4.153593, + "tests/Feature/V2/V2SagaWorkflowTest.php": 17.124487, + "tests/Feature/V2/V2ScheduleAuditRetentionTest.php": 8.736316, + "tests/Feature/V2/V2ScheduleNamespaceInstanceIdTest.php": 4.880101, + "tests/Feature/V2/V2ScheduleTest.php": 37.8724, + "tests/Feature/V2/V2ScheduleTickBurstTest.php": 26.284349, + "tests/Feature/V2/V2ScheduleTimezoneTest.php": 14.774949, + "tests/Feature/V2/V2SchedulerDegradedModeTest.php": 3.188815, + "tests/Feature/V2/V2ScopedActivityCancellationTest.php": 26.751015, + "tests/Feature/V2/V2ScopedChildCancellationTest.php": 43.22807, + "tests/Feature/V2/V2ScopedLocalControlTest.php": 5.677932, + "tests/Feature/V2/V2ScopedTimerCancellationTest.php": 9.412796, + "tests/Feature/V2/V2ScopedWaitCancellationTest.php": 20.583399, + "tests/Feature/V2/V2SearchAttributeDatetimeRepairTest.php": 5.897169, + "tests/Feature/V2/V2SearchAttributeTest.php": 9.48931, + "tests/Feature/V2/V2ServiceBillingPeriodTest.php": 185.53345, + "tests/Feature/V2/V2ServiceDispatchTimestampMigrationTest.php": 14.648865, + "tests/Feature/V2/V2ServiceModeParallelChildBarrierTest.php": 23.272069, + "tests/Feature/V2/V2ServiceResponseReplayTest.php": 3.235544, + "tests/Feature/V2/V2SideEffectWorkflowTest.php": 12.248191, + "tests/Feature/V2/V2StandaloneActivityHostTest.php": 7.885662, + "tests/Feature/V2/V2StartNamespaceTest.php": 2.501358, + "tests/Feature/V2/V2StartSearchAttributeTest.php": 5.169331, + "tests/Feature/V2/V2StateMachineResourceBudgetTest.php": 15.732547, + "tests/Feature/V2/V2StructuralLimitTest.php": 59.249993, + "tests/Feature/V2/V2TaskDispatchHistoryRoleTest.php": 0.956627, + "tests/Feature/V2/V2TaskDispatchTest.php": 8.898944, + "tests/Feature/V2/V2TaskWatchdogRepairConcurrencyTest.php": 2.857797, + "tests/Feature/V2/V2TerminalReasonDiagnosticsTest.php": 20.148251, + "tests/Feature/V2/V2TimeoutCleanupAdmissionTest.php": 1.839018, + "tests/Feature/V2/V2TimeoutCleanupMigrationTest.php": 9.793906, + "tests/Feature/V2/V2TimeoutCleanupTest.php": 17.945254, + "tests/Feature/V2/V2TimerDeadlineMigrationTest.php": 43.07614, + "tests/Feature/V2/V2TimerWorkflowTest.php": 3.567774, + "tests/Feature/V2/V2UpdateBeforeCloseTest.php": 2.280479, + "tests/Feature/V2/V2UpdateTailCheckpointTest.php": 4.936395, + "tests/Feature/V2/V2UpdateWorkflowTest.php": 36.351156, + "tests/Feature/V2/V2UuidWorkflowTest.php": 0.560212, + "tests/Feature/V2/V2VersionUsageQueryTest.php": 2.582491, + "tests/Feature/V2/V2VersionWorkflowTest.php": 21.785245, + "tests/Feature/V2/V2WebhookPollAndControlPlaneTest.php": 1.463667, + "tests/Feature/V2/V2WebhookWorkflowTest.php": 69.470018, + "tests/Feature/V2/V2WorkflowControlPlaneTest.php": 36.278328, + "tests/Feature/V2/V2WorkflowEntryArgumentsTest.php": 10.782672, + "tests/Feature/V2/V2WorkflowReplayerTest.php": 2.183616, + "tests/Feature/V2/V2WorkflowRunRetentionCleanupTest.php": 8.013083, + "tests/Feature/V2/V2WorkflowStubContractTest.php": 0.407565, + "tests/Feature/V2/V2WorkflowStubFakeTest.php": 9.674243, + "tests/Feature/V2/V2WorkflowTaskBridgeTest.php": 248.634709, + "tests/Feature/V2/V2WorkflowTest.php": 122.640307, + "tests/Feature/V2/V2WorkflowTimeoutTest.php": 4.969788, + "tests/Feature/V2/V2WorkflowVersionPinningTest.php": 0.888929, + "tests/Feature/V2/WaterlineEngineSourceMysqlReadinessTest.php": 0.074714, + "tests/Feature/V2/WorkflowTaskFailureLivenessTest.php": 3.611261, + "tests/Feature/V2/WorkflowTaskSignalGapLockTest.php": 10.485876, + "tests/Feature/VersionWorkflowTest.php": 3.12323, + "tests/Feature/WebhookWorkflowTest.php": 5.274024, + "tests/Feature/WorkflowPollingTest.php": 20.609262, + "tests/Feature/WorkflowTest.php": 5.821523 }, "postgresql": { - "tests/Feature/ActivityCompletionWakeTest.php": 1.868825, - "tests/Feature/ActivityDispatchBoundaryTest.php": 1.989559, - "tests/Feature/AiWorkflowTest.php": 4.217325, - "tests/Feature/AsyncWorkflowTest.php": 3.669619, - "tests/Feature/AwaitWithTimeoutWorkflowTest.php": 10.188327, - "tests/Feature/AwaitWorkflowTest.php": 7.188924, - "tests/Feature/Base64WorkflowTest.php": 7.33077, - "tests/Feature/ChildWorkflowSignalingTest.php": 6.021228, - "tests/Feature/ConcurrentWorkflowTest.php": 3.692732, - "tests/Feature/ContinueAsNewWorkflowTest.php": 0.679446, - "tests/Feature/ContinuedSignalRetirementTest.php": 15.727504, - "tests/Feature/DatabaseConnectionLifecycleTest.php": 0.065923, - "tests/Feature/DatabaseTruncationTest.php": 0.48517, - "tests/Feature/DispatchWorkflowInTransactionTest.php": 3.447516, - "tests/Feature/ExceptionLoggingReplayTest.php": 8.000093, - "tests/Feature/ExceptionWorkflowTest.php": 4.81857, - "tests/Feature/ExplicitQueueWorkerTest.php": 0.427187, - "tests/Feature/FailingWorkflowTest.php": 3.498386, - "tests/Feature/HeartbeatWorkflowTest.php": 10.538656, - "tests/Feature/MigrationTest.php": 10.988065, - "tests/Feature/NestedSignalRaceConditionTest.php": 3.328914, - "tests/Feature/ParentContinueAsNewChildWorkflowTest.php": 0.579949, - "tests/Feature/ParentWorkflowTest.php": 7.857314, - "tests/Feature/PendingContinuationTimerTest.php": 2.20354, - "tests/Feature/RaceConditionTest.php": 18.797795, - "tests/Feature/RetriesWorkflowTest.php": 6.58546, - "tests/Feature/SagaChildWorkflowTest.php": 3.990787, - "tests/Feature/SagaWorkflowTest.php": 1.475643, - "tests/Feature/SideEffectWorkflowTest.php": 0.350606, - "tests/Feature/SignalReplayTest.php": 43.002528, - "tests/Feature/StateChangedEventTest.php": 0.637443, - "tests/Feature/StateMachineWorkflowTest.php": 12.647753, - "tests/Feature/TimeoutWorkflowTest.php": 6.4648, - "tests/Feature/TimerWorkflowTest.php": 7.141101, - "tests/Feature/V2/ScheduleVisibilityQueryNativeStorageTest.php": 0.200975, - "tests/Feature/V2/ScheduleVisibilityQueryTest.php": 0.031355, - "tests/Feature/V2/TaskQueuePriorityFairnessTest.php": 1.013421, - "tests/Feature/V2/V2ActivityArgumentCodecTest.php": 7.373389, - "tests/Feature/V2/V2ActivityAttemptBudgetTest.php": 8.439179, - "tests/Feature/V2/V2ActivityEntryArgumentsTest.php": 2.556452, - "tests/Feature/V2/V2ActivityExceptionCodecTest.php": 2.320526, - "tests/Feature/V2/V2ActivityLeaseRepairLockTest.php": 0.352442, - "tests/Feature/V2/V2ActivityMetadataProjectionTest.php": 0.150961, - "tests/Feature/V2/V2ActivityOptionsTest.php": 3.665868, - "tests/Feature/V2/V2ActivityOutcomeHistoryRoleTest.php": 16.831354, - "tests/Feature/V2/V2ActivityTaskBridgeTest.php": 27.989575, - "tests/Feature/V2/V2ActivityTimeoutTest.php": 34.170642, - "tests/Feature/V2/V2AdvanceBalanceColdRecoveryTest.php": 110.705814, - "tests/Feature/V2/V2AdvanceBalanceMachineTest.php": 161.618002, - "tests/Feature/V2/V2AdvanceBalanceRefundTest.php": 214.596916, - "tests/Feature/V2/V2ArchiveWorkflowTest.php": 2.133064, - "tests/Feature/V2/V2AuthoredActivityRetryReplayTest.php": 3.174119, - "tests/Feature/V2/V2AuthorizedPaymentMachineTest.php": 96.797749, - "tests/Feature/V2/V2AvroAdapterCodecTest.php": 0.767456, - "tests/Feature/V2/V2AvroParitySuiteTest.php": 2.262229, - "tests/Feature/V2/V2AwaitWorkflowTest.php": 23.596604, - "tests/Feature/V2/V2BackfillMigrationLockTest.php": 13.51647, - "tests/Feature/V2/V2BankFundingMachineTest.php": 168.946169, - "tests/Feature/V2/V2BusinessCommitConcurrencyTest.php": 1.156015, + "tests/Feature/ActivityCompletionWakeTest.php": 1.469372, + "tests/Feature/ActivityDispatchBoundaryTest.php": 2.488067, + "tests/Feature/AiWorkflowTest.php": 7.162987, + "tests/Feature/AsyncWorkflowTest.php": 0.560969, + "tests/Feature/AwaitWithTimeoutWorkflowTest.php": 14.111604, + "tests/Feature/AwaitWorkflowTest.php": 3.935574, + "tests/Feature/Base64WorkflowTest.php": 7.291746, + "tests/Feature/ChildWorkflowSignalingTest.php": 5.250152, + "tests/Feature/ConcurrentWorkflowTest.php": 0.514077, + "tests/Feature/ContinueAsNewWorkflowTest.php": 0.665879, + "tests/Feature/ContinuedSignalRetirementTest.php": 16.334963, + "tests/Feature/DatabaseConnectionLifecycleTest.php": 0.073056, + "tests/Feature/DatabaseTruncationTest.php": 0.809033, + "tests/Feature/DispatchWorkflowInTransactionTest.php": 4.127804, + "tests/Feature/ExceptionLoggingReplayTest.php": 4.427831, + "tests/Feature/ExceptionWorkflowTest.php": 4.487615, + "tests/Feature/ExplicitQueueWorkerTest.php": 0.503277, + "tests/Feature/FailingWorkflowTest.php": 3.388239, + "tests/Feature/HeartbeatWorkflowTest.php": 10.530493, + "tests/Feature/MigrationTest.php": 12.402744, + "tests/Feature/NestedSignalRaceConditionTest.php": 4.141357, + "tests/Feature/ParentContinueAsNewChildWorkflowTest.php": 0.522168, + "tests/Feature/ParentWorkflowTest.php": 8.286288, + "tests/Feature/PendingContinuationTimerTest.php": 1.644712, + "tests/Feature/RaceConditionTest.php": 24.295986, + "tests/Feature/RetriesWorkflowTest.php": 9.505372, + "tests/Feature/SagaChildWorkflowTest.php": 0.870764, + "tests/Feature/SagaWorkflowTest.php": 1.6973, + "tests/Feature/SideEffectWorkflowTest.php": 0.55712, + "tests/Feature/SignalReplayTest.php": 19.11023, + "tests/Feature/StateChangedEventTest.php": 0.079063, + "tests/Feature/StateMachineWorkflowTest.php": 12.79405, + "tests/Feature/TimeoutWorkflowTest.php": 6.445223, + "tests/Feature/TimerWorkflowTest.php": 6.965354, + "tests/Feature/V2/ScheduleVisibilityQueryNativeStorageTest.php": 0.150499, + "tests/Feature/V2/ScheduleVisibilityQueryTest.php": 0.075023, + "tests/Feature/V2/TaskQueuePriorityFairnessTest.php": 1.200875, + "tests/Feature/V2/V2ActivityArgumentCodecTest.php": 7.313762, + "tests/Feature/V2/V2ActivityAttemptBudgetTest.php": 13.30295, + "tests/Feature/V2/V2ActivityEntryArgumentsTest.php": 2.957671, + "tests/Feature/V2/V2ActivityExceptionCodecTest.php": 2.60505, + "tests/Feature/V2/V2ActivityLeaseRepairLockTest.php": 0.334418, + "tests/Feature/V2/V2ActivityMetadataProjectionTest.php": 0.191192, + "tests/Feature/V2/V2ActivityOptionsTest.php": 5.285354, + "tests/Feature/V2/V2ActivityOutcomeHistoryRoleTest.php": 16.617671, + "tests/Feature/V2/V2ActivityTaskBridgeTest.php": 24.559807, + "tests/Feature/V2/V2ActivityTimeoutTest.php": 48.06683, + "tests/Feature/V2/V2AdvanceBalanceColdRecoveryTest.php": 144.802247, + "tests/Feature/V2/V2AdvanceBalanceMachineTest.php": 228.882954, + "tests/Feature/V2/V2AdvanceBalanceRefundTest.php": 154.311357, + "tests/Feature/V2/V2ArchiveWorkflowTest.php": 1.693093, + "tests/Feature/V2/V2AuthoredActivityRetryReplayTest.php": 3.487941, + "tests/Feature/V2/V2AuthorizedPaymentMachineTest.php": 186.07126, + "tests/Feature/V2/V2AvroAdapterCodecTest.php": 0.846713, + "tests/Feature/V2/V2AvroParitySuiteTest.php": 2.696732, + "tests/Feature/V2/V2AwaitWorkflowTest.php": 25.749653, + "tests/Feature/V2/V2BackfillMigrationLockTest.php": 8.102385, + "tests/Feature/V2/V2BankFundingMachineTest.php": 171.327209, + "tests/Feature/V2/V2BusinessCommitConcurrencyTest.php": 1.006287, "tests/Feature/V2/V2CallerSuppliedReservationSnapshotTest.php": 0.001, - "tests/Feature/V2/V2CancellationCascadeViewTest.php": 16.008546, - "tests/Feature/V2/V2CancellationCleanupOutcomeTest.php": 7.117086, - "tests/Feature/V2/V2CancellationRequestConcurrencyTest.php": 2.371918, - "tests/Feature/V2/V2CancellationScopeDeliveryTest.php": 71.729139, - "tests/Feature/V2/V2CancellationScopeDescendantsTest.php": 185.59839, - "tests/Feature/V2/V2CancellationScopeHistoryTest.php": 10.705327, - "tests/Feature/V2/V2CancellationScopeRequestsTest.php": 8.032706, - "tests/Feature/V2/V2CaptureCancellationMachineTest.php": 96.031743, - "tests/Feature/V2/V2CartCancellationMachineTest.php": 50.087116, - "tests/Feature/V2/V2CartCheckoutMachineTest.php": 165.15369, - "tests/Feature/V2/V2CartColdRecoveryTest.php": 165.121473, - "tests/Feature/V2/V2CartExpiryRefundMachineTest.php": 52.699624, - "tests/Feature/V2/V2CartOrderAssociationConcurrencyTest.php": 64.68181, - "tests/Feature/V2/V2CartOrderReceiptTest.php": 109.718759, - "tests/Feature/V2/V2CartUncertaintyMachineTest.php": 59.793674, - "tests/Feature/V2/V2ChildCancellationPolicyTest.php": 8.358306, - "tests/Feature/V2/V2ChildReservationConcurrencyTest.php": 1.530184, - "tests/Feature/V2/V2ChildReservationTest.php": 2.188265, - "tests/Feature/V2/V2ChildTerminalOutcomeTest.php": 4.890516, - "tests/Feature/V2/V2ChildWorkflowExternalOutputReplayTest.php": 0.180903, - "tests/Feature/V2/V2ChildWorkflowNamespaceProjectionTest.php": 0.511029, - "tests/Feature/V2/V2CodFundingMachineTest.php": 158.268962, - "tests/Feature/V2/V2CodMerchantSettlementTest.php": 62.664058, + "tests/Feature/V2/V2CancellationCascadeViewTest.php": 12.407651, + "tests/Feature/V2/V2CancellationCleanupOutcomeTest.php": 6.352107, + "tests/Feature/V2/V2CancellationRequestConcurrencyTest.php": 2.59287, + "tests/Feature/V2/V2CancellationScopeDeliveryTest.php": 88.89854, + "tests/Feature/V2/V2CancellationScopeDescendantsTest.php": 185.165807, + "tests/Feature/V2/V2CancellationScopeHistoryTest.php": 17.82362, + "tests/Feature/V2/V2CancellationScopeRequestsTest.php": 6.293343, + "tests/Feature/V2/V2CaptureCancellationMachineTest.php": 94.292355, + "tests/Feature/V2/V2CartCancellationMachineTest.php": 49.017876, + "tests/Feature/V2/V2CartCheckoutMachineTest.php": 140.669532, + "tests/Feature/V2/V2CartColdRecoveryTest.php": 221.466655, + "tests/Feature/V2/V2CartExpiryRefundMachineTest.php": 52.749857, + "tests/Feature/V2/V2CartOrderAssociationConcurrencyTest.php": 85.887323, + "tests/Feature/V2/V2CartOrderReceiptTest.php": 111.143579, + "tests/Feature/V2/V2CartUncertaintyMachineTest.php": 79.451232, + "tests/Feature/V2/V2ChildCancellationPolicyTest.php": 11.017928, + "tests/Feature/V2/V2ChildReservationConcurrencyTest.php": 1.657936, + "tests/Feature/V2/V2ChildReservationTest.php": 2.416067, + "tests/Feature/V2/V2ChildTerminalOutcomeTest.php": 6.276514, + "tests/Feature/V2/V2ChildWorkflowExternalOutputReplayTest.php": 0.249134, + "tests/Feature/V2/V2ChildWorkflowNamespaceProjectionTest.php": 0.273937, + "tests/Feature/V2/V2CodFundingMachineTest.php": 225.994537, + "tests/Feature/V2/V2CodMerchantSettlementTest.php": 77.092129, "tests/Feature/V2/V2CommandDeadlockRetryTest.php": 0.001, - "tests/Feature/V2/V2CommonFundingMachineTest.php": 214.346938, - "tests/Feature/V2/V2CommonReserveFirstProviderMachineTest.php": 57.731593, - "tests/Feature/V2/V2CompatibilityWorkflowTest.php": 7.81997, - "tests/Feature/V2/V2CompensationForwardAdmissionTest.php": 5.884199, + "tests/Feature/V2/V2CommonFundingMachineTest.php": 149.960561, + "tests/Feature/V2/V2CommonReserveFirstProviderMachineTest.php": 56.815567, + "tests/Feature/V2/V2CompatibilityWorkflowTest.php": 7.9571, + "tests/Feature/V2/V2CompensationForwardAdmissionTest.php": 7.352515, "tests/Feature/V2/V2CompensationInnoDbConcurrencyTest.php": 0.001, - "tests/Feature/V2/V2CompensationRecoveryAuthorityTest.php": 47.924264, - "tests/Feature/V2/V2CompensationScopeConcurrencyTest.php": 1.292979, - "tests/Feature/V2/V2CompensationScopeRunBoundaryTest.php": 19.203501, - "tests/Feature/V2/V2CompensationScopeTest.php": 103.884382, - "tests/Feature/V2/V2ConfiguredCoreModelsTest.php": 8.07109, - "tests/Feature/V2/V2ConfiguredStateMachineExampleTest.php": 169.32676, - "tests/Feature/V2/V2ContinueAsNewMetadataTest.php": 4.356855, - "tests/Feature/V2/V2ContinueAsNewOpenChildSupervisionTest.php": 3.894038, - "tests/Feature/V2/V2CooperativeParentCloseTest.php": 8.120643, - "tests/Feature/V2/V2DefaultConnectionRecoveryTest.php": 1.521902, - "tests/Feature/V2/V2DeliveryCaptureMachineTest.php": 129.91974, - "tests/Feature/V2/V2DependencyInjectionTest.php": 1.431216, - "tests/Feature/V2/V2DeterministicTimeReplayTest.php": 1.283457, - "tests/Feature/V2/V2DeterministicTimeTest.php": 1.708285, - "tests/Feature/V2/V2DuplicateStartPolicyTest.php": 3.696488, - "tests/Feature/V2/V2EmbeddedNamespaceIsolationTest.php": 5.682611, - "tests/Feature/V2/V2EmbeddedParallelChildConcurrencyTest.php": 6.5764, - "tests/Feature/V2/V2EmbeddedReplayRegressionCorpusTest.php": 68.752268, - "tests/Feature/V2/V2EntityReferenceTest.php": 9.825567, - "tests/Feature/V2/V2EntryMethodTest.php": 1.531645, - "tests/Feature/V2/V2FailedRunRedrivePlanTest.php": 0.96099, - "tests/Feature/V2/V2FailedRunRedriveTest.php": 184.169658, - "tests/Feature/V2/V2FailureMessageStorageMigrationTest.php": 1.390751, - "tests/Feature/V2/V2FinallyCleanupTest.php": 35.188863, - "tests/Feature/V2/V2FinancialInspectionTest.php": 14.560672, - "tests/Feature/V2/V2FinancialRetainedScopeTest.php": 17.719769, - "tests/Feature/V2/V2GoldenHistoryReplayTest.php": 0.630241, - "tests/Feature/V2/V2HistoryBudgetReplayTest.php": 6.225997, - "tests/Feature/V2/V2HistoryRecordedAtTimezoneTest.php": 1.097227, - "tests/Feature/V2/V2HistoryTimelineTest.php": 30.361972, - "tests/Feature/V2/V2InboxAfterParallelTest.php": 11.176395, - "tests/Feature/V2/V2IncomingPaymentInspectionTest.php": 14.338532, - "tests/Feature/V2/V2IncomingPaymentRetentionTest.php": 21.350748, - "tests/Feature/V2/V2LeasedSignalDeliveryTest.php": 3.307745, - "tests/Feature/V2/V2LegacyEventCompatibilityTest.php": 2.327433, - "tests/Feature/V2/V2LifecycleEventTest.php": 2.741613, - "tests/Feature/V2/V2LocalActivityTest.php": 3.916718, - "tests/Feature/V2/V2LocalEntityReferenceAuthorityTest.php": 7.709028, - "tests/Feature/V2/V2MachineDefinitionTest.php": 8.111255, - "tests/Feature/V2/V2MemoUpsertTest.php": 4.172675, - "tests/Feature/V2/V2MessageCursorContinueAsNewTest.php": 1.99857, - "tests/Feature/V2/V2MessageStreamAuthoringTest.php": 0.282824, - "tests/Feature/V2/V2MessageStreamReplayTest.php": 24.765024, - "tests/Feature/V2/V2NamespaceScopedLoadTest.php": 1.146886, - "tests/Feature/V2/V2NestedCompensationExampleTest.php": 52.378327, - "tests/Feature/V2/V2NexusCallerDeliveryTest.php": 0.415722, - "tests/Feature/V2/V2NonRetryableFailureTest.php": 3.131552, - "tests/Feature/V2/V2OpenOperationsAtCloseTest.php": 10.674279, - "tests/Feature/V2/V2OperatorMetricsTest.php": 35.985586, - "tests/Feature/V2/V2OperatorQueueVisibilityTest.php": 0.997555, - "tests/Feature/V2/V2ParentClosePolicyTest.php": 20.963118, - "tests/Feature/V2/V2PaymentFirstProviderMachineTest.php": 184.638778, - "tests/Feature/V2/V2PhysicalShipmentMachineTest.php": 139.399761, - "tests/Feature/V2/V2PortableCancellationDeliveryTest.php": 64.690743, - "tests/Feature/V2/V2PortableLocalActivityCheckpointTest.php": 4.907263, - "tests/Feature/V2/V2PortableLocalActivityCleanupTest.php": 7.39993, - "tests/Feature/V2/V2PortableLocalActivityControlTest.php": 19.035293, - "tests/Feature/V2/V2PortableLocalActivityOutcomeTest.php": 19.219915, - "tests/Feature/V2/V2PortableLocalActivityPreparationTest.php": 36.065933, - "tests/Feature/V2/V2PortableLocalActivityRecoveryTest.php": 20.209713, - "tests/Feature/V2/V2ProjectionTimestampTimezoneTest.php": 1.251267, - "tests/Feature/V2/V2ProviderRefundOutcomeTest.php": 84.019883, - "tests/Feature/V2/V2ProviderStateMachineExampleTest.php": 227.834521, - "tests/Feature/V2/V2PrunedHistoryExportTest.php": 2.086834, - "tests/Feature/V2/V2QueryWorkflowTest.php": 26.640613, - "tests/Feature/V2/V2RegisteredObligationCompensationTest.php": 10.840927, - "tests/Feature/V2/V2ReplayDiffTest.php": 5.657005, - "tests/Feature/V2/V2ResumeTaskSchedulingTest.php": 2.215009, - "tests/Feature/V2/V2RetainedProviderOperationTest.php": 4.6192, - "tests/Feature/V2/V2RunDetailViewTest.php": 41.307196, - "tests/Feature/V2/V2RunSummarySortKeyTest.php": 0.119683, - "tests/Feature/V2/V2RunTimerTaskHistoryRoleTest.php": 0.995903, - "tests/Feature/V2/V2SagaWorkflowTest.php": 9.40128, - "tests/Feature/V2/V2ScheduleAuditRetentionTest.php": 6.314239, - "tests/Feature/V2/V2ScheduleNamespaceInstanceIdTest.php": 8.078887, - "tests/Feature/V2/V2ScheduleTest.php": 68.565232, - "tests/Feature/V2/V2ScheduleTickBurstTest.php": 16.359253, - "tests/Feature/V2/V2ScheduleTimezoneTest.php": 9.1125, - "tests/Feature/V2/V2SchedulerDegradedModeTest.php": 2.52776, - "tests/Feature/V2/V2ScopedActivityCancellationTest.php": 41.863508, - "tests/Feature/V2/V2ScopedChildCancellationTest.php": 28.475396, - "tests/Feature/V2/V2ScopedLocalControlTest.php": 6.101876, - "tests/Feature/V2/V2ScopedTimerCancellationTest.php": 12.814074, - "tests/Feature/V2/V2ScopedWaitCancellationTest.php": 25.711505, - "tests/Feature/V2/V2SearchAttributeDatetimeRepairTest.php": 4.313552, - "tests/Feature/V2/V2SearchAttributeTest.php": 5.59171, - "tests/Feature/V2/V2ServiceDispatchTimestampMigrationTest.php": 2.591034, - "tests/Feature/V2/V2ServiceModeParallelChildBarrierTest.php": 4.383417, - "tests/Feature/V2/V2ServiceResponseReplayTest.php": 5.056996, - "tests/Feature/V2/V2SideEffectWorkflowTest.php": 4.956356, - "tests/Feature/V2/V2StandaloneActivityHostTest.php": 22.351838, - "tests/Feature/V2/V2StartNamespaceTest.php": 2.238535, - "tests/Feature/V2/V2StartSearchAttributeTest.php": 3.185098, - "tests/Feature/V2/V2StateMachineResourceBudgetTest.php": 8.888048, - "tests/Feature/V2/V2StructuralLimitTest.php": 19.825654, - "tests/Feature/V2/V2TaskDispatchHistoryRoleTest.php": 0.625971, - "tests/Feature/V2/V2TaskDispatchTest.php": 9.213103, - "tests/Feature/V2/V2TaskWatchdogRepairConcurrencyTest.php": 1.825897, - "tests/Feature/V2/V2TerminalReasonDiagnosticsTest.php": 1.498701, - "tests/Feature/V2/V2TimeoutCleanupAdmissionTest.php": 7.275858, - "tests/Feature/V2/V2TimeoutCleanupMigrationTest.php": 2.427624, - "tests/Feature/V2/V2TimeoutCleanupTest.php": 11.131509, - "tests/Feature/V2/V2TimerDeadlineMigrationTest.php": 6.442281, - "tests/Feature/V2/V2TimerWorkflowTest.php": 10.038091, - "tests/Feature/V2/V2UpdateBeforeCloseTest.php": 1.759909, - "tests/Feature/V2/V2UpdateTailCheckpointTest.php": 6.560977, - "tests/Feature/V2/V2UpdateWorkflowTest.php": 41.671415, - "tests/Feature/V2/V2UuidWorkflowTest.php": 0.479056, - "tests/Feature/V2/V2VersionUsageQueryTest.php": 2.37385, - "tests/Feature/V2/V2VersionWorkflowTest.php": 6.397062, - "tests/Feature/V2/V2WebhookPollAndControlPlaneTest.php": 2.017558, - "tests/Feature/V2/V2WebhookWorkflowTest.php": 69.888678, - "tests/Feature/V2/V2WorkflowControlPlaneTest.php": 13.046197, - "tests/Feature/V2/V2WorkflowEntryArgumentsTest.php": 5.821127, - "tests/Feature/V2/V2WorkflowReplayerTest.php": 1.662782, - "tests/Feature/V2/V2WorkflowRunRetentionCleanupTest.php": 7.751532, - "tests/Feature/V2/V2WorkflowStubContractTest.php": 0.528592, - "tests/Feature/V2/V2WorkflowStubFakeTest.php": 7.891656, - "tests/Feature/V2/V2WorkflowTaskBridgeTest.php": 149.98872, - "tests/Feature/V2/V2WorkflowTest.php": 96.289512, - "tests/Feature/V2/V2WorkflowTimeoutTest.php": 4.450298, - "tests/Feature/V2/V2WorkflowVersionPinningTest.php": 0.697625, - "tests/Feature/V2/WaterlineEngineSourceMysqlReadinessTest.php": 0.112993, - "tests/Feature/V2/WorkflowTaskFailureLivenessTest.php": 2.456, + "tests/Feature/V2/V2CompensationRecoveryAuthorityTest.php": 38.569295, + "tests/Feature/V2/V2CompensationScopeConcurrencyTest.php": 0.687335, + "tests/Feature/V2/V2CompensationScopeRunBoundaryTest.php": 18.332037, + "tests/Feature/V2/V2CompensationScopeTest.php": 135.038827, + "tests/Feature/V2/V2ConfiguredCoreModelsTest.php": 8.539893, + "tests/Feature/V2/V2ConfiguredStateMachineExampleTest.php": 285.308911, + "tests/Feature/V2/V2ContinueAsNewMetadataTest.php": 4.581668, + "tests/Feature/V2/V2ContinueAsNewOpenChildSupervisionTest.php": 3.49614, + "tests/Feature/V2/V2CooperativeParentCloseTest.php": 8.048235, + "tests/Feature/V2/V2DefaultConnectionRecoveryTest.php": 0.915989, + "tests/Feature/V2/V2DeliveryCaptureMachineTest.php": 89.951563, + "tests/Feature/V2/V2DependencyInjectionTest.php": 2.259726, + "tests/Feature/V2/V2DeterministicTimeReplayTest.php": 1.4536, + "tests/Feature/V2/V2DeterministicTimeTest.php": 1.596174, + "tests/Feature/V2/V2DuplicateStartPolicyTest.php": 4.572891, + "tests/Feature/V2/V2EmbeddedNamespaceIsolationTest.php": 5.609465, + "tests/Feature/V2/V2EmbeddedParallelChildConcurrencyTest.php": 7.121619, + "tests/Feature/V2/V2EmbeddedReplayRegressionCorpusTest.php": 100.916456, + "tests/Feature/V2/V2EntityReferenceTest.php": 12.231823, + "tests/Feature/V2/V2EntryMethodTest.php": 1.423477, + "tests/Feature/V2/V2FailedRunRedrivePlanTest.php": 0.893805, + "tests/Feature/V2/V2FailedRunRedriveTest.php": 195.059111, + "tests/Feature/V2/V2FailureMessageStorageMigrationTest.php": 1.38763, + "tests/Feature/V2/V2FinallyCleanupTest.php": 30.916773, + "tests/Feature/V2/V2FinancialInspectionTest.php": 14.799708, + "tests/Feature/V2/V2FinancialRetainedScopeTest.php": 18.018058, + "tests/Feature/V2/V2GoldenHistoryReplayTest.php": 0.619313, + "tests/Feature/V2/V2HistoryBudgetReplayTest.php": 5.037408, + "tests/Feature/V2/V2HistoryRecordedAtTimezoneTest.php": 1.723251, + "tests/Feature/V2/V2HistoryTimelineTest.php": 30.408398, + "tests/Feature/V2/V2InboxAfterParallelTest.php": 11.401773, + "tests/Feature/V2/V2IncomingPaymentInspectionTest.php": 15.998991, + "tests/Feature/V2/V2IncomingPaymentRetentionTest.php": 14.605651, + "tests/Feature/V2/V2LeasedSignalDeliveryTest.php": 2.699646, + "tests/Feature/V2/V2LegacyEventCompatibilityTest.php": 2.752551, + "tests/Feature/V2/V2LifecycleEventTest.php": 1.82331, + "tests/Feature/V2/V2LocalActivityTest.php": 1.152456, + "tests/Feature/V2/V2LocalEntityReferenceAuthorityTest.php": 7.780744, + "tests/Feature/V2/V2MachineDefinitionTest.php": 9.661601, + "tests/Feature/V2/V2MemoUpsertTest.php": 5.114637, + "tests/Feature/V2/V2MessageCursorContinueAsNewTest.php": 2.511117, + "tests/Feature/V2/V2MessageStreamAuthoringTest.php": 0.34192, + "tests/Feature/V2/V2MessageStreamReplayTest.php": 31.008152, + "tests/Feature/V2/V2NamespaceScopedLoadTest.php": 1.276408, + "tests/Feature/V2/V2NestedCompensationExampleTest.php": 50.613553, + "tests/Feature/V2/V2NexusCallerDeliveryTest.php": 0.386982, + "tests/Feature/V2/V2NonRetryableFailureTest.php": 3.910008, + "tests/Feature/V2/V2OpenOperationsAtCloseTest.php": 12.764892, + "tests/Feature/V2/V2OperatorMetricsTest.php": 19.440024, + "tests/Feature/V2/V2OperatorQueueVisibilityTest.php": 1.142493, + "tests/Feature/V2/V2OrderBillingPeriodTest.php": 427.40349, + "tests/Feature/V2/V2ParentClosePolicyTest.php": 15.240671, + "tests/Feature/V2/V2PaymentFirstProviderMachineTest.php": 130.836778, + "tests/Feature/V2/V2PhysicalShipmentMachineTest.php": 131.299379, + "tests/Feature/V2/V2PortableCancellationDeliveryTest.php": 52.346571, + "tests/Feature/V2/V2PortableLocalActivityCheckpointTest.php": 2.886538, + "tests/Feature/V2/V2PortableLocalActivityCleanupTest.php": 15.480474, + "tests/Feature/V2/V2PortableLocalActivityControlTest.php": 14.436146, + "tests/Feature/V2/V2PortableLocalActivityOutcomeTest.php": 18.904387, + "tests/Feature/V2/V2PortableLocalActivityPreparationTest.php": 37.041096, + "tests/Feature/V2/V2PortableLocalActivityRecoveryTest.php": 28.603013, + "tests/Feature/V2/V2ProjectionTimestampTimezoneTest.php": 1.738182, + "tests/Feature/V2/V2ProviderRefundOutcomeTest.php": 43.860281, + "tests/Feature/V2/V2ProviderStateMachineExampleTest.php": 300.885491, + "tests/Feature/V2/V2PrunedHistoryExportTest.php": 2.482655, + "tests/Feature/V2/V2QueryWorkflowTest.php": 22.530384, + "tests/Feature/V2/V2RegisteredObligationCompensationTest.php": 13.650573, + "tests/Feature/V2/V2ReplayDiffTest.php": 6.540059, + "tests/Feature/V2/V2ResumeTaskSchedulingTest.php": 6.437606, + "tests/Feature/V2/V2RetainedProviderOperationTest.php": 4.358975, + "tests/Feature/V2/V2RunDetailViewTest.php": 58.422969, + "tests/Feature/V2/V2RunSummarySortKeyTest.php": 0.082196, + "tests/Feature/V2/V2RunTimerTaskHistoryRoleTest.php": 1.300193, + "tests/Feature/V2/V2SagaWorkflowTest.php": 14.929401, + "tests/Feature/V2/V2ScheduleAuditRetentionTest.php": 4.719105, + "tests/Feature/V2/V2ScheduleNamespaceInstanceIdTest.php": 7.640884, + "tests/Feature/V2/V2ScheduleTest.php": 60.34515, + "tests/Feature/V2/V2ScheduleTickBurstTest.php": 22.0616, + "tests/Feature/V2/V2ScheduleTimezoneTest.php": 12.072772, + "tests/Feature/V2/V2SchedulerDegradedModeTest.php": 2.553203, + "tests/Feature/V2/V2ScopedActivityCancellationTest.php": 29.927891, + "tests/Feature/V2/V2ScopedChildCancellationTest.php": 36.725462, + "tests/Feature/V2/V2ScopedLocalControlTest.php": 5.850581, + "tests/Feature/V2/V2ScopedTimerCancellationTest.php": 14.550241, + "tests/Feature/V2/V2ScopedWaitCancellationTest.php": 20.884707, + "tests/Feature/V2/V2SearchAttributeDatetimeRepairTest.php": 5.22702, + "tests/Feature/V2/V2SearchAttributeTest.php": 5.860138, + "tests/Feature/V2/V2ServiceBillingPeriodTest.php": 97.400449, + "tests/Feature/V2/V2ServiceDispatchTimestampMigrationTest.php": 3.481666, + "tests/Feature/V2/V2ServiceModeParallelChildBarrierTest.php": 5.4658, + "tests/Feature/V2/V2ServiceResponseReplayTest.php": 5.671945, + "tests/Feature/V2/V2SideEffectWorkflowTest.php": 5.760455, + "tests/Feature/V2/V2StandaloneActivityHostTest.php": 18.726391, + "tests/Feature/V2/V2StartNamespaceTest.php": 2.771951, + "tests/Feature/V2/V2StartSearchAttributeTest.php": 3.102823, + "tests/Feature/V2/V2StateMachineResourceBudgetTest.php": 6.601543, + "tests/Feature/V2/V2StructuralLimitTest.php": 19.627539, + "tests/Feature/V2/V2TaskDispatchHistoryRoleTest.php": 0.624479, + "tests/Feature/V2/V2TaskDispatchTest.php": 8.606336, + "tests/Feature/V2/V2TaskWatchdogRepairConcurrencyTest.php": 2.052987, + "tests/Feature/V2/V2TerminalReasonDiagnosticsTest.php": 1.868372, + "tests/Feature/V2/V2TimeoutCleanupAdmissionTest.php": 4.37395, + "tests/Feature/V2/V2TimeoutCleanupMigrationTest.php": 1.443939, + "tests/Feature/V2/V2TimeoutCleanupTest.php": 16.830544, + "tests/Feature/V2/V2TimerDeadlineMigrationTest.php": 6.176345, + "tests/Feature/V2/V2TimerWorkflowTest.php": 9.23982, + "tests/Feature/V2/V2UpdateBeforeCloseTest.php": 1.424569, + "tests/Feature/V2/V2UpdateTailCheckpointTest.php": 6.663639, + "tests/Feature/V2/V2UpdateWorkflowTest.php": 48.97222, + "tests/Feature/V2/V2UuidWorkflowTest.php": 0.613644, + "tests/Feature/V2/V2VersionUsageQueryTest.php": 3.032004, + "tests/Feature/V2/V2VersionWorkflowTest.php": 9.546831, + "tests/Feature/V2/V2WebhookPollAndControlPlaneTest.php": 1.662564, + "tests/Feature/V2/V2WebhookWorkflowTest.php": 61.2102, + "tests/Feature/V2/V2WorkflowControlPlaneTest.php": 15.5479, + "tests/Feature/V2/V2WorkflowEntryArgumentsTest.php": 7.501367, + "tests/Feature/V2/V2WorkflowReplayerTest.php": 2.227963, + "tests/Feature/V2/V2WorkflowRunRetentionCleanupTest.php": 7.461381, + "tests/Feature/V2/V2WorkflowStubContractTest.php": 0.936633, + "tests/Feature/V2/V2WorkflowStubFakeTest.php": 10.368125, + "tests/Feature/V2/V2WorkflowTaskBridgeTest.php": 159.120161, + "tests/Feature/V2/V2WorkflowTest.php": 122.442964, + "tests/Feature/V2/V2WorkflowTimeoutTest.php": 5.363332, + "tests/Feature/V2/V2WorkflowVersionPinningTest.php": 0.66408, + "tests/Feature/V2/WaterlineEngineSourceMysqlReadinessTest.php": 0.088089, + "tests/Feature/V2/WorkflowTaskFailureLivenessTest.php": 3.147917, "tests/Feature/V2/WorkflowTaskSignalGapLockTest.php": 0.001, - "tests/Feature/VersionWorkflowTest.php": 3.490341, - "tests/Feature/WebhookWorkflowTest.php": 4.811, - "tests/Feature/WorkflowPollingTest.php": 20.68245, - "tests/Feature/WorkflowTest.php": 5.996934 + "tests/Feature/VersionWorkflowTest.php": 2.645568, + "tests/Feature/WebhookWorkflowTest.php": 4.38898, + "tests/Feature/WorkflowPollingTest.php": 24.376564, + "tests/Feature/WorkflowTest.php": 9.380376 } } diff --git a/.github/feature-test-timings.md b/.github/feature-test-timings.md new file mode 100644 index 000000000..557d62726 --- /dev/null +++ b/.github/feature-test-timings.md @@ -0,0 +1,7 @@ +# Feature shard weights + +`feature-test-timings.json` contains balancing hints in seconds. It does not select or exclude tests. The shard verifier still requires every discovered feature file exactly once, and each backend retains its existing process limit and required coverage reports. Reports that contain only declared backend skips receive a positive scheduling floor of 0.001 seconds. + +The November 17 refresh uses the per-file JUnit timings from accepted main [build 44004967899](https://github.com/durable-workflow/workflow/actions/runs/44004967899) at `7b2e41eedd17137e6acdbeb83292e73b100f7fc4`. PostgreSQL entries with a complete newer report use [build 44017266532](https://github.com/durable-workflow/workflow/actions/runs/44017266532) at `569eb03bb385c490b80d1614b53cdd5433dfa346` instead. Its PostgreSQL shard 5 reached the 20-minute limit without a complete JUnit report, so those existing files retain the accepted-main measurements. + +The new Order billing-period class measured **284.935660 seconds on MySQL** in build 44017266532. Its **427.403490-second PostgreSQL weight is a provisional estimate**, 1.5 times that MySQL measurement, pending a complete PostgreSQL report. It replaces the one-second unprofiled-file fallback; it is not a measured PostgreSQL duration. Refresh that entry from the next successful PostgreSQL report. diff --git a/examples/configured-state-machines/providers/Journal.php b/examples/configured-state-machines/providers/Journal.php index 780edc2b1..ad6022f0b 100644 --- a/examples/configured-state-machines/providers/Journal.php +++ b/examples/configured-state-machines/providers/Journal.php @@ -89,6 +89,22 @@ public function timedLookup(Request $request): TimedObservation }); } + /** + * Admission of the optional timing capability; reads schema metadata without observing a business operation. + */ + public function requireEffectTimeSupport(): void + { + if (! $this->captureEffectTimes) { + throw new LogicException('The provider did not admit original effect timestamps.'); + } + $this->transaction(function (): void { + $this->query( + 'SELECT operation_id, fingerprint, effect_id, confirmed_at FROM provider_effect_times LIMIT 0', + [] + ); + }); + } + /** * Explicit optional provider support; install() keeps the original four-table fixtures unchanged. */ diff --git a/examples/provider-state-machines/OrderBillingPeriodStore.php b/examples/provider-state-machines/OrderBillingPeriodStore.php index e590b0a48..b2f3110af 100644 --- a/examples/provider-state-machines/OrderBillingPeriodStore.php +++ b/examples/provider-state-machines/OrderBillingPeriodStore.php @@ -31,6 +31,7 @@ public function __construct( throw new LogicException('Order periods require the original configured native SQL connection.'); } $this->assignments = new BillingPeriodAssignments($db, $authority->principal, $authority->periods->grants()); + $provider->requireEffectTimeSupport(); $this->receipts = new OrderPeriodPaymentReceipt($authority, $provider); } diff --git a/examples/provider-state-machines/README.md b/examples/provider-state-machines/README.md index 6fdf2fc89..d32daa742 100644 --- a/examples/provider-state-machines/README.md +++ b/examples/provider-state-machines/README.md @@ -593,6 +593,12 @@ still load the protected Order. Seed the genuine Order with `$machineStore->seed($period->order)`, then obtain the period adapter from the container and call `admit($period->subjectKey())`. +The Order adapter requires the provider's original effect-time capability and +its actual schema during bootstrap, before native admission or money dispatch. +`Journal::requireEffectTimeSupport()` checks that metadata without recording a +provider request or observing a payment. Existing journal operations and default +four-table installations retain their original behavior. + This admission atomically records the original period receipt and starts the existing `FundingCheckout`; its actual `FundingPayment` and `FullShipment` children retain the common routes, reservations and verified scope ownership. diff --git a/tests/Feature/V2/V2OrderBillingPeriodTest.php b/tests/Feature/V2/V2OrderBillingPeriodTest.php index 7dd8bcc1d..ccc023cb4 100644 --- a/tests/Feature/V2/V2OrderBillingPeriodTest.php +++ b/tests/Feature/V2/V2OrderBillingPeriodTest.php @@ -22,9 +22,11 @@ use Illuminate\Support\Facades\Queue; use LogicException; use PDO; +use PDOException; use PHPUnit\Framework\Attributes\DataProvider; use Tests\Support\CommonFundingMachineFixture; use Tests\TestCase; +use Throwable; use Workflow\V2\Compensation\Persistence\ScopeRepository; use Workflow\V2\Models\WorkflowRun; use Workflow\V2\Support\WorkflowReplayer; @@ -85,6 +87,40 @@ public static function policies(): array return [[BillingPeriod::PAYMENT_FIRST], [BillingPeriod::GRACE]]; } + public static function unsupportedTimingProfiles(): array + { + return [['not-selected', LogicException::class], ['schema-missing', PDOException::class]]; + } + + /** + * @param class-string $exception + */ + #[DataProvider('unsupportedTimingProfiles')] + public function testMissingOriginalTimingCapabilityRefusesBootstrapBeforeNativeAdmission( + string $case, + string $exception + ): void { + if ($case === 'not-selected') { + $this->provider = new Journal($this->providerDb, 'shop-a', static fn (): int => Carbon::now()->getTimestamp()); + } else { + $this->providerDb->exec('DROP TABLE provider_effect_times'); + } + $refusal = null; + try { + $this->startPeriodOrder(BillingPeriod::PAYMENT_FIRST, pump: false); + } catch (Throwable $error) { + $refusal = $error; + } + if ($refusal === null) { + // The predecessor admitted this unsupported configuration and could + // reach money dispatch before discovering the missing time contract. + $this->pump(); + } + $this->assertSame([], $this->effects(), 'Missing original timing must refuse before money dispatch.'); + $this->assertSame(0, WorkflowRun::query()->count(), 'Capability admission must precede native admission.'); + $this->assertInstanceOf($exception, $refusal); + } + #[DataProvider('policies')] public function testPaidPeriodUsesItsGenuineCommonOrderPaymentAndShipment(string $policy): void { diff --git a/tests/Unit/V2/StateMachine/ProviderEffectTimeCapabilityTest.php b/tests/Unit/V2/StateMachine/ProviderEffectTimeCapabilityTest.php new file mode 100644 index 000000000..2133f2a8a --- /dev/null +++ b/tests/Unit/V2/StateMachine/ProviderEffectTimeCapabilityTest.php @@ -0,0 +1,65 @@ +install(); + $provider->requireEffectTimeSupport(); + foreach (['provider_requests', 'provider_operations', 'provider_effects', 'provider_effect_times'] as $table) { + $this->assertSame(0, (int) $db->query('SELECT COUNT(*) FROM ' . $table)->fetchColumn()); + } + $this->assertFalse($db->inTransaction()); + } + + public function testTheUnselectedCapabilityDoesNotInstallOrChangeTheLegacyFourTables(): void + { + $db = new PDO('sqlite::memory:'); + $provider = new Journal($db, 'shop-a'); + $provider->install(); + try { + $provider->requireEffectTimeSupport(); + $this->fail('Unselected timing cannot become an admitted capability.'); + } catch (LogicException $error) { + $this->assertSame('The provider did not admit original effect timestamps.', $error->getMessage()); + } + $this->assertSame( + 4, + (int) $db->query( + "SELECT COUNT(*) FROM sqlite_master WHERE type = 'table' AND name LIKE 'provider_%'" + )->fetchColumn() + ); + $this->assertSame(0, (int) $db->query('SELECT COUNT(*) FROM provider_requests')->fetchColumn()); + $this->assertFalse($db->inTransaction()); + } + + public function testMissingSchemaRefusalRollsBackOnlyItsOwnedMetadataTransaction(): void + { + $db = new PDO('sqlite::memory:'); + $provider = new Journal($db, 'shop-a', captureEffectTimes: true); + $provider->install(); + $db->exec('DROP TABLE provider_effect_times'); + try { + $provider->requireEffectTimeSupport(); + $this->fail('A declared capability requires its actual schema.'); + } catch (PDOException $error) { + $this->assertStringContainsString('provider_effect_times', $error->getMessage()); + } + $this->assertFalse($db->inTransaction()); + $this->assertSame(0, (int) $db->query('SELECT COUNT(*) FROM provider_operations')->fetchColumn()); + } +}