← Back to Pull requests

Greenfield: Implement direct controller, E2E fixtures, and fuzzer for CCInsightsQAQuestion #16780

Closed
unknown closed this pull request without merging on Nov 30, 2026 13:06 UTC
View on GitHub
unknown unknown commented on Nov 30, 2026 01:10 UTC
Author

This pull request was generated by an AI coding agent.

Summary of Changes

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

  • Handled server-generated ID: Contact Center Insights ignores client-provided question IDs on creation and unconditionally assigns an internal numeric ID. Configured ResourceID as server-generated, generated identity.ServerGeneratedIdentity, guarded Find() with !a.id.HasIdentitySpecified(), and populated status.ExternalRef from the created resource name using the spec's project ID.

  • Implemented custom mapper functions in ccinsightsqaquestion_mapper.go for QaQuestion_AnswerChoice to preserve oneof variants (boolValue, strValue, numValue, naValue) without zero-value loss, enabling full round-trip fuzzing across all answer choice types.

  • Created minimal and maximal E2E fixtures with parent dependencies (CCInsightsQAScorecard and CCInsightsQAScorecardRevision), create.yaml, and update.yaml.

  • Added normalization for server-generated scorecard revision IDs, QA question IDs, and unmodeled .questionType responses.

  • Recorded authentic real-GCP golden HTTP logs (_http.log) and verified all 7 HTTP validation checks pass cleanly.

  • Updated tests/apichecks/testdata/exceptions/alpha-missingfields.txt via TestCRDFieldPresenceInTestsForAlpha.

  • Documented findings in .gemini/journals/contactcenterinsights.md.
  • Fixes #16754

    ``release-note
    NONE

    
    ## Real-GCP Verification & Audit Logs
    Recorded in GCP project `cnrm-barni-4`:
    
    yaml
    ---
    insertId: egi0hkfluogk4
    jsonPayload:
    event: RESOURCE_ACTUATED_AND_VERIFIED
    gvk: contactcenterinsights.cnrm.cloud.google.com/v1alpha1, Kind=CCInsightsQaQuestion
    namespace: 3dbeobyf4iz5lfq
    probedUrls:
    - https://contactcenterinsights.googleapis.com/v1/projects/cnrm-barni-4/locations/us-central1/qaScorecards/scorecard-max-3dbeobyf4iz5lfq?%24alt=json%3Benum-encoding%3Dint
    - https://contactcenterinsights.googleapis.com/v1/projects/cnrm-barni-4/locations/us-central1/qaScorecards/scorecard-max-3dbeobyf4iz5lfq/revisions/rev-max-3dbeobyf4iz5lfq?%24alt=json%3Benum-encoding%3Dint
    - https://contactcenterinsights.googleapis.com/v1/projects/cnrm-barni-4/locations/us-central1/qaScorecards/scorecard-max-3dbeobyf4iz5lfq/revisions?%24alt=json%3Benum-encoding%3Dint
    - https://contactcenterinsights.googleapis.com/v1/projects/cnrm-barni-4/locations/us-central1/qaScorecards/scorecard-max-3dbeobyf4iz5lfq/revisions/rev-max-3dbeobyf4iz5lfq/qaQuestions/8666230126757011491?%24alt=json%3Benum-encoding%3Dint
    resourceName: qaquestion-max-3dbeobyf4iz5lfq
    testKey: basic/contactcenterinsights/v1alpha1/ccinsightsqaquestion/ccinsightsqaquestion-maximal
    timestamp: '2026-11-30T00:34:32Z'
    logName: projects/cnrm-barni-4/logs/kcc-e2e-actuation-audit
    ---
    insertId: 1nf7dv4f8xwqma
    jsonPayload:
    event: RESOURCE_ACTUATED_AND_VERIFIED
    gvk: contactcenterinsights.cnrm.cloud.google.com/v1alpha1, Kind=CCInsightsQaQuestion
    namespace: ultifglpolgnepi
    probedUrls:
    - https://contactcenterinsights.googleapis.com/v1/projects/cnrm-barni-4/locations/us-central1/qaScorecards/scorecard-min-ultifglpolgnepi?%24alt=json%3Benum-encoding%3Dint
    - https://contactcenterinsights.googleapis.com/v1/projects/cnrm-barni-4/locations/us-central1/qaScorecards/scorecard-min-ultifglpolgnepi/revisions/rev-min-ultifglpolgnepi?%24alt=json%3Benum-encoding%3Dint
    - https://contactcenterinsights.googleapis.com/v1/projects/cnrm-barni-4/locations/us-central1/qaScorecards/scorecard-min-ultifglpolgnepi/revisions?%24alt=json%3Benum-encoding%3Dint
    - https://contactcenterinsights.googleapis.com/v1/projects/cnrm-barni-4/locations/us-central1/qaScorecards/scorecard-min-ultifglpolgnepi/revisions/rev-min-ultifglpolgnepi/qaQuestions/13800312923705197966?%24alt=json%3Benum-encoding%3Dint
    resourceName: qaquestion-min-ultifglpolgnepi
    testKey: basic/contactcenterinsights/v1alpha1/ccinsightsqaquestion/ccinsightsqaquestion-minimal
    timestamp: '2026-11-30T00:22:12Z'
    logName: projects/cnrm-barni-4/logs/kcc-e2e-actuation-audit
    
    ## 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 - (Step 1b resolved, no generator commands added to `generate.sh`, controller has `// +generated:controller`, fuzzer has `// +generated:fuzzer`, `static_config.go` maps CCInsightsQaQuestion to Direct, and kind remains blocked)
    * **Client Creation & Reference Normalization**: Pass - (REST client configured, `common.NormalizeGreenfieldReferences` called in `AdapterForObject`)
    * **CompareGreenfieldSpec & Structured Reporting**: Pass - (Desired vs actual verified with `common.CompareGreenfieldSpec`; structured reporting in place)
    * **LRO Wait & Mandatory Status Updates**: Pass - (Non-LRO endpoints handle create/update/delete directly, status updated on creation, refresh, and no-op reconciles)
    * **Fuzzer & Real-GCP Test Coverage**: Pass - (Round-trip mapper fuzzer verified with 200 seeds, minimal and maximal fixtures pass real-GCP recording with 7/7 HTTP checks passing)
    
    #### Detailed Findings / Actions Required:
    None. All Greenfield Step 2 criteria and invariants are satisfied.
    
    <sub>🤖 [Agent session](https://staging.repoagent.dev/#/overseers/kcc/task-session/fix-k8s-config-connector-16754/recipe-fix-20261129-221101-d3fc)</sub>
    
    <!-- factory:task-output kind=Change task=recipe-fix-20261129-221101-d3fc -->
    
    ---
    
    ### Greenfield: Implement MockGCP and Alignment for CCInsightsQAQuestion
    
    This pull request was generated by an AI coding agent.
    
    Implements Greenfield Step 3 (MockGCP and Alignment) for `CCInsightsQaQuestion` (`contactcenterinsights.cnrm.cloud.google.com/v1alpha1`):
    - Implemented `ContactCenterInsightsServer` CRUD RPCs for QA questions in `mockgcp/mockcontactcenterinsights/ccinsightsqaquestion.go` (`GetQaQuestion`, `CreateQaQuestion`, `UpdateQaQuestion`, `DeleteQaQuestion`, `ListQaQuestions`).
    - Modeled server-generated ID generation for mock QA questions using deterministic hashing, matching Contact Center Insights behavior.
    - Added QA question resource path parsing in `mockgcp/mockcontactcenterinsights/names.go`.
    - Added dynamic `/qaQuestions/` numeric ID replacement to `${qaQuestionId}` in `mockgcp/mockcontactcenterinsights/normalize.go`.
    - Allowed `CCInsightsQaQuestion` under mock GCP in `config/tests/samples/create/harness.go`.
    - Generated mock golden HTTP logs (`_http_mock.log`) for both minimal and maximal fixtures.
    - Verified all contactcenterinsights fixtures pass hermetically and `TestGoldenLogAlignment` passes with zero discrepancies.
    
    Fixes #16799
    
    
    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 - (`_http.log` and `_audit_probe.log` baselines remain completely untouched)
    * **Mock Service & CRUD (Step 3) / Fix Quality (Step 4)**: Pass - (`ContactCenterInsightsServer` implements full CRUD with parent validation and server-generated ID behavior)
    * **Golden Log Alignment & CI Fixtures**: Pass - (`TestGoldenLogAlignment` passes with zero errors; fixtures presubmit suite passes for `contactcenterinsights`)
    * **Normalizer Scoping**: Pass - (Normalizers are strictly scoped within `mockcontactcenterinsights` to `/qaQuestions/` paths)
    * **Scope, Exceptions & `BLOCKED_KINDS`**: Pass - (No unit tests added to mock package, ratcheting check passes, no exceptions added, `CCInsightsQaQuestion` remains in `BLOCKED_KINDS`)
    
    #### Detailed Findings / Actions Required:
    None. All Greenfield Step 3 criteria and invariants are satisfied.
    
    <!-- factory:group-step issue=16799 -->
    
    ---
    
    ### Greenfield: Align MockGCP logs with RealGCP for CCInsightsQAQuestion
    
    This pull request was generated by an AI coding agent.
    
    Aligns MockGCP behavior with real GCP responses for CCInsightsQaQuestion (contactcenterinsights.cnrm.cloud.google.com/v1alpha1):
    - Refined `CreateQaQuestion` in `mockgcp/mockcontactcenterinsights/ccinsightsqaquestion.go` to store `tuningMetadata: {}` for subsequent GET and UPDATE requests while omitting it from the synchronous Create response, precisely matching real GCP behavior.
    - Regenerated mock golden HTTP logs (`_http_mock.log`) for both minimal and maximal fixtures (`ccinsightsqaquestion-minimal` and `ccinsightsqaquestion-maximal`).
    - Verified all contactcenterinsights fixtures pass hermetically and `TestGoldenLogAlignment` passes with zero discrepancies.
    
    Fixes #16816
    
    
    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**: 4 (Alignment)
    * **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 4 criteria and invariants are satisfied.
    
    <!-- factory:group-step issue=16816 -->
    
    ---
    
    ### Greenfield: Release CCInsightsQAQuestion (remove it from BLOCKED_KINDS)
    
    This pull request was generated by an AI coding agent.
    
    Release `CCInsightsQAQuestion` by removing `CCInsightsQaQuestion` from `BLOCKED_KINDS` in `dev/tasks/build-release-bundle`.
    
    All prerequisites and prior Greenfield steps for `CCInsightsQAQuestion` 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/contactcenterinsights/v1alpha1/ccinsightsqaquestion/` 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.
    - CCInsightsQAQuestion is ready to ship in the release bundle.
    
    Fixes #16824
    
    
    release-note
    New Alpha Resources (Direct Reconciler):
    CCInsightsQAQuestion
    `

    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=16824 -->

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: reviewbot-robot Review duration: 715m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)). 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%
    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
    Real PR Conversation Timeline
    1 comments
    "Review active on #16780"
    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: 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: 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: 22.5% · Safe to merge
    22.5%