Skip to content

Replace lifetime docblock tags with method attributes - #104

Merged
binaryfire merged 36 commits into
0.4from
feature/hypervel-attributes
Nov 12, 2026
Merged

binaryfire merged 36 commits into
0.4from
feature/hypervel-attributes

Conversation

@binaryfire

@binaryfire binaryfire commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

This adds hypervel/attributes, a small package of method attributes, and uses it to replace the "Boot-only.", "Tests only." and "Boot or tests only." docblock warnings across the framework.

Hypervel workers are long-lived, so some methods are only safe to call while the application boots or in tests. Until now, those methods said so in prose at the start of a docblock paragraph. That works for someone reading the source, but it isn't reliable for tools. The worker-state analysis matched the tags with a regex, which also matched conditional prose such as "Boot-only when setting", and there was no way to say that only some calls to a method are restricted. Attributes carry the same information as exact metadata that PHPStan reads through reflection.

The attributes don't change runtime behavior. In this PR, the existing worker-state analysis uses them to skip writes in marked methods, as it did with the tags. Checking calls to marked methods is left to a follow-up that builds on this.

The attributes

BootOnly, TestsOnly and BootOrTestsOnly live in Hypervel\Support\Attributes. Each takes optional arguments for methods where only some calls are restricted:

  • whenNotDefault: 'parameter' restricts calls that pass that parameter a value other than its default. Relation::morphMap() uses it, so calling it without a map to read the current map is still fine at runtime.
  • whenProvided: 'parameter' restricts any call that passes that parameter. This is for methods that treat an explicit default differently from an omitted argument, such as Passport::rememberConsentFor(), where an explicit null clears the duration.
  • whenShared: true restricts calls only on the worker-shared instance, for methods that change only their own object. An HTTP client factory you create yourself can set its own global options; the application's shared factory should only be configured while booting.

A parameter condition can be combined with whenShared, in which case a call is restricted only when both apply.

Unsupported marks a retained public method that always throws, such as a Symfony or PSR method that doesn't fit Hypervel's runtime. It takes an optional message pointing to the supported alternative:

#[Unsupported('Return the response from your route or controller so the server can send it.')]
public function send(bool $flush = true): never

Base methods that drivers override, extension hooks, deliberate control-flow throws and methods that only reject some calls aren't marked.

The attributes are a separate package, rather than part of hypervel/support, because PHPStan drops an attribute that has arguments when the attribute class isn't installed. Every package using one has to depend on it, and several of those packages, such as container, contracts and collections, don't depend on Support. The package requires nothing but PHP and shares the Hypervel\Support namespace, the same way hypervel/macroable and hypervel/conditionable do.

Converting the existing warnings

Each tagged method was checked against what it actually changes instead of being converted mechanically. Most keep their restriction, but the conversion also corrected a number of them:

  • Methods that only change their own instance use whenShared, and their docblocks now say they affect the shared instance rather than every instance.
  • Caches that are rebuilt on demand, such as the view finder and routing reflection caches, are no longer restricted. Neither are the broadcast, queue, mail and filesystem manager purge() methods, whose documented use is recovering broken pooled resources at runtime.
  • Methods that forward to an injected object, such as event registration wrappers that receive their dispatcher, are left unmarked. Whether they touch shared state depends on the object passed in, and the target's own mutators carry the marker.
  • Methods that directly call a marked method carry the same marker, including facade fake() methods and service provider registration helpers.
  • Contracts and their implementations carry matching markers, since PHP attributes aren't inherited.
  • Registration that happens lazily on first use with stable definitions, such as Pennant class features and Eloquent model boot hooks, stays unmarked.

Each docblock keeps its explanation of what goes wrong; only the tag phrase is gone.

Context state owned by the right object

Checking each marker against its real behavior turned up places where coroutine context state was keyed by a fixed name instead of by the object that owns it. Independent instances could then read, replace or clear each other's state:

  • Container: scoped instances and resolution state used fixed context keys. A second container could return or clear the first container's scoped instances, and resolving through another container inside a binding could throw a CircularDependencyException. Each container now has its own lazily allocated key prefix. A cloned container gets a new prefix and starts with copies of the scoped instances already resolved in the current coroutine.
  • Guards: all six guards stored per-request users, credentials and caches under keys built from the guard name. A guard created later with the same name, for example after AuthManager::forgetGuards(), picked up the previous guard's user and cached credentials. Guard keys now belong to the guard instance. Session keys and remember cookies are unchanged, so a replacement guard still reauthenticates from a valid session.
  • Cache: managers with the same store name shared one memo() repository, and forgetDriver() evicted another manager's memo. Memo keys now belong to the manager. Cloning a cache repository also cloned its ArrayStore, which kept the original context keys, so writes through the clone changed the original. Cloned array stores now get their own keys, starting with copies of the current values and locks. A cloned tagged cache likewise keeps its tags on its cloned store, so flushing the copy no longer resets the original's tags.
  • Redis: pinned connections and deferred-release owners were keyed by connection name alone, so proxies on different pool managers shared a pin and could release each other's connections. The keys now include the owning pool manager. Proxies on the same manager still share their pin.

Only the keys change, not how values are stored, so child coroutines inherit context as before. The fixed-key constants (Container::SCOPED_CONTEXT_PREFIX and RESOLUTION_STATE_CONTEXT_KEY, JwtGuard::GUARD_CONTEXT_KEY_PREFIX, RedisProxy::CONNECTION_CONTEXT_PREFIX) and the getContextStateKey() helpers on SessionGuard and JwtGuard are removed.

Other changes

  • The Queue facade's popUsing() accepts null to remove a callback, matching Worker::popUsing().
  • Engine\Http\Stream::seek() has native int parameter types, matching PSR-7 v2.
  • The worker-state analysis reads the attributes through PHPStan reflection instead of matching docblock text.
  • The Static Analysis documentation has a new Method Attributes section, and AGENTS.md describes the attributes in place of the tags.
  • docs/todo.md lists the hypervel/attributes split repository and Packagist entry, which need to exist before release.

Validation

Formatting, PHPStan and the analyzer test suite pass. A standalone copy of the package was installed on its own and every attribute instantiated from it, and each package that uses an attribute declares the dependency. The context-key fixes have regression tests covering independent instances, invalidation, cloning, child coroutines and reauthentication after a guard is replaced.

Note

