Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
4ade564
Report undefined default database connections in Doctor
binaryfire Nov 23, 2026
8300f3d
Probe registered filesystem disks without requiring a config record
binaryfire Nov 23, 2026
689895e
Report the Redis server's PING error on the connection that received it
binaryfire Nov 23, 2026
bcfd5ef
Check Redis feature support on the effective connection
binaryfire Nov 23, 2026
5e0ea5a
Include Redis server replies in queue reachability failures
binaryfire Nov 23, 2026
127713b
Match Doctor session probes to the configured connection
binaryfire Nov 23, 2026
c655a69
Validate active driver records and composite configuration in Doctor
binaryfire Nov 23, 2026
53e59a5
Migrate Horizon charts and update dashboard frontend dependencies
binaryfire Nov 23, 2026
32d99a6
Close the Redis cluster transport fixture after reading the request
binaryfire Nov 23, 2026
6f769a6
Trust the Redis fixture CA for the cluster transport test
binaryfire Nov 23, 2026
52df72f
Expose resolved filesystem disks without initializing them
binaryfire Nov 23, 2026
97f38a3
Check the effective filesystem disk and identify missing drivers
binaryfire Nov 23, 2026
87c0736
Report malformed Redis settings alongside independent connection fail…
binaryfire Nov 23, 2026
4876889
Ignore configured paths for the built-in null cache store
binaryfire Nov 23, 2026
a39bce3
Display diagnostic details literally in the terminal
binaryfire Nov 23, 2026
a492ef5
Check registered local disks without root metadata
binaryfire Nov 23, 2026
973c7fb
Rebuild the dashboard and exception renderer bundles
binaryfire Nov 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
479 changes: 374 additions & 105 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ catalog:
vite-plus: 1.4.0
vue: ^3.5.44
vue-json-pretty: ^2.6.0
vue-router: ^4.6.4
vue-router: ^5.4.0
9 changes: 6 additions & 3 deletions src/docs/doctor.md
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ The `Configured` helper reads configuration defensively. Diagnostics must be abl
```php
use Hypervel\Doctor\Support\Configured;

$connection = Configured::string('queue.default', 'database');
$connection = Configured::string('queue.default');
```

`Configured::missing()` returns the given keys that do not hold a usable value. Null values, blank strings, and empty arrays are treated as missing, so a "package requires these configuration values" diagnostic reduces to:
Expand All @@ -388,10 +388,13 @@ Default configuration values often point at wrapper drivers: the default log cha

