Improvements v0.3.0 #15
Loading…
Reference in a new issue
No description provided.
Delete branch "improvements-v0.3.0"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Carries the worker resilience + proxy + WAF rework on top of the v0.2.0 release. v0.2.0 left 8 sources failing in prod (5 stuck on Cloudflare/CloudFront 403s, Foojay on a retired RSS path, 2 with broken endpoints); this branch addresses the root causes and adds defenses against the same class of failure going forward.
Worker
Proxy
WAF headers
Catalog
Code review
Four review rounds covered: probe cadence bug (probe-every-cycle regression), SSRF regression under proxy (httpcore CONNECT tunnel ignores sni_hostname), success-branch duplication, port/path/query validation, threshold clamp, and the sync_catalog auto-block undo defect. All resolved. 270 tests pass.
Out of scope for this PR (follow-up)
Add a bounded retry cap so perpetually-failing sources stop hammering the network. When consecutive_failures crosses TILENS_AUTO_BLOCK_AFTER_FAILURES (default 25) and the error class is in {http_error, fetch_error, sitemap_http_403, post_fetch_error, adapter_blocked}, the storage layer flips the row to status='blocked', stamps last_blocked_at, clears next_due_at, and writes a reason explaining the transition. Each ingestion cycle now also selects blocked sources whose last_blocked_at is older than TILENS_BLOCKED_PROBE_INTERVAL_SEC (default 24h) and probes them through the regular fetch pipeline. A 200/304 result flips the row back to active (with the SQLite SET expression order chosen so the cleanup CASE runs BEFORE the status CASE, otherwise SQLite's left-to-right evaluation reads the already-updated status). Other error classes keep retrying. New migration 011 adds the last_blocked_at column plus a partial index on (status, last_blocked_at) WHERE status='blocked' to keep the probe scan cheap. SourceRow, list_blocked_sources_for_probe, and the persistence layer carry the field end-to-end. Tests pin the threshold boundary, the non-blocking error class escape hatch, the successful probe restore, and the probe-window skip behavior.Review-driven additions: - _assert_modern_waf_signature now asserts Sec-CH-UA-Platform alongside the other Chrome 142 / Sec-CH-UA / Sec-Fetch-* / br+zstd signals. Every WAF-allowlist E2E test catches a regression on any single signal. - test_fetch_source_injects_waf_headers_for_last_week_in_aws: the last allowlist entry without an E2E test. Now all six (docker-blog, unsloth-blog, last-week-in-aws, osi-blog, mit-news-ai, mit-news-eecs) exercise the full WAF signature end-to-end through the wrapped fetcher. - test_coerce_proxy_url_rejects_double_slash_path: pins that urlparse('http://host:8080//') parses path='//' (not in {'', '/'}) and the validator rejects it. Locks the path regex against a future 'use parsed.path != ""' regression.