Replace lifecycle docblock tags with BootOnly/TestsOnly/Unsupported method attributes

  • Adds a new hypervel/attributes package defining BootOnly, BootOrTestsOnly, TestsOnly, and Unsupported attributes with whenNotDefault, whenProvided, and whenShared options. All packages declare it as a dependency.
  • Applies these attributes across the framework, replacing prose lifetime labels ("Boot only", "Tests only") in docblocks. The attributes carry no runtime enforcement; method bodies are unchanged except where noted.
  • Updates the PHPStan WorkerStateHelper and WorkerStateClassCollector to detect lifecycle markers via reflected attributes instead of doc-comment patterns.
  • Fixes state isolation beyond the attribute sweep: guards (GuardHelpers, SessionGuard, RequestGuard, TokenGuard) and Container now use per-instance context-key prefixes, so same-named guards and separate containers no longer share cached state. CacheManager, ArrayStore, and tagged-cache classes gain similar per-instance/clone isolation.
  • Behavioral Change: Queue::popUsing now accepts a nullable callable (null removes the callback); engine.Stream::seek declares integer parameter types; phpstan/src/Rules/Coroutine/WorkerStateHelper.php and phpstan/src/Collectors/WorkerStateClassCollector.php change how lifetime markers are detected, so custom classes relying on docblock wording for the analysis are no longer recognized.

Macroscope summarized 8db14b5.

Introduce hypervel/attributes with BootOnly, TestsOnly, BootOrTestsOnly and Unsupported markers under Hypervel\Support\Attributes. Lifetime markers can describe argument-dependent restrictions and methods that only affect a shared receiver.

Wire the package into framework installation and Components autoloading without adding runtime enforcement or dependencies beyond PHP.
Give each container a lazily allocated context prefix so independent containers cannot adopt or invalidate each other’s scoped services or share circular-resolution stacks. Retain the existing context copying behavior and number of context lookups.

Cloned containers start with shallow copies of currently resolved scoped values while owning their cache entries independently. Cover independent resolution, invalidation, cloning and child-coroutine inheritance, and mark container mutators according to their corrected ownership.
Replace prose-tag matching with PHPStan attribute reflection for method bodies and promoted constructor parameters. Preserve the existing exemption for restricted setters, including attributes with argument conditions.

Convert the rule fixtures and cover a conditional request setter alongside the existing unmarked write. Remove obsolete lifetime tags from the configuration stub.
Convert core package lifetime warnings to attributes while retaining useful explanations of shared state. Distinguish instance-owned state from global effects, leave target-dependent forwarding methods unmarked, and declare the attributes dependency in each using package.

Mark unsupported stream operations and Str cache clearing, cover facade fake and registration wrappers, and allow Queue::popUsing(null) to remove a worker callback as its underlying API supports. Record the remaining conversions and the ArrayStore clone correction in the implementation plan.
Give each guard its own coroutine context keys so replacement guards do not adopt cached users, clients or credentials from an earlier instance. Preserve session and remember-cookie identifiers so persisted authentication still reloads normally.

Convert auth, session, cookie, encryption and hashing lifecycle restrictions to attributes and declare their dependency. Cover replacement guards across authentication drivers, HTTP test state synchronization and session reauthentication.
Allocate memoized cache keys per manager so independent managers cannot reuse or evict each other's repositories. Give cloned array stores fresh context keys and shallow copies of their current values and locks.

Convert cache lifecycle restrictions to attributes, mark unsupported any-mode reads and declare the attribute dependency. Regression coverage checks manager isolation and independent mutations through cloned repositories.
Build pinned-connection and deferred-release keys from the owning pool manager, caching the resulting keys on each proxy. Proxies sharing a manager and connection name continue to share their pin; independent managers no longer release or reuse each other's connections.

Convert Redis and object-pool lifecycle restrictions to attributes and declare their dependencies. Update context-key inspection in existing tests and cover separate pins, shared pins and deferred cleanup.
Replace lifecycle prose tags with method attributes, distinguishing receiver-owned configuration from shared resource mutation. Mark intentionally unsupported filesystem accessors and declare the attribute dependencies.

Update the active implementation plan with the completed package group and the context ownership corrections, retaining the remaining conversion and documentation work.
Convert broadcasting, bus, mail, queue, Horizon and pipeline lifetime restrictions to method attributes, with receiver conditions for instance-owned state. Preserve runtime recovery through pooled manager purges and exclusive borrowed-object configuration.

Mark the queue connection contract and after-commit dispatcher setter consistently, declare the attribute dependencies, and update queue package metadata coverage.
Replace console, scheduling, concurrency and process-factory lifetime tags with attributes. Shared mutex configuration remains restricted while process recording helpers retain their supported conditional runtime behavior.

Mark scheduled callback background execution as unsupported, declare the package dependencies and update console metadata coverage.
Mark process registration, server binding, signal listener setup and shared server configuration with lifecycle attributes. Keep ProcessManager running-state updates unmarked because both startup and shutdown legitimately own them.

Add the corresponding contract marker and package dependencies, preserving existing behavior and checking Reverb and WebSocket server metadata.
Leave protected provider implementation helpers unmarked when only startup hooks call them, while retaining markers on generally callable registration APIs. Preserve useful existing explanations on contracts and mark the inherited application environment resolver consistently.

Update the active plan with exclusive pool-borrow semantics, legitimate startup and shutdown calls, completed conversions and remaining work.
Replace database, schema, migration and Eloquent lifetime tags with method attributes. Preserve read-only morph-map calls and lazy model boot hooks, while marking event registration consistently across ordinary and soft-delete events.

Describe dispatcher and transaction-manager restrictions on reusable physical connections, mark retained unsupported database APIs, and declare the attribute dependency with metadata coverage. Runtime behavior and signatures are unchanged.
Convert search engine configuration and Scout callbacks to lifecycle attributes, applying receiver conditions to engine-owned state. Keep model boot registration available during lazy initialization.

Mark index creation methods that always reject calls, declare the attribute dependency and update package metadata coverage without changing engine behavior.
Replace lifecycle tags with attributes for data morph maps, pagination resolvers and permission configuration. Distinguish receiver-owned state from setters that update shared configuration and bindings.

Mark retained unsupported data APIs, declare package dependencies, and update the implementation plan with completed conversions and the remaining package groups.
Explore replacing the manual static-reset registry with discovered method attributes. Record discovery, ordering, inheritance and optional-package constraints while keeping test execution free of repeated scanning.
Replace lifetime prose tags with attributes across application bootstrap, exception handling, middleware configuration, console registration and Vite. Mark configuration wrappers and align the application contract with its implementation.