```php
use Hypervel\Doctor\Support\ActiveDrivers;
use Hypervel\Doctor\Support\Configured;

$channels = ActiveDrivers::logChannels(Configured::string('logging.default', 'stack'));
$channel = Configured::string('logging.default');
$channels = $channel === null ? [] : ActiveDrivers::logChannels($channel);

$mailers = ActiveDrivers::mailers(Configured::string('mail.default', 'log'));
$mailer = Configured::string('mail.default');
$mailers = $mailer === null ? [] : ActiveDrivers::mailers($mailer);

$stores = ActiveDrivers::cacheStores(config()->string('cache.default'));

Expand Down
8 changes: 6 additions & 2 deletions src/doctor/src/Diagnostics/DatabaseConnectionIsReachable.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ protected function messages(): array
{
return [
'not-configured' => 'The application does not have a default database connection configured.',
'connection-missing' => 'The default database connection [{connection}] is not configured.',
'connection-missing' => Message::make(
summary: 'The default database connection [{connection}] is not configured.',
remediation: 'Set DB_CONNECTION to a connection defined in config/database.php.',
)->link(Link::docs('database', 'configuration')),
'unreachable' => Message::make(
summary: 'The application cannot connect to the default database connection [{connection}].',
remediation: 'Check DB_CONNECTION and the database credentials in your environment file.',
Expand All @@ -58,7 +61,8 @@ public function check(): DiagnosticResult
$configuration = $this->configuration($name->base);

if ($configuration === null) {
return $this->skip('connection-missing', ['connection' => $connection]);
// The database manager rejects an undefined default connection.
return $this->fail('connection-missing', ['connection' => $connection]);
}

try {
Expand Down
72 changes: 36 additions & 36 deletions src/doctor/src/Diagnostics/FilesystemDisksAreReachable.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Hypervel\Doctor\Results\Link;
use Hypervel\Doctor\Results\Message;
use Hypervel\Doctor\Support\Configured;
use Hypervel\Filesystem\LocalFilesystemAdapter;
use Hypervel\Support\Facades\Storage;
use RuntimeException;
use Throwable;
Expand All @@ -29,7 +30,10 @@ protected function messages(): array
{
return [
'not-configured' => 'The application does not have a default filesystem disk configured.',
'disk-missing' => 'The default filesystem disk [{disk}] is not configured.',
'missing-driver' => Message::make(
summary: 'The default filesystem disk [{disk}] does not have a configured driver.',
remediation: 'Set FILESYSTEM_DISK to a disk with a driver in config/filesystems.php.',
)->link(Link::docs('filesystem', 'configuration')),
'unreachable' => Message::make(
summary: 'The application cannot reach the default filesystem disk [{disk}].',
remediation: 'Check filesystem disk roots, credentials, and network access.',
Expand All @@ -49,14 +53,28 @@ public function check(): DiagnosticResult
return $this->skip('not-configured');
}

$configuration = $this->configuration($disk);

if ($configuration === null) {
return $this->skip('disk-missing', ['disk' => $disk]);
}

try {
$this->probe($disk, $configuration);
$resolved = Storage::getDisks()[$disk] ?? null;

if ($resolved instanceof LocalFilesystemAdapter) {
$this->probeLocalDisk($resolved->getConfig(), $resolved);
} elseif ($resolved !== null) {
$resolved->exists('.hypervel-doctor');
} else {
$configuration = Configured::array("filesystems.disks.{$disk}");
$driver = $configuration['driver'] ?? null;

if (! is_string($driver) || trim($driver) === '') {
return $this->fail('missing-driver', ['disk' => $disk]);
}

// Resolving a local disk would create the missing root that Doctor is checking.
if ($driver === 'local') {
$this->probeLocalDisk($configuration);
} else {
Storage::disk($disk)->exists('.hypervel-doctor');
}
}
} catch (Throwable $e) {
if (Coroutine::causedByCancellation($e)) {
throw $e;
Expand All @@ -69,47 +87,29 @@ public function check(): DiagnosticResult
return $this->pass('reachable');
}

/**
* Probe a filesystem disk.
*
* @param array<string, mixed> $configuration
*/
private function probe(string $disk, array $configuration): void
{
if (($configuration['driver'] ?? null) === 'local') {
$this->probeLocalDisk($configuration);

return;
}

Storage::disk($disk)->exists('.hypervel-doctor');
}

/**
* Probe a local filesystem disk.
*
* @param array<string, mixed> $configuration
*/
private function probeLocalDisk(array $configuration): void
private function probeLocalDisk(array $configuration, ?LocalFilesystemAdapter $disk = null): void
{
$root = $configuration['root'] ?? null;

if (! is_string($root) || $root === '') {
throw new RuntimeException('The local disk root is not configured.');
if ($disk === null) {
throw new RuntimeException('The local disk root is not configured.');
}

if (! $disk->directoryExists('')) {
throw new RuntimeException('The registered local disk root does not exist.');
}

return;
}

if (! is_dir($root) || ! is_readable($root)) {
throw new RuntimeException(sprintf('The local disk root [%s] is not readable.', $root));
}
}

/**
* Get the default filesystem disk configuration.
*
* @return null|array<string, mixed>
*/
private function configuration(string $disk): ?array
{
return Configured::array("filesystems.disks.{$disk}");
}
}
24 changes: 7 additions & 17 deletions src/doctor/src/Diagnostics/QueueConnectionIsReachable.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
use Hypervel\Doctor\Results\Message;
use Hypervel\Doctor\Support\ActiveDrivers;
use Hypervel\Doctor\Support\Configured;
use Hypervel\Doctor\Support\RedisConnections;
use Hypervel\Support\Facades\Queue;
use Hypervel\Support\Facades\Redis;
use Hypervel\Support\Facades\Schema;
use RuntimeException;
use Throwable;
Expand Down Expand Up @@ -106,7 +106,7 @@ private function probe(string $connection, array $configuration): void
match ($configuration['driver'] ?? null) {
'sync' => null,
'database' => $this->probeDatabaseQueue($configuration),
'redis' => $this->probeRedisQueue($configuration),
'redis' => RedisConnections::ensureReachable(RedisConnections::name("queue.connections.{$connection}.connection")),
'sqs', 'beanstalkd' => Queue::connection($connection)->size(),
default => Queue::connection($connection),
};
Expand All @@ -130,21 +130,6 @@ private function probeDatabaseQueue(array $configuration): void
}
}

/**
* Probe a Redis-backed queue.
*
* @param array<string, mixed> $configuration
*/
private function probeRedisQueue(array $configuration): void
{
$connection = $configuration['connection'] ?? 'default';

// phpredis returns false instead of throwing for ERR replies such as "max number of clients reached".
if (Redis::connection($connection)->ping() === false) {
throw new RuntimeException("Redis connection [{$connection}] returned an error for PING.");
}
}

/**
* Get the queue connection configuration.
*
Expand All @@ -162,6 +147,11 @@ private function configuration(string $connection): array
throw new RuntimeException(sprintf('The [%s] queue connection is not configured.', $connection));
}

$driver = $configuration['driver'] ?? null;
if (! is_string($driver) || trim($driver) === '') {
throw new RuntimeException("The [{$connection}] queue connection does not have a driver.");
}

return $configuration;
}

Expand Down
14 changes: 5 additions & 9 deletions src/doctor/src/Diagnostics/RedisConnectionsAreReachable.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
use Hypervel\Doctor\Results\DiagnosticResult;
use Hypervel\Doctor\Results\Link;
use Hypervel\Doctor\Results\Message;
use Hypervel\Doctor\Support\ActiveDrivers;
use Hypervel\Doctor\Support\Details;
use Hypervel\Support\Facades\Redis;
use Hypervel\Doctor\Support\RedisConnections;
use Throwable;

class RedisConnectionsAreReachable extends Diagnostic
Expand Down Expand Up @@ -42,20 +41,17 @@ protected function messages(): array
*/
public function check(): DiagnosticResult
{
$connections = ActiveDrivers::redisConnections();
$selectors = RedisConnections::selectors();

if ($connections === []) {
if ($selectors === []) {
return $this->skip('not-configured');
}

$failures = [];
[$connections, $failures] = RedisConnections::resolve($selectors);

foreach ($connections as $connection) {
try {
// phpredis returns false instead of throwing for ERR replies such as "max number of clients reached".
if (Redis::connection($connection)->ping() === false) {
$failures[$connection] = 'The Redis server returned an error for PING.';
}
RedisConnections::ensureReachable($connection, includeName: false);
} catch (Throwable $e) {
if (Coroutine::causedByCancellation($e)) {
throw $e;
Expand Down
24 changes: 12 additions & 12 deletions src/doctor/src/Diagnostics/RedisSupportsConfiguredFeatures.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
use Hypervel\Doctor\Support\ActiveDrivers;
use Hypervel\Doctor\Support\Configured;
use Hypervel\Doctor\Support\Details;
use Hypervel\Doctor\Support\RedisConnections;
use Hypervel\Redis\RedisRequirements;
use Hypervel\Session\SessionManager;
use Hypervel\Support\Facades\Redis;
use Throwable;

Expand Down Expand Up @@ -46,7 +46,7 @@ protected function messages(): array
*/
public function check(): DiagnosticResult
{
if (ActiveDrivers::redisConnections() === []) {
if (RedisConnections::selectors() === []) {
return $this->skip('not-configured');
}

Expand All @@ -60,17 +60,17 @@ public function check(): DiagnosticResult
));
}

$connections = $this->featureConnections();
$selectors = $this->featureSelectors();

if ($connections === []) {
if ($selectors === []) {
return $this->pass('supported');
}

if (($error = RedisRequirements::hashFieldExpirationClientError($version)) !== null) {
return $this->fail('unsupported')->withDetails($error);
}

$failures = [];
[$connections, $failures] = RedisConnections::resolve($selectors);

foreach ($connections as $connection) {
try {
Expand All @@ -97,34 +97,34 @@ public function check(): DiagnosticResult
}

/**
* Get data connections that need hash field expiration.
* Get the configuration keys selecting connections that need hash field expiration.
*
* @return list<string>
*/
private function featureConnections(): array
private function featureSelectors(): array
{
$connections = [];
$keys = [];
$default = Configured::string('cache.default');

foreach ($default === null ? [] : ActiveDrivers::cacheStores($default) as $store) {
$configuration = Configured::array("cache.stores.{$store}");

if ($configuration === null || ($configuration['driver'] ?? null) !== 'redis') {
if ($store === 'null' || ($configuration['driver'] ?? null) !== 'redis') {
continue;
}

$mode = $configuration['tag_mode'] ?? TagMode::All;
$mode = $mode instanceof TagMode ? $mode : TagMode::fromConfig($mode);

if ($mode === TagMode::Any) {
$connections[] = $configuration['connection'] ?? 'default';
$keys[] = "cache.stores.{$store}.connection";
}
}

if (Configured::string('session.driver') === 'redis' && config()->boolean('session.track_user_sessions')) {
$connections[] = Configured::string('session.connection', SessionManager::DEFAULT_REDIS_CONNECTION);
$keys[] = 'session.connection';
}

return array_values(array_unique($connections));
return $keys;
}
}
Loading