Repository navigation
feat: plan 033 — privacy lookup index, cart lock on series start, Skipped runs for refused cart claims - #40
Merged
Merged
Conversation
… output and error
…s; erase and run deletes keep the index in sync
…e index with the old full scan
… series; each abandon without one fires with its kind
…fecycle checks count 8 tables
…he removed erase REGEXP
…lete order, D5 summary, no generated footer
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
This PR must ship before the WordPress.org submission.
run_emailstable plusruns.subject. At 200k runs a page takes about 4 ms instead of 5.5 s.Base:
develop9b31ca7. Schema change: DB 7 → 8 (newrun_emailstable,KEY subject (subject, status)onruns). No backfill: runs written before 033 aren't indexed, so export and erase can't find them. Staging: after deploy, run./run.sh reset-data --staging, thenseed, then./run.sh probe-mysql --staging. Tester sites: no reset; test only with emails never used on that site.One commit per checkpoint; CP3 and CP4 share one.
Checkpoints
run_emails(run_id, email; primary (run_id, email), index (email, run_id)) andKEY subjecton runs.Uninstaller::TABLESandreset-datalist the new table.RunStore::index_emails()runs increate,saveandcancel_waiting, and inRunStepStorestart,finish,close_openandcancel_waiting.replace_text()would replace, with the same boundaries.INSERT IGNORE … SELECTper write, selecting from runs or run_steps, so a missing run gets no row. A failure is logged and the write stands.about()is a UNION ofrun_emails(email + claim key) andruns.subject.for_exportkeeps OFFSET.anonymize()removes the person's rows, except for a run whose scrub failed or changed nothing.delete_with_steps()deletes steps, then runs, then index rows../run.sh bench-privacy(wp-env only) and./run.sh check-privacy-index(in check-all).dev/scripts/lib/privacy-old-scan.php.yaymatik_cart_abandoned( $cart_id, $kind )on every abandon of a cart with no series yet.CartStore::start_series()setsseries_at,abandoned_atandabandon_triggerin one UPDATE onseries_at IS NULL.Trigger::skip_reason(), null by default. On a refused claim with a reason, the Dispatcher records one finished skipped run per active workflow of that trigger.languages/yaymatik.potrebuilt.Bench (wp-env, MariaDB, PHP 8.1)
The measured shopper has 125 runs at 50k and 500 at 200k.
Side effects
yaymatik_cart_abandonedfires on every abandon, a cart already in a series included, not once per cycle, and gains$kind. It is experimental, like the other hooks.Tests
pnpm test:php(PHPUnit),pnpm lint:php../run.sh check-all --wp-envand--wp-env-min(check-privacy-index added).pnpm e2einmcr.microsoft.com/playwright:v1.64.1-nobleagainst wp-env: 11/11.developwith only this PR's e2e harness change: 11/11 too../run.sh probe-mysql --staging. Its erase-REGEXP part is replaced by the index SQL: the derived-table SELECT now, and the three lookups once staging is at DB 8. Run it again after the deploy and reset-data../run.sh bench-privacy --wp-env.WordPress.org review notes
RunStore::index_emails()takes$runs, a fixedSELECT … FROM %i WHERE id = %d-style fragment written inRunStore/RunStepStore, with its values passed separately.about()returns a fixed derived-table fragment the same way. As with$filterandSchema::in(), no value from a request or the database is written into the SQL text.Browser check for Jack (UI only)
0 Before you start
1 Setup
2 Steps
B1. Cart only
B2. Checkout only
B3. Both on
B4. Same cart again
B5. Privacy: export and erase
3 Results