Limit instance-owned settings to shared receivers while retaining unconditional restrictions for global configuration. Keep lifecycle hooks and stable lazy initialization unrestricted, and declare the attributes dependency.
Convert shared HTTP factory, middleware, resource and routing configuration to lifetime attributes. Preserve runtime-safe reflection and routing cache resets without restrictions, and retain conditional getter behavior.

Mark retained unsupported HTTP and transport methods, including stream rewind paths that always reject seeking. Add direct attributes dependencies to each affected package without changing runtime behavior.
Convert DI registries, proxy generation, server initialization and test infrastructure to method attributes. Align server initialization with its contract and declare the package dependencies.

Leave aspect-chain and Eloquent caster cache clearing unrestricted because subsequent calls rebuild them from unchanged configuration. Update the implementation plan with these cache boundaries, lifecycle exclusions and remaining conversion work.
Allow Unsupported to carry an optional message while preserving bare markers. Supply verified alternatives for rejected cache, database, filesystem, HTTP, validation and transport methods.

Keep runtime exceptions unchanged. The metadata gives static analysis the guidance needed to direct callers to supported APIs without inspecting method bodies.
Convert AI manager configuration, fake gateways and provider setters to lifetime attributes with shared-receiver conditions. Mark MCP route registration and client configuration according to the state each method owns.

Describe unsupported provider and MCP content operations with useful guidance where an alternative exists. Declare attributes dependencies and update the implementation plan and approved guidance wording.
Qualify HTTP factory, cookie middleware, migration hook, pool callback and Redis configuration warnings for shared receivers. Independently constructed instances retain their own state, matching the conditional lifetime attributes.
Convert compiler, finder, head registry and Inertia configuration warnings to attributes, preserving receiver-specific restrictions and runtime-safe cache clearing.

Keep forwarding methods unmarked where caller-supplied dependencies determine the effect. Document shared dispatcher and registry behavior without treating every independently built object as application-global. Declare the attributes dependencies.
Mark shared loader and translator mutations, validation factory configuration and DNS test overrides. Preserve getter calls to validation defaults through conditional attributes and keep injected-loader forwarders unrestricted.

Declare the attributes dependencies and update validation package metadata coverage.
Convert process-wide prompt theme, cancellation, reset and test configuration to attributes while retaining runtime getter behavior.

Add supported alternatives to the unsupported prompt methods on progress, spinner, stream and task objects. Declare the attributes package and preserve coroutine-local prompt settings.
Remove unconditional restrictions from exception configuration and event registration wrappers whose handlers or dispatchers can be independently constructed. Retain the target mutators and static-target restrictions, with accurate shared-instance guidance.

Record the forwarding boundary and completed package conversions in the implementation plan.
…tributes

Replace prose lifetime tags across Fortify, JWT, Passkeys, Passport, Sanctum and Socialite with method attributes and declare their package dependency. Preserve conditional getter behavior for Passport settings and Fortify feature options, including the distinction between omitted and explicit null consent durations.

Restrict instance configuration only on shared receivers and mark the Socialite fake as test-only. Leave guard listener forwarders unmarked because the injected dispatcher owns the registration. Update the Passkeys dependency assertion alongside its manifest.
Convert lifetime tags in Doctor, gRPC, Image, Pennant, RateLimiter and Saloon to attributes, with direct dependencies and matching metadata assertions. Keep configuration writes and global descriptor registration unconditional, while owned instance registries are restricted only when shared.

Mark explicit Pennant definitions in both argument forms without restricting its guarded lazy registration callers. Preserve unknown dispatcher ownership for Connection::listen(), mark global mock cleanup as test-only, and add actionable Unsupported guidance for health watches and cursor paginator pooling.
Replace lifetime tags in OpenTelemetry, Sentry and Telescope with attributes that distinguish shared instance configuration from global registrations. Mark Telescope startup and listener registration, retain conditional ownership explanations for injected forwarders, and describe the exception recorder handoff precisely.

Declare the attributes dependency and complete Telescope direct-dependency assertions. Update the active plan to record the completed source conversion and Unsupported inventory, leaving guidance, documentation and final verification as the remaining work.
Explain the lifetime markers, argument conditions and Unsupported guidance in the static analysis documentation. Distinguish metadata and worker-state body exemptions from runtime enforcement and call-site checking, and link the existing worker-state section to the new examples.

Update the authoring guide to use attributes instead of prose tags, retain the requirement to explain runtime harm, and keep flushState cleanup hooks unmarked. Document the exclusions for intentionally unsupported methods and require useful alternative guidance when available.
Add the attributes split repository and Packagist registration to release preparation. Record the Channel capability investigation without changing the existing unsupported methods.

Mark the attributes implementation and verification complete in the active plan. Keep private consumer conversion dependent on the merge and the subsequent PHPStan rule work separate.
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Replace lifecycle docblock tags with method attributes

✨ Enhancement 🐞 Bug fix 📝 Documentation 🧪 Tests ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

AI Description

• Introduces a standalone attributes package so lifecycle restrictions are precise, reflectable
 metadata.
• Converts framework methods and PHPStan worker-state analysis from prose tags to attributes.
• Isolates coroutine context state by owning instance, with regression tests for replacement and
 cloning.
Diagram

graph TD
  Composer["Package wiring"] --> Attributes["Method attributes"] --> Methods["Framework methods"] --> Reflection["PHPStan reflection"] --> Analysis["Worker-state analysis"]
  Methods --> Owners["State owners"] --> Context[("Coroutine context")]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Put attributes in hypervel/support
  • ➕ Avoids another package and release artifact.
  • ➖ Introduces Support dependencies into foundational packages; missing attribute classes with arguments can disappear from PHPStan reflection.
2. Retain structured PHPDoc annotations
  • ➕ Avoids Composer dependency changes.
  • ➖ Requires continued text parsing and offers weaker, less reliable representation of conditional restrictions.

Recommendation: Keep the standalone PHP-only attributes package: it preserves package layering while making restrictions discoverable through reflection. Review the instance-owned context changes independently because they alter runtime state isolation, unlike the attributes.

Files changed (543) +5380 / -2451

Enhancement (398) +3751 / -1860
AiManager.phpMark shared AI configuration +17/-9

Mark shared AI configuration

• Annotates manager configuration and fake-related methods with lifecycle restrictions.

src/ai/src/AiManager.php

Audio.phpMark audio fake setup +3/-1

Mark audio fake setup

• Makes the test-only fake restriction reflectable.

src/ai/src/Audio.php

