Centralize curation config (issue #7) #14
Reference in New Issue
Block a user
Delete Branch "refactor/curation-config-7"
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?
Summary (issue #7 — curation centralized)
Curation values moved from 5 scattered module constants into one
config/queries.json(per-adapter blocks). Dead-code script deleted.What changed
config/queries.json(new): per-adapter blocks —hackernews.keywords,arxiv.categories,reddit.subreddits,rss.feeds+rss.keywords,github.search_terms. JSON not YAML — Athena is deliberately stdlib-only; PyYAML avoided (it happened to be installed but isn't a declared dep).adapters/__init__.py:load_queries()+source_config(name)loader. Safe fallback: missing/corrupt config →{}, adapters fall back to class defaults instead of crashing.AI_KEYWORDSand the duplicate inline list inside_is_ai_relevant()(the internal drift Ty flagged). Now loadsself.ai_keywordsfrom config. Matching simplified to one substring pass.__init__prefers config; the old class/module constants are retained as inert fallbacks (issue #7 cut #5: safe rollout).reddit_proof.py: standalone PoC v5 at repo root — ownmain(),init_db(), directINSERT OR REPLACE. Confirmed NOT in cron, NOT imported anywhere → dead code. Also removes its byte-duplicateSUBREDDITS.Behavior note (honest)
HN keyword matching changed from 2-pass (substring +
\bai\bregex boundary +compute-needs-tech-context guard) to a single substring pass over the config list (which includes boundary variants"ai "," ai","ai-","-ai"). Slightly looser on edge cases ("Britain" still avoided via the space-prefixed variants; the nichecompute+gpuguard was dropped as not worth centralizing). If you want exact-preserve, say so and I'll add\bai\bback as a regex entry.Deferred (per #7 scoping, to #6)
Verification (raw, from this session)
Branch point =
main(verified via merge-base before push — the #12 branch-contamination bug is not repeated).Test plan
grep -rn "AI_KEYWORDS\|DEFAULT_SUBREDDITS\|DEFAULT_CATEGORIES" adapters/→ only fallback constants remain, no duplicate value lists.config/queries.jsonedit propagates (e.g. add a subreddit, confirm it's picked up).Related
Closes #7. Pairs with #6 (embeddings). RSS feed URLs tracked in #13 (separate). PR #12 (#1/#2/#9) is independent and unmerged.
- adapters/__init__.py: add load_queries() + source_config() (stdlib json, safe fallback to {} on missing/corrupt config so pipeline never crashes). - config/queries.json: per-adapter blocks (hackernews.keywords, arxiv.categories, reddit.subreddits, rss.feeds+keywords, github.search_terms). JSON (not yaml) to honor Athena's dependency-free runtime; PyYAML avoided. - hackernews: drop class AI_KEYWORDS + the DUPLICATE inline list inside _is_ai_relevant() (the internal drift Ty flagged). Now loads self.ai_keywords from config. Simplified matching to single substring pass (boundary variants 'ai ',' ai','ai-','-ai' approximate word-boundary; dropped the niche 'compute+tech-context' guard as not worth centralizing). - reddit: DEFAULT_SUBREDDITS kept as fallback; __init__ prefers config. - arxiv: DEFAULT_CATEGORIES kept as fallback; __init__ prefers config. - rss: FEEDS + AI_KEYWORDS kept as module fallbacks; __init__ prefers config. Keywords stay regex form (re.search) as in original. - github: trending queries moved to config search_terms; fallback retained. - DELETE reddit_proof.py: standalone PoC v5 at repo root, own main()+init_db() + direct INSERT OR REPLACE, NOT in cron, NOT imported anywhere -> dead code. Also removes its byte-duplicate SUBREDDITS. NOTE: fallback class constants remain intentionally (issue #7 cut #5: safe rollout). Curation VALUES now live in one file; the constants are inert unless config/queries.json is missing. Verified: all adapters compile; config loads (HN 46 kw, RSS 10 feeds); full dry-run fetches all 6 sources; grep confirms HN internal dup list gone.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.