← Back to Pull requests

Greenfield: Prepopulate direct KRM types, identity, and judgement queue for BackupDRRestoreTemplate #15551

Closed
unknown closed this pull request without merging on Nov 26, 2026 13:48 UTC
View on GitHub
unknown unknown commented on Nov 13, 2026 02:51 UTC
Author

Prepopulates direct KRM types, IdentityV2, reference, and judgement queue for BackupDRRestoreTemplate under backupdr.cnrm.cloud.google.com/v1alpha1 following Greenfield Step 1a (.gemini/skills/kcc-direct-greenfield-types-implementer/prepopulate/SKILL.md).

Summary of Changes


  • Protos & Dependencies: Added google/cloud/backupdr/v1/restore_template.proto and related protos under mockgcp/apis/google/cloud/backupdr/v1/ and wired proto overwrites in dev/tools/controllerbuilder/generate-proto.sh and sourcelinks.go (kccProtoOverrides). Bumped cloud.google.com/go/backupdr to v1.20.0 in go.mod (with replace for genproto) so mapper.generated.go compiles cleanly with pb.RestoreTemplate.

  • Generator Config (apis/backupdr/generate.sh): Added generate-types --prepopulate-resource, generate-identity, and updated generate-mapper --multiversion --prepopulate-resource for BackupDRRestoreTemplate:RestoreTemplate.

  • KRM Types & CRD: Generated initial BackupDRRestoreTemplate types, deepcopy methods, and CRD manifest under config/crds/resources/.

  • Identity & Reference: Emitted canonical BackupDRRestoreTemplateIdentity, BackupDRRestoreTemplateRef, and unit conformance tests.

  • Judgement Queue (apis/backupdr/judgement_queue.yaml): Initialized judgement queue with reason: untriaged-bulk-generation in status: open state for subsequent Step 1b triage.

  • Release Bundle Blocklist (dev/tasks/build-release-bundle): Added BackupDRRestoreTemplate to BLOCKED_KINDS.

  • Exceptions & Journal: Updated tests/apichecks/testdata/exceptions/alpha-missingfields.txt and spec_dislike_etag.txt, and documented service notes in .gemini/journals/backupdr.md.
  • Review Results


    KCC Greenfield Step 1 (Prepopulate) Auto-Review Results


    Trigger criteria matched: Yes
    generate.sh & Flags Check: Pass - Configured generate-types --prepopulate-resource, generate-identity, and generate-mapper --multiversion --prepopulate-resource; no --allow-non-ga-proto used.
    Judgement Queue Open Check: Pass - apis/backupdr/judgement_queue.yaml contains reason: untriaged-bulk-generation with status: open.
    Mechanical Output & Idempotency: Pass - ./apis/backupdr/generate.sh runs idempotently with zero uncommitted diffs.
    Release Bundle Blocklist (BLOCKED_KINDS): Pass - BackupDRRestoreTemplate added to BLOCKED_KINDS in dev/tasks/build-release-bundle.
    Mapper Compilation & apichecks: Pass - packages build cleanly and all tests pass.

    Fixes #15531

    ``release-note
    NONE

    
    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-15531/recipe-fix-20261113-003551-da0e)</sub>
    
    <!-- factory:task-output kind=Change task=recipe-fix-20261113-003551-da0e -->
    
    ---
    
    ### Greenfield: Triage judgement queue and finalize direct KRM types and identity for BackupDRRestoreTemplate
    
    This pull request was generated by an AI coding agent.
    
    Triage `apis/backupdr/judgement_queue.yaml` and finalize direct KRM types, identity, and references for `BackupDRRestoreTemplate` (`backupdr.cnrm.cloud.google.com/v1alpha1`) following Greenfield Step 1b:
    
    - **Parent & Identity**: Replaced separate `projectRef` and `location` fields in `BackupDRRestoreTemplateSpec` with inlined `*parent.ProjectAndLocationRef`. Confirmed CAI URL format against proto `google.api.resource` pattern and resolved `identity-not-in-cai` as `accepted`.
    - **Nested Structs & Resource References**: Moved `BackupSelectionConfig`, `PreRestoreConfig`, `PostRestoreConfig`, and `VerificationConfig` from `types.generated.go` into `backupdrrestoretemplate_types.go`.
    - **BackupDRDataSource Reference**: Created `BackupDRDataSourceIdentity` and `BackupDRDataSourceRef` in `apis/backupdr/v1alpha1/` to support referencing backup data sources (`projects/{project}/locations/{location}/backupVaults/{backupVault}/dataSources/{dataSource}`). Converted `.spec.backupSelectionConfig.dataSource` to `dataSourceRef *BackupDRDataSourceRef`.
    - **Cloud Run Job References**: Converted `cloudRunJob` fields in `PreRestoreConfig`, `PostRestoreConfig`, and `VerificationConfig` to `cloudRunJobRef *runv1beta1.JobRef` referencing `run.googleapis.com/Job`.
    - **Direct Mappers**: Implemented custom `ToProto` mappers in `pkg/controller/direct/backupdr/restoretemplate_mappers.go` to construct proto `oneof` wrappers for `dataSource` and `cloudRunJob`.
    - **Etag & Labels**: Moved `etag` from `Spec` to `ObservedState`. Preserved `Spec.Labels` for greenfield direct resource conventions.
    - **Documentation Links**: Removed unverified REST documentation URL from comments (`verify-resource-docs-link`).
    - **Judgement Queue**: Resolved all 9 entries for `BackupDRRestoreTemplate` in `apis/backupdr/judgement_queue.yaml`.
    - **Exceptions & Artifacts**: Regenerated CRDs, deepcopy, and mappers. Updated `tests/apichecks/testdata/exceptions/naming_violations.txt` and `alpha-missingfields.txt`, and removed `backupdrrestoretemplates` from `spec_dislike_etag.txt`. Documented service notes in `.gemini/journals/backupdr.md`.
    
    Fixes #16512
    
    
    release-note
    NONE
    ``

    Review Instructions

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

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

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: ada-coder-bot Review duration: 19377m
    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 #15551"
    general weight: 0.35
    Reviewers
    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%