Skip to content
PidebugCLI & tooling8 files · +384 −208

Fix truncated article loading in Economist TUI (Go)

Session from economist-tui-sessions on Hugging Face by thomasmustier · MIT · condensed by Coders Talk

15msession
0interventions
GOAL

Debug and fix articles being cut off in the economist-tui CLI/TUI, then cut a v0.4.1 release with notes.

  1. Prompt · +0
    Articles appear to be getting cutoff in my economist tui. Please can we fix this? We're logged in with the brew install.
  2. Agent did · +0m
    Cloned the repo, read the article parsing, browse view, and layout code, then fetched a live Economist article via the installed CLI in debug mode and found only one paragraph loaded before a registration wall, plus stale CSS selectors (.article__body-text p vs new p[data-component="paragraph"]).
  3. Agent did · +3m
    Cloned a fresh working copy, updated selectors and content-wait logic in article.go, then diagnosed that the headless fetch used a separate browser instance without the persistent login profile, so auth cookies never made it in.
  4. Fail · +7m
    After wiring the headless browser to reuse the persistent profile, article still loaded with only one paragraph; deeper check showed Cloudflare was blocking the headless browser with a 'Just a moment...' security challenge instead of the article.
  5. Agent did · +9m
    Reverted the shared-profile approach, then found the real bug: isEconomistDomain() only matched the base domain, dropping auth cookies from myaccount.economist.com and the Zephr paywall subdomain, and IsAuthCookie() used stale cookie names. Fixed domain matching and cookie name checks, then re-ran login to capture 46 cookies including wall_session and fcx_access_token.
  6. Fail · +12m
    With auth cookies injected, the read still returned a Cloudflare challenge page — turned out cf_clearance was bound to the login browser's fingerprint and rejected when injected into the headless browser.
  7. Agent did · +13m
    Filtered Cloudflare fingerprint-bound cookies out of injection, rebuilt, cleared cache, and confirmed full articles now loaded (verified on two different URLs). Added a test fixture for the modern selector, ran the full test suite, then committed and pushed the fix to main.
  8. Agent did · +14m
    Installed the fixed binary via make install and confirmed the real CLI now returned the full 32-line article versus the previous 14-line (single paragraph) output.
  9. Break · 2h 39m away, not counted
  10. Prompt · +15m
    Ok, cool. let's release 0.4.1 with notes
  11. Outcome · +15m
    Bumped version to 0.4.1, added release notes, committed, tagged v0.4.1, and pushed to main with tags. All package tests passing (article, ui packages green).
VERDICT

Next time I'd point straight at the debug HTML dump and cookie state instead of starting from the UI layout code — the real bug was three layers deep in auth cookie filtering and stale selectors, not rendering. The correction that actually fixed it was noticing Cloudflare was rejecting the fingerprint-bound cf_clearance cookie when injected into the headless browser; filtering that out is what finally got full articles loading.

I tried this · 0

Discussion · 0

How Builds work