← Back to Pull requests

pgdb: gate SearchField() and drop fts_data GIN index for no-full-text messages #152

Merged
tthayer merged 11 files (324 lines) on Jul 15, 2026 18:31 UTC
View on GitHub
tthayer tthayer commented on Jul 14, 2026 19:29 UTC
Author

Consolidates the two follow-ups to #148 into one change. #148 stopped creating the fts_data BTREE_GIN index on messages with no direct full-text field; this finishes the job.

Changes

  • SearchField() gate (was #149): the descriptor's SearchField() returns nil for messages with no direct full-text field, so the generic FTS query builder treats them as not-searchable instead of emitting a predicate against an always-NULL fts_data column.
  • Drop existing indexes (was #151): rather than omitting the index for no-full-text messages, emit it flagged IsDropped: true. This is the only mechanism that removes indexes already present on provisioned tables — Migrations() reconciles only indexes named in the descriptor, so an omitted index is invisible to it and lingers forever. With IsDropped:

  • - fresh tables never create it (IndexSchema skips IsDropped entries), and
    - existing tables get DROP INDEX ... CONCURRENTLY.

    Same pattern as the long-standing pksk_split tombstone in getCommonIndexes.

    Verification

  • go build ./..., go vet ./... clean.

  • New descriptor tests pass: TestFTSDataIndexGatedOnFullText (full-text message keeps a live index; no-full-text message emits IsDropped: true) and TestSearchFieldGatedOnFullText (SearchField() non-nil for full-text, nil otherwise).

  • Example models regenerated.
  • Supersedes #149 and #151.

    Diff: 324 lines (+270 / -54) across 11 files Reviewer: loganintech Review duration: 1382m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.52) × (1 − Review Confidence (0.65)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 324 lines diff across 11 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.47 · 1 substantive comment(s)
    0.47
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    64%
    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.346
    Real PR Conversation Timeline
    1 comments
    "Review active on #152"
    general weight: 0.35
    Reviewers
    Assignees
    tthayer tthayer
    Labels
    risk: low confidence: 64.7% reviewed
    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: 52.3% (MEDIUM) · Higher = larger blast radius
    52.3%
    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: 64.7% · Lower = rushed or shallow review
    64.7%
    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: 18.4% · Safe to merge
    18.4%