← Back to Pull requests

Greenfield: Implement direct controller, E2E fixtures, and fuzzer for DataformWorkspace #16695

Closed
unknown closed this pull request without merging on Nov 29, 2026 18:08 UTC
View on GitHub
unknown unknown commented on Nov 29, 2026 10:56 UTC
Author

This pull request was generated by an AI coding agent.

Implement and verify Greenfield Step 2 (direct controller, round-trip fuzzer, and real-GCP recorded E2E fixtures) for DataformWorkspace (dataform.cnrm.cloud.google.com/v1alpha1):

  • Direct Controller & Fuzzer: Verified deterministic direct controller (pkg/controller/direct/dataform/dataformworkspace_controller.go) and round-trip fuzzer (pkg/controller/direct/dataform/dataformworkspace_fuzzer.generated.go). The controller normalizes greenfield references via common.NormalizeGreenfieldReferences in AdapterForObject, resolves identity via obj.GetIdentity, initializes the GAPIC REST client with RESTClientOptions(), and enforces immutable resource semantics via common.CompareGreenfieldSpec and structuredreporting.ReportDiff (as the GCP Dataform API does not provide an UpdateWorkspace method).

  • Fuzzer Verification: Verified round-trip fuzzer passes with 200 random seeds (FOCUS=DataformWorkspace go test -v ./pkg/fuzztesting/fuzztests -run TestFocusedMappers).

  • Proto Overlay: Pinned Google APIs commit in apis/git.versions lacks Workspace.disable_moves, which real GCP returns in Create and Get response bodies. Added dataform v1 proto overlay to mockgcp/apis/google/cloud/dataform/v1/ and registered it in dev/tools/controllerbuilder/generate-proto.sh so .build/googleapis.pb includes disable_moves, resolving V7 validation during E2E record.

  • E2E Test Fixtures: Created minimal (dataformworkspace-minimal) and maximal (dataformworkspace-maximal) fixtures under pkg/test/resourcefixture/testdata/basic/dataform/v1alpha1/dataformworkspace/ referencing DataformRepository in dependencies.yaml. update.yaml is omitted per greenfield guidelines as Workspaces are immutable in GCP.

  • Authentic Real GCP Golden Logs: Recorded authentic HTTP logs (_http.log), golden generated objects, identities, and audit probes (_audit_probe.log) against real GCP project cnrm-barni-4 using RECORD_AUDIT_PROBE=1 ./hack/record-gcp. Re-reconciliation testing succeeds cleanly and all 7/7 HTTP lifecycle checks pass.

  • Field Presence Tracking: Updated tests/apichecks/testdata/exceptions/alpha-missingfields.txt via TestCRDFieldPresenceInTestsForAlpha.

  • Service Journal: Documented findings and API quirks in .gemini/journals/dataform.md.
  • Fixes #16687

    ``release-note
    NONE

    
    ## Real-GCP Verification & Audit Logs
    Recorded in GCP project `cnrm-barni-4`:
    
    yaml
    ---
    insertId: 18ghqgwe1ms1m
    logName: projects/cnrm-barni-4/logs/cloudaudit.googleapis.com%2Factivity
    protoPayload:
    '@type': type.googleapis.com/google.cloud.audit.AuditLog
    authenticationInfo:
    principalEmail: overseer-kcc-tester@cnrm-barni-4.iam.gserviceaccount.com
    authorizationInfo:
    - granted: true
    permission: dataform.workspaces.delete
    permissionType: ADMIN_WRITE
    resource: projects/600845353393/locations/us-central1/repositories/dfrepo-biuk45obk7e7guy/workspaces/dfworkspace-biuk45obk7e7guy
    methodName: google.cloud.dataform.v1.Dataform.DeleteWorkspace
    resourceName: projects/cnrm-barni-4/locations/us-central1/repositories/dfrepo-biuk45obk7e7guy/workspaces/dfworkspace-biuk45obk7e7guy
    serviceName: dataform.googleapis.com
    timestamp: '2026-11-29T10:31:09.742900196Z'
    ---
    insertId: 1v7jb6xe15jw0
    logName: projects/cnrm-barni-4/logs/cloudaudit.googleapis.com%2Factivity
    protoPayload:
    '@type': type.googleapis.com/google.cloud.audit.AuditLog
    authenticationInfo:
    principalEmail: overseer-kcc-tester@cnrm-barni-4.iam.gserviceaccount.com
    authorizationInfo:
    - granted: true
    permission: dataform.workspaces.create
    permissionType: ADMIN_WRITE
    resource: projects/600845353393/locations/us-central1/repositories/dfrepo-biuk45obk7e7guy/workspaces/dfworkspace-biuk45obk7e7guy
    methodName: google.cloud.dataform.v1.Dataform.CreateWorkspace
    resourceName: projects/cnrm-barni-4/locations/us-central1/repositories/dfrepo-biuk45obk7e7guy/workspaces/dfworkspace-biuk45obk7e7guy
    serviceName: dataform.googleapis.com
    timestamp: '2026-11-29T10:31:07.129698907Z'
    
    ## 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 - (Confirmed judgement_queue.yaml is resolved, generate.sh does not invoke generate-controller / generate-fuzzer for DataformWorkspace, controller carries // +generated:controller, fuzzer carries // +generated:fuzzer, static_config.go is updated, and DataformWorkspace is still in BLOCKED_KINDS)
    * **Client Creation & Reference Normalization**: Pass - (Confirmed GAPIC REST client and common.NormalizeGreenfieldReferences in AdapterForObject)
    * **CompareGreenfieldSpec & Structured Reporting**: Pass - (Confirmed common.CompareGreenfieldSpec and structuredreporting.ReportDiff are used in Update to enforce immutability)
    * **LRO Wait & Mandatory Status Updates**: Pass - (Confirmed synchronous Workspace methods and updateOp.UpdateStatus on no-op re-reconciliation and status refreshes)
    * **Fuzzer & Real-GCP Test Coverage**: Pass - (Confirmed dataformworkspace_fuzzer.generated.go, minimal/maximal fixtures with authentic real-GCP _http.log & _audit_probe.log, parentRef modeled and tested, and ratcheting enabled)
    
    #### 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-16687/recipe-fix-20261129-100217-b574)</sub>
    
    <!-- factory:task-output kind=Change task=recipe-fix-20261129-100217-b574 -->
    
    ---
    
    ### Greenfield: Implement MockGCP and Alignment for DataformWorkspace
    
    This pull request was generated by an AI coding agent.
    
    Implement MockGCP service handlers and align HTTP golden logs for `DataformWorkspace` (`dataform.cnrm.cloud.google.com/v1alpha1`) following Greenfield Step 3:
    
    - **Proto Integration**: Updated `mockgcp/apply-proto-patches.sh` to copy the `apis/google/cloud/dataform/v1/*` proto overlay into `third_party/googleapis/google/cloud/dataform/v1/` prior to compilation, added idempotency checks for `TeamFolder` patching, and updated `mockgcp/Makefile` to reference `apis/google/cloud/dataform/v1/*.proto`. Generated MockGCP protobufs now include `Workspace.disable_moves` and `PrivateResourceMetadata`.
    - **Mock Implementation**: Implemented `GetWorkspace`, `CreateWorkspace`, `DeleteWorkspace`, and `ListWorkspaces` in `mockgcp/mockdataform/workspace.go`. Enforced parent `Repository` validation (returning 404 when missing), defaulted `disableMoves` to `false` when unset, populated `privateResourceMetadata.userScoped = true`, and supplied deterministic `internalMetadata` matching real GCP `observedState`.
    - **Mock Harness Support**: Added `DataformWorkspace` to the mock-supported kinds list in `config/tests/samples/create/harness.go`.
    - **Golden Log Alignment**: Generated authentic `_http_mock.log` files for both minimal and maximal fixtures under `pkg/test/resourcefixture/testdata/basic/dataform/v1alpha1/dataformworkspace/` with zero discrepancies across all CRUD requests, passing `TestGoldenLogAlignment` and `dev/ci/presubmits/tests-e2e-fixtures-suite dataform`.
    - **Service Journal**: Documented MockGCP learnings in `.gemini/journals/dataform.md`.
    
    Fixes #16703
    
    
    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 and alignment requirements are satisfied.
    
    <!-- factory:group-step issue=16703 -->
    
    ---
    
    ### Greenfield: Release DataformWorkspace (remove it from BLOCKED_KINDS)
    
    This pull request was generated by an AI coding agent.
    
    Release `DataformWorkspace` by removing it from `BLOCKED_KINDS` in `dev/tasks/build-release-bundle`.
    
    All prerequisites and prior Greenfield steps for `DataformWorkspace` are complete:
    - Direct KRM types, identity, reference, and CRD generated and finalized.
    - Direct controller, fuzzer, and minimal/maximal E2E fixtures implemented.
    - Verified all fixtures under `pkg/test/resourcefixture/testdata/basic/dataform/v1alpha1/dataformworkspace/` have authentic real-GCP `_http.log`, `_audit_probe.log`, and `_http_mock.log`.
    - MockGCP CRUD methods implemented and verified; mock E2E fixtures pass cleanly with zero discrepancies.
    - DataformWorkspace is ready to ship in the release bundle.
    
    Fixes #16724
    
    
    release-note
    New Alpha Resources (Direct Reconciler):
    DataformWorkspace
    `

    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 step criteria and invariants are satisfied.

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

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: reviewbot-robot Review duration: 432m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    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%
    60%
    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
    Real PR Conversation Timeline
    1 comments
    "Review active on #16695"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% 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: 52% (MEDIUM) · Higher = larger blast radius
    52%
    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: 60.5% · Lower = rushed or shallow review
    60.5%
    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: 20.5% · Safe to merge
    20.5%