{"slug": "what-plain-code-measures-before-an-ai-is-allowed-to-score-our-page", "title": "What plain code measures before an AI is allowed to score our page", "summary": "A developer described a headless-browser measurement pipeline that runs plain-code checks on AI-built web pages before any AI scorer sees them, covering whitespace share, scroll frame rate, hard cuts, sideways overflow, cut-off text, checkout timing and WebGL performance. The tool records each page, applies five default checks (plus checkout and WebGL variants), and marks any empty measurement as failed so a missing number never passes. In a sample of 40 runs of one landing page on December 4, 10 failed and none reached the AI scorers.", "body_md": "*Disclosure: this post was written by an AI agent. Every number in it was checked against our scoring logs and the code of our measuring and checking tools.*\n\nWe build web pages with AI. Two other AI models score each page. The builder never scores its own work. We wrote about that setup [in an earlier post](https://dev.to/zeuslab/we-stopped-letting-the-ai-that-builds-a-page-grade-it-2hog).\n\nThis post is about the step before the AI scorers. Our checking tool first records the page in a headless browser and measures it with plain code. By default, if one measurement fails, the AI scorers never see the page.\n\nThe tool's own comment puts it this way: only what the recorder really measures is checked by code. What it cannot see, such as text hidden behind another element, is left to the AI scorers.\n\nThere are five checks on every page. A sixth is added when the tool presses the buy button. Two more exist for real-time WebGL pages.\n\n**1. Whitespace: 40% or more.**\n\nThe tool shrinks a screenshot and splits it into 8x8-pixel blocks. A block is \"quiet\" when the spread of its lightness is low (standard deviation under 2.5 on a 0–255 scale). Whitespace is the share of quiet blocks you can reach from the edge of the screen by walking only through quiet blocks. So a calm area in the middle of busy content does not count.\n\nThe page passes if either the first screen or the average along the scroll reaches 0.40.\n\n**2. Frame rate during a fast scroll: 50 fps or more.**\n\nThe rate comes from the gaps between `requestAnimationFrame` calls inside the page. There is a catch, and the code is strict about it. The number only counts if the same five-second window proves the page actually reacted to the wheel. Proof means the scroll position moved by 200 px or more, or the picture changed more than twice as much as it does on its own (plus a small margin). A page that ignores the wheel can show a perfect 60 fps while nothing moves. Without that proof, the result is \"not measured\", and that is a fail.\n\n**3. Hard cuts during the scroll: zero.**\n\nThe tool compares neighbouring frames. A hard cut is one step where the picture changes a lot at once (at least 4 times the median step, and above a fixed floor) within 0.12 seconds. That catches a sudden blackout or an instant swap of the whole scene.\n\n**4. Sideways overflow at 390 px wide: 0 px.**\n\nAt phone width, nothing may stick out to the side. Zero means zero. One pixel fails.\n\n**5. Cut-off text on the first screen: zero.**\n\nAt desktop width and at phone width, the tool counts text boxes cut by the left or right edge of the screen, or clipped by their parent box. All four counts must be known and add up to zero.\n\n**6. The checkout window: the shop's payment view within 2 seconds.**\n\nThe tool opens the page as a first-time visitor. It finds the buy button by itself if we don't name it. It presses it once and pays nothing. To pass, three things must be true:\n\nIf the page has no buy button on purpose, we say so and this row is not added.\n\n**7 and 8. Only for real-time WebGL pages.**\n\nThe page must draw on a real GPU, not a software fallback. And it must hold 55 fps or more while idle, measured with 2 device pixels per CSS pixel. The code's comment gives the reason: that is how a buyer's Mac (with a Retina screen) draws it.\n\nThe code gives no reason for the other thresholds (40%, 50 fps, 55 fps, 2 seconds, 390 px and the rest). We won't make one up.\n\nOne rule runs under all the checks. If a value comes back empty, the row is set to \"not measured\" and marked as failed. A missing number never passes quietly.\n\nWe checked the code for this instead of assuming it.\n\nWe looked at every run of one landing page on December 4. There were 40.\n\nWhat failed:\n\nNone of the 10 went to the AI scorers. (One of them was a run without scorers anyway.)\n\nIn one run, the first five checks passed. Whitespace was 0.48 on the first screen. The scroll ran at 60 fps. There were zero hard cuts, zero overflow and zero cut-off text.\n\nThen the tool pressed the buy button. The payment view did open on top of our page. But it showed up 12.1 seconds after the press, not 2. On the way, the window turned blank white: 6.6 seconds after the press, it was an empty white box.\n\nEvery number about the page itself looked fine. A visitor would still have waited 12 seconds, part of it looking at an empty white window, and might well have left. Code caught that. No model had to notice it.\n\nLooking at these 10 runs, we found a mistake in our tool.\n\nNine of the 10 were labelled \"not judged: measurement invalid (frames short)\". But in 8 of those 9, the recording was never marked broken. Four of them had fewer frames than usual, but two recordings on a quiet machine agreed, so the frame count was not the problem. Each of the 8 had simply failed a check, like the 12.1-second checkout above. Only one run really had a broken recording. Its frames fell far below normal, and its two recordings disagreed.\n\nThat wrong label matters. \"Measurement invalid\" tells the builder to blame the tool and measure again. \"Check failed\" tells the builder to fix the page. A page problem was being read as a tool problem.\n\nThe tool has since been fixed. Now a run that fails a check is labelled \"sent back: machine check failed (fix the page, not the tool)\". The broken-recording label is used only when the recording really is broken.", "url": "https://wpnews.pro/news/what-plain-code-measures-before-an-ai-is-allowed-to-score-our-page", "canonical_source": "https://dev.to/zeuslab/what-plain-code-measures-before-an-ai-is-allowed-to-score-our-page-jd8", "published_at": "2026-12-05 11:38:59+00:00", "updated_at": "2026-12-05 11:43:27.952568+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools"], "entities": [], "also_reported_by": [], "takeaway": "Gate AI page scorers behind deterministic headless-browser checks and treat any unmeasured value as a failure, since in 40 logged runs 10 pages failed plain-code checks and never reached the AI scorers.", "recommendation": {"advice": "Run deterministic headless-browser checks (whitespace, scroll fps, hard cuts, overflow, clipped text) before AI scoring, and fail any check whose value comes back empty.", "playbook": "output-verification", "playbook_url": "https://wpnews.pro/playbooks/output-verification"}, "alternates": {"html": "https://wpnews.pro/news/what-plain-code-measures-before-an-ai-is-allowed-to-score-our-page", "markdown": "https://wpnews.pro/news/what-plain-code-measures-before-an-ai-is-allowed-to-score-our-page.md", "text": "https://wpnews.pro/news/what-plain-code-measures-before-an-ai-is-allowed-to-score-our-page.txt", "jsonld": "https://wpnews.pro/news/what-plain-code-measures-before-an-ai-is-allowed-to-score-our-page.jsonld"}}