Skip to content

Add Hypervel-owned test command#403

Merged
binaryfire merged 10 commits into
0.4from
feature/hypervel-owned-test-command
Jun 26, 2026
Merged

Add Hypervel-owned test command#403
binaryfire merged 10 commits into
0.4from
feature/hypervel-owned-test-command

Conversation

@binaryfire

@binaryfire binaryfire commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR adds a Hypervel-owned application test command and moves Testbench's package:test command onto the same shared runner.

The new command support lives in hypervel/testing and shells out to PHPUnit or ParaTest while preserving Hypervel's parallel-testing setup. It supports the documented app/package testing flags including coverage, minimum coverage thresholds, profiling, parallel database controls, parallel cache opt-out, and PHPUnit / ParaTest pass-through arguments.

What Changed

  • Added php artisan test via Hypervel\Testing\Console\TestCommand.
  • Added a shared TestCommandBase for application tests and Testbench package tests.
  • Added Hypervel-owned coverage reporting and profile reporting support without relying on Collision's PHPUnit printer.
  • Injected the profile PHPUnit extension into a temporary config file next to the original config so relative paths continue to resolve correctly.
  • Kept PHPUnit's native sequential output visible by avoiding the old Collision-specific --no-output suppression.
  • Added app bootstrap fallback for parallel test runs so ParaTest can boot an inferred Hypervel application and run ParallelTesting callbacks.
  • Updated Testbench's package:test command to reuse the shared command base and removed the old Collision fallback installer command.
  • Added --without-cache handling for parallel test runs.
  • Removed the console renderer's dependency on Collision's Laravel inspector adapter by adding a tiny Hypervel-owned CollisionInspector.
  • Updated Boost testing docs and removed the completed todo entry.

Performance And Architecture

  • The command work runs only when tests are invoked; it adds no runtime request overhead.
  • Parallel testing continues to use Hypervel's existing ParallelRunner, process callbacks, database isolation, and cache-prefix isolation.
  • The profile collector stores per-process data in temporary files keyed by process token and pid, then merges at command completion.
  • The command keeps Collision available only for console exception rendering when installed; test output now uses PHPUnit / ParaTest directly.

Verification

  • Ran focused PHPUnit coverage for the new command, profile, coverage, Testbench command, and console renderer paths.
  • Ran composer fix, including cs-fixer, phpstan, and test:parallel.
  • Claude reviewed the implementation through the Codesonic review loop and signed off.

Summary by CodeRabbit

  • New Features

    • Added/registered a new test command with support for parallel runs, coverage, and profiling, plus new cache-related options.
    • Improved Telescope and Horizon install commands to automatically publish required resources and set up providers/config reliably.
  • Bug Fixes

    • Enhanced console collision rendering by using a dedicated collision inspector when available.
    • Improved parallel test application resolution for more consistent parallel runs.
    • Updated install commands to return proper status codes and fail fast with clearer errors when publishing/registering resources fails.
  • Documentation

    • Updated testbench/testing docs to match the new package:test and --parallel setup, including new/removed CLI options.
  • Tests

    • Added/expanded test coverage for Horizon/Telescope installs and the new testing command behavior.

Add a Telescope installer command that publishes the provider stub, configuration, and migrations, registers the generated Telescope service provider in bootstrap/providers.php, rewrites the published provider namespace to the application namespace, and avoids republishing duplicate Telescope migrations.

Register the new command with Telescope's console commands and remove the completed todo entry from the Boost todo list.

Clean up Horizon's installer by removing the stale config/app.php fallback, using the same bootstrap providers registration path, correcting the docblock, and tightening publish task callbacks to strict boolean checks.

Add parallel-safe install command tests for Telescope and Horizon. The tests restore bootstrap/providers.php and remove published files so Testbench workers do not leak generated app state across tests.

Validation: ran focused Telescope and Horizon install command tests, then composer fix successfully, including cs-fixer, phpstan, and the parallel test suite. Claude reviewed and signed off.
Introduce a framework-owned Artisan test command for applications instead of relying on Collision's Laravel-oriented test command integration.

