← Back to Pull requests

Greenfield: Implement direct controller, E2E fixtures, and fuzzer for DataMigrationMappingRule #16775

Closed
unknown closed this pull request without merging on Nov 30, 2026 15:25 UTC
View on GitHub
unknown unknown commented on Nov 30, 2026 00:20 UTC
Author

This pull request was generated by an AI coding agent.

Summary of Changes

Implements Greenfield Step 2 direct controller verification, round-trip fuzzer, and real-GCP recorded E2E fixtures for DataMigrationMappingRule (datamigration.cnrm.cloud.google.com/v1alpha1):

1. Direct Controller & Fuzzer:
- Verified direct controller pkg/controller/direct/datamigration/datamigrationmappingrule_controller.go adhering to canonical Greenfield standards.
- Called common.NormalizeGreenfieldReferences in AdapterForObject.
- Handled immutability in Update (since Cloud DMS does not support an UpdateMappingRule RPC, the controller rejects spec changes with diff reporting while supporting idempotent re-reconciliation without mutating GCP).
- Verified round-trip fuzzer pkg/controller/direct/datamigration/datamigrationmappingrule_fuzzer.generated.go, passing FOCUS=DataMigrationMappingRule go test -v ./pkg/fuzztesting/fuzztests -run TestFocusedMappers.

2. E2E Fixtures & Real-GCP Recordings:
- Created minimal (datamigrationmappingrule-minimal) and maximal (datamigrationmappingrule-maximal) fixtures with DatabaseMigrationConversionWorkspace dependencies.
- Recorded golden HTTP logs (_http.log) and audit probe logs (_audit_probe.log) against real GCP project cnrm-barni-4, passing all 7/7 automated lifecycle validation checks.
- Configured state: ENABLED on both fixtures to satisfy the GCP Cloud DMS API requirement (ResourceState cannot be unspecified).

3. Exceptions & Journal:
- Updated tests/apichecks/testdata/exceptions/alpha-missingfields.txt.
- Documented service behavior and findings in .gemini/journals/datamigration.md.

Fixes #16762

``release-note
NONE


## Review Instructions

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

<sub>🤖 [Agent session](https://staging.repoagent.dev/#/overseers/kcc/task-session/fix-k8s-config-connector-16762/recipe-fix-20261129-231104-1a0b)</sub>

<!-- factory:task-output kind=Change task=recipe-fix-20261129-231104-1a0b -->

---

### Greenfield: Implement MockGCP and Alignment for DataMigrationMappingRule

This pull request was generated by an AI coding agent.

Implement Phase 3 (MockGCP and Alignment) for `DataMigrationMappingRule` (`datamigration.cnrm.cloud.google.com/v1alpha1`) following Greenfield Step 3:

1. **Mock Service Implementation**:
- Implemented `MappingRule` CRUD RPCs (`GetMappingRule`, `CreateMappingRule`, `DeleteMappingRule`, `ListMappingRules`) in `mockgcp/mockclouddms/mappingrule.go`.
- Added validation in `CreateMappingRule` and `ListMappingRules` verifying parent `ConversionWorkspace` exists in storage.
- Handled GCP-specific behavior where `MappingRule` response omits `name`.
- Handled mock behavior where creating a mapping rule updates parent `ConversionWorkspace` (`hasUncommittedChanges: true` and `has_rules`).
- Handled canonical GCP error response on `DeleteMappingRule` returning NOT_FOUND while removing the object from storage.
- Added normalization for `revisionCreateTime` and `revisionId` in `mockgcp/mockclouddms/normalize.go`.

2. **Test Harness & Fixtures**:
- Registered `DataMigrationMappingRule` in `config/tests/samples/create/harness.go` under `MaybeSkip`.
- Generated `_http_mock.log` for `datamigrationmappingrule-minimal` and `datamigrationmappingrule-maximal` fixtures.
- Verified all tests in `./dev/ci/presubmits/tests-e2e-fixtures-suite datamigration` and `TestGoldenLogAlignment` pass cleanly with zero discrepancies.

3. **Learnings & Service Behaviors**:
- Documented mock service behaviors and learnings in `.gemini/journals/datamigration.md`.

Fixes #16789

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 Greenfield Step 3 MockGCP implementation and alignment criteria and invariants are satisfied.

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

---

### Greenfield: Release DataMigrationMappingRule (remove it from BLOCKED_KINDS)

This pull request was generated by an AI coding agent.

Release `DataMigrationMappingRule` by removing it from `BLOCKED_KINDS` in `dev/tasks/build-release-bundle`.

Verified that every fixture for `DataMigrationMappingRule` under `pkg/test/resourcefixture/testdata/basic/` (`datamigrationmappingrule-minimal` and `datamigrationmappingrule-maximal`) has `_http.log`, `_audit_probe.log`, and `_http_mock.log`, and all golden log alignment and E2E mock tests pass.

Fixes #16830

release-note
New Alpha Resources (Direct Reconciler):
DataMigrationMappingRule
`

Review Instructions

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

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
  • Detailed Findings / Actions Required:


    None. All Greenfield Release criteria are satisfied.

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

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: reviewbot-robot Review duration: 905m
    All Vouch review confidence checks passed
    Residual risk 0.33 = Change Risk (0.75) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.75 · 650 lines diff across 8 files
    0.75
    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
    Sensitive Paths sensitive_paths
    0.075
    Real PR Conversation Timeline
    1 comments
    "Review active on #16775"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% 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: 75.2% (HIGH) · Higher = larger blast radius
    75.2%
    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: 32.5% · Safe to merge
    32.5%