Fix config-path defaults + implement baseline config-drift detection (plus CI & LICENSE) - #1
Merged
Merged
Conversation
…t detection Empty or non-string `baseline`/`cache` config values previously collapsed to the project root directory instead of the documented defaults, silently breaking baseline load/write. They now fall back to the defaults. The baseline already stored an include/exclude fingerprint under `config.hash`, but nothing ever read it, so the README's "helps catch accidental config drift" was unimplemented. The fingerprint is now centralised on BladeCoverageConfig, read back via BladeCoverageBaseline::loadConfigHash(), and a non-failing warning is emitted on a normal run when the current config no longer matches the fingerprint stored in the baseline. Legacy path-to-hash baselines are unaffected. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Runs the Pest suite across PHP 8.3/8.4 with prefer-lowest and prefer-stable dependencies, plus a Pint style check. Co-Authored-By: Claude Opus 4.8 <[email protected]>
composer.json declares the MIT license but no LICENSE file was present. Co-Authored-By: Claude Opus 4.8 <[email protected]>
The org requires all GitHub Actions to be pinned to a full-length commit SHA; tag refs (@v4, @v2) were rejected at job setup. Pin actions/checkout to v4.3.1 and shivammathur/setup-php to v2.37.1 by SHA, with version comments. Co-Authored-By: Claude Opus 4.8 <[email protected]>
The 'records blade views rendered through Laravel view assertions' test calls $this->view(), which newer Testbench exposes on its base TestCase but the lowest-pinned version (Laravel 11.0 / Testbench 9.0) does not — so the prefer-lowest CI matrix errored with 'Call to undefined method ...::view()'. Apply the InteractsWithViews trait explicitly so the helper is available regardless of the resolved Laravel/Testbench version. Co-Authored-By: Claude Opus 4.8 <[email protected]>
actions/checkout v4 runs on the deprecated Node 20 runtime, which GitHub flags on every job (forced removal Sept 2026). v5.0.1 runs on Node 24. setup-php 2.37.1 is already on Node 24, so checkout was the only source of the warning. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Full review of the plugin. The core is well-structured and well-tested (the render-collector approach via a wildcard
View::composer('*'), the hash baseline, and the parallel-shard merge are all solid). This PR fixes two concrete issues I could verify, and adds two pieces of missing project infrastructure. Each is a separate, revertable commit.1.
fix(config)— config-path defaults + drift detectionBug: empty/non-string
baseline/cachecollapse to the project root.BladeCoverageConfig::stringValue()returned''for an empty string or any non-string value, and the?? 'default'chain only triggers onnull. So['baseline' => ''](or an array/int) resolved the baseline path to the project root directory:That silently breaks baseline load (
is_file()on a directory → empty baseline, every view treated as new) and write (file_put_contentson a directory → throws). Now non-empty-string values fall back to the documented defaults.Gap:
config.hashwas written but never read. The README says the baseline "stores metadata that helps catch accidental config drift," but nothing compared it — confirmed by grep, the key was write-only. This PR:BladeCoverageConfig::fingerprint()(single source of truth, used bywrite()),BladeCoverageBaseline::loadConfigHash()(tolerant of legacy path-to-hash baselines, which returnnull),Exit codes are unchanged; legacy baselines are unaffected.
2.
ci— GitHub Actions workflowThere was no CI. Added a matrix (PHP 8.3/8.4 × prefer-lowest/prefer-stable) running Pest, plus a Pint style check.
3.
docs— LICENSE filecomposer.jsondeclares MIT but noLICENSEfile existed. Added the standard MIT text.Testing
vendor/bin/pest— 19 passed (was 16; added 3 tests: default fallback, fingerprint round-trip/drift, legacy-baselineloadConfigHash).vendor/bin/pint --test— passes.Further observations (not changed here — happy to follow up if wanted)
--update-baseline: the report is built from the pre-update evaluation, so it can show"failed": truewithnewUncoveredentries immediately after a successful baseline refresh (the console output correctly suppresses this). A CI step consuming the JSON could misread it.scanRootsfootgun: an include pattern with no literal prefix (e.g.*/views/*.blade.php) yields an empty prefix and recursively scans the entire project root (incl.vendor/,node_modules/). Worth a guard or a documented warning.🤖 Generated with Claude Code