Classification.phpMark classification fake setup +3/-1

Mark classification fake setup

• Makes the test-only fake restriction reflectable.

src/ai/src/Classification.php

InteractsWithFakeAgents.phpMark agent fake helpers +5/-2

Mark agent fake helpers

• Annotates fake installation as test-only.

src/ai/src/Concerns/InteractsWithFakeAgents.php

InteractsWithFakeAudio.phpMark audio fake helpers +5/-2

Mark audio fake helpers

• Annotates fake installation as test-only.

src/ai/src/Concerns/InteractsWithFakeAudio.php

InteractsWithFakeClassification.phpMark classification fake helpers +5/-2

Mark classification fake helpers

• Annotates fake installation as test-only.

src/ai/src/Concerns/InteractsWithFakeClassification.php

InteractsWithFakeEmbeddings.phpMark embedding fake helpers +5/-2

Mark embedding fake helpers

• Annotates fake installation as test-only.

src/ai/src/Concerns/InteractsWithFakeEmbeddings.php

InteractsWithFakeFiles.phpMark file fake helpers +7/-3

Mark file fake helpers

• Annotates file fake setup and related mutation restrictions.

src/ai/src/Concerns/InteractsWithFakeFiles.php

InteractsWithFakeImages.phpMark image fake helpers +5/-2

Mark image fake helpers

• Annotates fake installation as test-only.

src/ai/src/Concerns/InteractsWithFakeImages.php

InteractsWithFakeReranking.phpMark reranking fake helpers +5/-2

Mark reranking fake helpers

• Annotates fake installation as test-only.

src/ai/src/Concerns/InteractsWithFakeReranking.php

InteractsWithFakeStores.phpMark store fake helpers +11/-5

Mark store fake helpers

• Annotates store fake setup and related mutation restrictions.

src/ai/src/Concerns/InteractsWithFakeStores.php

InteractsWithFakeTranscriptions.phpMark transcription fake helpers +5/-2

Mark transcription fake helpers

• Annotates fake installation as test-only.

src/ai/src/Concerns/InteractsWithFakeTranscriptions.php

AudioProvider.phpAnnotate audio provider contract +2/-0

Annotate audio provider contract

• Exposes a lifecycle restriction on the provider interface.

src/ai/src/Contracts/Providers/AudioProvider.php

ClassificationProvider.phpAnnotate classification provider contract +2/-0

Annotate classification provider contract

• Exposes a lifecycle restriction on the provider interface.

src/ai/src/Contracts/Providers/ClassificationProvider.php

EmbeddingProvider.phpAnnotate embedding provider contract +2/-0

Annotate embedding provider contract

• Exposes a lifecycle restriction on the provider interface.

src/ai/src/Contracts/Providers/EmbeddingProvider.php

FileProvider.phpAnnotate file provider contract +2/-0

Annotate file provider contract

• Exposes a lifecycle restriction on the provider interface.

src/ai/src/Contracts/Providers/FileProvider.php

ImageProvider.phpAnnotate image provider contract +2/-0

Annotate image provider contract

• Exposes a lifecycle restriction on the provider interface.

src/ai/src/Contracts/Providers/ImageProvider.php

RerankingProvider.phpAnnotate reranking provider contract +2/-0

Annotate reranking provider contract

• Exposes a lifecycle restriction on the provider interface.

src/ai/src/Contracts/Providers/RerankingProvider.php

StoreProvider.phpAnnotate store provider contract +2/-0

Annotate store provider contract

• Exposes a lifecycle restriction on the provider interface.

src/ai/src/Contracts/Providers/StoreProvider.php

TextProvider.phpAnnotate text provider contract +2/-0

Annotate text provider contract

• Exposes a lifecycle restriction on the provider interface.

src/ai/src/Contracts/Providers/TextProvider.php

TranscriptionProvider.phpAnnotate transcription provider contract +2/-0

Annotate transcription provider contract

• Exposes a lifecycle restriction on the provider interface.

src/ai/src/Contracts/Providers/TranscriptionProvider.php

Embeddings.phpMark embedding fake setup +3/-1

Mark embedding fake setup

• Replaces the test-only warning with metadata.

src/ai/src/Embeddings.php

Files.phpMark file fake setup +3/-1

Mark file fake setup

• Replaces the test-only warning with metadata.

src/ai/src/Files.php

ProviderDocument.phpMark unsupported document method +2/-0

Mark unsupported document method

• Identifies a retained throwing API as unsupported.

src/ai/src/Files/ProviderDocument.php

S3Document.phpMark unsupported S3 document method +2/-0

Mark unsupported S3 document method

• Identifies a retained throwing API as unsupported.

src/ai/src/Files/S3Document.php

UntrustedUrl.phpClarify URL restrictions +3/-1

Clarify URL restrictions

• Adds method metadata in place of prose warning.

src/ai/src/Files/UntrustedUrl.php

AnthropicGateway.phpMark unsupported Anthropic operations +5/-0

Mark unsupported Anthropic operations

• Annotates always-throwing gateway methods.

src/ai/src/Gateway/Anthropic/AnthropicGateway.php

FakeAudioGateway.phpMark fake audio gateway setup +4/-1

Mark fake audio gateway setup

• Annotates fake gateway mutation restrictions.

src/ai/src/Gateway/FakeAudioGateway.php

FakeClassificationGateway.phpMark fake classification gateway setup +4/-1

Mark fake classification gateway setup

• Annotates fake gateway mutation restrictions.

src/ai/src/Gateway/FakeClassificationGateway.php

FakeEmbeddingGateway.phpMark fake embedding gateway setup +4/-1

Mark fake embedding gateway setup

• Annotates fake gateway mutation restrictions.

src/ai/src/Gateway/FakeEmbeddingGateway.php

FakeFileGateway.phpMark fake file gateway setup +4/-1

Mark fake file gateway setup

• Annotates fake gateway mutation restrictions.

src/ai/src/Gateway/FakeFileGateway.php

FakeImageGateway.phpMark fake image gateway setup +4/-1

Mark fake image gateway setup

• Annotates fake gateway mutation restrictions.

src/ai/src/Gateway/FakeImageGateway.php

FakeRerankingGateway.phpMark fake reranking gateway setup +4/-1

Mark fake reranking gateway setup

• Annotates fake gateway mutation restrictions.

src/ai/src/Gateway/FakeRerankingGateway.php

FakeStoreGateway.phpMark fake store gateway setup +4/-1

Mark fake store gateway setup

• Annotates fake gateway mutation restrictions.

