← Back to Pull requests

Greenfield: Implement direct controller, E2E fixtures, and fuzzer for DatabaseMigrationPrivateConnection #16818

Open
unknown opened this pull request with 569 lines diff across 7 files
View on GitHub
unknown unknown commented on Nov 30, 2026 06:56 UTC
Author

This pull request was generated by an AI coding agent.

Implement Greenfield Phase 2 (direct controller, fuzzer, and E2E fixtures) for DatabaseMigrationPrivateConnection (datamigration.cnrm.cloud.google.com/v1alpha1):

  • Controller Logic:

  • - Generated direct controller using controllerbuilder generate-controller --prepopulate-resource.
    - Used cloud.google.com/go/clouddms/apiv1 gRPC client options (NewDataMigrationClient with m.config.GRPCClientOptions()).
    - Normalized references before resolving identity using common.NormalizeGreenfieldReferences(ctx, reader, obj, nil).
    - Handled immutability via common.CompareGreenfieldSpec: since GCP DMS API does not support UpdatePrivateConnection, spec changes are rejected with structured reporting and no-op reconciles refresh status.
    - Waited on long-running operations in Create and Delete using standard op.Wait(ctx).
  • Custom Mappers:

  • - Handled VpcPeeringConfig mapping in pkg/controller/direct/datamigration/databasemigrationprivateconnection_mapper.go, resolving the VpcNameRef computerefs.ComputeNetworkRef reference field and near-miss casing.
    - Added --skip-proto PrivateConnection,VpcPeeringConfig to generate-mapper in apis/datamigration/generate.sh.
  • Fuzzer:

  • - Configured and registered round-trip fuzzer in pkg/controller/direct/datamigration/databasemigrationprivateconnection_fuzzer.generated.go.
    - Verified passing status with FOCUS=DatabaseMigrationPrivateConnection go test ./pkg/fuzztesting/fuzztests -run TestFocusedMappers.
  • Static Config:

  • - Updated pkg/controller/resourceconfig/static_config.go via python3 dev/tasks/generate_static_config.py.
  • E2E Fixtures:

  • - Created databasemigrationprivateconnection-minimal and databasemigrationprivateconnection-maximal fixtures covering all declared spec fields.
    - Recorded against real GCP project cnrm-barni-4 using RECORD_AUDIT_PROBE=1 ./hack/record-gcp.
    - Generated authentic _http.log, _audit_probe.log, and golden status files; all 7 validation checks in _http_report.md passed for both fixtures.
  • Journal:

  • - Documented service-specific implementation details in .gemini/journals/datamigration.md.

    Fixes #16802

    ``release-note
    NONE

    
    ## Review Instructions
    
    Use .gemini/skills/reviewgen-greenfield-controller/SKILL.md to conduct the review.
    
    ### KCC Greenfield Controller Auto-Review Results
    * **Trigger criteria matched**: Yes
    * **Post-Judgement, One-Shot Generation, & `static_config.go`**: Pass
    * **Client Creation & Reference Normalization**: Pass
    * **CompareGreenfieldSpec & Structured Reporting**: Pass
    * **LRO Wait & Mandatory Status Updates**: Pass
    * **Fuzzer & Real-GCP Test Coverage**: Pass
    
    #### Detailed Findings / Actions Required:
    None. All Greenfield Step 2 direct controller, fuzzer, and E2E fixture criteria and invariants are satisfied.
    
    <sub>🤖 [Agent session](https://staging.repoagent.dev/#/overseers/kcc/task-session/fix-k8s-config-connector-16802/recipe-fix-20261130-041557-e797)</sub>
    
    <!-- factory:task-output kind=Change task=recipe-fix-20261130-041557-e797 -->
    
    ---
    
    ### Greenfield: Implement MockGCP and Alignment for DatabaseMigrationPrivateConnection
    
    Implement Phase 3 (MockGCP and Alignment) for DatabaseMigrationPrivateConnection (`datamigration.cnrm.cloud.google.com/v1alpha1`):
    
    - Implemented `GetPrivateConnection`, `CreatePrivateConnection`, `DeletePrivateConnection`, and `ListPrivateConnections` in `mockgcp/mockclouddms/privateconnection.go`.
    - Added `DatabaseMigrationPrivateConnection` to supported MockGCP GroupKinds in `config/tests/samples/create/harness.go`.
    - Generated `_http_mock.log` for both `databasemigrationprivateconnection-minimal` and `databasemigrationprivateconnection-maximal` fixtures and verified golden log alignment.
    - Verified that all `datamigration` fixtures pass via `./dev/ci/presubmits/tests-e2e-fixtures-suite datamigration`.
    
    This pull request was generated by an AI coding agent.
    
    Fixes #16825
    
    
    release-note
    NONE
    `

    Review Instructions

    Use .gemini/skills/reviewgen-greenfield-mockgcp/SKILL.md to conduct the review.

    KCC Greenfield MockGCP (Step 3/4) Auto-Review Results


    Step: 3 (MockGCP)
    Real-GCP Baseline Untouched: Pass
    Mock Service & CRUD (Step 3) / Fix Quality (Step 4): Pass
    Golden Log Alignment & CI Fixtures: Pass
    Normalizer Scoping: Pass
  • Scope, Exceptions & BLOCKED_KINDS`: Pass
  • Detailed Findings / Actions Required:


    None. All checks passed.

    <!-- factory:group-step issue=16825 -->

    Diff: 569 lines (+426 / -143) across 7 files Reviewer: reviewbot-robot Review duration: 588m
    All Vouch review confidence checks passed
    Residual risk 0.39 = Change Risk (0.73) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.73 · 569 lines diff across 7 files
    0.73
    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%
    46%
    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.380
    Shallow Review Depth shallow_review_depth
    0.344
    Sensitive Paths sensitive_paths
    0.073
    Real PR Conversation Timeline
    1 comments
    "Review active on #16818"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: medium confidence: 46.7% 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: 72.9% (HIGH) · Higher = larger blast radius
    72.9%
    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: 46.7% · Lower = rushed or shallow review
    46.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: 38.9% · Moderate risk
    38.9%