Skip to content

Commit b9c9b99

Browse files
Revert "Relax workflow cache admission to warning-only diagnostics"
This reverts commit d1e2378.
1 parent d1e2378 commit b9c9b99

8 files changed

Lines changed: 16 additions & 256 deletions

File tree

src/V2/Support/BackendCapabilities.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,19 +175,16 @@ private static function cache(?string $configuredStore = null): array
175175
if ($store === null || $driver === null) {
176176
$issues[] = self::issue(
177177
'cache',
178-
'warning',
178+
'error',
179179
'cache_store_missing',
180-
'No cache store is configured. Wake acceleration, repair-loop throttles, and cache-backed fleet fallbacks may be degraded, but durable dispatch remains correct.',
180+
'Workflow v2 requires a configured cache store for worker-loop throttles and compatibility heartbeat fallbacks.',
181181
);
182182
} elseif (! $lockSupported) {
183183
$issues[] = self::issue(
184184
'cache',
185-
'warning',
185+
'error',
186186
'cache_locks_unsupported',
187-
sprintf(
188-
'The [%s] cache store does not advertise Laravel atomic lock support. Wake acceleration remains optional, but repair-loop throttles and cache-backed fleet fallbacks may be degraded.',
189-
$store,
190-
),
187+
sprintf('The [%s] cache store does not advertise Laravel atomic lock support.', $store),
191188
);
192189
}
193190

