Skip to content

refactor(gh-21)!: conventional package layout, 80 tests, Larastan - #23

Merged
Nejcc merged 10 commits into
mainfrom
refactor/gh-21-package-structure
Oct 31, 2026
Merged

Nejcc merged 10 commits into
mainfrom
refactor/gh-21-package-structure

Conversation

@Nejcc

@Nejcc Nejcc commented Oct 31, 2026

Copy link
Copy Markdown
Member

Stacked on #20, which is stacked on #9. It retargets to main as those merge.

Package structure (#21)

  • src/Controllers, src/Middleware → src/Http/{Controllers,Middleware}. src/Commands → src/Console/Commands (Laravel package convention).
  • Migrations are publishable: vendor:publish --tag=digdeep-migrations. They keep the same filenames, so published copies replace the package ones instead of running twice.
  • composer.json gains keywords, homepage, support, authors, sort-packages and an analyse script.
  • Added SECURITY.md (private advisory reporting plus an app hardening checklist), CONTRIBUTING.md, CHANGELOG.md and .editorconfig. Dev-only files are export-ignored.
  • Larastan level 5 runs in CI. 43 existing typing issues are baselined; new code must be clean.

Tests (#22): 15 → 80 tests, 75% line coverage

Area Covered
Unit: QueryAnalyzer normalisation, N+1, SELECT *, missing/present indexes, hint types
Storage store/find, route visits, pruning, thresholds + ThresholdExceeded, filters, bulk tag/delete/clear, stats, size cap
Profiling middleware request/response/perf, queries+caller, cache/logs/http client, exceptions, ignored paths, sub-requests, debugbar only on HTML/non-AJAX, show_debugbar=false, dev fixtures
Dashboard all 14 pages, empty state, profile 404, log path traversal
API list, trigger, replay, tags/notes stripping, JSON + 3 HTML exports, bulk export/tag/delete, trends/performance/compare, delete/clear, AI 501
Commands digdeep:status, prune --keep, clear
MCP all 8 tools via laravel/mcp testing

The CI coverage job fails below 70%.

Bugs the new tests found (fixed here)

  • The profiler errored on non-Laravel responses. $response->exception ?? null read an undefined property on a plain Symfony or streamed response with status ≥ 400 (&& binds tighter than ??). Now uses isset() in all three places. The test fails on the old code.
  • digdeep:status crashed. It passed a float to twoColumnDetail() under strict_types.

Testing

  • composer test: 80 passed.
  • composer lint: clean.
  • composer analyse: no errors.
  • gitleaks: clean.

BREAKING CHANGE: the Controllers, Middleware and Commands namespaces moved under Http\ and Console\. Apps only reference DigDeep and config, and the package isn't on Packagist yet, so no aliases are kept.

Closes #21, closes #22.

Nejcc added 9 commits October 31, 2026 15:24
- run-command and ai-apply need code_actions (unset = local only); wider denylist
- debugbar injected only when DigDeep::check() passes
- session values and more auth headers redacted
- Js::from() in HTML exports and inline handlers; AI text escaped before markup
- CDN scripts pinned with SRI
- ai_model/ai_provider fall back to defaults when env is unset
- AI endpoints probe the laravel/ai trait instead of autoloading agents (501, not fatal)
- EXPLAIN uses the right syntax per driver

BREAKING CHANGE: outside local, run-command and ai-apply return 403 unless DIGDEEP_CODE_ACTIONS=true.

Closes #11, closes #12, closes #13, closes #14, closes #15, refs #7
One QueryAnalyzer::schema() replaces the duplicated sqlite_master/PRAGMA code
in the database page and the MCP AnalyzeQueries tool.

Closes #5
PHP 8.4/8.5 x Laravel 12/13. Covers the gate, CSRF, code actions, debugbar
gating, redaction, export XSS, AI defaults, schema and EXPLAIN.

Closes #6
…rations

- Controllers and Middleware -> src/Http, Commands -> src/Console/Commands
- digdeep-migrations publish tag
- fix: non-Laravel responses with status >= 400 no longer error in the profiler
- fix: digdeep:status crashed with a TypeError under strict_types

BREAKING CHANGE: LaravelPlus\DigDeep\{Controllers,Middleware,Commands} namespaces moved to Http\Controllers, Http\Middleware and Console\Commands.

Refs #21
…ommands, MCP

80 tests, 75% line coverage; CI fails under 70%.

Closes #22
@Nejcc Nejcc added the breaking label Oct 31, 2026
@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 58 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fa84a28b-8799-4d30-a832-916b0cab3da4
Commits

Reviewing files that changed from the base of the PR and between 75dbd0c and e5b8401.

Files selected for processing: 28
  • .editorconfig
  • .gitattributes
  • .github/workflows/tests.yml
  • CHANGELOG.md
  • CONTRIBUTING.md
  • README.md
  • SECURITY.md
  • composer.json
  • phpstan-baseline.neon
  • phpstan.neon.dist
  • phpunit.xml
  • routes/web.php
  • src/Console/Commands/ClearCommand.php
  • src/Console/Commands/PruneCommand.php
  • src/Console/Commands/StatusCommand.php
  • src/DigDeepServiceProvider.php
  • src/Http/Controllers/ApiController.php
  • src/Http/Controllers/DashboardController.php
  • src/Http/Middleware/Authorize.php
  • src/Http/Middleware/ProfileRequest.php
  • tests/Feature/ApiTest.php
  • tests/Feature/CommandsTest.php
  • tests/Feature/DashboardTest.php
  • tests/Feature/McpTest.php
  • tests/Feature/ProfilingTest.php
  • tests/Feature/StorageTest.php
  • tests/TestCase.php
  • tests/Unit/QueryAnalyzerTest.php
  • 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

@Nejcc
Nejcc changed the base branch from fix/prod-hardening to main October 31, 2026 14:59
@gitguardian

gitguardian Bot commented Oct 31, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
39354595 Triggered Laravel APP_KEY 7baa676 phpunit.xml View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@Nejcc
Nejcc merged commit f2ebd9d into main Oct 31, 2026
8 of 9 checks passed
@Nejcc
Nejcc deleted the refactor/gh-21-package-structure branch November 2, 2026 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test coverage for controllers, storage, collectors, analyzer, commands and MCP Adopt conventional Laravel package layout and metadata

1 participant