← Back to Pull requests

Run encryption tests in CI with test keys #4335

Closed
unknown closed this pull request without merging on Oct 20, 2026 22:52 UTC
View on GitHub
unknown unknown commented on Oct 20, 2026 09:00 UTC
Author

Problem

Every encryption test skips in CI. They check encryption_ready?, which is only true when the Active Record encryption keys come from ENV or credentials. config/environments/test.rb sets the keys as runtime config only, and the test_unit job sets no ACTIVE_RECORD_ENCRYPTION_* variables. So encrypts declarations, the security:backfill_encryption task and encryption data migrations are never exercised in CI, and a regression in them stays green.

Change

A new step at the end of test_unit sets throwaway keys and reruns every test file that contains encryption_ready? (12 files on current main). Files are selected by grep, so new encryption tests are picked up without a hand-kept list, and the step fails if none are found. It runs with if: ${{ !cancelled() }}, so it still reports when the main test run fails.

Only these files run with keys. Running the whole suite with keys fails in about 185 unrelated tests that assume encryption is off, so that is out of scope here.

Effects

  • test_unit takes about 30 seconds longer. No new job, no app or data changes.

  • Encryption tests in open PRs (for example #3190, #3221, #3510) now actually run.

  • If #3189 lands (encryption_ready? uses ready?), these tests already run in the main step and this step can be removed.
  • Validation

  • CI run with this change: the main step passes as before (12,435 runs, 37 skips), then the encryption step runs the 12 selected files: 174 runs, 0 failures, 0 skips, in about 20 seconds.
  • <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

  • Tests

  • - Added automated coverage for encryption-related functionality in the test workflow.
    - The workflow now detects relevant tests, verifies they exist, and runs them with temporary encryption settings.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 238 lines (+178 / -60) across 2 files Reviewer: jjmata Review duration: 831m
    All Vouch review confidence checks passed
    Residual risk 0.24 = Change Risk (0.60) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.60 · 238 lines diff across 2 files
    0.60
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.328
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.060
    Real PR Conversation Timeline
    1 comments
    "Review active on #4335"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 60.4% (MEDIUM) · Higher = larger blast radius
    60.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 23.9% · Safe to merge
    23.9%