Skip to content

feat: track canonical Meta CompleteRegistration - #16

Draft
nicoechaniz wants to merge 9 commits into
feat/registration-v4from
feat/meta-complete-registration
Draft

feat: track canonical Meta CompleteRegistration#16
nicoechaniz wants to merge 9 commits into
feat/registration-v4from
feat/meta-complete-registration

Conversation

@nicoechaniz

@nicoechaniz nicoechaniz commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Outcome

Implements Meta CompleteRegistration at the canonical boundary: only after the registration API returns a valid registration.response.v1 with registration_status=REGISTERED, before the official Ticket Tailor widget is mounted.

This PR is intentionally stacked on draft #22 (registration-v4). Merge/deploy #22 first, then this PR, only after Bot accepts the exact v3+v4 allowlist described there. The branch is rebased through current landing main (b62cd9c) and preserves the official inline widget, checkout identity prefill, email typo and DNS/MX validation, confirmation content, and current registration-page redesign.

Behavior

  • consent granted: PageView + one CompleteRegistration;
  • consent declined/revoked: no event; a later explicit grant safely emits the pending canonical registration once;
  • event completed before consent: held locally and sent once only after explicit grant;
  • malformed/non-REGISTERED/error/timeout paths: no event;
  • retry, duplicate event, same-tab refresh and cross-tab idempotent response: deduplicated in-memory and browser storage;
  • parameters contain only the selected canonical session code and generic product name; no name, email, terms, token or checkout context;
  • analytics listener/tracker failures cannot reject a valid registration or block the validated checkout widget or its identity prefill.

Verification

  • combined stacked branch: 45/45 Node tests, including both canonical ES and EN products;
  • build: pass;
  • diff-check: pass;
  • exact v3/v4 hashes verified;
  • real Chrome via Kimi WebBridge against the local build: consent/PageView, canonical REGISTERED→CompleteRegistration, no-PII inspection, refresh dedupe, revoke/regrant all pass on the prior branch head;
  • no production registration, checkout, participant data or Meta Test Event was created.

Browser evidence: #16 (comment)

Publication blocker

Do not merge/deploy yet. Production is open on registration-v3; publication requires the coordinated registration-v4 legal/backend cutover in #22 and SairaAsua/proyecciones-mito#33. Purchase remains fail-closed and out of this PR until #33 exposes authoritative paid facts.

Related: #12. Purchase: #11.

@nicoechaniz
nicoechaniz force-pushed the feat/meta-complete-registration branch 2 times, most recently from b8c45bf to c4ece7d Compare August 4, 2026 06:14
@nicoechaniz

Copy link
Copy Markdown
Contributor Author

Auditoría adicional de consentimiento en feat/meta-complete-registration:

  • corregido el caso Accept → Decline → Accept sin recarga; el píxel vuelve a recibir consent grant;
  • una inscripción que llega mientras el consentimiento está revocado ya no puede emitir CompleteRegistration;
  • si luego existe un grant explícito, el evento pendiente se envía una sola vez;
  • deduplicación se conserva.

Gates locales: 28/28 tests, build y git diff --check verdes. Este commit sólo toca assets/meta-pixel.js y tests/meta-pixel.test.js; no toca el catálogo ni el cutover de Mariano. PR sigue en draft y no se publicará antes de registration-v4/coordinación.

@nicoechaniz

Copy link
Copy Markdown
Contributor Author

Cobertura adicional en commit nuevo:

  • refresh en la misma pestaña no reenvía CompleteRegistration;
  • retry/evento duplicado sigue deduplicado;
  • una excepción de cualquier listener analytics no rechaza una respuesta REGISTERED válida ni impide obtener el checkout.

Suite actual: 30/30 tests + build + diff-check verdes.

@nicoechaniz
nicoechaniz force-pushed the feat/meta-complete-registration branch from f996750 to a78f0dd Compare August 4, 2026 07:05
@nicoechaniz
nicoechaniz changed the base branch from main to feat/registration-v4 August 4, 2026 07:05
@nicoechaniz

Copy link
Copy Markdown
Contributor Author

PR rebaseada e integrada sobre registration-v4 PR #22. El stack explícito queda: #22 (documento/version/hash/cutover) → #16 (CompleteRegistration).

Estado combinado: 33/33 tests, build incluyendo artefactos legales, diff-check y hashes source/dist verdes. No se mergeó ni desplegó ninguna de las dos.

@nicoechaniz
nicoechaniz force-pushed the feat/meta-complete-registration branch from a78f0dd to cf3eb8b Compare August 4, 2026 07:08
@nicoechaniz

Copy link
Copy Markdown
Contributor Author

Browser-runtime verification (Kimi WebBridge + real Chrome, local build, 2026-08-04):

  • explicit Accept queued consent: grant, init, then exactly one PageView;
  • a fully canonical synthetic registration.response.v1 with registration_status=REGISTERED caused exactly one CompleteRegistration;
  • the emitted event contained only generic product fields plus content_ids=[es-0830-cr]; a search of the Meta call found no synthetic name or email;
  • the canonical status context was stored and the v4 idempotency key cleared only after the valid response;
  • same-tab reload + the same registration ID emitted zero additional CompleteRegistration events;
  • while consent was revoked, a newly completed registration emitted zero events; re-granting consent emitted that pending event exactly once.

