← Back to Pull requests

Greenfield: Implement direct controller, E2E fixtures, and fuzzer for DialogflowCompanionAgent #15470

Closed
unknown closed this pull request without merging on Nov 18, 2026 21:16 UTC
View on GitHub
unknown unknown commented on Nov 12, 2026 06:23 UTC
Author

Implements the direct controller, mappers, round-trip fuzzer, and minimal/maximal E2E fixtures for DialogflowCompanionAgent (dialogflow.cnrm.cloud.google.com/v1alpha1).

Key Changes


  • Upgraded cloud.google.com/go/dialogflow to v1.87.0 across root and mockgcp modules to introduce CompanionAgentsClient support.

  • Implemented direct controller adapter in pkg/controller/direct/dialogflow/dialogflowcompanionagent_controller.go using GAPIC REST client options.

  • Isolated Dialogflow v2 mappers in pkg/controller/direct/dialogflow/dialogflowcompanionagent_mapper.go to prevent colliding with Dialogflow CX v3 mappers in mapper.generated.go.

  • Generated round-trip fuzzer in pkg/controller/direct/dialogflow/dialogflowcompanionagent_fuzzer.generated.go, verified across 200 random seeds for both Spec and Status.

  • Registered DialogflowCompanionAgent as a Direct reconciler in pkg/controller/resourceconfig/static_config.go.

  • Created minimal and maximal E2E fixtures under pkg/test/resourcefixture/testdata/basic/dialogflow/v1alpha1/dialogflowcompanionagent/ and recorded authentic golden HTTP logs, objects, and audit probe markers against real GCP in project cnrm-barni-4 (location global), passing all 7/7 HTTP lifecycle checks.

  • Updated tests/apichecks/testdata/exceptions/alpha-missingfields.txt to remove covered spec fields.

  • Added service-specific learnings to .gemini/journals/dialogflow.md.
  • Workflow Feedback


  • When a service packages both v2 and cx/v3 APIs within the same package directory (pkg/controller/direct/dialogflow/), isolating mappers in <kind_lower>_mapper.go maintains clean type separation and conforms to TestDirectResourceFileNaming.
  • Real GCP Audit Logs


  • Project: cnrm-barni-4

  • Fresh Audit Logs (gcloud logging read 'logName:"audit" AND "dialogflow"' --freshness=3h --limit=50):

  • ---
    insertId: fjwgwgf3u961h
    jsonPayload:
      event: RESOURCE_ACTUATED_AND_VERIFIED
      gvk: dialogflow.cnrm.cloud.google.com/v1alpha1, Kind=DialogflowCompanionAgent
      namespace: 62ptn7f53po67ty
      probedUrls:
      - https://dialogflow.googleapis.com/v2/projects/cnrm-barni-4/locations/global/companionAgents/dialogflowcompanionagent-max-62ptn7f53po67ty?%24alt=json%3Benum-encoding%3Dint
      resourceName: dialogflowcompanionagent-max-62ptn7f53po67ty
      testKey: basic/dialogflow/v1alpha1/dialogflowcompanionagent/dialogflowcompanionagent-maximal
      timestamp: '2026-11-12T05:00:29Z'
      traceIds: null
    logName: projects/cnrm-barni-4/logs/kcc-e2e-actuation-audit
    receiveTimestamp: '2026-11-12T05:00:29.314286545Z'
    resource:
      labels:
        project_id: cnrm-barni-4
      type: global
    timestamp: '2026-11-12T05:00:29.314286545Z'
    ---
    insertId: ukdzhff70hizk
    jsonPayload:
      event: RESOURCE_ACTUATED_AND_VERIFIED
      gvk: dialogflow.cnrm.cloud.google.com/v1alpha1, Kind=DialogflowCompanionAgent
      namespace: bs5rozwfhqqdbma
      probedUrls:
      - https://dialogflow.googleapis.com/v2/projects/cnrm-barni-4/locations/global/companionAgents/dialogflowcompanionagent-min-bs5rozwfhqqdbma?%24alt=json%3Benum-encoding%3Dint
      resourceName: dialogflowcompanionagent-min-bs5rozwfhqqdbma
      testKey: basic/dialogflow/v1alpha1/dialogflowcompanionagent/dialogflowcompanionagent-minimal
      timestamp: '2026-11-12T04:59:05Z'
      traceIds: null
    logName: projects/cnrm-barni-4/logs/kcc-e2e-actuation-audit
    receiveTimestamp: '2026-11-12T04:59:06.030476454Z'
    resource:
      labels:
        project_id: cnrm-barni-4
      type: global
    timestamp: '2026-11-12T04:59:06.030476454Z'
    

    Fixes #15457

    ``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-15457/recipe-fix-20261112-035812-b730)</sub>
    
    <!-- factory:task-output kind=Change task=recipe-fix-20261112-035812-b730 -->
    
    ---
    
    ### Greenfield: Implement MockGCP and Alignment for DialogflowCompanionAgent
    
    Implement MockGCP support and align mock HTTP logs with real GCP for `DialogflowCompanionAgent` (`dialogflow.cnrm.cloud.google.com/v1alpha1`).
    
    Key changes:
    - Implement `CompanionAgentsServer` in `mockgcp/mockdialogflow/companionagent.go` supporting Create, Get, Update, Delete, and List RPCs.
    - Register companion agents gRPC service and REST HTTP gateway handlers in `mockgcp/mockdialogflow/service.go`.
    - Add `DialogflowCompanionAgent` to the mock GCP support list in `config/tests/samples/create/harness.go`.
    - Generate `_http_mock.log` for both `dialogflowcompanionagent-minimal` and `dialogflowcompanionagent-maximal` test fixtures with 100% golden log alignment.
    - Validate with `TestGoldenLogAlignment` and `./dev/ci/presubmits/tests-e2e-fixtures-suite dialogflow`.
    
    Fixes #15484
    
    
    release-note
    NONE
    
    This pull request was generated by an AI coding agent.
    
    <!-- factory:group-step issue=15484 -->
    
    ---
    
    ### Greenfield: Release DialogflowCompanionAgent (remove it from BLOCKED_KINDS)
    
    Removes `DialogflowCompanionAgent` from `BLOCKED_KINDS` in `dev/tasks/build-release-bundle` so its CRD ships in the release bundle.
    
    All test fixtures under `pkg/test/resourcefixture/testdata/basic/dialogflow/v1alpha1/dialogflowcompanionagent/` (`dialogflowcompanionagent-minimal` and `dialogflowcompanionagent-maximal`) have been verified to have authentic real-GCP HTTP logs (`_http.log`), audit probe logs (`_audit_probe.log`), and mock golden logs (`_http_mock.log`).
    
    Fixes #15488
    
    
    release-note
    New Alpha Resources (Direct Reconciler):
    DialogflowCompanionAgent
    `

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

    This pull request was generated by an AI coding agent.

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

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