Files
orangecat/scripts
ed1d96147a fix(cat): the outcome gate reported a cause it had never tested (#829)
The nightly gate failed with "assistant messages exist in the window but 0 Cat
actions were logged — the cat_action_log write path looks dead (check RLS
policies and the executor)" while cat_action_log held TEN rows for that window,
the newest from 2026-08-25. The write path was alive. The gate had never looked
at it.

`proposed` counts only rows that are BOTH status=completed AND a create_*
action. In the window there were none — the single create_* was `create_cause`,
DENIED. Three different worlds produce proposed === 0:

  1. nothing is written at all           → the audit trail is dead. Page.
  2. writes happen, no completed creates → nothing creatable was asked for, or
                                           every attempt was denied. Not an outage.
  3. no assistant activity at all        → nothing to grade.

The old predicate could not tell 1 from 2, so it asserted the diagnosis for 1
whenever it saw either. It now fetches the window's rows with no status or
action filter and fails only on the shape it was built for: the log EMPTY while
the Cat is talking. Otherwise it reports what it found — including denials,
which are a real signal worth seeing and were being swallowed.

This matters beyond the noise: a tripwire that cries every night is one nobody
believes on the night it is right, which is the exact failure it exists to catch.

The predicate is now a pure function and main() only runs on direct execution,
so the decision can be tested without a database — it stayed wrong because
nothing could reach it. Seven cases added, run in a child process against the
real module (matching eval-cat-retry's pattern). Proven by mutation: restoring
the old predicate turns three of them red, and the artifact was verified
byte-identical afterwards.

Live against production: exits 0 with
  "the write path is alive — 10 action(s) logged in window (denied 4,
   completed 5, failed 1), just none of them a completed create_*."


Claude-Session: https://claude.ai/code/session_01AqzRcMP1uJzd7Tav5fNxQz

Co-authored-by: Georgy Butaev <41178744+g-but@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 07:30:44 +02:00
..
2025-12-10 16:56:40 +01:00

Scripts Directory

This directory contains all automation scripts organized by purpose.

Directory Structure

  • analysis/ - Bundle analysis, documentation checking, and optimization tools
  • auth-fix/ - Scripts to fix authentication and RLS policy issues
  • db/ - Database operations, migrations, and schema management
    • Migration scripts moved from root: apply-migration.js, apply-*-migration.js
    • Old schema files archived in db/archive/
  • deployment/ - Deployment, production setup, and monitoring scripts
  • dev/ - Development helpers, local setup, and debugging tools
  • diagnostics/ - Health checks and system diagnostics
  • maintenance/ - Cleanup, optimization, and maintenance scripts
  • monitoring/ - Performance monitoring and bundle size tracking
  • oauth/ - OAuth provider setup and configuration
  • profile-fix/ - Scripts to fix profile-related issues
  • schema-fix/ - Database schema fixes and migrations
  • storage/ - Supabase storage bucket setup and management
  • test/ - Testing utilities and validation scripts
    • Test/debug scripts moved from root: test-*.js, check-*.js, debug-*.js

Usage

Most scripts can be run with:

node scripts/{category}/script-name.js

For deployment scripts:

bash scripts/deployment/script-name.sh

Important Scripts

  • scripts/dev/dev-start.js - Main development server starter
  • scripts/deployment/browser-verify.js - Post-deploy browser smoke test (deploys themselves happen on the box — see docs/deployment/DEPLOYMENT_PROCESS.md)
  • scripts/db/apply-migrations.ts - Database migrations
  • scripts/maintenance/cleanup-console-logs.ts - Remove console.log statements