← Back to Pull requests

fix: emit builder form for StorageParameters descriptor (opaque API) #150

Merged
arreyder merged 7 files (70 lines) on Jul 14, 2026 13:36 UTC
View on GitHub
arreyder arreyder commented on Jul 14, 2026 13:09 UTC
Author

Problem

descriptor.tmpl emits an open-struct composite literal for GetStorageParameters():

return &pgdb_v1.MessageOptions_StorageParameters{
    AutovacuumVacuumScaleFactor: proto.Float32(0.01),
}

but pgdb/v1 is generated with default_api_level=API_OPAQUE (buf.gen.yaml), so MessageOptions_StorageParameters has no exported fields — any downstream proto that sets (pgdb.v1.msg).storage_parameters produces generated code that fails to compile:

unknown field AutovacuumVacuumScaleFactor in struct literal of type pgdb_v1.MessageOptions_StorageParameters

Found while adding per-table autovacuum tuning in ductone/c1 — first real use of the option; the example tree never exercised it, which is how this shipped unnoticed.

Fix

Emit the builder form — builder fields take exactly the proto.Int32/Float32/Bool pointers the template already produces, so only the wrapper changes:

return pgdb_v1.MessageOptions_StorageParameters_builder{
    AutovacuumVacuumScaleFactor: proto.Float32(0.01),
}.Build()

Also annotates the Pet example message with storage_parameters (scale factor + threshold + fillfactor) and adds a test pinning the generated descriptor output, so the example tree permanently compiles and exercises this emission.

Testing

  • go build ./... ./example/... — fails before the template fix (with the example annotation present), passes after.

  • New TestPetStorageParameters passes.

  • pgtest-based schema suites need local PG binaries (not available in my environment) — relying on CI for those; schema_sql.go/schema.go runtime behavior is untouched.
  • 🤖 Generated with Claude Code

    Diff: 70 lines (+58 / -12) across 7 files Reviewer: None requested Review duration: 27m
    All Vouch review confidence checks passed
    Residual risk 0.28 = Change Risk (0.49) × (1 − Review Confidence (0.44)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.49 · 70 lines diff across 7 files
    0.49
    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: 10%
    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
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.255
    No Reviewer Assigned no_reviewer_assigned
    0.120
    Real PR Conversation Timeline
    1 comments
    "Review active on #150"
    general weight: 0.35
    Reviewers
    None requested
    Assignees
    arreyder arreyder
    Labels
    risk: low confidence: 44.2% 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: 49.3% (MEDIUM) · Higher = larger blast radius
    49.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: 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: 27.5% · Safe to merge
    27.5%