The shared command shells out to PHPUnit or ParaTest, manages Hypervel's parallel-testing environment flags, supports coverage thresholds, injects a temporary PHPUnit profile extension when requested, and preserves PHPUnit's native output for sequential runs.

This also adds the required testing package dependencies and registers the command from the testing service provider when running in console.
Teach the parallel runner to resolve the application from the inferred base path and bootstrap the console kernel when no custom application resolver has been provided.

This makes the app-facing test command usable with ParaTest while preserving Testbench's existing custom runner override for package tests.
Replace Testbench's Collision-backed package test command implementation with a small package-specific subclass of the shared Hypervel testing command.

The Testbench command now only owns package paths, package environment variables, visibility, and its package parallel runner while the common PHPUnit, ParaTest, coverage, profile, and argument handling lives in hypervel/testing.

This removes the fallback installer command because package tests now depend on Hypervel's own testing package instead of Collision.
Add a Hypervel-owned Collision inspector and use it from the console error renderer instead of importing Collision's Laravel adapter.

The new inspector preserves the existing trace behavior while removing an unnecessary cross-framework reference from Hypervel's console package.
Add regression coverage for the new app-facing test command, including native PHPUnit output, profile extension injection, relative PHPUnit config paths, command-owned argument filtering, coverage-data failures, provider registration, and parallel runner app bootstrapping.

These tests lock in the behavior that replaced the old Collision printer path and guard the Hypervel-specific ParaTest bootstrap integration.
Update Testbench's package test command tests for the shared Hypervel testing runner and remove the obsolete Collision fallback command coverage.

The refreshed tests assert package-root binary/config resolution, package environment variables, parallel cache flags, and direct registration of the package:test command.
Update the testing docs to describe the app skeleton's ParaTest support and document package:test without the old Collision dependency note or compact printer option.

The docs now include the parallel cache opt-out flag, and the completed app-facing test command todo is removed.
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@binaryfire, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 21 minutes and 14 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e86d794c-9666-435c-953d-d97e75bd5cd9

📥 Commits

Reviewing files that changed from the base of the PR and between f9ce966 and 94d0cc2.

📒 Files selected for processing (8)
  • AGENTS.md
  • src/horizon/src/Console/InstallCommand.php
  • src/telescope/src/Console/InstallCommand.php
  • src/testing/src/Console/TestCommandBase.php
  • tests/Horizon/Console/InstallCommandTest.php
  • tests/Telescope/Console/InstallCommandTest.php
  • tests/Testbench/Foundation/Console/TestCommandTest.php
  • tests/Testing/Console/TestCommandTest.php
📝 Walkthrough

Walkthrough

The PR adds a shared testing command stack with coverage and profiling support, refactors package:test onto that stack, and introduces Telescope and Horizon installer commands with updated bootstrapping, docs, and tests.

Changes

Testing stack and package:test migration

