Skip to content

IMP Report core dev mode repeated queries as info - #69

Merged
allrude merged 1 commit into
mainfrom
lane-1/debugbar-core-dev-sites
Nov 17, 2026
Merged

allrude merged 1 commit into
mainfrom
lane-1/debugbar-core-dev-sites

Conversation

@allrude

@allrude allrude commented Nov 17, 2026

Copy link
Copy Markdown
Member

Theme registration (Magento\Theme\Model\Theme\Plugin\Registration) repeats the same queries on every request in developer mode. The N+1 rule flagged this as a warning, although no shop code can fix it.

  • New Analysis/KnownQuerySources allowlist, matched by call frame method prefix. Shops can extend it through the di.xml sources argument.
  • RepeatedQueryRule moves repeats from known sources into a single query.known_source INFO finding. Real N+1 detection is unchanged.
  • Two new unit tests, CHANGELOG entry under Unreleased.

Checked on a dev shop: the Findings tab now shows only the theme registration INFO (4 queries, 26 executions).

@allrude

allrude commented Nov 17, 2026

Copy link
Copy Markdown
Member Author

Review at 597679f: PASS

Checked: head is 597679f, MERGEABLE, the CI run's headSha matches, PHP 8.2 to 8.5 and JS all green (no pending bucket). Diff is 4 files: new KnownQuerySources, RepeatedQueryRule, CHANGELOG, unit tests.

Logic: known source items are split off before analysis, so real N+1 detection only sees the remaining items and is unchanged. The new test proves both sides (theme registration becomes one INFO, a product N+1 still warns) and the below-threshold case stays silent. KnownQuerySources is autowirable, so the di.xml sources argument works, and the optional constructor arg keeps RepeatedQueryRule construction backward compatible. No dash punctuation in the changelog entry.

Notes, none blocking:

  1. A query is treated as known if any frame of its call site is in a known source. A shop observer that queries inside the theme registration chain would also be folded into the INFO. Acceptable for this source, worth knowing before more sources are added.
  2. A sources entry from di.xml without a call key would raise an undefined index notice in the constructor filter. Cheap to guard with ?? ''.
  3. CI was not confirmed to run phpstan or code style; I only verified the listed jobs.

@allrude
allrude merged commit 8f6e804 into main Nov 17, 2026
5 checks passed
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.

1 participant