Skip to content

SIDDARTHA577/envguard-node / .agents/skills/envguard-load-test

envguard-load-test

Verified

Guides capacity planning, workload profile design, local performance benchmarking, and threshold validation without fabricating production metrics or executing unauthorized traffic.

FileKindSize
SKILL.mdskill md7.7 KB
scripts/readiness-auditor.mjsscript27.1 KB
scripts/readiness/adapters/android-adapter.mjsscript30.0 KB
scripts/readiness/adapters/base-adapter.mjsscript4.6 KB
scripts/readiness/adapters/flutter-adapter.mjsscript28.9 KB
scripts/readiness/adapters/generic-adapter.mjsscript15.9 KB
scripts/readiness/adapters/index.mjsscript661 B
scripts/readiness/adapters/ios-adapter.mjsscript21.0 KB
scripts/readiness/adapters/java-spring-adapter.mjsscript39.9 KB
scripts/readiness/adapters/nextjs-react-adapter.mjsscript30.5 KB
scripts/readiness/adapters/node-typescript-adapter.mjsscript115.8 KB
scripts/readiness/adapters/python-adapter.mjsscript44.0 KB
scripts/readiness/adapters/react-native-adapter.mjsscript34.6 KB
scripts/readiness/adapters/registry.mjsscript3.7 KB
scripts/readiness/architecture/applicability.mjsscript21.8 KB
scripts/readiness/architecture/architecture-inventory.mjsscript16.9 KB
scripts/readiness/architecture/architecture-reporter.mjsscript9.4 KB
scripts/readiness/architecture/capacity-model.mjsscript16.9 KB
scripts/readiness/architecture/design-decisions.mjsscript42.0 KB
scripts/readiness/architecture/failure-modes.mjsscript13.3 KB
scripts/readiness/architecture/index.mjsscript895 B
scripts/readiness/architecture/requirements.mjsscript22.0 KB
scripts/readiness/architecture/tradeoffs.mjsscript4.5 KB
scripts/readiness/capacity/benchmark-runner.mjsscript13.4 KB
scripts/readiness/constants.mjsscript6.0 KB
scripts/readiness/deployment/cicd-gate-validator.mjsscript6.1 KB
scripts/readiness/deployment/container-validator.mjsscript10.1 KB
scripts/readiness/deployment/deployment-gate.mjsscript4.8 KB
scripts/readiness/deployment/index.mjsscript411 B
scripts/readiness/deployment/k8s-validator.mjsscript8.8 KB
scripts/readiness/deployment/reliability-validator.mjsscript9.4 KB
scripts/readiness/engine/discovery.mjsscript15.4 KB
scripts/readiness/engine/index.mjsscript341 B
scripts/readiness/engine/orchestrator.mjsscript21.0 KB
scripts/readiness/engine/planner.mjsscript4.2 KB
scripts/readiness/engine/sarif.mjsscript12.7 KB
scripts/readiness/engine/skills-selector.mjsscript10.0 KB
scripts/readiness/execution/git.mjsscript2.3 KB
scripts/readiness/execution/runner.mjsscript11.9 KB
scripts/readiness/index.mjsscript516 B
scripts/readiness/orchestration/engineering-workflow.mjsscript18.5 KB
scripts/readiness/orchestration/index.mjsscript170 B
scripts/readiness/policies/index.mjsscript189 B
scripts/readiness/policies/release-policy.mjsscript9.5 KB
scripts/readiness/remediation/checkpoint-manager.mjsscript34.0 KB
scripts/readiness/remediation/diff-viewer.mjsscript2.5 KB
scripts/readiness/remediation/index.mjsscript778 B
scripts/readiness/remediation/patch-generator.mjsscript17.5 KB
scripts/readiness/remediation/remediation-runner.mjsscript9.9 KB
scripts/readiness/reporters/comparator.mjsscript20.7 KB
scripts/readiness/reporters/index.mjsscript293 B
scripts/readiness/reporters/json-reporter.mjsscript193 B
scripts/readiness/reporters/markdown-reporter.mjsscript18.8 KB
scripts/readiness/validation/evidence-matrix.mjsscript21.5 KB
scripts/readiness/validation/independent-app-runner.mjsscript26.2 KB
scripts/readiness/validation/index.mjsscript328 B

scripts/readiness/deployment/reliability-validator.mjs

View on GitHub
import fs from 'node:fs';
import path from 'node:path';

