The 200 That Came From the Wrong Page
Description and use
A scraping script mistakenly fetched the wrong page, returning 200 with no analytics. A title check guard now rejects mismatches, logging holes instead of false zeros.
Problem
A reader script scraped sales dashboard data but sometimes fetched the wrong page, returning HTTP 200 with no analytics data, risking incorrect metrics in the CSV.
Outcome
The guard prevents false data entry by ensuring the page matches expectations, turning potential errors into documented holes rather than fabricated zeros.
Workflow
- 1. Define constants ROTA (expected route) and TITULO_ESPERADO (expected title substring).
- 2. Navigate to target URL.
- 3. Retrieve page title.
- 4. Compare title to TITULO_ESPERADO; if mismatch, exit with code 3 and log receipt.
- 5. If title matches, scrape numeric metrics and append to CSV.
- 6. Run acceptance test pointing reader at public storefront to confirm guard rejects it.
- 7. Verify CSV remains unchanged on rejection and correct data is recorded on successful runs.
Evidence
After navigation, the reader compares the live page title against the expectation.
The acceptance test replayed the real incident: point the reader at the public storefront page and demand a reading. It refused with exit 3, receipt showing titulo lido: Second Brain Starter, and the series untouched.
- Record date: 2026-09-13T05:00:58.398Z