Repository navigation
fix(cache): remove Woo Internal cache dependencies from runtime paths (#209) - #220
Draft
MrDarkRoot wants to merge 7 commits into
Draft
MrDarkRoot wants to merge 7 commits into
MrDarkRoot wants to merge 7 commits into
Conversation
Round-3 verification of PR #220 (issue #209). No production change: the transient unreadable_product_data retry was traced end to end and shown to re-run the full fenced precondition sequence before any save, with the durable journal PENDING state as the only retry gate. - docs/review/209/IMPLEMENTATION.md: recovery-semantics matrix (reason -> durable journal/item state -> retryable? -> guard), the seven required proofs with branch-HEAD citations, re-verification receipts, and the explicit founder-approval note for the transient retry divergence. - tests/durable/cache-public-integration.php: transient refusal leaves durable PENDING with zero saves; retry applies once; a concurrent edit between attempts wins as CONFLICT with zero overwrite. - tests/jobs/integration.php: killed worker between checkpoints recovers to APPLIED with one net price change; transient refusal at the job boundary returns to PENDING with backoff and the retry re-runs the precondition. - tests/jobs/worker.php: test-only public woocommerce_product_class fault knob used by those durable fixtures.
wc_delete_product_transients() can re-prime Woo's optional product- instance cache through the factory. Running it before clean_post_cache() left a stale instance behind, so later wc_get_product() calls skipped the product-class filter entirely (unreadable products mislabeled, stale picker data). clean_post_cache() now runs after the priming call so its public cache-clean hook evicts the instance last. Same targeted operations, no Internal dependencies, no global flush.
MrDarkRoot
added a commit
that referenced
this pull request
Oct 8, 2026
Cherry-picks 8ca98e4 (#220): run wc_delete_product_transients() before clean_post_cache() so the public cache-clean hook evicts Woo's optional product-instance cache last. Fixes unreadable-product labeling in Discovery (selection-integration) and stale wc_get_product reads. Verified locally: throwing class filter fires post-invalidate; #109 transient/persistent probes PASS. No #170 binding impact.
This branch has not been deployed
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.
Refs #209 — draft for code review only. Do not merge; founder GO/NO-GO pending.
Base:
c48e307efe7750d0fb36015c39d50a34675f9579· Round-2 head:7496874eb0b48989814234afb703d17a5563ace0· Round-3 head:029a08040da0fab06bfea2a8d174aeba3d72f2d4(docs/tests only)P0 review finding addressed — recovery semantics
The reviewed implementation classified every non-core resolved class as
unreadable_product_data, turning the previously terminal unsupported outcome into a retryable (PENDING) one. This fix restores the established terminal refusal and keeps transient read failures typed and conservatively retryable.Behavioral changes:
Product_Price_Snapshot::fresh_product()WC_Productsubclass outside the three exact core classes (WC_Product_Simple,WC_Product_Variation,WC_Product_Variable) →Price_Validation_Error('unsupported_product_type')(stable unsupported, terminal), never instantiated.WC_Productat all (e.g.stdClass) is a broken mapping, not a product type →unreadable_product_data(satisfies the requiredstdClass → unreadable_product_datacase).unreadable_product_dataalso covers missing WP/Woo functions/classes, suspended invalidation, non-string classname, constructor failure (the literal core constructors are now wrapped in try/catch), and constructor result mismatch.new $var; only the three literal core constructors (unchanged public-runtime audit).unsupported_product_type→ new$unsupported_typecollection (top-level andexpand_variable_parentschildren); everything else →$unreadable. Unsupported IDs are included in the finalMAX_SELECTEDcount and final frozen ID set, and becomeProduct_Price_Snapshot::unsupported_type()snapshots (exists=true,unreadable=false, no core identity/prices) soProduct_Price_Eligibilityyields the establishedunsupported_product_typereason. Unsupported children never drop silently from the frozen population.c48e307):unsupported_product_type→Price_Apply_Error('UNSUPPORTED_PRODUCT_STATE')→ durableFAILED(terminal) with zero write; any otherPrice_Validation_Erroris rethrown →FAILED→PENDING(retryable).unsupported_product_type→CACHE_VERIFICATION_FAILED, matching the pre-change exact-class comparison (NEEDS_REVIEW).Price_Cache_Verifier::sync_variable_parent(): additional restoration — a stable unsupported parent maps toCONFLICT, the pre-change exact-class outcome, so a concurrent parent type change can no longer demote CONFLICT to retryable. Transient read failures still rethrow.observe()/observe_variable_parent()continue to convert non-Price_Apply_ErrortoCACHE_VERIFICATION_FAILEDat their callers;product_observationcatch-all →Unavailable;variation_facts()parent read catch →null— unchanged.Files changed
wordpress/writeleash/includes/free/class-product-snapshot.php— classification +unsupported_type().wordpress/writeleash/includes/free/class-product-selector.php— unsupported collection, IDs and count.wordpress/writeleash/includes/free/class-woo-price-mutator.php— Apply mapping.wordpress/writeleash/includes/free/class-woo-undo-mutator.php— entry + recovery mapping.wordpress/writeleash/includes/free/class-price-cache-verifier.php— parent-sync CONFLICT restoration.wordpress/tests/free/cache-public.php— extension →unsupported_product_type; extension never constructed;stdClass/non-product and core constructor-result mismatch →unreadable_product_data; suspended/absent unchanged.wordpress/tests/free/variations.php— extension parent eligibility restored tounsupported_product_type; unsupported snapshotexists=true/unreadable=false; SKU admission filter now by eligibility with the byte-match assertion unchanged.wordpress/tests/durable/cache-public-integration.php— extension class mapping at Apply → terminalUNSUPPORTED_PRODUCT_STATE/durable FAILED with no write; non-product classname → retryable FAILED/durable PENDING; public-API-only fixture style.Test evidence
cache-public(73),unit(2,607),sale-price(105),variations(75),admin-audit,no-replan-audit,package-preflight,inventory-audit,public-audit-cases,readme-validate,historical-shim-cases,claim-matrix,source-audit,ownership --audit,dependency-audit,test-artifact, PHP/JS/shell lint,git diff --checkclean.fresh_productCRITICAL/11 direct callers,resolveLOW,expand_variable_parentsLOW,applyHIGH lower-bound — 1 production callerattempt_itemplus tests confirmed by text search,restoreHIGH,observe_undoHIGH,sync_variable_parentCRITICAL/2) before editing;detect-changes --scope alland--scope stagedcomplete (8 files / 22 symbols / 35 flows, risk critical, no partial/truncated), post-commit clean.Remaining blockers
pr-fast.shfails only at the unchanged WriteLeash Admin: real-browser accessibility and safety regression gate before RC #170 UI evidence gate (asset-audit.php): the UI source differs from the reviewed capture because the prior implementation commit touchedclass-free-admin.php. No evidence/assertion/fingerprint was edited.asset-audit-cases.phpfails identically at the pre-existing head (same gate).Support-claim impact
None.
WOOCOMMERCE_MIN 10.0.0/WOOCOMMERCE_MAX_EXCLUSIVE 12.0.0unchanged; no version-conditional branch added.Deviations requiring founder approval
None — the prior deviation (unsupported → unreadable / terminal → retryable) is resolved. Implementation notes, not approval-requiring: (1) non-
WC_Productresolved strings stayunreadable_product_datawhileWC_Productsubclasses are terminal, which is howstdClass → unreadableandextension → unsupportedare both satisfied; (2)sync_variable_parent()is an additional restoration site beyond the listed ones, required to keep the pre-change CONFLICT outcome.Integration / Problem B
No shipped
Internalreference including escaped strings, nonew $, nowc_get_container, no global cache flush; targeted invalidation only. Test-only residual:wordpress/tests/admin/integration.php:729still primes Woo's private cache to stage stale state (not shipped; deliberately untouched).Round-3 recovery-semantics evidence (
029a080)Round-3 is verification-only: no production code changed. New commit
029a08040da0fab06bfea2a8d174aeba3d72f2d4adds the recovery-semantics matrix and durable fixtures; branch is a fast-forward over7496874e….End-to-end traces and the required proofs
file:linecitations:docs/review/209/IMPLEMENTATION.md, section “Round-3 recovery-semantics evidence”.tests/durable/cache-public-integration.php:126-137(WC_Product_Externalmapped for the Apply read →UNSUPPORTED_PRODUCT_STATE/durableFAILED/zero write); planning-level terminal refusal cited atclass-product-selector.php:83-87,127-129.apply()whose first actions are the journal lock +PENDINGgate, storage row locks, targeted invalidation, frozenpreconditionMATCH, expected-price and sale/regular coherence, and re-authorization — the Woo save is last and shares the transaction (class-woo-price-mutator.php:76-150). New durable regressions:cache-public-integration.php:149-186(transient refusal → zero saves + durablePENDING; retry → one save; a concurrent edit between attempts →CONFLICT, zero overwrite) andtests/jobs/integration.php:516-558(job-levelPENDING/FAILED/attempt_count=1/RETRY_BACKOFF; retry re-runs the precondition and preserves the newer edit).$committed+FAILED ⇒ AMBIGUOUS_COMMIT(:174); failed rollback ⇒TRANSACTION_LOST(:175-177); both ⇒NEEDS_REVIEW(:179-194), which is terminal at item level (class-job-state.php:90) and never re-claimed (claim_next_itemPENDING-only).APPLIED⇒ALREADY_APPLIED, no second save (class-woo-price-mutator.php:80-85); job-row transactional fence + journal row lock + lease-generation CAS fence duplicate Resume. New job fixture: killed worker between checkpoints (AFTER_WOO_SAVE_BEFORE_JOURNAL,AFTER_JOURNAL_BEFORE_COMMIT) leaves durablePENDING/original price; recovery reconciles and applies once (tests/jobs/integration.php:485-514).CONFLICTterminal with zero write.UNDO_CONFLICTterminal,UNDO_NEEDS_REVIEWfor uncertainty, later edits/sale configuration preserved; interrupted Undo already covered attests/undo/integration.php:385-441.class-woo-price-mutator.php:164,class-woo-undo-mutator.php:228); target-equality without journal evidence isCONFLICT(durable/integration.php:232-235).Test deltas and executed checks
tests/durable/cache-public-integration.php+38 assertions;tests/jobs/integration.php+ interrupted-before-COMMIT recovery loop and transient-retry blocks;tests/jobs/worker.php+ test-only publicwoocommerce_product_classfault knob.php -lclean;git diff --checkclean.cache-public73,unit2607,sale-price105,variations75, admin-audit, no-replan-audit, ownership, dependency-audit, package-preflight, inventory-audit, public-audit, readme, historical-shim, claim-matrix, source-audit.029a080):detect-changes --scope alland--scope stagedcomplete (4 files / 10 symbols / 0 processes / risk low), post-commit clean.Remaining divergence + founder approval
The transient
unreadable_product_data→FAILED→ durablePENDINGretry remains a divergence from the pre-#209 terminal baseline. Round-3 proves it is not unsafe re-execution (rollback-before-retry, full precondition re-run, journal-gatedPENDING, 3-attempt budget) but it is not approved: explicit founder sign-off is still required. No production change was made to remove it.Blockers / NOT_TESTED
bash .github/ci/pr-fast.shfails only at the unchanged WriteLeash Admin: real-browser accessibility and safety regression gate before RC #170 UI source/capture fingerprint (21 PASS, thenasset-audit.php:6), exactly as before.docker infoexit 1, no/var/run/docker.sock): all new durable fixtures and the Docker battery (durable/,jobs/,undo/) are NOT_TESTED, not PASS. Receipts:evidence/pr-fix3/220/.Round 4 — real runtime acceptance (lead-run equivalent environment)
WordPress 7.1.2 + WooCommerce 11.1.2, pinned MySQL 8.0.44 / MariaDB 10.11.15, default + Redis 7.4.2:
#108durable cache/journal gate (kill-before/after COMMIT, rollback, retry, current-price): PASS, both engines × both caches (396 assertions in final matrix).#109jobs gate incl. interrupted workers, duplicate Resume fencing, deadlock stress, unicode: PASS, both engines × both caches (160 PASS lines; one load-induced isolated failure reproduced as PASS on clean re-run — both logs preserved).#110conflict-aware Undo gate incl. kill-after-COMMIT: PASS, both engines × both caches.unreadable_product_dataretry divergence remains and still requires explicit founder approval; runtime evidence confirms retries re-run full journal/precondition fences and never blind-overwrite.Round 5 — final verification (HOLD)
The Round-4 #109 deadlock-stress failure was reproduced in a fully isolated run (
final-merge-evidence/race/jobs-B4-isolated-FAIL.log) while other isolated and instrumented runs passed:actual [COMPLETED_WITH_ISSUES, NEEDS_REVIEW]vs expected[COMPLETED, COMPLETED_WITH_ISSUES]. Durable state shows the winner committedAPPLIED/WOO_CRUD_VERIFIEDthen its post-commitobserve()threwCACHE_VERIFICATION_FAILED(conservative, no overwrite; one save). No InnoDB deadlock; not load-attributable; instrumented attempts did not reproduce. Classification: FLAKY / UNRESOLVED. Recommendation: HOLD until hosted CI reproduction/attribution or founder acceptance. The transient-retry semantics decision also remains open.Round 6 — reproduced #109 defect fixed (root cause + regression)
Instrumented real-runtime evidence pinned the intermittent
different jobs same productfailure: after a verified commit (APPLIED / WOO_CRUD_VERIFIED, raw DB correct), the public Woo read could still serve the pre-write value from the in-processpost_metablob cache, so post-commit observation degraded toNEEDS_REVIEW / CACHE_VERIFICATION_FAILED(conservative: one save, no overwrite).Fix
c2e3f616:observe()keeps the independent storage-vs-journal comparison as authority and, on a public-read mismatch, evicts the targeted product caches (wp_cache_delete+wp_cache_delete_multiple+product_<id>group) and reconstructs the product exactly once; a persistent mismatch still fails closed.Regression:
tests/durable/cache-public-integration.phpR4 deterministically emulates the stale blob — unfixed bytes fail atclass-price-cache-verifier.php:268, fixed bytes pass (64 assertions, zero extra saves). Stability: the exact runner config that failed 5/5 pre-fix passed 2/2 full#109gates (two engines × default/Redis) post-fix.Evidence:
docs/review/parallel-20261008-handoff/round6-evidence/(traces, value-level diagnostics, before/after regression, runner PASS logs).Round-6 integrated validation: the rebuilt disposable candidate (
3b4ab5e, four PR heads) passes the full#109jobs gate and#108durable gate on MySQL + MariaDB × default + Redis, plus the local battery and PR_FAST (seeROUND-6-CORRECTNESS-REPORT.md).