src/ai/src/Gateway/FakeStoreGateway.php

FakeTextGateway.phpMark fake text gateway setup +4/-1

Mark fake text gateway setup

• Annotates fake gateway mutation restrictions.

src/ai/src/Gateway/FakeTextGateway.php

FakeTranscriptionGateway.phpMark fake transcription gateway setup +4/-1

Mark fake transcription gateway setup

• Annotates fake gateway mutation restrictions.

src/ai/src/Gateway/FakeTranscriptionGateway.php

XaiGateway.phpMark unsupported xAI operations +5/-0

Mark unsupported xAI operations

• Annotates always-throwing gateway methods.

src/ai/src/Gateway/Xai/XaiGateway.php

Image.phpMark image fake setup +3/-1

Mark image fake setup

• Replaces the test-only warning with metadata.

src/ai/src/Image.php

Promptable.phpMark prompt fake setup +3/-1

Mark prompt fake setup

• Replaces the test-only warning with metadata.

src/ai/src/Promptable.php

HasAudioGateway.phpAnnotate audio gateway setter +3/-1

Annotate audio gateway setter

• Marks provider gateway configuration with lifecycle metadata.

src/ai/src/Providers/Concerns/HasAudioGateway.php

HasClassificationGateway.phpAnnotate classification gateway setter +3/-1

Annotate classification gateway setter

• Marks provider gateway configuration with lifecycle metadata.

src/ai/src/Providers/Concerns/HasClassificationGateway.php

HasEmbeddingGateway.phpAnnotate embedding gateway setter +3/-1

Annotate embedding gateway setter

• Marks provider gateway configuration with lifecycle metadata.

src/ai/src/Providers/Concerns/HasEmbeddingGateway.php

HasFileGateway.phpAnnotate file gateway setter +3/-1

Annotate file gateway setter

• Marks provider gateway configuration with lifecycle metadata.

src/ai/src/Providers/Concerns/HasFileGateway.php

HasImageGateway.phpAnnotate image gateway setter +3/-1

Annotate image gateway setter

• Marks provider gateway configuration with lifecycle metadata.

src/ai/src/Providers/Concerns/HasImageGateway.php

HasRerankingGateway.phpAnnotate reranking gateway setter +3/-1

Annotate reranking gateway setter

• Marks provider gateway configuration with lifecycle metadata.

src/ai/src/Providers/Concerns/HasRerankingGateway.php

HasStoreGateway.phpAnnotate store gateway setter +3/-1

Annotate store gateway setter

• Marks provider gateway configuration with lifecycle metadata.

src/ai/src/Providers/Concerns/HasStoreGateway.php

HasTextGateway.phpAnnotate text gateway setter +3/-1

Annotate text gateway setter

• Marks provider gateway configuration with lifecycle metadata.

src/ai/src/Providers/Concerns/HasTextGateway.php

HasTranscriptionGateway.phpAnnotate transcription gateway setter +3/-1

Annotate transcription gateway setter

• Marks provider gateway configuration with lifecycle metadata.

src/ai/src/Providers/Concerns/HasTranscriptionGateway.php

Reranking.phpMark reranking fake setup +3/-1

Mark reranking fake setup

• Replaces the test-only warning with metadata.

src/ai/src/Reranking.php

Stores.phpMark store fake setup +3/-1

Mark store fake setup

• Replaces the test-only warning with metadata.

src/ai/src/Stores.php

Transcription.phpMark transcription fake setup +3/-1

Mark transcription fake setup

• Replaces the test-only warning with metadata.

src/ai/src/Transcription.php

PendingRequest.phpMark unsupported request operation +2/-0

Mark unsupported request operation

• Identifies an always-throwing API as unsupported.

src/api-client/src/PendingRequest.php

BootOnly.phpDefine BootOnly attribute +25/-0

Define BootOnly attribute

• Adds method metadata for boot-only calls and conditional restrictions.

src/attributes/src/Attributes/BootOnly.php

BootOrTestsOnly.phpDefine BootOrTestsOnly attribute +25/-0

Define BootOrTestsOnly attribute

• Adds conditional method metadata for calls allowed during boot or tests.

src/attributes/src/Attributes/BootOrTestsOnly.php

TestsOnly.phpDefine TestsOnly attribute +25/-0

Define TestsOnly attribute

• Adds conditional method metadata for test-only calls.

src/attributes/src/Attributes/TestsOnly.php

Unsupported.phpDefine Unsupported attribute +21/-0

Define Unsupported attribute

• Marks always-throwing methods with optional alternative-use guidance.

src/attributes/src/Attributes/Unsupported.php

Gate.phpAnnotate gate registration +27/-17

Annotate gate registration

• Marks persistent authorization configuration and test hooks.

src/auth/src/Access/Gate.php

AuthManager.phpAnnotate auth manager mutation +31/-17

Annotate auth manager mutation

• Marks shared guard configuration and reset methods.

src/auth/src/AuthManager.php

AuthenticationException.phpAnnotate redirect configuration +4/-2

Annotate redirect configuration

• Replaces lifecycle prose with method attributes.

src/auth/src/AuthenticationException.php

AuthenticationRedirects.phpAnnotate authentication redirects +10/-6

Annotate authentication redirects

• Marks worker-shared redirect configuration.

src/auth/src/AuthenticationRedirects.php

EloquentUserProvider.phpAnnotate user provider configuration +22/-12

Annotate user provider configuration

• Marks persistent provider callbacks and shared-instance changes.

src/auth/src/EloquentUserProvider.php

Authenticate.phpAnnotate authentication middleware setup +4/-2

Annotate authentication middleware setup

• Replaces lifecycle warnings with attributes.

src/auth/src/Middleware/Authenticate.php

RedirectIfAuthenticated.phpAnnotate guest redirect setup +4/-3

Annotate guest redirect setup

• Marks persistent redirect configuration.

src/auth/src/Middleware/RedirectIfAuthenticated.php

ResetPassword.phpAnnotate reset notification hooks +7/-4

Annotate reset notification hooks

• Marks persistent notification configuration.

src/auth/src/Notifications/ResetPassword.php

VerifyEmail.phpAnnotate verification notification hooks +7/-4

Annotate verification notification hooks

• Marks persistent notification configuration.

src/auth/src/Notifications/VerifyEmail.php

PasswordBroker.phpAnnotate password broker hooks +4/-2

Annotate password broker hooks

• Marks persistent password-reset configuration.

src/auth/src/Passwords/PasswordBroker.php

