← Back to Pull requests

Greenfield: Add E2E fixtures and verify controller for SecuritycenterEventThreatDetectionCustomModule #16809

Open
unknown opened this pull request with 618 lines diff across 7 files
View on GitHub
unknown unknown commented on Nov 30, 2026 05:28 UTC
Author

This pull request was generated by an AI coding agent.

Verify direct controller, roundtrip fuzzer, and record authentic E2E fixtures against real GCP for SecuritycenterEventThreatDetectionCustomModule (securitycenter.cnrm.cloud.google.com/v1alpha1) following Greenfield Step 2 (.gemini/skills/kcc-direct-controller-logic-greenfield-implementer/SKILL.md):

1. Direct Controller & Fuzzer Verification:
- Verified existing deterministic direct controller (pkg/controller/direct/securitycenter/securitycentereventthreatdetectioncustommodule_controller.go).
- Ran and verified roundtrip fuzzer via FOCUS=SecuritycenterEventThreatDetectionCustomModule go test -v ./pkg/fuzztesting/fuzztests -run TestFocusedMappers.

2. E2E Fixtures & Real GCP Recording:
- Added minimal and maximal fixtures in pkg/test/resourcefixture/testdata/basic/securitycenter/v1alpha1/securitycentereventthreatdetectioncustommodule/.
- Successfully executed RECORD_AUDIT_PROBE=1 ./hack/record-gcp against real GCP project cnrm-barni-4 to generate golden HTTP logs (_http.log), resource states (.golden.yaml), identities (_identities.yaml), and audit probe markers (_audit_probe.log).
- All 7/7 validation checks pass in _http_report.md for both minimal and maximal fixtures.

3. Schema & API Quirks:
- Added google.cloud.securitycenter.v1.EventThreatDetectionCustomModule to unmarshalDynamicJSON's discardUnknown list in pkg/test/httplogreport/validator/protovalidate.go to tolerate unvendored cloudProvider returned by real GCP.
- Noted upstream v1 API 500 error when including enablementState in updateMask during PATCH, keeping enablementState unchanged in update.yaml while exercising in-place updates for displayName, description, and config.
- Documented findings in .gemini/journals/securitycenter.md.

Fixes #16801

``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-16801/recipe-fix-20261130-040650-7381)</sub>

<!-- factory:task-output kind=Change task=recipe-fix-20261130-040650-7381 -->

---

### MockGCP: Implement Mock and Alignment for SecuritycenterEventThreatDetectionCustomModule

This pull request was generated by an AI coding agent.

Implement mock service support for `SecuritycenterEventThreatDetectionCustomModule` in `mocksecuritycenter`, register the kind in create test harness, align with minimal and maximal E2E fixtures, and generate `_http_mock.log`.

- Implemented CRUD methods (Create, Get, Update, Delete, List) in `mockgcp/mocksecuritycenter/eventthreatdetectioncustommodule.go`.
- Handled project ID to project number canonicalization and deterministic ID assignment matching recorded real GCP fixtures.
- Handled real GCP PATCH response behavior where `enablementState` is omitted unless present in `updateMask`.
- Normalized REST-only `cloudProvider` in `pkg/test/resourcefixture/golden_alignment_test.go`.
- Registered `SecuritycenterEventThreatDetectionCustomModule` in `config/tests/samples/create/harness.go`.
- Generated `_http_mock.log` files for both minimal and maximal fixtures and verified alignment.

Fixes #16831

release-note
NONE

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

---

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

This pull request was generated by an AI coding agent.

Remove `SecuritycenterEventThreatDetectionCustomModule` from `BLOCKED_KINDS` in `dev/tasks/build-release-bundle`.

All prerequisites and prior Greenfield steps for `SecuritycenterEventThreatDetectionCustomModule` 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/securitycenter/v1alpha1/securitycentereventthreatdetectioncustommodule/` have authentic real-GCP `_http.log`, `_audit_probe.log`, and `_http_mock.log`.
- MockGCP CRUD methods implemented and verified; mock E2E fixtures and golden log alignment pass cleanly with zero discrepancies.
- `SecuritycenterEventThreatDetectionCustomModule` is ready to ship in the release bundle.

Fixes #16837

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

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

    Diff: 618 lines (+463 / -155) across 7 files Reviewer: reviewbot-robot Review duration: 676m
    All Vouch review confidence checks passed
    Residual risk 0.45 = Change Risk (0.78) × (1 − Review Confidence (0.43)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.78 · 618 lines diff across 7 files
    0.78
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    42%
    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.385
    Shallow Review Depth shallow_review_depth
    0.344
    Sensitive Paths sensitive_paths
    0.078
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #16809"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: medium confidence: 43.0% 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: 78.4% (HIGH) · Higher = larger blast radius
    78.4%
    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: 43.0% · Lower = rushed or shallow review
    43.0%
    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: 44.7% · Moderate risk
    44.7%