No production registration, Ticket Tailor checkout, participant data or Meta Test Event was created. Local browser session/server were closed after verification. Combined branch remains 33/33 tests + build + diff-check green.

@nicoechaniz

Copy link
Copy Markdown
Contributor Author

Adversarial dedupe follow-up: head 7e55f4d now records successful canonical registration IDs in both sessionStorage and first-party localStorage. This preserves the existing same-tab marker and prevents an idempotent response in a second tab from emitting another CompleteRegistration; the opaque registration ID is not sent to Meta. Added explicit PageView lifecycle and cross-tab tests. Combined suite: 35/35 + build + diff-check green.

@nicoechaniz

Copy link
Copy Markdown
Contributor Author

Latest-main integration gate: merged head 7e55f4d into a disposable worktree at landing main bc3a8f1 (including Saira’s four new editorial commits). Merge was conflict-free; 35/35 tests, build and diff-check passed. The temporary merge was aborted and worktree removed; nothing was published.

@nicoechaniz

Copy link
Copy Markdown
Contributor Author

Real-Chrome cross-tab gate on head 7e55f4d: tab 1 emitted one CompleteRegistration and stored both session/local first-party markers; tab 2, with independent sessionStorage but the same origin/localStorage, received the same canonical registration ID and emitted zero CompleteRegistration events. Meta was stubbed before consent, so no external Meta request or production mutation occurred. Both WebBridge sessions and the local server were closed.

@nicoechaniz

Copy link
Copy Markdown
Contributor Author

Rollout compatibility on head a16d7ce: if a pre-update tab has only the legacy sessionStorage dedupe marker, the new tracker backfills the first-party localStorage marker before returning. A later tab therefore also emits zero duplicates. Added regression coverage; combined suite is 36/36 + build + diff-check green.

@nicoechaniz

Copy link
Copy Markdown
Contributor Author

Final disposable integration gate on landing main bc3a8f1 + stack head a16d7ce: conflict-free merge, 36/36 tests, build and diff-check pass. Hashes remained exact: v3 0d65e0c…, v4/current policy c062b639…. Temporary merge was aborted and worktree removed; no deploy.

@nicoechaniz

Copy link
Copy Markdown
Contributor Author

Rebased the stacked CompleteRegistration branch onto the updated #22/current landing main. The widget lifecycle is preserved and now has an explicit regression test proving an analytics listener failure cannot block the validated checkout widget. Verification on head 2d924e0: 40/40 tests, build, diff-check, and exact v3/v4 hashes pass. Publication remains blocked on the coordinated Bot dual-allowlist cutover.

@nicoechaniz

Copy link
Copy Markdown
Contributor Author

Fresh Chrome verification on rebased head 2d924e0: synthetic canonical REGISTERED response produced exactly one PageView and one CompleteRegistration; the event payload contained no synthetic name/email or other PII. The detached official widget mounted with its signed metadata fragment intact and widget/modal_widget removed. A second canonical response with dispatchEvent forced to throw still returned REGISTERED and mounted the validated widget. No production registration, Ticket Tailor checkout, Meta request, or participant record was created.

@nicoechaniz

Copy link
Copy Markdown
Contributor Author

Added explicit EN coverage on head 93ec1ba: the canonical en-1400-cr selection emits exactly one CompleteRegistration with that content_id and no inferred value/currency. Combined branch is now 41/41 tests + build + diff-check green.

@nicoechaniz
nicoechaniz force-pushed the feat/registration-v4 branch from 4f0b0d3 to 8b6dd6c Compare August 4, 2026 18:08
@nicoechaniz
nicoechaniz force-pushed the feat/meta-complete-registration branch from 93ec1ba to fbf312f Compare August 4, 2026 18:09
@nicoechaniz

Copy link
Copy Markdown
Contributor Author

Rebased the stacked CompleteRegistration branch onto updated #22/current main. Head fbf312f preserves identity prefill and adds a regression assertion that metadata + name/email prefill survive even when analytics dispatch fails. Verification: 43/43 tests, build, diff-check and exact legal hashes pass.

@nicoechaniz
nicoechaniz force-pushed the feat/registration-v4 branch from 8b6dd6c to 5ef1005 Compare August 4, 2026 18:30
@nicoechaniz
nicoechaniz force-pushed the feat/meta-complete-registration branch from fbf312f to df77ef3 Compare August 4, 2026 18:31
@nicoechaniz

Copy link
Copy Markdown
Contributor Author

Stack actualizado nuevamente sobre #22@5ef1005 y main@b62cd9c (incluye validación MX #29). Nuevo head df77ef3. Gates: 45/45 tests, build y diff-check verdes. CompleteRegistration sigue fail-safe/no bloqueante y no emite PII. Continúa draft hasta el contrato backend compatible.

@Mar-IA-no

Copy link
Copy Markdown
Contributor

Coordinación de supersesión: el contenido funcional de este stack fue reaplicado sobre el main vigente, preservando la autoría de Nico, revisado y publicado mediante PR #35 (merge 107bb44). La implementación publicada conserva registration-v4, verificación de buzón compatible, CompleteRegistration deduplicado y consentimiento Meta. Para evitar trabajo duplicado, por favor cerrá esta PR apilada; no modificaremos ni eliminaremos su rama. Cualquier evolución posterior debe partir del main actual.

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.

2 participants