PasswordBrokerManager.phpAnnotate broker manager setup +6/-4

Annotate broker manager setup

• Marks worker-shared broker configuration.

src/auth/src/Passwords/PasswordBrokerManager.php

BroadcastManager.phpAnnotate broadcaster registration +17/-11

Annotate broadcaster registration

• Marks persistent manager configuration while allowing runtime pool recovery.

src/broadcasting/src/BroadcastManager.php

BroadcastPoolProxy.phpAnnotate broadcast proxy methods +8/-5

Annotate broadcast proxy methods

• Marks lifecycle or unsupported operations on the proxy.

src/broadcasting/src/BroadcastPoolProxy.php

AblyBroadcaster.phpAnnotate Ably configuration +4/-2

Annotate Ably configuration

• Marks persistent broadcaster mutation.

src/broadcasting/src/Broadcasters/AblyBroadcaster.php

Broadcaster.phpAnnotate broadcaster configuration +14/-10

Annotate broadcaster configuration

• Marks shared broadcaster registration methods.

src/broadcasting/src/Broadcasters/Broadcaster.php

MercureBroadcaster.phpAnnotate Mercure configuration +4/-2

Annotate Mercure configuration

• Marks persistent broadcaster mutation.

src/broadcasting/src/Broadcasters/MercureBroadcaster.php

PusherBroadcaster.phpAnnotate Pusher configuration +4/-2

Annotate Pusher configuration

• Marks persistent broadcaster mutation.

src/broadcasting/src/Broadcasters/PusherBroadcaster.php

DispatchLockContext.phpAnnotate dispatch lock setup +6/-4

Annotate dispatch lock setup

• Converts lifetime warnings into method attributes.

src/bus/src/DispatchLockContext.php

Dispatcher.phpAnnotate bus dispatcher registration +14/-9

Annotate bus dispatcher registration

• Marks persistent handler and dispatch configuration.

src/bus/src/Dispatcher.php

AnyModeTaggedCache.phpMark unsupported tagged cache calls +10/-0

Mark unsupported tagged cache calls

• Identifies retained throwing methods.

src/cache/src/AnyModeTaggedCache.php

DatabaseStore.phpAnnotate database store configuration +7/-3

Annotate database store configuration

• Replaces lifetime prose with attributes.

src/cache/src/DatabaseStore.php

FileStore.phpAnnotate file store configuration +5/-2

Annotate file store configuration

• Replaces lifetime prose with attributes.

src/cache/src/FileStore.php

RedisStore.phpAnnotate Redis store configuration +14/-9

Annotate Redis store configuration

• Marks persistent callbacks and shared-instance mutation.

src/cache/src/RedisStore.php

Repository.phpAnnotate cache repository setters +15/-9

Annotate cache repository setters

• Restricts shared repository configuration and persistent unserializable-class handling.

src/cache/src/Repository.php

SerializableClassPolicy.phpAnnotate serialization policy +6/-4

Annotate serialization policy

• Marks persistent cache serialization configuration.

src/cache/src/SerializableClassPolicy.php

StorageStore.phpAnnotate storage cache configuration +3/-1

Annotate storage cache configuration

• Replaces lifecycle warning with metadata.

src/cache/src/StorageStore.php

SwooleTableManager.phpAnnotate table manager configuration +4/-2

Annotate table manager configuration

• Marks persistent table management restrictions.

src/cache/src/SwooleTableManager.php

Enumerable.phpAnnotate collection contract +4/-3

Annotate collection contract

• Adds method-level restriction metadata to the interface.

src/collections/src/Enumerable.php

EnumeratesValues.phpAnnotate collection implementation +7/-5

Annotate collection implementation

• Keeps lifecycle metadata aligned with the Enumerable contract.

src/collections/src/Traits/EnumeratesValues.php

ConcurrencyManager.phpAnnotate concurrency configuration +3/-1

Annotate concurrency configuration

• Marks persistent manager mutation.

src/concurrency/src/ConcurrencyManager.php

Repository.phpAnnotate configuration repository +16/-15

Annotate configuration repository

• Replaces prose warnings and distinguishes shared-repository mutation.

src/config/src/Repository.php

KeepaliveConnection.phpMark unsupported keepalive methods +4/-0

Mark unsupported keepalive methods

• Identifies retained methods that always throw.

src/connection-pool/src/KeepaliveConnection.php

Application.phpAnnotate console application setup +8/-4

Annotate console application setup

• Marks persistent command configuration.

src/console/src/Application.php

CacheCommandMutex.phpAnnotate command mutex setup +4/-2

Annotate command mutex setup

• Marks shared mutex configuration.

src/console/src/CacheCommandMutex.php

ScheduleListCommand.phpAnnotate schedule-list setup +4/-2

Annotate schedule-list setup

• Replaces lifecycle warning with metadata.

src/console/src/Commands/ScheduleListCommand.php

Prohibitable.phpAnnotate command prohibition +5/-2

Annotate command prohibition

• Marks persistent command configuration.

src/console/src/Prohibitable.php

CacheAware.phpAnnotate scheduler cache setup +4/-1

Annotate scheduler cache setup

• Marks shared scheduling configuration.

src/console/src/Scheduling/CacheAware.php

CacheEventMutex.phpAnnotate event mutex setup +3/-1

Annotate event mutex setup

• Marks persistent mutex configuration.

src/console/src/Scheduling/CacheEventMutex.php

CacheSchedulingMutex.phpAnnotate scheduling mutex setup +3/-1

Annotate scheduling mutex setup

• Marks persistent mutex configuration.

src/console/src/Scheduling/CacheSchedulingMutex.php

CallbackEvent.phpAnnotate callback event setup +2/-0

Annotate callback event setup

• Adds lifecycle metadata to scheduling mutation.

src/console/src/Scheduling/CallbackEvent.php

Schedule.phpAnnotate schedule registration +13/-8

Annotate schedule registration

• Marks persistent scheduled-event definitions.

src/console/src/Scheduling/Schedule.php

CoroutineContext.phpAnnotate context lifecycle APIs +10/-6

Annotate context lifecycle APIs

• Replaces documented restrictions with method metadata.

src/context/src/CoroutineContext.php

Gate.phpAnnotate gate contract +6/-0

Annotate gate contract

• Adds lifecycle metadata matching gate implementations.

src/contracts/src/Auth/Access/Gate.php

Dispatcher.phpAnnotate bus contract +4/-0

Annotate bus contract

• Adds lifecycle metadata matching dispatcher implementations.

