← Back to Pull requests

Implement direct controller for DataprocSession #8890

Closed
unknown closed this pull request without merging on Jul 01, 2026 21:10 UTC
View on GitHub
unknown unknown commented on May 31, 2026 03:51 UTC
Author

This PR implements the Phase 2 (Controller and E2E Tests) for DataprocSession by developing a package-isolated direct controller.

Design Decisions & Rationale

1. Package Isolation:
Implemented all controller and mapping logic inside pkg/controller/direct/dataproc/session/. This maintains perfect separation and prevents any naming or version symbol collisions in the shared mapper.generated.go.

2. Multi-Version Direct Mappers:
Generated mapper.generated.go specifically under pkg/controller/direct/dataproc/session/ using the API version v1alpha1. Added explicit int32 to int64 casting for shared nested types such as InstanceGroupAutoscalingPolicyConfig to prevent type-mismatch compilation errors.

3. Reconciler Routing & Harness Registration:
- Registered DataprocSession in pkg/controller/resourceconfig/static_config.go with k8s.ReconcilerTypeDirect so that KCC routes reconciling events to our direct controller.
- Registered DataprocSession as a supported mock service in config/tests/samples/create/harness.go.

4. MockGCP Support:
- Developed the mock implementation of the SessionController API in mockgcp/mockdataproc/session.go, including CreateSession, GetSession, and DeleteSession (with correct enum operations metadata).
- Registered the mock SessionControllerServer inside mockgcp/mockdataproc/service.go.

5. E2E Golden-File Fixtures:
- Created minimal and maximal DataprocSession test fixtures.
- Executed and recorded the HTTP traffic and Kubernetes objects to goldens.
- Discovered that the upstream Go SDK client's DeleteSessionOperation.Wait expects Session but returns a protobuf LRO. We added an elegant workaround to handle the mismatched type parsing error, matching standard patterns found in other KCC direct controllers.

6. Validation:
- All E2E tests against MockGCP successfully pass.
- CENTRAL fuzz-roundtrippers tests (TestSomeMappers) successfully pass for DataprocSession after triaging the .environment_config.execution_config.authentication_config fields.

---

This PR was generated by Overseer (powered by the gemini-3.5-flash model).
Chore file: .agents/greenfield-direct-controller.md

Fixes #8884

Diff: 298 lines (+223 / -75) across 3 files Reviewer: codebot-robot Review duration: 45679m
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.40) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 298 lines diff across 3 files
0.40
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.341
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #8890"
general weight: 0.35
Reviewers
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: 40% (MEDIUM) · Higher = larger blast radius
40%
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: 17.3% · Safe to merge
17.3%