/**
 * Validates operational reliability and resilience safeguards.
 * Evaluates graceful shutdown, downstream timeouts, retry storm safeguards,
 * message queue dead-letter configurations, database migration reversibility,
 * and disaster recovery restore verification.
 *
 * @param {string} projectDir - Root project directory
 * @param {string[]} [files=[]] - Relative project files list
 * @param {object} [inventory=null] - Architecture inventory
 * @returns {object[]} Array of reliability findings
 */
export function validateOperationalReliability(projectDir, files = [], inventory = null) {
  const findings = [];

  const codeFiles = files.filter((f) => {
    const ext = path.extname(f).toLowerCase();
    return (
      (ext === '.js' ||
        ext === '.ts' ||
        ext === '.mjs' ||
        ext === '.py' ||
        ext === '.java' ||
        ext === '.go') &&
      !f.includes('.test.') &&
      !f.includes('.spec.') &&
      !f.includes('tests/')
    );
  });

  // 1. Graceful Shutdown (DEP-REL-001)
  let shutdownFound = false;
  let shutdownFile = null;

  for (const relPath of codeFiles) {
    const fullPath = path.join(projectDir, relPath);
    try {
      const content = fs.readFileSync(fullPath, 'utf8');
      if (
        content.includes('SIGTERM') ||
        content.includes('SIGINT') ||
        content.includes('gracefulShutdown') ||
        content.includes('server.close(') ||
        content.includes('app.stop(')
      ) {
        shutdownFound = true;
        shutdownFile = relPath;
        break;
      }
    } catch { /* ignore non-critical read/parse error */ }
  }

  if (shutdownFound) {
    findings.push({
      id: 'DEP-REL-001',
      category: 'deployment',
      status: 'PASS',
      severity: 'info',
      title: 'Graceful Process Shutdown Handlers Detected',
      explanation: `Found shutdown signal handling in "${shutdownFile}". Active requests will be allowed to finish during rolling deployments.`,
      evidence: { file: shutdownFile },
      checkMethod: 'static_analysis',
      recommendation: 'Ensure database pools and active sockets are drained with a bounded 15-30s timeout on SIGTERM.',
      manualVerificationRequired: false,
      confidence: 'verified_fact',
    });
  } else {
    findings.push({
      id: 'DEP-REL-001',
      category: 'deployment',
      status: 'WARNING',
      severity: 'high',
      title: 'Missing Graceful Process Shutdown Handlers',
      explanation: 'No SIGTERM or SIGINT handlers detected in application entry points. During rolling updates or pod terminations, in-flight HTTP requests may be dropped abruptly with 502/504 errors.',
      evidence: { file: 'src/' },
      checkMethod: 'static_analysis',
      recommendation: 'Register process.on("SIGTERM", async () => { server.close(); await db.disconnect(); }) in main server file.',
      manualVerificationRequired: false,
      confidence: 'verified_fact',
    });
  }

  // 2. Downstream Network Timeout Enforcement (DEP-REL-002)
  let outboundCallFound = false;
  let hasTimeoutEnforcement = false;
  let outboundFile = null;

  for (const relPath of codeFiles) {
    const fullPath = path.join(projectDir, relPath);
    try {
      const content = fs.readFileSync(fullPath, 'utf8');
      if (content.includes('fetch(') || content.includes('axios.') || content.includes('http.request(')) {
        outboundCallFound = true;
        outboundFile = relPath;
        if (
          content.includes('timeout:') ||
          content.includes('AbortSignal.timeout(') ||
          content.includes('signal:') ||
          content.includes('connectTimeout')
        ) {
          hasTimeoutEnforcement = true;
          break;
        }
      }
    } catch { /* ignore non-critical read/parse error */ }
  }

  if (outboundCallFound) {
    if (hasTimeoutEnforcement) {
      findings.push({
        id: 'DEP-REL-002',
        category: 'deployment',
        status: 'PASS',
        severity: 'info',
        title: 'Downstream HTTP Call Timeouts Enforced',
        explanation: `Outbound network clients in "${outboundFile}" configure explicit timeouts or abort signals.`,
        evidence: { file: outboundFile },
        checkMethod: 'static_analysis',
        recommendation: 'Keep network call timeouts under 5000ms for user-facing API routes.',
        manualVerificationRequired: false,
        confidence: 'verified_fact',
      });
    } else {
      findings.push({
        id: 'DEP-REL-002',
        category: 'deployment',
        status: 'WARNING',
        severity: 'high',
        title: 'Unbounded Outbound Network Request Timeouts',
        explanation: `Outbound HTTP requests detected in "${outboundFile}" without explicit timeout bounds. A slow or hanging downstream service can tie up server connection pools indefinitely.`,
        evidence: { file: outboundFile },
        checkMethod: 'static_analysis',
        recommendation: 'Pass signal: AbortSignal.timeout(3000) or configure client timeout to prevent indefinite socket hangs.',
        manualVerificationRequired: false,
        confidence: 'verified_fact',
      });
    }
  }

  // 3. Database Migration Reversibility (DEP-REL-005)
  const migrationFiles = files.filter((f) => {
    const lower = f.toLowerCase();
    return (
      (lower.includes('migration') || lower.includes('migrations/')) &&
      (lower.endsWith('.sql') || lower.endsWith('.js') || lower.endsWith('.ts'))
    );
  });

  if (migrationFiles.length > 0) {
    let hasDownMigrations = false;
    for (const relPath of migrationFiles) {
      const fullPath = path.join(projectDir, relPath);
      try {
        const content = fs.readFileSync(fullPath, 'utf8');
        if (
          content.includes('down =') ||
          content.includes('exports.down') ||
          content.includes('DROP TABLE') ||
          content.includes('DROP COLUMN') ||
          content.includes('-- Down') ||
          content.includes('def down')
        ) {
          hasDownMigrations = true;
          break;
        }
      } catch { /* ignore non-critical read/parse error */ }
    }

    if (hasDownMigrations) {
      findings.push({
        id: 'DEP-REL-005',
        category: 'database',
        status: 'PASS',
        severity: 'info',
        title: 'Reversible Database Migration Scripts Configured',
        explanation: `Database migration files include automated down/rollback definitions across ${migrationFiles.length} migrations.`,
        evidence: { migrationCount: migrationFiles.length },
        checkMethod: 'static_analysis',
        recommendation: 'Always follow the Expand/Contract pattern for schema changes to support zero-downtime rollbacks.',
        manualVerificationRequired: false,
        confidence: 'verified_fact',
      });
    } else {
      findings.push({
        id: 'DEP-REL-005',
        category: 'database',
        status: 'WARNING',
        severity: 'high',
        title: 'Non-Reversible Database Migrations Detected',
        explanation: 'Database migration files lack automated down/rollback scripts. Failed deployments cannot safely roll back database schema changes.',
        evidence: { migrationCount: migrationFiles.length },
        checkMethod: 'static_analysis',
        recommendation: 'Provide explicit down/rollback scripts or adopt an expand/contract migration protocol.',
        manualVerificationRequired: false,
        confidence: 'verified_fact',
      });
    }
  }

  // 4. Dead Letter Queue & Backlog Handling (DEP-REL-004)
  const isQueueDetected =
    inventory?.detectedTechnologies?.includes('message-queue') ||
    files.some((f) => f.includes('bull') || f.includes('rabbit') || f.includes('sqs') || f.includes('kafka'));

  if (isQueueDetected) {
    let dlqFound = false;
    for (const relPath of codeFiles) {
      const fullPath = path.join(projectDir, relPath);
      try {
        const content = fs.readFileSync(fullPath, 'utf8');
        if (
          content.includes('deadLetterTargetArn') ||
          content.includes('deadLetterQueue') ||
          content.includes('dlq') ||
          content.includes('attempts:') ||
          content.includes('backoff:')
        ) {
          dlqFound = true;
          break;
        }
      } catch { /* ignore non-critical read/parse error */ }
    }

    if (dlqFound) {
      findings.push({
        id: 'DEP-REL-004',
        category: 'deployment',
        status: 'PASS',
        severity: 'info',
        title: 'Queue Poison Message Protection (DLQ / Bounded Retries)',
        explanation: 'Background worker / queue consumer configures Dead Letter Queue or bounded retry policies.',
        evidence: { detected: true },
        checkMethod: 'static_analysis',
        recommendation: 'Monitor DLQ message depth and alert if messages accumulate.',
        manualVerificationRequired: false,
        confidence: 'verified_fact',
      });
    } else {
      findings.push({
        id: 'DEP-REL-004',
        category: 'deployment',
        status: 'WARNING',
        severity: 'high',
        title: 'Missing Dead-Letter Queue (DLQ) Safeguard',
        explanation: 'Message queue consumers detected without explicit Dead-Letter Queue or bounded retry policies. A poison pill message could cause infinite worker crash loops.',
        evidence: { detected: true },
        checkMethod: 'static_analysis',
        recommendation: 'Configure max retries (maxAttempts: 3) and route persistently failing messages to a Dead-Letter Queue.',
        manualVerificationRequired: false,
        confidence: 'verified_fact',
      });
    }
  }

  return findings;
}
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 319kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 319kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 319kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 196kUpdated Claude CodeCodexVerifiedInstall