src/V2/Support/HealthCheck.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,15 @@ private static function backendCheck(array $backend): array
6666
{
6767
$issues = is_array($backend['issues'] ?? null) ? $backend['issues'] : [];
6868
$supported = BackendCapabilities::isSupported($backend);
69-
$severity = is_string($backend['severity'] ?? null) ? $backend['severity'] : ($supported ? 'ok' : 'error');
7069

7170
return self::check(
7271
'backend_capabilities',
73-
match ($severity) {
74-
'error' => 'error',
75-
'warning' => 'warning',
76-
default => 'ok',
77-
},
78-
match ($severity) {
79-
'error' => 'One or more configured v2 backend capabilities are unsupported.',
80-
'warning' => 'One or more configured v2 backend capabilities are degraded but non-blocking.',
81-
default => 'The configured database, queue, cache, and codec backends satisfy the v2 capability contract.',
82-
},
72+
$supported ? 'ok' : 'error',
73+
$supported
74+
? 'The configured database, queue, and cache backends satisfy the v2 capability contract.'
75+
: 'One or more configured v2 backend capabilities are unsupported.',
8376
self::CATEGORY_CORRECTNESS,
8477
[
85-
'severity' => $severity,
8678
'issue_count' => count($issues),
8779
'issues' => $issues,
8880
],

src/V2/Support/LongPollCacheValidator.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
use Illuminate\Support\Str;
1111

1212
/**
13-
* Validates cache backend configuration for long-poll wake acceleration in multi-node deployments.
13+
* Validates cache backend configuration for long-poll coordination in multi-node deployments.
1414
*
15-
* Shared cache backends (Redis, database, Memcached) are required only for
16-
* cross-node wake propagation. Durable dispatch correctness does not depend on
17-
* this layer, but latency and rollout-safety diagnostics do.
15+
* Multi-node deployments require shared cache backends (Redis, database, Memcached)
16+
* for wake signal propagation. File-based cache is per-node and cannot coordinate
17+
* across nodes.
1818
*
1919
* @see \Workflow\V2\Contracts\LongPollWakeStore
2020
*/
@@ -53,7 +53,7 @@ public function validateMultiNodeCapable(CacheRepository $cache): array
5353
}
5454

5555
/**
56-
* Check if current configuration is safe for multi-node wake acceleration.
56+
* Check if current configuration is safe for multi-node deployment.
5757
*
5858
* @return array{
5959
* safe: bool,
@@ -82,7 +82,7 @@ public function checkMultiNodeSafety(CacheRepository $cache, bool $multiNode): a
8282
return [
8383
'safe' => false,
8484
'message' => sprintf(
85-
'Multi-node wake acceleration is enabled (DW_V2_MULTI_NODE=true) but cache backend is "%s". %s',
85+
'Multi-node deployment detected (DW_V2_MULTI_NODE=true) but cache backend is "%s". %s',
8686
$validation['backend'],
8787
$validation['reason']
8888
),

src/V2/Support/ReadinessContract.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public static function definition(): array
6767
'dispatch' => [
6868
'authority' => BackendCapabilities::class . '::snapshot',
6969
'readiness_key' => 'supported',
70-
'gate' => 'No database, queue, codec, or structural-limit issue has error severity; cache issues remain non-blocking warnings.',
70+
'gate' => 'No database, queue, cache, codec, or structural-limit issue has error severity.',
7171
'unready_behavior' => 'Task dispatch does not claim unsupported durable work; operators see backend_capabilities errors.',
7272
],
7373
'claim' => [
@@ -107,8 +107,6 @@ public static function definition(): array
107107
],
108108
'cache' => [
109109
'required_capabilities' => ['atomic_locks'],
110-
'dispatch_blocking_severity' => 'warning',
111-
'role' => 'acceleration_only',
112110
],
113111
'codec' => [
114112
'default_for_new_v2_runs' => 'avro',
@@ -132,7 +130,7 @@ public static function forBackendCapabilities(): array
132130
$contract['effective_states'] = [
133131
'dispatch' => [
134132
'state' => 'evaluated_by_backend_capabilities_snapshot',
135-
'blocking_rule' => 'Any error-severity database, queue, codec, or structural-limit issue makes supported=false; cache diagnostics stay warning-only.',
133+
'blocking_rule' => 'Any error-severity backend issue makes supported=false.',
136134
],
137135
'claim' => [
138136
'state' => 'evaluated_per_task_queue_connection',

tests/Support/NonLockingCacheStore.php

Lines changed: 0 additions & 89 deletions
This file was deleted.

tests/Unit/Commands/V2DoctorCommandTest.php

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55
namespace Tests\Unit\Commands;
66

7-
use Illuminate\Cache\CacheManager;
8-
use Illuminate\Cache\Repository;
9-
use Tests\Support\NonLockingCacheStore;
107
use Tests\TestCase;
118

129
final class V2DoctorCommandTest extends TestCase
@@ -122,40 +119,4 @@ public function testQueueModeSyncQueueIsReportedAsErrorAndFailsStrict(): void
122119
->expectsOutputToContain('[ERROR] [queue_sync_unsupported]')
123120
->assertFailed();
124121
}
125-
126-
public function testCustomNoLockCacheStoreAppearsInJsonOutputAndStrictStillSucceeds(): void
127-
{
128-
config()->set('queue.default', 'redis');
129-
config()
130-
->set('queue.connections.redis.driver', 'redis');
131-
config()
132-
->set('workflows.serializer', 'avro');
133-
$this->configureNonLockingCacheStore();
134-
135-
$this->artisan('workflow:v2:doctor', [
136-
'--json' => true,
137-
'--strict' => true,
138-
])
139-
->expectsOutputToContain('"code":"cache_locks_unsupported"')
140-
->assertSuccessful();
141-
}
142-
143-
private function configureNonLockingCacheStore(): void
144-
{
145-
$driver = 'test-non-locking';
146-
$store = 'test-non-locking';
147-
148-
$this->app['cache']->extend($driver, function (): Repository {
149-
if (! $this instanceof CacheManager) {
150-
throw new \RuntimeException('Unexpected cache manager binding.');
151-
}
152-
153-
return new Repository(new NonLockingCacheStore());
154-
});
155-
156-
config()
157-
->set("cache.stores.{$store}.driver", $driver);
158-
config()
159-
->set('cache.default', $store);
160-
}
161122
}

tests/Unit/V2/BackendCapabilitiesTest.php

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44

55
namespace Tests\Unit\V2;
66

7-
use Illuminate\Cache\CacheManager;
8-
use Illuminate\Cache\Repository;
97
use Illuminate\Support\Carbon;
10-
use Tests\Support\NonLockingCacheStore;
118
use Tests\TestCase;
129
use Workflow\V2\Support\BackendCapabilities;
1310

@@ -96,17 +93,11 @@ public function testSnapshotIncludesFrozenReadinessContractMatrix(): void
9693
'info',
9794
$contract['backend_capabilities']['queue']['poll_mode']['sync_or_missing_queue_severity']
9895
);
99-
$this->assertSame('warning', $contract['backend_capabilities']['cache']['dispatch_blocking_severity']);
100-
$this->assertSame('acceleration_only', $contract['backend_capabilities']['cache']['role']);
10196
$this->assertSame('avro', $contract['backend_capabilities']['codec']['default_for_new_v2_runs']);
10297
$this->assertSame(
10398
'evaluated_by_backend_capabilities_snapshot',
10499
$contract['effective_states']['dispatch']['state']
105100
);
106-
$this->assertStringContainsString(
107-
'cache diagnostics stay warning-only',
108-
$contract['effective_states']['dispatch']['blocking_rule']
109-
);
110101
}
111102

112103
public function testSnapshotCanInspectAnExplicitTaskQueueConnection(): void
@@ -381,8 +372,6 @@ public function testSnapshotIncludesSeverityRollupOfOkWhenAdmissionIsClean(): vo
381372
->set('cache.default', 'array');
382373
config()
383374
->set('cache.stores.array.driver', 'array');
384-
config()
385-
->set('workflows.serializer', 'avro');
386375

387376
$snapshot = BackendCapabilities::snapshot();
388377

@@ -450,49 +439,4 @@ public function testSnapshotSeverityRollupReportsErrorWhenAnyIssueIsErrorSeverit
450439
$this->assertSame('error', $snapshot['severity']);
451440
$this->assertFalse($snapshot['supported']);
452441
}
453-
454-
public function testCustomNoLockCacheStoreIsWarningOnlyAndDoesNotFailSupport(): void
455-
{
456-
config()->set('database.default', 'pgsql');
457-
config()
458-
->set('database.connections.pgsql.driver', 'pgsql');
459-
config()
460-
->set('queue.default', 'redis');
461-
config()
462-
->set('queue.connections.redis.driver', 'redis');
463-
config()
464-
->set('workflows.serializer', 'avro');
465-
$this->configureNonLockingCacheStore();
466-
467-
$snapshot = BackendCapabilities::snapshot();
468-
469-
$this->assertTrue($snapshot['supported']);
470-
$this->assertTrue(BackendCapabilities::isSupported($snapshot));
471-
$this->assertTrue($snapshot['cache']['supported']);
472-
$this->assertSame('warning', $snapshot['severity']);
473-
474-
$cacheIssue = collect($snapshot['issues'])->firstWhere('code', 'cache_locks_unsupported');
475-
$this->assertNotNull($cacheIssue);
476-
$this->assertSame('warning', $cacheIssue['severity']);
477-
$this->assertStringContainsString('Wake acceleration remains optional', $cacheIssue['message']);
478-
}
479-
480-
private function configureNonLockingCacheStore(): void
481-
{
482-
$driver = 'test-non-locking';
483-
$store = 'test-non-locking';
484-
485-
$this->app['cache']->extend($driver, function (): Repository {
486-
if (! $this instanceof CacheManager) {
487-
throw new \RuntimeException('Unexpected cache manager binding.');
488-
}
489-
490-
return new Repository(new NonLockingCacheStore());
491-
});
492-
493-
config()
494-
->set("cache.stores.{$store}.driver", $driver);
495-
config()
496-
->set('cache.default', $store);
497-
}
498442
}

0 commit comments

Comments
 (0)