Skip to content

fix: allow category_matrix widget + decouple its cache write#100

Merged
asecord92 merged 1 commit into
mainfrom
fix/category-matrix-widget-constraint
Jul 22, 2026
Merged

fix: allow category_matrix widget + decouple its cache write#100
asecord92 merged 1 commit into
mainfrom
fix/category-matrix-widget-constraint

Conversation

@asecord92

Copy link
Copy Markdown
Owner

The regression

The posture PR (#99) writes a new category_matrix row to dashboard_cache, but the table's dashboard_cache_widget_check constraint didn't whitelist it. Every _run_category_ranks_compute raised 23514, and because both rows were upserted in one batched call, the failure rolled back the essential category_ranks + history write too.

Symptom: category ranks silently stopped updating after deploy; start/sit + news lost their "weakest categories" strategic line (they read category_ranks). Seen in Railway logs post-sync.

Fix

  1. 20260722_category_matrix_widget.sql — adds category_matrix to the allowed widget list (apply manually in Supabase SQL editor, per repo convention).
  2. Decoupled the writescategory_ranks + _snapshot_rank_history land first and unconditionally; category_matrix is now a separate best-effort upsert in its own try/except. A matrix failure can never block the essential ranks/history again (also means it degrades gracefully until the migration is applied).

Test

  • ruff clean.
  • Logic: two independent upserts, matrix wrapped so its exception is logged but swallowed.

🤖 Generated with Claude Code

The posture PR (#99) wrote a new category_matrix row to dashboard_cache, but
the table's widget CHECK constraint didn't whitelist it — every compute raised
23514 and, because both rows were upserted together, took the essential
category_ranks + history write down with it. Category ranks silently stopped
updating (and start/sit/news lost their weak-category context line).

- Migration 20260722_category_matrix_widget.sql adds category_matrix to the
  allowed widget list (apply manually in Supabase SQL editor).
- Split _run_category_ranks_compute into two writes: category_ranks + history
  land first and unconditionally; category_matrix is a separate best-effort
  upsert, so a matrix failure can never block the essential ranks again.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
dynastyos Ready Ready Preview, Comment Jul 22, 2026 5:00pm

@railway-app
railway-app Bot temporarily deployed to dynastyops-secordlabs / dynastyos-pr-100 July 22, 2026 16:59 Destroyed
@asecord92
asecord92 merged commit 4091df4 into main Jul 22, 2026
5 checks passed
@asecord92
asecord92 deleted the fix/category-matrix-widget-constraint branch July 22, 2026 17:01
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.

1 participant