Commit d4e1caf
feat(admin): Phase 2 — nightly AI content review cron + metadata
Adds the AI content pipeline backing the admin cockpit:
Schema (migration 0038, additive + idempotent topic seed):
- post_metadata (1:1): sentiment, sentimentScore, qualityScore, modelId,
analyzedAt watermark, schemaVersion.
- topic / post_topic: controlled vocab + provenance-aware edges (ai|manual);
the cron only ever rewrites its own 'ai' edges.
- comments.moderatedAt watermark; reports.source (user|system) + nullable
reporter so AI flags share the existing moderation queue.
server/lib/contentAnalysis.ts: one Bedrock call per post returns topics +
sentiment + quality + a moderation verdict. Gated + fail-open like autoReview;
heuristic fallback when Bedrock is off. Unit-tested (7 cases).
app/api/cron/daily-review: incremental, capped, per-item-isolated cron doing
four passes (tag/sentiment, quality, re-screen posts+comments, digest email).
Auth via CRON_SECRET. Wired into CDK via a new dailyReview invoker Lambda +
daily EventBridge rule (cron-stack.ts), mirroring promoteScheduled.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 69feb35 commit d4e1caf
11 files changed
Lines changed: 8362 additions & 4 deletions
File tree
- app/api/cron/daily-review
- cdk
- lambdas/dailyReview
- lib
- drizzle
- meta
- server
- db
- lib
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
0 commit comments