fix(perf): drop unconditional debug logs from the MagicMapper hot path - #2323
Merged
Merged
Conversation
Second half of the runaway-log fix. Removing the two calls from isFileProperty() cut the rate from ~1 GB/min to ~0.7 GB/min — still enough to fill a disk mid-upgrade, because four more handlers log on every query. Sampled from a live log, the top writers were: MagicStatisticsHandler "Set critical metadata field" (per field, per row), MagicTableHandler "Table existence check: cache hit" (per query), and the MagicRbacHandler / MagicOrganizationHandler "CLI/system context" lines (per query, on the path every background job takes). The rule applied: a debug log that fires UNCONDITIONALLY on a hot path tells you nothing a single trace would not, while costing a line per call forever. A log that fires on an unusual branch is a real signal. So these go — cache hit, cache miss, CLI-context bypass, admin bypass, filter applied, org lookups returned, row converted, metadata field set, entity state. And these stay, all of them rare and all of them about a decision that matters: "Authorization unresolvable; clamping query to deny-all (fail-closed)" "Action not configured on a non-empty authorization block — failing closed" "No access conditions met, denying all" "Array operand for a scalar comparison operator — emitting an impossible predicate" "Could not determine the database platform — defaulting to MariaDB syntax" Nothing about RBAC or organisation ENFORCEMENT changes here; only whether the handler narrates itself on paths where the answer was never in doubt. phpcs and phpmd clean on lib/Db/MagicMapper; 1358 Db tests, 4308 assertions.
Contributor
Quality Report — ConductionNL/openregister @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ✅ | ||||
| phpmd | ✅ | ||||
| psalm | ✅ | ||||
| phpstan | ✅ | ||||
| phpmetrics | ✅ | ||||
| eslint | ✅ | ||||
| stylelint | ✅ | ||||
| build | ✅ | ||||
| composer | ✅ | ✅ 173/173 | |||
| npm | ✅ | ✅ 713/713 | |||
| PHPUnit | ✅ | ||||
| Newman | ✅ | ||||
| Playwright | ✅ |
Quality workflow — 2026-08-04 05:28 UTC
Download the full PDF report from the workflow artifacts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second half of the runaway-log fix (#2320 was the first).
Removing the two calls from
isFileProperty()cut the log rate from ~1 GB/min to ~0.7 GB/min — still enough to fill a disk mid-upgrade, because four more handlers log on every query.Sampled from a live log, the top writers were:
The rule applied: a debug log that fires unconditionally on a hot path tells you nothing a single trace would not, while costing a line per call forever. A log that fires on an unusual branch is a real signal.
Removed: cache hit, cache miss, CLI-context bypass, admin bypass, filter applied, org lookups returned, row converted, metadata field set, entity state.
Kept — every one rare, every one about a decision that matters:
Authorization unresolvable; clamping query to deny-all (fail-closed)Action not configured on a non-empty authorization block — failing closedNo access conditions met, denying allArray operand for a scalar comparison operator — emitting an impossible predicateCould not determine the database platform — defaulting to MariaDB syntaxNothing about RBAC or organisation enforcement changes; only whether the handler narrates itself on paths where the answer was never in doubt.
phpcs and phpmd clean on
lib/Db/MagicMapper; 1358 Db tests, 4308 assertions.