src/contracts/src/Bus/Dispatcher.php

Repository.phpAnnotate config contract +10/-9

Annotate config contract

• Replaces prose restrictions with method attributes.

src/contracts/src/Config/Repository.php

Kernel.phpAnnotate console kernel contract +2/-0

Annotate console kernel contract

• Adds lifecycle metadata to persistent registration.

src/contracts/src/Console/Kernel.php

Container.phpAnnotate container contract +21/-0

Annotate container contract

• Marks binding and shared-instance mutations to match implementations.

src/contracts/src/Container/Container.php

ModelIdentifier.phpAnnotate model identifier contract +4/-2

Annotate model identifier contract

• Replaces lifecycle prose with method metadata.

src/contracts/src/Database/ModelIdentifier.php

CoroutineInterface.phpAnnotate coroutine contract +4/-2

Annotate coroutine contract

• Replaces lifecycle prose with method metadata.

src/contracts/src/Engine/CoroutineInterface.php

Dispatcher.phpAnnotate events contract +6/-0

Annotate events contract

• Marks persistent listener registration.

src/contracts/src/Events/Dispatcher.php

Application.phpAnnotate application contract +11/-0

Annotate application contract

• Marks worker-wide application configuration.

src/contracts/src/Foundation/Application.php

Kernel.phpAnnotate HTTP kernel contract +37/-24

Annotate HTTP kernel contract

• Replaces lifecycle warnings with matching method attributes.

src/contracts/src/Http/Kernel.php

Driver.phpAnnotate image driver contract +3/-1

Annotate image driver contract

• Adds lifecycle restriction metadata.

src/contracts/src/Image/Driver.php

Factory.phpAnnotate pool factory contract +4/-2

Annotate pool factory contract

• Replaces lifecycle prose with metadata.

src/contracts/src/ObjectPool/Factory.php

Recycler.phpAnnotate recycler contract +8/-4

Annotate recycler contract

• Marks persistent recycler configuration.

src/contracts/src/ObjectPool/Recycler.php

Monitor.phpAnnotate queue monitor contract +6/-0

Annotate queue monitor contract

• Adds lifecycle metadata to monitor registration.

src/contracts/src/Queue/Monitor.php

Queue.phpAnnotate queue contract +2/-0

Annotate queue contract

• Adds lifecycle metadata matching queue implementations.

src/contracts/src/Queue/Queue.php

Connection.phpAnnotate Redis connection contract +3/-0

Annotate Redis connection contract

• Adds lifecycle metadata to macro registration.

src/contracts/src/Redis/Connection.php

BindingRegistrar.phpAnnotate binding registrar contract +2/-0

Annotate binding registrar contract

• Adds lifecycle metadata to route binding setup.

src/contracts/src/Routing/BindingRegistrar.php

UrlGenerator.phpAnnotate URL generator contract +2/-0

Annotate URL generator contract

• Adds lifecycle metadata to shared URL configuration.

src/contracts/src/Routing/UrlGenerator.php

ProcessInterface.phpAnnotate server process contract +2/-0

Annotate server process contract

• Adds lifecycle metadata to process setup.

src/contracts/src/ServerProcess/ProcessInterface.php

Session.phpAnnotate session contract +2/-0

Annotate session contract

• Adds lifecycle metadata matching session implementation.

src/contracts/src/Session/Session.php

Loader.phpAnnotate translation loader contract +5/-0

Annotate translation loader contract

• Marks persistent translation registration.

src/contracts/src/Translation/Loader.php

Translator.phpAnnotate translator contract +5/-3

Annotate translator contract

• Replaces prose warnings with method metadata.

src/contracts/src/Translation/Translator.php

Factory.phpAnnotate validation contract +4/-0

Annotate validation contract

• Marks persistent validator registration.

src/contracts/src/Validation/Factory.php

Factory.phpAnnotate view contract +4/-0

Annotate view contract

• Marks persistent view configuration.

src/contracts/src/View/Factory.php

CookieJar.phpAnnotate cookie jar configuration +3/-1

Annotate cookie jar configuration

• Marks shared-instance mutation.

src/cookie/src/CookieJar.php

EncryptCookies.phpAnnotate cookie encryption setup +10/-6

Annotate cookie encryption setup

• Marks persistent middleware configuration.

src/cookie/src/Middleware/EncryptCookies.php

StdoutLogger.phpAnnotate stdout logger setup +4/-2

Annotate stdout logger setup

• Replaces lifecycle prose with method metadata.

src/core/src/Logger/StdoutLogger.php

Coroutine.phpAnnotate coroutine configuration +10/-7

Annotate coroutine configuration

• Marks persistent coroutine hooks and configuration.

src/coroutine/src/Coroutine.php

AnyOf.phpMark unsupported validation call +2/-0

Mark unsupported validation call

• Annotates a retained always-throwing method.

src/data/src/Attributes/Validation/AnyOf.php

Can.phpMark unsupported validation call +2/-0

Mark unsupported validation call

• Annotates a retained always-throwing method.

src/data/src/Attributes/Validation/Can.php

Password.phpMark unsupported validation call +2/-0

Mark unsupported validation call

• Annotates a retained always-throwing method.

src/data/src/Attributes/Validation/Password.php

PaginatedDataCollectable.phpMark unsupported pagination call +2/-0

Mark unsupported pagination call

• Annotates a retained always-throwing method.

src/data/src/Concerns/PaginatedDataCollectable.php

DataConfig.phpAnnotate data configuration +4/-2

Annotate data configuration

• Marks persistent data configuration changes.

src/data/src/Support/DataConfig.php

Manager.phpAnnotate capsule setup +5/-0

Annotate capsule setup

• Marks persistent database container configuration.

src/database/src/Capsule/Manager.php

Connection.phpAnnotate connection configuration +26/-6

Annotate connection configuration

• Marks shared connection setters and lifecycle-sensitive operations.

src/database/src/Connection.php

ConnectionFactory.phpAnnotate connection factory setup +9/-5

Annotate connection factory setup

• Marks persistent connection creation configuration.

src/database/src/Connectors/ConnectionFactory.php

DatabaseCliManager.phpAnnotate database CLI setup +5/-2

Annotate database CLI setup

• Marks persistent CLI configuration.

src/database/src/DatabaseCliManager.php

DatabaseManager.phpAnnotate database manager setup +31/-18

Annotate database manager setup

• Marks shared connection registration and configuration.

src/database/src/DatabaseManager.php

DatabaseTransactionsManager.phpAnnotate transaction manager setup +10/-6

