diff --git a/.github/workflows/drop-debug-temp-collection.yml b/.github/workflows/drop-debug-temp-collection.yml deleted file mode 100644 index 1764942a..00000000 --- a/.github/workflows/drop-debug-temp-collection.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Drop Debug Temp Collection (one-off, cleanup) - -# One-time cleanup for the 2026-09-25 live-bug investigation. Drops -# the throwaway debug_temp_2026_09_25 collection. Safe/idempotent. - -on: - workflow_dispatch: - -env: - INFISICAL_ENVIRONMENT: prod - INFISICAL_SECRET_PATH: / - -jobs: - cleanup: - name: SSH Drop Collection - runs-on: ubuntu-latest - environment: production - - steps: - - name: Setup SSH - run: | - mkdir -p ~/.ssh - echo "${{ secrets.CSFAQ_DEPLOY_SSH_KEY }}" | tr -d '\r' > ~/.ssh/id_ed25519 - chmod 600 ~/.ssh/id_ed25519 - ssh-keyscan -H ${{ secrets.CSFAQ_HOST }} >> ~/.ssh/known_hosts - - - name: Drop collection - run: | - ssh -i ~/.ssh/id_ed25519 csfaq-deploy@${{ secrets.CSFAQ_HOST }} bash << 'CLEANUP' - set -e - - cd /home/csfaq-prod/crowd-source-faq - - echo "==> Pulling latest code..." - git pull origin main - - echo "==> Authenticating with Infisical..." - export INFISICAL_TOKEN=$(npx @infisical/cli@0.43.40 login \ - --method=universal-auth \ - --client-id="${{ secrets.INFISICAL_CLIENT_ID }}" \ - --client-secret="${{ secrets.INFISICAL_CLIENT_SECRET }}" \ - --silent \ - --plain) - - if [ -z "$INFISICAL_TOKEN" ]; then - echo "Infisical authentication failed" - exit 1 - fi - - echo "==> Writing backend .env from Infisical..." - npx @infisical/cli@0.43.40 export \ - --token="$INFISICAL_TOKEN" \ - --projectId="${{ secrets.INFISICAL_PROJECT_ID }}" \ - --env="${{ env.INFISICAL_ENVIRONMENT }}" \ - --path="${{ env.INFISICAL_SECRET_PATH }}" \ - --format=dotenv > apps/backend/.env - - echo "==> Cleaning quotes from env file..." - sed -i "s/='\(.*\)'/=\1/; s/=\"\(.*\)\"/=\1/" apps/backend/.env - - echo "==> Installing backend dependencies..." - cd apps/backend - pnpm install --frozen-lockfile - - echo "==> Dropping debug_temp_2026_09_25..." - npx tsx src/scripts/drop-debug-temp-collection.ts - - echo "==> Done." - CLEANUP diff --git a/apps/backend/src/scripts/drop-debug-temp-collection.ts b/apps/backend/src/scripts/drop-debug-temp-collection.ts deleted file mode 100644 index 9d77426f..00000000 --- a/apps/backend/src/scripts/drop-debug-temp-collection.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * One-time cleanup: drops the throwaway `debug_temp_2026_09_25` - * collection created during the 2026-09-25 live-bug investigation - * (see programScope.ts git history / project memory for context). - * Safe to run even if the collection doesn't exist. - * - * Run: npx tsx src/scripts/drop-debug-temp-collection.ts - */ - -import 'dotenv/config'; -import mongoose from 'mongoose'; - -async function main() { - const mongoUri = process.env.MONGODB_URI; - if (!mongoUri) throw new Error('MONGODB_URI is not set'); - await mongoose.connect(mongoUri); - - const db = mongoose.connection.db; - if (!db) throw new Error('no db connection'); - - const collections = await db.listCollections({ name: 'debug_temp_2026_09_25' }).toArray(); - if (collections.length === 0) { - console.log('debug_temp_2026_09_25 does not exist — nothing to do.'); - } else { - await db.collection('debug_temp_2026_09_25').drop(); - console.log('Dropped debug_temp_2026_09_25.'); - } - - await mongoose.disconnect(); -} - -main().catch((err) => { - console.error(err); - process.exit(1); -});