01Spec before code
The crawl produced 122 page specs per locale, an image map, and a URL map of the 388 live addresses across English, French and Arabic. My verify-urls harness walks all 388 against a running server and reports any that fail to route; the final run passed 388 of 388. A known-slug allowlist keeps genuine 404s returning 404.
02The CRM bug that looked like a form bug
Every deal in Bitrix24 arrived with a name and nothing else. The cause was not the form. Bitrix Deals have no email or phone fields, so `crm.deal.add` accepted EMAIL and PHONE and silently discarded them, and I had reproduced the old handler faithfully enough to inherit the behaviour and carry it past cutover. My fix creates a Contact first, then a Deal linked by CONTACT_ID with every detail mirrored into the comment; if the contact step fails the deal is still created, so a lead is never lost.
03Attribution that survives the walk to the form
The lead form is a popup that can open from any page. A Google Ads visitor lands on /?gclid=…, reads for a while, and by submit time the query string is long gone, so reading the URL at submit captures nothing for exactly the traffic worth attributing. I now capture on every page load and persist to sessionStorage rather than localStorage, so an organic return visit weeks later is not credited to an old click; I write UTMs as real Bitrix fields, gbraid and wbraid stand in for gclid on iOS traffic, and I also write the click id into the deal comment as a fallback.
04Pasted articles, contained
Editors wanted to paste a complete, self-styled HTML article and have it render as designed, but letting its `<style>` through would have allowed a rule like `body{background:#06070d}` to repaint the whole site. So I hand-rolled a CSS walker that rewrites every selector to sit under one wrapper class, folds :root, html and body onto that wrapper, recurses into @media and @supports, and resolves bare filenames in src, srcset and url() to the Payload media library. It runs server-side, so no iframe and no Shadow DOM: the article stays in the real document and stays indexable.
05The LCP that was never recorded
After launch the rebuilt homepage had no mobile PageSpeed score at all, because Chrome recorded no LCP candidate. Three separate causes, all in my new code: a first-visit loading veil occluded the hero, a page-transition transform made the wrapper a containing block for the fixed background blobs and shifted them (the captured report measured 0.95 CLS), and a scroll-snap carousel finalised LCP with zero candidates. I then moved analytics off the measured trace by injecting GTM, GA and the Pixel on first interaction instead of on load, and code-split the popup bundle out of the initial hydration pass; the project's own record for the fix reports a mobile score of 97 with LCP 0.6s, checked on pagespeed.web.dev, with tuning continuing against later runs the same day.