Wave B: per-action throttling with safety hardening#26
Merged
Conversation
1fec837 to
dbb4c59
Compare
Address the QA red flags raised on the initial Wave B per-action throttle: - Skip the action_scheduler_before_execute registration in test_observe so capability-probe mode does not pay per-action DB cost. - Refuse to defer recurring schedules. Cancelling a recurring instance breaks AS's recurrence chain, and re-rooting it at now+delay silently shifts the cadence (and for cron schedules can drop a tick entirely). - Cap deferrals per (hook, args, group) at 5 by default, filterable via hypercart_query_guard_max_defer_count, so a deferrable action under sustained critical load eventually runs instead of starving. - Guard ActionScheduler_Action::get_priority/set_priority with method_exists so sites on AS < 3.7 (older bundled WooCommerce) no longer fatal. - Log as_action_defer_failed on the save_action-returns-zero path, not just on exceptions. - Dedupe observe-mode as_action_deferred records by (hook, level) per request to bound log volume during sustained load. - Document the action_delay_matrix filter contract — override-existing-cells only; unknown levels and tiers are dropped; values clamp to non-negative integers. Tests: extend the bootstrap to load the main plugin file with both modes forced off so init() bails, and add ActionThrottleTest covering the matrix filter contract, get_action_delay_seconds boundaries, and the defer-count helpers. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
noelsaw1
added a commit
that referenced
this pull request
May 7, 2026
Move the original P1-PRIORITY-CC-AS planning doc from 1-INBOX to 3-DONE with a completion header mapping its phases to shipped waves: Phase 1 to Wave A (PR #25), Phase 2 to Wave B (PR #26), Phase 3 carved out into the new Wave C design doc. Add PROJECT/2-WORKING/P1-MUTEX-GUARD.md, the Wave C design for a third subsystem that prevents thundering-herd patterns by deduplicating concurrent invocations of the same operation. The doc captures storage decisions (wp_options + autoload no, atomic INSERT...ON DUPLICATE KEY UPDATE with PHP-anchored time, expires_at|nonce delimited value, md5 key hashing), the four-method API with reentrancy and TTL semantics, explicit caller patterns, contention-only logging defaults, and a phased rollout with checklists. Phase 1 ships the smallest thing that solves the NoFraud admin_init herd; Phase 2 is gated on production evidence. Drop empty placeholder files and the unused AGENTS-NAV-CMS.md as part of folder cleanup. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 tasks
7 tasks
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.
Summary
action_scheduler_before_executeusing a filterable load-level x priority-tier delay matrixNotes
dc464c0and1fec837) in the comparison tomain.Validation
php -l hypercart-query-guard.phpphp -l class-hcqg-load-monitor.phpphp -l class-hcqg-priority-registry.phpgit diff --check