Fix Discovery system context-dependent caching issue
The Discovery system was creating separate caches for WEB vs CLI contexts,
causing RequestFactory #[Initializer] to be missing in WEB context and
leading to 500 errors due to Request interface binding failures.
Changes:
- Remove execution context from Discovery cache keys
- Ensure consistent Discovery results across WEB and CLI contexts
- WEB and CLI now share same Discovery cache (535 items vs 369/535 split)
- RequestFactory consistently discovered in both contexts
Root cause: Context-dependent cache keys caused:
- CLI: discovery:full_{hash}_cli-script
- WEB: discovery:full_{hash}_web
Fixed: Both contexts now use discovery:full_{hash}
Resolves: #21 DI Container Request Interface Binding
Resolves: #18 Discovery WEB vs CLI Context differences
This commit is contained in:
@@ -64,12 +64,12 @@ final class DiscoveryContext
|
||||
|
||||
public function getCacheKey(): CacheKey
|
||||
{
|
||||
// Include execution context in cache key if available
|
||||
$contextString = $this->executionContext
|
||||
? $this->executionContext->getType()->value
|
||||
: null;
|
||||
|
||||
return DiscoveryCacheIdentifiers::discoveryKey($this->paths, $this->scanType, $contextString);
|
||||
// FIXED: Remove execution context from cache key to ensure consistent Discovery results
|
||||
// between WEB and CLI contexts. Discovery results should be the same regardless of
|
||||
// execution context - the same PHP files should produce the same attributes.
|
||||
// Context-dependent caching was causing RequestFactory to be missing in WEB context.
|
||||
|
||||
return DiscoveryCacheIdentifiers::discoveryKey($this->paths, $this->scanType, null);
|
||||
}
|
||||
|
||||
public function isIncremental(): bool
|
||||
|
||||
Reference in New Issue
Block a user