test(project-engine-client): reusable live-vs-mock parity probe#1747
Open
rainer-friederich wants to merge 1 commit into
Open
test(project-engine-client): reusable live-vs-mock parity probe#1747rainer-friederich wants to merge 1 commit into
rainer-friederich wants to merge 1 commit into
Conversation
…1745) A token-gated drift detector that replays a canonical PE + User Manager request catalog against any origin (live Semrush gateway or a running Counterfact mock), normalises volatile ids/timestamps, and diffs two captures — splitting KNOWN/documented divergences (tagged fixed-in-1746 or intentional) from UNEXPECTED drift. Shape + behavioural-sentinel comparison so a differently-seeded mock does not flood the diff. The --mutate lifecycle is self-cleaning. Validated against live + the published mock image. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
1. Abstract
Adds a reusable, token-gated live-vs-mock parity probe (
scripts/parity-probe.mjs) for the Semrush Project Engine and User Manager gateways — a drift detector that replays one request catalog against any origin and diffs the captures. It is a dev tool underscripts/, outside the published surface.2. Reasoning
The mock-fidelity sweep behind adobe/spacecat-shared issue 1745 was a manual, one-off comparison of the Counterfact mocks against the live Semrush gateway. The findings need to stay true as the mocks change (the fixes land in PR 1746), so the comparison should be repeatable rather than re-done by hand each time.
3. High-level overview of the changes
Adds a single Node ESM CLI (no dependencies, no runtime/app behaviour change — it does not ship with the package; it lives in
scripts/, outside thesrc/+mock/coverage globs). Two modes:capture— replays a canonical PE + User Manager request catalog against any origin (the live Semrush gateway OR a running Counterfact mock), normalising volatile uuids/timestamps into a JSON capture.--mutateadds a self-cleaning create → publish → duplicate → delete lifecycle (it deletes exactly what it creates);--only pe|umrestricts to one gateway for a single-container mock;--insecureaccepts the mock's self-signed TLS.diff— compares two captures and splits KNOWN / documented divergences (a curated catalog, each taggedfixed-in-1746orintentionalwith a reason) from UNEXPECTED drift. Comparison is shape + behavioural-sentinel based (field presence/type plus a small set of value-bearing fields such aslanguage.name,publish_status,existing_count,initialized), so a mock seeded with different data than the live workspace does not flood the diff. It exits non-zero on unexpected drift, so it can gate a manual parity check.Going-forward use: after the 1746 mock bump,
capturelive + the new mock anddiff— the UNEXPECTED list is new drift to investigate; the KNOWN list is the documented-gap ledger.4. Required information
6. Additional information outside the code
Validated this session against the live Semrush prod gateway (
https://adobe-hackathon.semrush.com, IMS bearer) and the publishedghcr.io/adobe/spacecat-shared-project-engine-client-mock:1.3.1image (pulled and booted locally on:8443). Thediffcorrectly auto-classified every documented divergence from issue 1745 into the KNOWN section (thelanguage.name/country.name/publish_status/published_at/existing_count/ family-403 ones asfixed-in-1746; the500/403/init_status/ publish-content-type ones asintentional), and surfaced the broader read-view drift that 1746 closes in the UNEXPECTED section. The--mutatelifecycle left zero leaked projects on the live workspace (verified by listing the workspace afterward).7. Test plan
(a) Done this session: ran
captureagainst live + the published mock image anddiff-ed them; confirmed the KNOWN/UNEXPECTED split is correct and the--mutaterun self-cleaned.(b) To re-verify (manual, token-gated — not a CI job):
node scripts/parity-probe.mjs capture --only pe --base https://adobe-hackathon.semrush.com --token "$(mysticat auth token --ims)" --pe-ws <child-ws> --pe-project <published-project> --pe-unowned-ws <ws-you-do-not-own> --mutate --out live.jsonnpm run mockor the GHCR image), then... capture --only pe --base <mock-origin> --token dummy --insecure --mutate --out mock.jsonnode scripts/parity-probe.mjs diff live.json mock.json— expect the documented gaps under KNOWN and nothing genuinely new under UNEXPECTED.8. Deployment & merge order
Independent — no merge-order dependency. Related to PR #1746 (the mock fixes this tool measures); either can merge first.
🤖 Generated with Claude Code