Skip to content

fix(gh-16): register collector listeners once and reset state per request - #25

Merged
Nejcc merged 12 commits into
mainfrom
fix/gh-16-listen-once
Oct 31, 2026
Merged

Nejcc merged 12 commits into
mainfrom
fix/gh-16-listen-once

Conversation

@Nejcc

@Nejcc Nejcc commented Oct 31, 2026

Copy link
Copy Markdown
Member

Closes #16

Stacked on #24.

What

  • DigDeepCollector::startRequest() registers listeners on the first call only. Later calls copy a fresh instance's state into the collectors the listeners are bound to (one small resetFrom() helper, no per-collector reset methods).
  • Request, response, route, Inertia, AJAX and exception data are reset as well. Before, an exception from one request could show up in the next profile in worker mode.
  • QueryCollector takes its start time in the constructor so a reset updates it. Readonly is dropped on the LogCollector/LifecycleCollector timestamps for the same reason.

Checks

  • New test: two startRequest() calls leave the QueryExecuted listener count unchanged, and only the second request's data is reported. It fails on the old code.
  • composer test 90 passed, lint and analyse clean, gitleaks clean.

Nejcc added 11 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
…nd bodies

One Redactor (src/Support/Redactor.php) driven by config('digdeep.redact')
replaces three copies of key/header masking. It now also covers SQL
bindings (sensitive columns and hash-looking values), log context,
response bodies and outgoing HTTP client bodies. Response body capture
can be switched off with DIGDEEP_CAPTURE_RESPONSE_BODIES=false.

Closes #18
…uest

startRequest() created new collectors and re-registered every listener
on each call. In long-lived workers that piled up listeners and kept old
collectors alive. Listeners are now registered once; later requests copy
fresh state into the bound collectors. Request, response, route, Inertia
and exception data are reset too, so nothing leaks between requests.

Closes #16
@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

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: 1faf2597-4e8f-4247-8056-fd7f7df17c2f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • 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/gh-18-shared-redactor to main October 31, 2026 15:00
@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 567f932 into main Oct 31, 2026
8 of 9 checks passed
@Nejcc
Nejcc deleted the fix/gh-16-listen-once 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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Collector listeners re-registered on every request in long-lived workers

1 participant