Stu Mason · Folkestone, Kent
One entryMerged PR· StuMason/laravel-coolify· PHP

PR #120 merged: fix(client): real cache invalidation, no host-cache flush, GET-only retries

additions
+113
deletions
-17
files changed
2

Top item from the triage backlog. Three latent CoolifyClient bugs, all invisible because the test suite runs with cache_ttl = 0:

  1. Cache invalidation was a no-op. clearCacheForEndpoint() forgot coolify:{resource}:list — a key that is never written (GET keys are 'coolify:'.md5(...)). So after every deploy/restart/env mutation, the dashboard kept serving pre-mutation state for the rest of the TTL.
  2. clearCache() was Cache::flush() — wiping the host application's entire cache store. Any app calling it (or hitting a mutation path that did) lost its own cache.
  3. Retries applied to POSTs. retry(3, 100) on every verb means a timed-out deploy can fire the deployment multiple times.

Fix

  • Cached GET keys are recorded in a single registry entry (coolify:cache-keys, 1-day TTL). Mutations and clearCache() Cache::pull the registry and forget exactly those keys — never anything else. Any mutation clears all package keys: the cache is 30s dashboard data, so over-invalidation is free and avoids cross-resource staleness (a deploy also touches deployments lists).
  • Retries are now GET-only; mutations fail fast instead of double-firing.

Tests

5 new: cached-GET behavior, mutation invalidates cache, clearCache leaves a host-app key untouched (the regression that matters), GET retry behavior, mutations never retry (assertSentCount(1)). The caching tests re-enable cache_ttl locally since the suite-wide TestCase zeroes it — which is exactly how this shipped unseen.

Full suite: 278 passed, Pint + PHPStan clean.