← Back to Pull requests

docs(runbooks): pre-deploy amount check uses the pre-migration query #1329

Open
unknown opened this pull request with 359 lines diff across 4 files
View on GitHub
unknown unknown commented on Oct 24, 2026 12:36 UTC
Author

Follow-up to #1297 (#1282), found by the coordinator's independent re-review. The pre-deploy check in docs/runbooks/deploy.md runs before the release's migrations, but its code block joined crove_kernel.currency, which that release creates. The query would therefore fail exactly when an operator runs it. The code block now uses the VND rule that applies before the migration, and the post-migration form (the one the DB test runs) moves to the prose.

Docs only; pnpm docs:check passes. The re-review ran both forms on a freshly migrated database: both are valid and return 0 rows.

🤖 Generated with Claude Code

---

<!-- dos-pr-summary -->

📌 TL;DR


Updates the deployment runbook to clarify that the pre-migration data integrity check must use a hardcoded VND rule because the crove_kernel.currency table does not yet exist. This corrects the SQL query in the documentation to prevent errors during the release process and distinguishes it from the post-migration validation logic.

🎯 Type of Change


  • 🚀 New feature

  • 🐛 Bugfix

  • 🧹 Refactor

  • ⚡ Performance

  • 📚 Documentation

  • ⚙️ CI / Configuration
  • 🔍 Changes Walkthrough


    | File | Summary of Changes |
    | :--- | :--- |
    | docs/runbooks/deploy.md | 1. Clarified Pre-Migration Context: Added a note explaining that crove_kernel.currency is unavailable before the migration runs, necessitating a hardcoded VND check.<br>2. Updated SQL Query: Modified the BEGIN READ ONLY block to remove the JOIN to crove_kernel.tenant and crove_kernel.currency. Replaced the dynamic c.minor_units check with a hardcoded pg_catalog.round(..., 0) (VND has 0 minor units).<br>3. Updated Post-Migration Guidance: Rewrote the subsequent paragraph to explain that the post-migration validation (which uses the dynamic currency join) is what is tested in finance-currency-scale.db.test.ts, rather than implying the pre-migration query should be swapped out manually. |

    📊 Architectural Flow


    flowchart TD
        A[Start Release] --> B{Pre-Migration Check}
        B --> C[Run SQL: Hardcoded VND Rule]
        C --> D{Any Rows Returned?}
        D -- Yes --> E[Fix Data / Abort]
        D -- No --> F[Run Migrations]
        F --> G[Post-Migration State]
        G --> H[Run SQL: Dynamic Currency Rule]
        H --> I[Validation Complete]
    

    <!-- /dos-pr-summary -->

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    Documentation
    Clarified that the pre-deploy journal check uses VND’s zero-decimal rule before migrations.
    * Updated the runbook to describe the currency-aware journal query as the post-migration approach, including its use in the finance currency-scale database test.

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

    Diff: 359 lines (+269 / -90) across 4 files Reviewer: claude[bot] Review duration: 11m
    All Vouch review confidence checks passed
    Residual risk 0.40 = Change Risk (0.71) × (1 − Review Confidence (0.44)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.71 · 359 lines diff across 4 files
    0.71
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    44%
    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.352
    Shallow Review Depth shallow_review_depth
    0.344
    Sensitive Paths sensitive_paths
    0.071
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #1329"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: medium confidence: 44.2% 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: 70.8% (HIGH) · Higher = larger blast radius
    70.8%
    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: 44.2% · Lower = rushed or shallow review
    44.2%
    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: 39.5% · Moderate risk
    39.5%
    Repository