Two minor faults found during the GNews capture/prioritisation diagnostic.
1. HTTP 400 on hyphenated queries
- is GNews's exclusion operator, so a token like "El-Sayed" returned HTTP 400 and wasted a query. _PUNCT_RE now strips -, en dash and em dash to spaces.
2. Phantom gnews_queries_used counter
The per-cycle budget counter incremented in evaluate() before get_sentiment() checked the API key, so with no key the [CYCLE SUMMARY] reported a phantom gnews_queries_used: 5/5 with zero real requests. Added NewsClient.enabled and gated the GNews block on it — with no key the counter stays 0/5 and no spurious SKIP_GNEWS_PRIORITY is logged. No behaviour change when a key is present.
Prioritisation itself was confirmed correct and left untouched: politics markets are sorted by gnews_priority DESC and prior-extreme markets return before the budget is consumed, so no query is ever spent on a market that cannot trade.
Tests:tests/test_news_query.py (4 new); full suite 66 passed.
Two minor faults found during the GNews capture/prioritisation diagnostic.
## 1. HTTP 400 on hyphenated queries
`-` is GNews's exclusion operator, so a token like "El-Sayed" returned HTTP 400 and wasted a query. `_PUNCT_RE` now strips `-`, en dash and em dash to spaces.
## 2. Phantom `gnews_queries_used` counter
The per-cycle budget counter incremented in `evaluate()` before `get_sentiment()` checked the API key, so with no key the `[CYCLE SUMMARY]` reported a phantom `gnews_queries_used: 5/5` with zero real requests. Added `NewsClient.enabled` and gated the GNews block on it — with no key the counter stays `0/5` and no spurious `SKIP_GNEWS_PRIORITY` is logged. No behaviour change when a key is present.
Prioritisation itself was confirmed correct and left untouched: politics markets are sorted by `gnews_priority` DESC and prior-extreme markets return before the budget is consumed, so no query is ever spent on a market that cannot trade.
**Tests:** `tests/test_news_query.py` (4 new); full suite 66 passed.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Two minor faults found during the GNews capture/prioritisation diagnostic:
1. Hyphens/dashes reached the GNews query verbatim. '-' is GNews's exclusion
operator, so a token like "El-Sayed" returned HTTP 400 and wasted a query.
_PUNCT_RE now strips '-', en dash and em dash to spaces.
2. The per-cycle GNews budget counter incremented in evaluate() before
get_sentiment() checked the API key, so with no key configured the
[CYCLE SUMMARY] reported a phantom "gnews_queries_used: 5/5" with zero real
requests. Added NewsClient.enabled and gated the GNews block on it; with no
key the counter stays 0/5 and no spurious SKIP_GNEWS_PRIORITY is logged.
No behaviour change when a key is present.
Prioritisation itself was confirmed correct and is left untouched: politics
markets are sorted by gnews_priority DESC and prior-extreme markets return
before the budget is consumed, so no query is ever spent on a market that
cannot trade.
Tests: tests/test_news_query.py (4 new); full suite 66 passed.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
chemavx
merged commit af0d1fbc59 into main2026-06-26 08:09:05 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Two minor faults found during the GNews capture/prioritisation diagnostic.
1. HTTP 400 on hyphenated queries
-is GNews's exclusion operator, so a token like "El-Sayed" returned HTTP 400 and wasted a query._PUNCT_REnow strips-, en dash and em dash to spaces.2. Phantom
gnews_queries_usedcounterThe per-cycle budget counter incremented in
evaluate()beforeget_sentiment()checked the API key, so with no key the[CYCLE SUMMARY]reported a phantomgnews_queries_used: 5/5with zero real requests. AddedNewsClient.enabledand gated the GNews block on it — with no key the counter stays0/5and no spuriousSKIP_GNEWS_PRIORITYis logged. No behaviour change when a key is present.Prioritisation itself was confirmed correct and left untouched: politics markets are sorted by
gnews_priorityDESC and prior-extreme markets return before the budget is consumed, so no query is ever spent on a market that cannot trade.Tests:
tests/test_news_query.py(4 new); full suite 66 passed.🤖 Generated with Claude Code