Skip to content

Menu

WorkServicesClaude CodeRetainerHostingAboutContactConsulting (hourly)Claude Code setupSee the packages
// 01 — sample audit

A real audit of a real repo

laravel-ga4-reader is a small public Laravel package of ours. We set it up for Claude Code earlier (a merged pull request), then audited it again from a fresh clone. This is that second audit, so it shows what a repo that is already set up still gets wrong.

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
// 02 — summary

Summary

The package is in good shape for an agent to work in. It installs, tests and lints with one command each, the tests take about two seconds, and a safety hook refuses a force-push to the main branch.
What is left is the part that a green test run hides: no test reads the rows Google sends back, the supported Laravel and PHP versions are declared but never run, and nothing has been released since the setup landed.
Can an agent...
Can an agent...AnswerEvidence
InstallYescomposer install finishes in 3.8 s.
TestYescomposer test: 82 passed, 1.99 s.
LintYescomposer lint passes (Laravel Pint).
ReleaseNot yetA written procedure exists; no release has been cut (finding 4).
Change a report safelyPartlyThe rules are written down, but the code that reads Google rows has no test (finding 1).
Avoid irreversible mistakesYesThe hook blocks a force-push to main and allows composer test.
// 03 — findings

Findings, by impact

  1. 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’s add-report-field skill already describes the helper.

  2. 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.

  3. 03

    The Google client is pinned behind the latest (0.24.0 against 0.29.0)

    Below version 1.0, ^0.24.0 allows 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.

  4. 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 directory
                      

    Fix: Cut v0.2.0 with the repo’s release skill, which asks the maintainer before it tags, and register the package on Packagist.

  5. 05

    The coverage tool is installed but switched off in this setup

    PHP’s PCOV extension is loaded but turned off here (pcov.enabled is 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 coverage script that passes -d pcov.enabled=1, and a line in CLAUDE.md saying so.

  6. 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(): array
                      

    Fix: Once finding 1’s tests are in place, check whether each pair can become one method with parameters.

  7. 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.

// 04 — working

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.php
                    

    Agent 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	.env
                    

    All 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=2
                    

    The same command with composer test exits 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.

Want this for your repo?

The audit is a written report like this one, on your repository. The packages and prices are on the setup page.
See the packages