← Back to Pull requests

Greenfield: Implement direct controller, E2E fixtures, and fuzzer for SQLAdminBackup #15972

Closed
unknown closed this pull request without merging on Nov 19, 2026 03:35 UTC
View on GitHub
unknown unknown commented on Nov 18, 2026 00:38 UTC
Author

This pull request implements Greenfield Step 2 direct controller, fuzzer, and E2E fixtures for SQLAdminBackup (sqladmin.cnrm.cloud.google.com/v1alpha1) following .gemini/skills/kcc-direct-controller-logic-greenfield-implementer/SKILL.md:

  • Direct Controller & Fuzzer Generation: Autogenerated pkg/controller/direct/sqladmin/sqladminbackup_controller.go and pkg/controller/direct/sqladmin/sqladminbackup_fuzzer.generated.go via one-shot controllerbuilder generate-controller and generate-fuzzer --prepopulate-resource. Added generate-mapper to apis/sqladmin/generate.sh.

  • Service-Generated Resource IDs: Updated SQLAdminBackup identity (apis/sqladmin/v1alpha1/sqladminbackup_identity.go) to conform to kcc-direct-service-generated-id standards for server-generated timestamp IDs.

  • Reconciler Implementation: Implemented BackupRunAdapter using GAPIC REST clients SqlBackupRunsClient and SqlOperationsClient, resolving instances, polling LROs until completion, and updating status with projects/{project}/backups/{id}.

  • Reconciler Registration: Configured SQLAdminBackup for ReconcilerTypeDirect in pkg/controller/resourceconfig/static_config.go.

  • Fuzzer Verification: Verified 200-seed round-trip fuzzer passes cleanly with FOCUS=SQLAdminBackup go test -v ./pkg/fuzztesting/fuzztests -run TestFocusedMappers.

  • E2E Fixtures & Golden Recording: Added sqladminbackup-minimal and sqladminbackup-maximal fixtures under pkg/test/resourcefixture/testdata/basic/sqladmin/v1alpha1/sqladminbackup/ with SQLInstance dependency and backup configuration enabled. Recorded authentic golden HTTP traffic, generated object goldens, identities, and audit probe markers against real GCP project cnrm-barni-4 using RECORD_AUDIT_PROBE=1 ./hack/record-gcp, with 7/7 automated validation checks passing.

  • Protobuf Validation: Added google.cloud.sql.v1.BackupRun to discardUnknown = true in pkg/test/httplogreport/validator/protovalidate.go for real-GCP fields absent in vendored schemas.

  • Exceptions & Journal: Updated tests/apichecks/testdata/exceptions/alpha-missingfields.txt and recorded service learnings in .gemini/journals/sqladmin.md.
  • Fixes #15956

    ``release-note
    NONE

    
    ## Review Instructions
    
    Use .gemini/skills/reviewgen-greenfield-controller/SKILL.md to conduct the review.
    
    ### Real GCP Recording Details
    - **GCP Project**: `cnrm-barni-4`
    - **Commands**:
      - `RECORD_AUDIT_PROBE=1 ./hack/record-gcp pkg/test/resourcefixture/testdata/basic/sqladmin/v1alpha1/sqladminbackup/sqladminbackup-minimal`
      - `RECORD_AUDIT_PROBE=1 ./hack/record-gcp pkg/test/resourcefixture/testdata/basic/sqladmin/v1alpha1/sqladminbackup/sqladminbackup-maximal`
    
    This pull request was generated by an AI coding agent.
    
    <sub>🤖 [Agent session](https://staging.repoagent.dev/#/overseers/kcc/task-session/fix-k8s-config-connector-15956/recipe-fix-20261117-225404-81e9)</sub>
    
    <!-- factory:task-output kind=Change task=recipe-fix-20261117-225404-81e9 -->
    
    ---
    
    ### Greenfield: Implement MockGCP and Alignment for SQLAdminBackup
    
    Implement Phase 3 (MockGCP and Alignment) for SQLAdminBackup to verify behavioral correctness against simulated GCP services.
    
    Key changes:
    - Added `SqlBackupRunsService` server implementation in `mockgcp/mocksql/sqlbackupruns.go` supporting `Insert`, `Get`, `Delete`, and `List` RPCs.
    - Registered `SqlBackupRunsServiceServer` and gRPC-gateway handler in `mockgcp/mocksql/service.go` with `/v1/projects/` to `/sql/v1beta4/projects/` URL path rewriting.
    - Updated `startLRO` in `mockgcp/mocksql/operations_store.go` to handle `*pb.BackupRun` operation targets.
    - Added `SQLAdminBackup` to `ShouldTestWithMockGCP` in `config/tests/samples/create/harness.go`.
    - Added path normalizers for `enqueuedTime` and `windowStartTime` in `mockgcp/mocksql/normalize.go`.
    - Generated golden mock logs (`_http_mock.log`) for `sqladminbackup-minimal` and `sqladminbackup-maximal` test fixtures.
    
    Fixes #16040
    
    
    release-note
    NONE
    
    This pull request was generated by an AI coding agent.
    
    <!-- factory:group-step issue=16040 -->
    
    ---
    
    ### chore: release `SQLAdminBackup`
    
    This pull request was generated by an AI coding agent.
    
    Release `SQLAdminBackup` (`sqladmin.cnrm.cloud.google.com/v1alpha1`) by removing it from `BLOCKED_KINDS` in `dev/tasks/build-release-bundle` so its CRD ships in the release bundle.
    
    ### Fixture Verification Matrix
    
    | Fixture | Real GCP (`_http.log`) | MockGCP (`_http_mock.log`) | Audit Probe (`_audit_probe.log`) | Alignment Test |
    | :--- | :--- | :--- | :--- | :--- |
    | `sqladminbackup-minimal` | PASS | PASS | PASS | PASS |
    | `sqladminbackup-maximal` | PASS | PASS | PASS | PASS |
    
    ### Verification Summary
    - **Fixture Verification:** Verified all fixtures (`sqladminbackup-minimal` and `sqladminbackup-maximal`) under `pkg/test/resourcefixture/testdata/basic/sqladmin/v1alpha1/sqladminbackup/`.
    - **Evidence:** Confirmed each fixture has authentic real-GCP `_http.log`, `_audit_probe.log`, and aligned `_http_mock.log`.
    - **Log Alignment:** Ran `go test ./pkg/test/resourcefixture -run 'TestGoldenLogAlignment/sqladmin/v1alpha1/sqladminbackup/'`, which passed cleanly with 0 diff.
    - **Static References:** Verified that all test fixtures have no static references; only `${projectId}` and `${uniqueId}` are used.
    - **Blocklist:** Removed `SQLAdminBackup` from `BLOCKED_KINDS` in `dev/tasks/build-release-bundle` with no other entries modified.
    - **Known Limitations:** None.
    
    ### KCC Greenfield Release Auto-Review Results
    * **Only `BLOCKED_KINDS` Changed**: Pass
    * **Fixture Evidence (`_http.log`, `_audit_probe.log`, `_http_mock.log`)**: Pass
    * **Release Note**: Pass
    
    Fixes #16075
    
    
    release-note
    New Alpha Resources (Direct Reconciler):
    SQLAdminBackup
    ``

    Review Instructions

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

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

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: lovelace-coder-bot Review duration: 1617m
    All Vouch review confidence checks passed
    Residual risk 0.25 = Change Risk (0.57) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.57 · 650 lines diff across 8 files
    0.57
    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%
    56%
    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.388
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #15972"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% 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: 57% (MEDIUM) · Higher = larger blast radius
    57%
    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: 56.8% · Lower = rushed or shallow review
    56.8%
    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: 24.7% · Safe to merge
    24.7%