Skip to content

Wave A: extract load monitor and add priority registry#25

Merged
noelsaw1 merged 2 commits into
mainfrom
wave-a-load-monitor-extraction
May 7, 2026
Merged

Wave A: extract load monitor and add priority registry#25
noelsaw1 merged 2 commits into
mainfrom
wave-a-load-monitor-extraction

Conversation

@noelsaw1
Copy link
Copy Markdown
Contributor

@noelsaw1 noelsaw1 commented May 6, 2026

Summary

  • extract Action Scheduler load probing, hysteresis, and cross-request state persistence into class-hcqg-load-monitor.php
  • add class-hcqg-priority-registry.php with a filterable default hook-to-tier map for future Wave B work
  • keep hypercart-query-guard.php as the bootstrap and throttle-control entrypoint
  • update docs for the multi-file MU-plugin layout introduced by the extraction

Scope

This is Wave A only. It is intended to preserve the Phase 1 throttle behavior already on main while making the codebase easier to extend for per-action throttling.

Notes

  • class-hcqg-priority-registry.php is intentionally inert in this PR; it is groundwork for Wave B.
  • The only user-visible change is deployment shape: the MU-plugin now consists of three PHP files instead of one.

Validation

  • php -l hypercart-query-guard.php
  • php -l class-hcqg-load-monitor.php
  • php -l class-hcqg-priority-registry.php
  • git diff --check

Lock the tier list to the four canonical constants in fixed order so
filters cannot add tiers or reorder them, and validate the
hypercart_query_guard_action_priority filter return against that list
instead of trusting any string that comes back. Document the
extend-vs-clear semantics on the registry filter so a clear must be
explicit (empty array) rather than implied by omission.

Add a no-WP-runtime PHPUnit suite covering both extracted classes —
pattern matching and tier semantics for the registry, and threshold
clamping, dwell, hysteresis exits, mixed-metric severity, the
no-detector failsafe, and round-trip persistence for the load monitor.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@noelsaw1 noelsaw1 merged commit 3acaccb into main May 7, 2026
@noelsaw1 noelsaw1 deleted the wave-a-load-monitor-extraction branch May 7, 2026 03:22
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>
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