Layer / File(s) Summary
Command entry and wiring
composer.json, src/testing/composer.json, src/testing/src/Console/TestCommand.php, src/testing/src/TestingServiceProvider.php, src/testing/src/Concerns/RunsInParallel.php, src/boost/docs/testing.md, src/boost/todo.md, tests/Testing/TestingServiceProviderTest.php
ext-dom and hypervel/testing are added, test is registered, and the related docs and provider test are updated.
Runner, coverage, and profiling
src/testing/src/Console/TestCommandBase.php, src/testing/src/Coverage.php, src/testing/src/Profile/*, tests/Testing/Console/TestCommandTest.php, tests/Testing/CoverageTest.php, tests/Testing/ParallelRunnerTest.php, tests/Testing/Profile/ProfileTrackerTest.php
The shared test command base builds PHPUnit/ParaTest execution, coverage reporting, and profile collection, with tests covering the new runner, coverage failure path, parallel base-path resolution, and profile ordering.
package:test migration
src/console/src/CollisionInspector.php, src/console/src/ErrorRenderer.php, src/testbench/composer.json, src/testbench/src/Foundation/Console/*, src/testbench/src/TestbenchServiceProvider.php, src/boost/docs/testbench.md, tests/Testbench/Foundation/*
ErrorRenderer now uses CollisionInspector, and package:test is refactored onto the shared testing base with the fallback command removed and the docs/tests updated.

Installer commands

Layer / File(s) Summary
Telescope install flow
src/telescope/src/Console/InstallCommand.php, src/telescope/src/TelescopeServiceProvider.php, tests/Telescope/Console/InstallCommandTest.php
telescope:install publishes provider, config, and migrations, registers the provider in bootstrap, rewrites the generated namespace, and is covered by install and republish tests.
Horizon install flow
src/horizon/src/Console/InstallCommand.php, tests/Horizon/Console/InstallCommandTest.php
horizon:install now uses strict publish checks and unconditionally writes the Horizon provider into the bootstrap providers file, with tests covering the generated files.

Sequence Diagram(s)

sequenceDiagram
  participant InstallCommand
  participant vendorPublish as vendor:publish
  participant addProviderToBootstrapFile as ServiceProvider::addProviderToBootstrapFile
  participant TelescopeServiceProviderFile as TelescopeServiceProvider.php
  InstallCommand->>vendorPublish: publish provider, config, and migrations
  InstallCommand->>addProviderToBootstrapFile: register ...\\Providers\\TelescopeServiceProvider
  InstallCommand->>TelescopeServiceProviderFile: replace namespace App\\Providers
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~90+ minutes

Poem

I thump through tests with tiny feet,
and profile hops keep pace in beat.
I nibble docs and hop the path,
while installs bloom in console math.
🐰✨ The burrow hums with code tonight.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.39% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the primary change: adding Hypervel-owned test command support.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/hypervel-owned-test-command

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

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Jun 26, 2026

Copy link
Copy Markdown

Greptile Summary

This PR introduces a Hypervel-owned php artisan test command and consolidates the testbench package:test command onto a shared TestCommandBase, replacing the previous Collision-dependent implementation with a self-contained PHPUnit/ParaTest runner that supports coverage, profiling, and parallel testing.

  • TestCommandBase: new 603-line shared base handling argv filtering, profile PHPUnit extension injection into a temp XML config, coverage reporting via SebastianBergmann\\CodeCoverage\\Report\\Facade, and per-process profile aggregation through a ProfileTracker + PHPUnit event subscribers.
  • Horizon/Telescope install commands: refactored with fail-fast exit codes, proper file-existence guards before string replacement, and removal of the legacy config/app.php fallback in favour of always using bootstrap/providers.php.
  • RunsInParallel: adds a bootstrap/app.php fallback for parallel worker application resolution so ParaTest workers can boot a Hypervel app without a custom resolver.

Confidence Score: 5/5

Safe to merge; all logic paths are exercised by tests and the previously raised --profile filtering regression has been addressed.

The core argument-filtering, profile extension injection, coverage reporting, and parallel bootstrap fallback all work correctly. The two findings are a temp-file cleanup gap on non-SIGINT signals and a wrong @var annotation, neither of which affects runtime correctness.

src/testing/src/Console/TestCommandBase.php - the two nested try/finally blocks leave coverage and profile temp files behind when a non-SIGINT signal is received.

Important Files Changed

Filename Overview
src/testing/src/Console/TestCommandBase.php New 603-line shared base for application and package test commands; handles argv slicing, PHPUnit/ParaTest argument filtering, profile extension injection into a temp XML config, and coverage reporting. Minor cleanup gap: coverage file and profile directory are not removed when a non-SIGINT signal kills the subprocess.
src/testing/src/Console/TestCommand.php New thin php artisan test command that delegates entirely to TestCommandBase. Declaration looks correct.
src/testing/src/Coverage.php New Hypervel-owned coverage reporter; wraps SebastianBergmann's Report Facade. The @var array<string, mixed> annotation on the required coverage file is wrong - the actual value is a serialised string consumed by fromSerializedData().
src/testbench/src/Foundation/Console/TestCommand.php Heavily simplified by delegating all command logic to TestCommandBase; overrides basePath, parallelRunner, and baseEnvironmentVariables cleanly.
src/horizon/src/Console/InstallCommand.php Refactored to return int exit codes and fail-fast on each step. Guards against missing/unreadable provider files before rewriting them. Drops the legacy config/app.php fallback.
src/telescope/src/Console/InstallCommand.php New Telescope install command mirroring the updated Horizon pattern; includes migration-skip detection and the same fail-fast provider registration logic.
src/testing/src/Concerns/RunsInParallel.php Adds a bootstrap/app.php fallback for parallel-test workers when no custom applicationResolver is set; correctly requires the file once per forEachProcess iteration and flushes each application instance afterward.
src/console/src/CollisionInspector.php Thin Whoops Inspector subclass that uses native exception traces rather than Collision's Laravel adapter.
src/testing/src/Profile/ProfileTracker.php In-process slow-test collector; maintains a sorted top-10 list per parallel worker. Logic is straightforward and correct.
src/testing/src/Profile/ExecutionFinishedSubscriber.php Writes per-process profile JSON keyed by TEST_TOKEN + PID; handles directory creation and is safe across parallel workers.

Reviews (3): Last reviewed commit: "fix(testing): close test command review ..." | Re-trigger Greptile

Comment thread src/testing/src/Console/TestCommandBase.php
Comment thread src/testing/src/Console/TestCommandBase.php
Comment thread src/telescope/src/Console/InstallCommand.php Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 10

🧹 Nitpick comments (1)
tests/Testing/TestingServiceProviderTest.php (1)

57-64: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add the missing : void return type to the new test method.

Line 57 introduces a new test without the required explicit return type. As per coding guidelines, add : void return types to test methods.

Suggested change
-    public function testRegistersApplicationTestCommand()
+    public function testRegistersApplicationTestCommand(): void
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/Testing/TestingServiceProviderTest.php` around lines 57 - 64, The new
test method testRegistersApplicationTestCommand is missing the required explicit
return type. Update this test method in TestingServiceProviderTest to declare :
void, matching the project’s test method signature conventions and keeping the
PHPUnit test class consistent.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/console/src/CollisionInspector.php`:
- Around line 8-10: The CollisionInspector class extends
Whoops\Exception\Inspector, but the console package manifest does not declare
the needed dependency. Update the require section in src/console/composer.json
to add the direct dependency used by CollisionInspector (prefer filp/whoops, or
the matching package if you choose to depend on nunomaduro/collision), so
subtree-split and standalone installs resolve it correctly.

In `@src/horizon/src/Console/InstallCommand.php`:
- Line 49: The Horizon install flow is ignoring a failed bootstrap provider
registration, so update the Console InstallCommand path that calls
ServiceProvider::addProviderToBootstrapFile to check its return value and handle
a false result explicitly. If bootstrap/providers.php is missing, stop the
install from reporting success and surface an appropriate failure path instead
of continuing as if Horizon was registered. Use the InstallCommand and
ServiceProvider::addProviderToBootstrapFile symbols to locate the fix.

In `@src/telescope/src/Console/InstallCommand.php`:
- Around line 33-42: The install flow in InstallCommand should stop on scaffold
failures instead of always reporting success. Update the logic around the
vendor:publish task and registerTelescopeServiceProvider() so a failed
telescope-provider publish, a missing bootstrap/providers.php, or a false return
from ServiceProvider::addProviderToBootstrapFile() causes the command to abort
and report failure. Also make the TelescopeServiceProvider file read/write path
in registerTelescopeServiceProvider() fail fast when the provider stub cannot be
read.

In `@src/testing/src/Console/TestCommandBase.php`:
- Around line 473-475: Reset the cached temporary configuration/profile paths
after cleanup so reused command instances don’t return deleted paths. In
TestCommandBase, update the cleanup flow that removes the temp XML and profile
directory to also clear the corresponding cached properties, and make the
path-returning logic reinitialize only when the cached value is still valid.
Check the methods that create and reuse these paths, including the
temporaryConfigurationFile accessor and the cleanup code around handle() and
profile cleanup.
- Around line 232-236: The child process is still ignoring the requested
environment because TestCommandBase::filterForwardedArguments strips --env and
the code path around TestCommandBase::setEnvironment still forces APP_ENV to
testing. Update the forwarding logic so --env is preserved and passed through to
PHPUnit/ParaTest, and adjust the environment setup so it only defaults to
testing when no explicit env was provided, using the existing
filterForwardedArguments and environment-handling code paths.
- Around line 264-267: The ArgvInput setup in TestCommandBase::run is missing an
argv[0] placeholder, so the first real option can be parsed as the script name
and lost. Update the $arguments passed into new ArgvInput so it begins with a
dummy executable name before the actual flags, then keep using
Options::setInputDefinition and Options::fromConsoleInput as-is to preserve
correct option parsing.

In `@src/testing/src/Profile/ExecutionFinishedSubscriber.php`:
- Around line 32-34: The profile directory creation in
ExecutionFinishedSubscriber is not race-safe because concurrent workers can pass
the is_dir check and then collide on mkdir. Update the directory setup logic so
mkdir handles the “already exists” case safely, either by suppressing or
checking the failure and treating an existing directory as success, and keep the
behavior localized to the directory creation block in
ExecutionFinishedSubscriber.

In `@tests/Horizon/Console/InstallCommandTest.php`:
- Around line 39-41: The cleanup in InstallCommandTest is deleting existing
published files unconditionally, which can permanently remove pre-existing
config/horizon.php or app/Providers/HorizonServiceProvider.php from the test
app. Update the test setup/teardown around publishedFiles() and the installer
flow to back up and restore those specific paths the same way the providers file
is handled, or otherwise isolate the install run to a disposable app location so
existing files are preserved.

In `@tests/Testing/Console/TestCommandTest.php`:
- Around line 40-42: The shared cleanup path is leaving the cached temporary
configuration file path intact, so a second profiled run on the same command
instance can reuse a deleted configuration file. Update the base cleanup in the
command class (the one exposing cleanupTemporaryConfigurationFile()) to clear
the cached path after unlinking, and add a regression test in TestCommandTest
that invokes cleanupTemporaryConfigurationFilePublic() followed by another
--profile run on the same command instance to verify it no longer forwards a
stale --configuration value.

In `@tests/Testing/ParallelRunnerTest.php`:
- Around line 21-34: The ParallelRunnerTest setup is missing cleanup for shared
runner state, which can make createApplication() depend on prior tests via
RunsInParallel resolver slots. Update the test’s setUp() and tearDown() to call
ParallelRunner::flushState() alongside the existing APP_BASE_PATH handling so
the base-path inference path stays isolated and order-independent.

---

Nitpick comments:
In `@tests/Testing/TestingServiceProviderTest.php`:
- Around line 57-64: The new test method testRegistersApplicationTestCommand is
missing the required explicit return type. Update this test method in
TestingServiceProviderTest to declare : void, matching the project’s test method
signature conventions and keeping the PHPUnit test class consistent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 83e15469-b2fd-4f69-a227-0f5831817662

📥 Commits

Reviewing files that changed from the base of the PR and between ac9bc8d and 71763da.

📒 Files selected for processing (34)
  • composer.json
  • src/boost/docs/testbench.md
  • src/boost/docs/testing.md
  • src/boost/todo.md
  • src/console/src/CollisionInspector.php
  • src/console/src/ErrorRenderer.php
  • src/horizon/src/Console/InstallCommand.php
  • src/telescope/src/Console/InstallCommand.php
  • src/telescope/src/TelescopeServiceProvider.php
  • src/testbench/composer.json
  • src/testbench/src/Foundation/Console/TestCommand.php
  • src/testbench/src/Foundation/Console/TestFallbackCommand.php
  • src/testbench/src/TestbenchServiceProvider.php
  • src/testing/composer.json
  • src/testing/src/Concerns/RunsInParallel.php
  • src/testing/src/Console/TestCommand.php
  • src/testing/src/Console/TestCommandBase.php
  • src/testing/src/Coverage.php
  • src/testing/src/Profile/ExecutionFinishedSubscriber.php
  • src/testing/src/Profile/ProfileExtension.php
  • src/testing/src/Profile/ProfileTracker.php
  • src/testing/src/Profile/TestFinishedSubscriber.php
  • src/testing/src/Profile/TestPreparedSubscriber.php
  • src/testing/src/TestingServiceProvider.php
  • tests/Horizon/Console/InstallCommandTest.php
  • tests/Telescope/Console/InstallCommandTest.php
  • tests/Testbench/Foundation/Console/TestCommandTest.php
  • tests/Testbench/Foundation/Console/TestFallbackCommandTest.php
  • tests/Testbench/Foundation/TestbenchServiceProviderTest.php
  • tests/Testing/Console/TestCommandTest.php
  • tests/Testing/CoverageTest.php
  • tests/Testing/ParallelRunnerTest.php
  • tests/Testing/Profile/ProfileTrackerTest.php
  • tests/Testing/TestingServiceProviderTest.php
💤 Files with no reviewable changes (3)
  • src/testbench/src/Foundation/Console/TestFallbackCommand.php
  • tests/Testbench/Foundation/Console/TestFallbackCommandTest.php
  • src/boost/todo.md

Comment thread src/console/src/CollisionInspector.php
Comment thread src/horizon/src/Console/InstallCommand.php Outdated
Comment thread src/telescope/src/Console/InstallCommand.php Outdated
Comment thread src/testing/src/Console/TestCommandBase.php
Comment thread src/testing/src/Console/TestCommandBase.php
Comment thread src/testing/src/Console/TestCommandBase.php
Comment thread src/testing/src/Profile/ExecutionFinishedSubscriber.php Outdated
Comment thread tests/Horizon/Console/InstallCommandTest.php
Comment thread tests/Testing/Console/TestCommandTest.php
Comment thread tests/Testing/ParallelRunnerTest.php
Honor the application test command's env option by passing it through to child PHPUnit and ParaTest processes as APP_ENV while keeping the Artisan-only option out of forwarded arguments.

Strip Hypervel-owned profile flags before invoking ParaTest, parse ParaTest options with a proper argv placeholder, pre-create profile directories before child processes start, and reset temporary profile paths during cleanup so repeated command runs stay isolated.

Make Horizon and Telescope installers fail fast when publishing, provider registration, provider file loading, or namespace rewrites fail instead of reporting success after a partial install.

Mark Collision as an optional console suggestion instead of a hard dependency, and add regression coverage for argument filtering, env propagation, profile cleanup, ParaTest config parsing, installer failure paths, and test method typing.

Verification: composer fix.
@binaryfire

Copy link
Copy Markdown
Collaborator Author

CodeRabbit follow-up: addressed the accepted review findings in f9ce966, including env propagation, ParaTest argv parsing, profile cleanup, race-safe profile directory creation, installer fail-fast paths, and test method typing. The two declined suggestions were answered inline with the reviewed rationale. Verification passed with composer fix.

@binaryfire

Copy link
Copy Markdown
Collaborator Author

Greptile follow-up: fixed the reported --profile ParaTest filtering regression and the Telescope provider read/write failure path in f9ce966. The fix is stricter than the suggested early return: installer failures now return a non-zero exit code with clear messages. Verification passed with composer fix.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (4)
tests/Telescope/Console/InstallCommandTest.php (1)

140-160: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider a test-specific namespace for these helper subclasses.

As per coding guidelines ("When a test class defines helper classes, give it a test-specific namespace to avoid class redefinition conflicts"), declaring FailingTelescopeInstallCommand / MissingProviderTelescopeInstallCommand in the file's default namespace risks collisions as more installer tests adopt this pattern.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/Telescope/Console/InstallCommandTest.php` around lines 140 - 160, The
helper subclasses FailingTelescopeInstallCommand and
MissingProviderTelescopeInstallCommand are declared in the default namespace,
which can cause class redefinition conflicts across tests. Move these test-only
helper classes into a dedicated test namespace (or otherwise isolate them within
the Telescope install command test setup) and update the InstallCommandTest
references to use the namespaced versions so they remain unique and
discoverable.

Source: Coding guidelines

tests/Horizon/Console/InstallCommandTest.php (1)

115-135: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider a test-specific namespace for these helper subclasses.

As per coding guidelines ("When a test class defines helper classes, give it a test-specific namespace to avoid class redefinition conflicts"), FailingHorizonInstallCommand / MissingProviderHorizonInstallCommand would be safer in a test-scoped namespace.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/Horizon/Console/InstallCommandTest.php` around lines 115 - 135, The
helper subclasses FailingHorizonInstallCommand and
MissingProviderHorizonInstallCommand are defined in the test file’s global
namespace, which can cause class redefinition conflicts. Move these test-only
helper classes into a test-specific namespace or otherwise scope them under the
InstallCommandTest context so they remain isolated, and keep their callSilent
overrides unchanged.

Source: Coding guidelines

src/horizon/src/Console/InstallCommand.php (1)

67-83: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Validate the published provider file before mutating bootstrap/providers.php.

Same ordering concern as the Telescope command: addProviderToBootstrapFile() (Line 71) writes HorizonServiceProvider::class into bootstrap/providers.php before the existence check at Lines 79-83. On a missing provider file the command returns FAILURE but has already left the bootstrap file referencing a non-existent class. Move the file validation ahead of the bootstrap mutation.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/horizon/src/Console/InstallCommand.php` around lines 67 - 83, The
registerHorizonServiceProvider() flow mutates bootstrap/providers.php before
confirming the published HorizonServiceProvider file exists, so move the file
validation check ahead of the ServiceProvider::addProviderToBootstrapFile()
call. Keep the existing symbols registerHorizonServiceProvider(),
addProviderToBootstrapFile(), and the providerPath/file checks together so the
command only writes the provider entry after confirming the file is present and
readable.
src/telescope/src/Console/InstallCommand.php (1)

113-129: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Validate the published provider file before mutating bootstrap/providers.php.

addProviderToBootstrapFile() (Line 117) writes TelescopeServiceProvider::class into bootstrap/providers.php before the existence check at Lines 125-129. If the provider file is missing (the exact scenario MissingProviderTelescopeInstallCommand exercises), the command returns FAILURE but has already left bootstrap/providers.php referencing a class that does not exist, which will fatal on the next boot. Reorder so the file is validated first.

Proposed reorder
     protected function registerTelescopeServiceProvider(): bool
     {
         $namespace = Str::replaceLast('\\', '', $this->hypervel->getNamespace());
 
+        $providerPath = $this->hypervel->path('Providers/TelescopeServiceProvider.php');
+
+        if (! is_file($providerPath) || ! is_readable($providerPath)) {
+            $this->components->error('TelescopeServiceProvider file was not published.');
+
+            return false;
+        }
+
         if (! ServiceProvider::addProviderToBootstrapFile("{$namespace}\\Providers\\TelescopeServiceProvider")) {
             $this->components->error('Unable to register TelescopeServiceProvider in bootstrap/providers.php.');
 
             return false;
         }
 
-        $providerPath = $this->hypervel->path('Providers/TelescopeServiceProvider.php');
-
-        if (! is_file($providerPath) || ! is_readable($providerPath)) {
-            $this->components->error('TelescopeServiceProvider file was not published.');
-
-            return false;
-        }
-
         $contents = file_get_contents($providerPath);

Note: this would change the failure ordering asserted by the tests, so update the test expectations accordingly.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/telescope/src/Console/InstallCommand.php` around lines 113 - 129, The
registerTelescopeServiceProvider() flow mutates bootstrap/providers.php before
confirming the TelescopeServiceProvider file exists, which can leave a bad
provider reference behind on failure. In InstallCommand, move the provider path
validation for the published Providers/TelescopeServiceProvider.php ahead of
ServiceProvider::addProviderToBootstrapFile(), and keep the error/false return
paths intact so the bootstrap file is only updated after the file check passes.
Update any tests that assert the current failure order to match the new
validation-first behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/horizon/src/Console/InstallCommand.php`:
- Around line 67-83: The registerHorizonServiceProvider() flow mutates
bootstrap/providers.php before confirming the published HorizonServiceProvider
file exists, so move the file validation check ahead of the
ServiceProvider::addProviderToBootstrapFile() call. Keep the existing symbols
registerHorizonServiceProvider(), addProviderToBootstrapFile(), and the
providerPath/file checks together so the command only writes the provider entry
after confirming the file is present and readable.

In `@src/telescope/src/Console/InstallCommand.php`:
- Around line 113-129: The registerTelescopeServiceProvider() flow mutates
bootstrap/providers.php before confirming the TelescopeServiceProvider file
exists, which can leave a bad provider reference behind on failure. In
InstallCommand, move the provider path validation for the published
Providers/TelescopeServiceProvider.php ahead of
ServiceProvider::addProviderToBootstrapFile(), and keep the error/false return
paths intact so the bootstrap file is only updated after the file check passes.
Update any tests that assert the current failure order to match the new
validation-first behavior.

In `@tests/Horizon/Console/InstallCommandTest.php`:
- Around line 115-135: The helper subclasses FailingHorizonInstallCommand and
MissingProviderHorizonInstallCommand are defined in the test file’s global
namespace, which can cause class redefinition conflicts. Move these test-only
helper classes into a test-specific namespace or otherwise scope them under the
InstallCommandTest context so they remain isolated, and keep their callSilent
overrides unchanged.

In `@tests/Telescope/Console/InstallCommandTest.php`:
- Around line 140-160: The helper subclasses FailingTelescopeInstallCommand and
MissingProviderTelescopeInstallCommand are declared in the default namespace,
which can cause class redefinition conflicts across tests. Move these test-only
helper classes into a dedicated test namespace (or otherwise isolate them within
the Telescope install command test setup) and update the InstallCommandTest
references to use the namespaced versions so they remain unique and
discoverable.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2cda3978-d631-4785-95ed-66b6099c58a6

📥 Commits

Reviewing files that changed from the base of the PR and between 71763da and f9ce966.

📒 Files selected for processing (9)
  • src/console/composer.json
  • src/horizon/src/Console/InstallCommand.php
  • src/telescope/src/Console/InstallCommand.php
  • src/testing/src/Console/TestCommandBase.php
  • src/testing/src/Profile/ExecutionFinishedSubscriber.php
  • tests/Horizon/Console/InstallCommandTest.php
  • tests/Telescope/Console/InstallCommandTest.php
  • tests/Testing/Console/TestCommandTest.php
  • tests/Testing/TestingServiceProviderTest.php
🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/Testing/TestingServiceProviderTest.php
  • src/testing/src/Profile/ExecutionFinishedSubscriber.php

Comment thread src/testing/src/Console/TestCommandBase.php
Register Horizon and Telescope providers only after the generated provider file has been published, read, and rewritten for the application namespace. This prevents failed installs from leaving stale provider entries in bootstrap/providers.php and keeps reruns clean.

Strip parallel-only command flags from the sequential PHPUnit argument path so options like --drop-databases and --without-cache are consumed by Hypervel's test command instead of leaking to PHPUnit when --parallel is not active.

Add regression coverage for the installer failure paths and for app/package test command argument filtering. Clarify the AGENTS.md helper namespace rule so test-specific namespaces are reserved for generic collision-prone helper classes, not already-specific helper names.

Verification: composer fix (cs-fixer, phpstan, test:parallel). The run exited successfully; PHPUnit still reports existing risky ViewBladeCompilerTest interaction tests unrelated to this PR.
@binaryfire

Copy link
Copy Markdown
Collaborator Author

CodeRabbit follow-up: addressed the two accepted installer ordering findings and left the helper namespace suggestions declined after review.

Fixed in 94d0cc2:

  • horizon:install and telescope:install now validate/read/rewrite the published provider file before mutating bootstrap/providers.php, so failed provider publishing or namespace rewriting cannot leave stale bootstrap entries behind.
  • Added regression coverage confirming the provider class is not added on missing-provider failure.

Declined after review:

  • The Horizon/Telescope helper command classes already have feature-specific names (FailingHorizonInstallCommand, MissingProviderTelescopeInstallCommand, etc.) and are unique across the suite, so moving them into extra test-specific namespaces would add ceremony without reducing real collision risk.
  • AGENTS.md now clarifies that test-specific namespaces are for generic collision-prone helper names like User, Post, or Comment, not already-specific helper names.

Also fixed Greptile’s latest sequential PHPUnit flag leak in the same commit. Verification passed with composer fix; the run exits 0, with the existing unrelated ViewBladeCompilerTest risky-test notices unchanged.

@binaryfire binaryfire merged commit 351d123 into 0.4 Jun 26, 2026
35 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