Skip to content

feat: registry schema migration + admin full-field editor + DB-backed leaderboard#208

Merged
danbuildss merged 3 commits into
mainfrom
claude/registry-schema-migration-d8j6l7
Jul 25, 2026
Merged

feat: registry schema migration + admin full-field editor + DB-backed leaderboard#208
danbuildss merged 3 commits into
mainfrom
claude/registry-schema-migration-d8j6l7

Conversation

@danbuildss

Copy link
Copy Markdown
Owner

Summary

  • Migrations: Promote 3 archive-only tables to real migrations so they're guaranteed to exist in every environment — agent_books_history, agent_gdp_history, agent_economic_events. Adds gdp_json column to agent_gdp_history for cross-instance caching.
  • Admin editor: Luca-admin edit form now exposes every editable agent field. Load → edit → save in one flow, all changes write directly to Supabase and flow to the UI on next cache refresh.
  • Leaderboard fix: getAgentGDP now uses a DB-backed L2 cache (4h TTL) so cold Vercel instances return consistent data instead of each recomputing independently.

Migrations

File What
20260725000001_promote_archive_tables.sql CREATE TABLE IF NOT EXISTS for agent_books_history, agent_gdp_history, agent_economic_events — code was writing to these tables but they were never in migrations
20260725000002_gdp_cache_column.sql Adds gdp_json jsonb to agent_gdp_history for full-snapshot caching

All migrations are idempotent — safe to run against databases where the tables already exist.

Admin editor

Before: edit form accepted name, X handle, website, symbol, bio only. No way to load current values — you had to know what was already there.

After:

  • "Load →" button fetches current Supabase values and pre-fills all fields
  • New fields: ecosystem (dropdown), verification status (dropdown), treasury health (dropdown), priority (0–100), PFP URL, GitHub repo, evidence sources (comma-separated → text[]), admin notes / Luca verdict
  • API route validates all enum fields against vocabulary before writing
  • "Save all →" writes the full set in one PATCH

Leaderboard cache

Before: getAgentGDP had a module-level 1h in-memory cache. On Vercel serverless each instance caches independently — cold starts triggered a full buildAgentBooks fan-out for every agent, and concurrent instances could return different leaderboard data.

After:

  • gdp-history.ts gains getRecentGDPSnapshot() — reads the most recent DB row with gdp_json if within 4h
  • getAgentGDP checks DB before computing (L1 memory → L2 DB → L3 live compute)
  • Every fresh computation auto-saves to DB via saveGDPSnapshot() so subsequent instances hit L2

Generated by Claude Code

claude added 3 commits July 25, 2026 12:59
- getAgentFinancialSummary: check manifestData.error explicitly;
  previously a failed manifest query was silently swallowed as null
- FinancialTruthSection: show header skeleton while fetch is in flight
  instead of returning null, preventing layout shift on slow connections
agent_books_history, agent_gdp_history, and agent_economic_events
existed only in supabase/archive/ and were never guaranteed to exist
in any environment. Code in agent-books-history.ts, gdp-history.ts,
and agent-events.ts writes to these tables — without this migration
those writes silently fail on fresh or reset environments.

All three tables are created with IF NOT EXISTS so the migration is
safe to run against databases where the tables were already applied
manually from the archive scripts.
Admin editor (0b):
- update-agent PATCH now accepts ecosystem, verificationStatus,
  treasuryHealth, priority, pfp, gitlawbRepo, evidenceSources,
  adminNotes — all fields validated against vocab before writing
- luca-admin edit form gains a Load button that pre-fills all
  current values from Supabase; every field is now editable in
  one save — changes flow directly to the UI on next cache refresh

DB-backed leaderboard (0c):
- agent_gdp_history gains a gdp_json column (migration 20260725000002)
  to store the full serialized AgentGDP on every computation
- getAgentGDP now checks the DB (4h TTL) before running a full
  buildAgentBooks fan-out — cold Vercel instances return consistent
  data instead of each recomputing independently
- saveGDPSnapshot is called automatically after every fresh GDP
  build, not only from research/generate
@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
zetta Ready Ready Preview, Comment Jul 25, 2026 6:41pm

@danbuildss
danbuildss merged commit fba91de into main Jul 25, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants