A real audit of a real repo
Each finding below comes with the command we ran and what it printed. We ran them on a fresh clone of the commit named above, with PHP 8.4.26 and Composer 2.8.4. Output is copied from the run; a line cut short ends in "...". Run the commands yourself to check any line.
- Repository
- laravel-ga4-reader
- Commit
- f3fa933
- Audited
- 2026-11-16 19:44 UTC
Summary
| Can an agent... | Answer | Evidence |
|---|---|---|
| Install | Yes | composer install finishes in 3.8 s. |
| Test | Yes | composer test: 82 passed, 1.99 s. |
| Lint | Yes | composer lint passes (Laravel Pint). |
| Release | Not yet | A written procedure exists; no release has been cut (finding 4). |
| Change a report safely | Partly | The rules are written down, but the code that reads Google rows has no test (finding 1). |
| Avoid irreversible mistakes | Yes | The hook blocks a force-push to main and allows composer test. |
Findings, by impact
- 01
The code that reads Google’s response is not covered by any test
Every fake report in the suite answers with no rows, so the loops that read rows never run. A change that swaps two numbers passes. We swapped sessions and page views on line 236 of the reader and ran the whole suite: 82 passed. The change was then reverted.
$ grep -rnE "setRows|new Row|DimensionValue|MetricValue" tests (no output)$ php -d pcov.enabled=1 -d pcov.directory=. vendor/bin/pest --coverage GoogleAnalyticsTraffic ... 234..236, 261, 337..339, 366..367, 397, 370 / 93.4% Total: 91.2 %$ sed -i '236s/(int) \$v\[1\]->getValue(), (int) \$v\[2\]->getValue()/(int) $v[2]->getValue(), (int) $v[1]->getValue()/' src/GoogleAnalyticsTraffic.php && vendor/bin/pest | grep -E 'Tests:|FAIL' Tests: 82 passed (171 assertions)Fix: Add a test helper that answers each request with rows, then one test per field in
tests/Feature/ReportParsingTest.php. The repo’sadd-report-fieldskill already describes the helper. - 02
Supported versions are declared, not run
composer.json promises PHP 8.3 and later, and Laravel 12 or 13. This audit ran on PHP 8.4.26 and Laravel 13.42.0. The lowest set the constraints allow resolves to Laravel 12.0.1, Testbench 10.0.0 and Pest 3.8.0, which nothing has run. There is no CI configuration in the repo.
$ ls .github ls: cannot access '.github': No such file or directory$ composer update --prefer-lowest --prefer-stable --dry-run Downgrading laravel/framework (v13.42.0 => v12.0.1) Downgrading orchestra/testbench (v11.3.0 => v10.0.0) Downgrading pestphp/pest (v4.7.8 => v3.8.0)Fix: A two-job matrix: PHP 8.3 with
--prefer-lowest, and PHP 8.4 with the latest versions. Add it after the parsing tests, so it has something to catch. - 03
The Google client is pinned behind the latest (0.24.0 against 0.29.0)
Below version 1.0,
^0.24.0allows 0.24.x only. Apps that install this package cannot take newer Google client releases, even if they ask for them.$ composer outdated --direct google/analytics-data 0.24.0 ~ 0.29.0 Google Analytics Data Client for PHP pestphp/pest 4.7.8 ~ 5.3.7 The elegant PHP Testing Framework.$ composer why-not google/analytics-data 0.29.0 stea4lth/laravel-ga4-reader dev-main requires google/analytics-data (^0.24.0)Fix: Widen the range once finding 1’s tests exist, since a client upgrade is what those tests would catch.
- 04
The setup is merged but nothing has been released
The branch is one commit past the only tag, the repo has no GitHub release, and Packagist’s package metadata address returns 404. The README tells people to require
^0.1, which under Composer’s rules will never accept 0.2.0, so the README has to change with each minor release before 1.0.$ git describe --tags v0.1.0-1-gf3fa933$ gh release list -R stea4lth/laravel-ga4-reader (no output)$ curl -s -o /dev/null -w "%{http_code}" https://repo.packagist.org/p2/stea4lth/laravel-ga4-reader.json 404$ ls CHANGELOG.md ls: cannot access 'CHANGELOG.md': No such file or directoryFix: Cut v0.2.0 with the repo’s
releaseskill, which asks the maintainer before it tags, and register the package on Packagist. - 05
The coverage tool is installed but switched off in this setup
PHP’s PCOV extension is loaded but turned off here (
pcov.enabledis 0), so the obvious command fails. We did not check whether that is PHP’s default or this machine’s setting. An agent that does not know the flag cannot see the gap in finding 1.$ php -m | grep -iE "pcov|xdebug" pcov$ php --ri pcov | grep support; php -r 'var_dump(ini_get("pcov.enabled"));' PCOV support => Disabled string(1) "0"$ XDEBUG_MODE=coverage vendor/bin/pest --coverage ERROR No code coverage driver is available.Fix: A
composer coveragescript that passes-d pcov.enabled=1, and a line in CLAUDE.md saying so. - 06
Two pairs of methods with near-identical names
Two pairs of methods have near-identical names. Read both methods of a pair before changing one: a change to one, such as a date range, can miss the other.
$ grep -nE "function (reportTotals|totals|overTime|overTimeRange)\b" src/GoogleAnalyticsTraffic.php 220: private function reportTotals(string $start): array 248: private function overTimeRange(int $days): array 324: private function totals(): array 381: private function overTime(): arrayFix: Once finding 1’s tests are in place, check whether each pair can become one method with parameters.
- 07
A temporary credentials file is deleted on a test’s last line
The helper creates a temp file, and each test removes it on its final line. If an assertion fails first, the file stays behind.
$ grep -rn "tempnam\|unlink" tests | head -4 tests/Pest.php:15: $path = tempnam(sys_get_temp_dir(), 'ga-creds'); tests/Feature/OutageNegativeCacheTest.php:30: unlink($credentials); tests/Feature/OutageNegativeCacheTest.php:48: unlink($credentials); tests/Feature/OutageNegativeCacheTest.php:65: unlink($credentials);Fix: Delete the file in
afterEach. CLAUDE.md already asks new tests to do that.
What already works
A tidy package archive
$ git archive HEAD | tar -t LICENSE README.md composer.json config/ config/ga4-reader.php src/ src/Ga4ReaderServiceProvider.php src/GoogleAnalyticsTraffic.php src/SampleAnalytics.phpAgent files and tests stay out of what users download.
Key files are ignored
$ git check-ignore -v ga-service-account.json storage/app/google/ga-service-account.json credentials.json .env .gitignore:10:*service-account*.json ga-service-account.json .gitignore:12:/storage/ storage/app/google/ga-service-account.json .gitignore:11:credentials.json credentials.json .gitignore:5:.env .envAll four paths are ignored.
The safety hook refuses the risky command and allows the normal one
$ echo '{"tool_name":"Bash","tool_input":{"command":"git push --force origin main"}}' | php .claude/hooks/guard.php; echo "exit=$?" Blocked by .claude/hooks/guard.php: force-pushing `main` is refused: ... exit=2The same command with
composer testexits 0.
Test speed
Whole suite: 82 tests, 171 assertions, 1.99 s (composer test took 2.3 s on the wall clock). An agent can run all of it after every edit, which is the best case. Nothing to fix.
What this audit does not cover
It reads the repository and runs its own commands. It does not contact Google, so it says nothing about the live report numbers, and it does not review the package’s design choices. It is a snapshot of one commit, taken at the time above.
Before and after
The first audit of this repo, of version 0.1.0, found no agent context at all, no linter, no safety rails and unignored key files. The setup pull request fixed those; this audit is what remained afterwards.