Annotate transaction manager setup

• Replaces lifecycle prose with attributes.

src/database/src/DatabaseTransactionsManager.php

Json.phpAnnotate JSON cast configuration +8/-4

Annotate JSON cast configuration

• Marks persistent cast configuration.

src/database/src/Eloquent/Casts/Json.php

HasAttributes.phpAnnotate Eloquent attribute configuration +6/-4

Annotate Eloquent attribute configuration

• Replaces prose restrictions with metadata.

src/database/src/Eloquent/Concerns/HasAttributes.php

HasEvents.phpClassify Eloquent event registration +55/-39

Classify Eloquent event registration

• Annotates persistent listeners while leaving stable lazy boot hooks unrestricted.

src/database/src/Eloquent/Concerns/HasEvents.php

HasGlobalScopes.phpAnnotate global scope registration +12/-8

Annotate global scope registration

• Marks persistent Eloquent scope mutation.

src/database/src/Eloquent/Concerns/HasGlobalScopes.php

HasRelationships.phpAnnotate relationship configuration +5/-3

Annotate relationship configuration

• Marks persistent relationship resolver changes.

src/database/src/Eloquent/Concerns/HasRelationships.php

Factory.phpAnnotate model factory setup +16/-11

Annotate model factory setup

• Distinguishes shared or static factory configuration.

src/database/src/Eloquent/Factories/Factory.php

Model.phpAnnotate model-wide configuration +39/-27

Annotate model-wide configuration

• Marks persistent model callbacks and global behavior.

src/database/src/Eloquent/Model.php

Relation.phpCondition morph-map restriction +10/-7

Condition morph-map restriction

• Marks map-setting calls as boot-only while preserving unrestricted reads.

src/database/src/Eloquent/Relations/Relation.php

SoftDeletes.phpAnnotate soft-delete hooks +21/-0

Annotate soft-delete hooks

• Marks persistent Eloquent event registration.

src/database/src/Eloquent/SoftDeletes.php

MigrationCreator.phpAnnotate migration creator setup +4/-2

Annotate migration creator setup

• Marks persistent configuration.

src/database/src/Migrations/MigrationCreator.php

Migrator.phpAnnotate migrator setup +10/-5

Annotate migrator setup

• Marks persistent migration configuration.

<a href='https://github.com/hypervel/components-backup/pull/104/files#diff-3ccdff302eb007...

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. View extensions lose their boot warning ✓ Resolved
Description
Factory::addExtension() loses its Boot-only docblock tag without receiving a lifetime attribute,
although it changes the factory’s extension mappings and can register an engine resolver. When the
shared view factory is configured during a request, those changes affect later requests, while the
method no longer carries the machine-readable restriction used elsewhere in this conversion.

Grey Divider

Tip of the day
💡 Did you know, you can open the rule or relationship behind a finding in one click

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@greptile-apps

greptile-apps Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[High impact] The latest cleanup fix looks safe to merge; the earlier cache-clone memory growth remains non-blocking.

Fix All in Claude CodeFindings

  1. P2 Discarded cache clones retain memory ▶

Summary

Adds hypervel/attributes, replaces lifetime docblock tags, and updates PHPStan to read the markers. The PR also separates context keys by owning object and isolates cloned cache stores.

  • Method lifetime rules now use attributes that PHPStan can read.
  • Each container keeps its scoped state separate from other containers.
  • A replacement guard starts with its own cached user and credentials.
  • Cache managers and cloned caches keep their memoized state apart.
  • Redis connection keys now belong to their pool manager.
  • Queue callback removal and stream seeking now match their intended contracts.

Reviews (3) · Last reviewed commit: "Normalize numeric cache store names duri..." · Reviewed by Greptile

Comment thread src/container/src/Container.php Resolved
Make the PoolManager mock partial so RedisProxy can derive its instance-owned context keys while the test still controls pool borrowing. Preserve the existing assertions for command failures, event dispatch and connection release.
Copy tag sets onto the cloned store so flushing an array-backed tagged repository invalidates the copy without rotating tag identifiers in the original. Preserve concrete tag-set classes and their state without reconstructing their constructors.

Clone memoized tagged repositories through their delegate and reuse its store and tags. Clear the wrapper own memo before flushing because cloned wrappers are not registered with the memoized store. Cover independent writes, direct and fresh-tag reads after flush, and preservation of the original backing values.
Allow both boot configuration and test resets for the shared channel formatter and authorizer. Mark view extension registration when the factory is shared, retaining the explanation of its separate effect on the injected engine resolver.

Update the attributes plan to describe the final view restriction and tagged-cache clone ownership, and replace the completed reporting step with the remaining PR verification work.
Comment thread src/cache/src/CacheManager.php Resolved
Comment on lines +70 to +71
CoroutineContext::set($this->storageContextKey, $items);
CoroutineContext::set($this->locksContextKey, $records);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Discarded cache clones retain memory

ArrayStore::__clone() leaves two new context entries behind after every clone is discarded. Outside a coroutine, these entries live in the static nonCoroutineContext array, and the store has no cleanup path for them.

A long-running CLI loop that clones an array-backed repository now keeps growing this array. Modified copies also retain their cached values. Give discarded clones a way to release their entries without clearing unrelated context.

Knowledge Base Used: Cache, filesystem, and Redis storage

Fix in Claude Code Fix in Codex

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing this. Every array store already gets its own context entries when it's created, and the clone follows the same model, so it doesn't introduce a new kind of retention.

We haven't found a realistic flow where these entries build up. Console commands run in their own coroutine by default, so their context ends with the command. The framework never clones a cache repository, and the test harness clears context after every test. A destructor-based cleanup also couldn't reliably know which coroutine's context holds the entries, so it would add machinery without solving a real problem.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s fair. __clone() does leave new entries in nonCoroutineContext when cloning happens outside a coroutine, but given that the framework doesn’t clone cache repositories in normal operation, commands and tests have context cleanup boundaries, and a destructor cannot reliably identify the owning coroutine context, this isn’t an actionable leak in the flows described. I’ll withdraw the concern; no change is needed.

PHP converts numeric string configuration keys to integers, so names obtained from array_keys must be normalized before deriving string-based memo context keys. Preserve enum normalization and the existing public signatures.

Exercise both ordinary string names and numeric names from configuration in the memo invalidation test. Verify that forgetting either name rebuilds the memoized repository and its underlying store.
@binaryfire
binaryfire merged commit 1e4ca12 into 0.4 Nov 12, 2026
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant