slice 16 X-cookie + Reddit adapters (qwopus35b): cashtag_search/trusted_timeline (1 req/3s, cookie-expiry->FAILED+degraded), Reddit public-JSON, 7d cache, FakeLLM, crowd-sentiment-not-edge caveat

Cross-review by ornith-35 pending. 17 new tests (40 adapter total).
This commit is contained in:
Investor Flow Build
2026-06-30 10:08:25 -04:00
parent 9f58d36566
commit e1e028b418
6 changed files with 2107 additions and 1 deletions
+37 -1
View File
@@ -339,7 +339,43 @@ CREATE TABLE IF NOT EXISTS llm_dispatch_audit (
ts TEXT NOT NULL
);
-- ===== Indexes =====
-- ===== Slice 16 — Sentiment / X-cookie / Reddit tables =====
-- sentiment_score: -1.0 (bearish) to +1.0 (bullish), computed by LLM post_summary or heuristic.
-- attribution: author_handle preserved on every cached post per M8.
-- cached_until: 7d rolling TTL; rows become stale after this window.
CREATE TABLE IF NOT EXISTS x_cookie_posts (
post_id TEXT NOT NULL,
source TEXT NOT NULL DEFAULT 'x',
author_handle TEXT NOT NULL,
cashtag TEXT, -- e.g. 'NVDA' — null if not a cashtag search
body_text TEXT,
posted_at TEXT NOT NULL,
engagement INTEGER NOT NULL DEFAULT 0, -- likes + retweets + replies
sentiment_score REAL, -- -1.0 to +1.0
attribution TEXT, -- original author handle (may differ from author_handle for quotes/retweets)
cached_until TEXT NOT NULL, -- 7d rolling; rows stale after this
PRIMARY KEY (post_id)
);
CREATE TABLE IF NOT EXISTS reddit_posts (
post_id TEXT NOT NULL,
source TEXT NOT NULL DEFAULT 'reddit',
author_handle TEXT NOT NULL,
subreddit TEXT NOT NULL,
body_text TEXT,
posted_at TEXT NOT NULL,
engagement INTEGER NOT NULL DEFAULT 0, -- upvotes + comments
sentiment_score REAL, -- -1.0 to +1.0
attribution TEXT, -- original author handle (may differ for cross-posts)
cached_until TEXT NOT NULL, -- 7d rolling
PRIMARY KEY (post_id)
);
-- Indexes for slice-16 sentiment tables
CREATE INDEX IF NOT EXISTS idx_x_cookie_cashtag ON x_cookie_posts(cashtag, posted_at DESC);
CREATE INDEX IF NOT EXISTS idx_reddit_subreddit ON reddit_posts(subreddit, posted_at DESC);
-- ===== Indexes (existing) =====
CREATE INDEX IF NOT EXISTS idx_pc_symbol_tf_ts ON price_candles(symbol, timeframe, ts);
CREATE INDEX IF NOT EXISTS idx_quote_obs ON quotes(observed_at);
CREATE INDEX IF NOT EXISTS idx_filing_symbol_form ON filings(symbol, form);