direct: Implement direct controller, E2E fixtures, and fuzzer for TranslateAdaptiveMtDataset - #12427
Conversation
…nslateAdaptiveMtDataset Implement the direct controller, E2E fixtures, and fuzzer for TranslateAdaptiveMtDataset under pkg/controller/direct/translate. Fix: 11851
GCP Audit Logs Proof of TestingBelow are the Google Cloud audit logs demonstrating that our newly implemented direct controller successfully exercised the GCP Translate API during E2E testing: ---
insertId: 11hj49ue236od
logName: projects/cnrm-barni-4/logs/cloudaudit.googleapis.com%2Factivity
protoPayload:
'@type': type.googleapis.com/google.cloud.audit.AuditLog
authenticationInfo:
oauthInfo:
oauthClientId: '117594038071648177763'
principalEmail: overseer-kcc-tester@cnrm-barni-4.iam.gserviceaccount.com
principalSubject: serviceAccount:overseer-kcc-tester@cnrm-barni-4.iam.gserviceaccount.com
authorizationInfo:
- granted: true
permission: cloudtranslate.adaptiveMtDatasets.delete
permissionType: ADMIN_WRITE
resource: projects/cnrm-barni-4/locations/us-central1/adaptiveMtDatasets/dataset-isk5y6vm2ruynra
resourceAttributes:
name: projects/cnrm-barni-4/locations/us-central1/adaptiveMtDatasets/dataset-isk5y6vm2ruynra
service: translate.googleapis.com
type: translate.googleapis.com/AdaptiveMtDataset
methodName: google.cloud.translation.v3.TranslationService.DeleteAdaptiveMtDataset
request:
'@type': type.googleapis.com/google.cloud.translation.v3.DeleteAdaptiveMtDatasetRequest
name: projects/cnrm-barni-4/locations/us-central1/adaptiveMtDatasets/dataset-isk5y6vm2ruynra
serviceName: translate.googleapis.com
status: {}
resource:
labels:
method: google.cloud.translation.v3.TranslationService.DeleteAdaptiveMtDataset
project_id: cnrm-barni-4
service: translate.googleapis.com
type: audited_resource
severity: NOTICE
timestamp: '2026-08-16T03:24:35.008661923Z'
---
insertId: 14al6wqda7os
logName: projects/cnrm-barni-4/logs/cloudaudit.googleapis.com%2Factivity
protoPayload:
'@type': type.googleapis.com/google.cloud.audit.AuditLog
authenticationInfo:
oauthInfo:
oauthClientId: '117594038071648177763'
principalEmail: overseer-kcc-tester@cnrm-barni-4.iam.gserviceaccount.com
principalSubject: serviceAccount:overseer-kcc-tester@cnrm-barni-4.iam.gserviceaccount.com
authorizationInfo:
- granted: true
permission: cloudtranslate.adaptiveMtDatasets.create
permissionType: ADMIN_WRITE
resource: projects/600845353393/locations/us-central1
resourceAttributes:
name: projects/cnrm-barni-4/locations/us-central1/adaptiveMtDatasets/dataset-isk5y6vm2ruynra
service: translate.googleapis.com
type: translate.googleapis.com/AdaptiveMtDataset
methodName: google.cloud.translation.v3.TranslationService.CreateAdaptiveMtDataset
request:
'@type': type.googleapis.com/google.cloud.translation.v3.CreateAdaptiveMtDatasetRequest
adaptiveMtDataset:
displayName: Minimal Dataset
name: projects/cnrm-barni-4/locations/us-central1/adaptiveMtDatasets/dataset-isk5y6vm2ruynra
sourceLanguageCode: en
targetLanguageCode: es
parent: projects/cnrm-barni-4/locations/us-central1
serviceName: translate.googleapis.com
status: {}
resource:
labels:
method: google.cloud.translation.v3.TranslationService.CreateAdaptiveMtDataset
project_id: cnrm-barni-4
service: translate.googleapis.com
type: audited_resource
severity: NOTICE
timestamp: '2026-08-16T03:24:32.060112320Z' |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
🤖 AI Factory started investigating CI check failures for this pull request. |
|
🤖 AI Factory started reviewing this pull request in a sandbox. |
reviewbot-robot
left a comment
There was a problem hiding this comment.
KCC Auto-Review Results
- Trigger criteria matched: Yes
- Proto Diffs & Update Mask: Pass
- Structured Reporting: Pass
- KRM Status Updates: Fail - KRM status update is skipped on no-op updates.
- LRO Wait: Pass (Not applicable)
- Test Coverage: Pass - Both minimal and maximal test cases exist in the repository under
pkg/test/resourcefixture/testdata/basic/translate/v1alpha1/translateadaptivemtdataset/
Detailed Findings / Actions Required:
- In
pkg/controller/direct/translate/translateadaptivemtdataset_controller.go(line 191), returningnildirectly on no-op updates skips updating the KRM Status. Under KCC's Greenfield controller standards, the status MUST always be updated at the end of bothCreateandUpdateoperations to ensure consistency.
|
|
||
| if !diffs.HasDiff() { | ||
| log.V(2).Info("no field needs update", "name", a.id.String()) | ||
| return nil |
There was a problem hiding this comment.
KCC direct controller standards require that status is always updated at the end of an Update operation, even on no-op reconciliations (when there's no diff between desired and actual states). Please call a.updateStatus(ctx, updateOp, a.actual) instead of returning nil.
|
🤖 AI Factory started addressing review feedback for this pull request. |
|
I have addressed the review feedback by updating The change has been committed and successfully pushed. (This comment was generated by overseer) |
|
🤖 AI Factory started addressing review feedback for this pull request. |
|
I have verified the implementation, running formatting and The previous fix correctly addressed the review feedback by calling The PR is fully updated, verified, and ready for further review! (This comment was generated by overseer) |
|
🤖 AI Factory started investigating CI check failures for this pull request. |
Investigating tests-e2e-fixtures-compute-4-of-4 failureRun: 31965078531 Investigating tests-e2e-fixtures-hypercomputecluster failureRun: 31965078531 Investigating presubmit-gatekeeper failureRun: 31965078531 Note: The priority fixtures test suite (This report was generated by overseer) |
|
🤖 AI Factory started reviewing this pull request in a sandbox. |
reviewbot-robot
left a comment
There was a problem hiding this comment.
KCC Auto-Review Results
- Trigger criteria matched: Yes
- Proto Diffs & Update Mask: Pass (The resource is immutable; hence, updates are blocked on KRM and UpdateMask is not used)
- Structured Reporting: Pass (Diff is reported correctly via
structuredreporting.ReportDiffon update checks) - KRM Status Updates: Pass (Status is always updated via
updateStatusat the end ofCreate, and on no-opUpdatereconciliation runs) - LRO Wait: Pass (The resource creation/deletion operations are synchronous and do not return an LRO)
- Test Coverage: Pass (Minimal and maximal test cases are provided under
pkg/test/resourcefixture/testdata/basic/translate/v1alpha1/translateadaptivemtdataset)
Detailed Findings / Actions Required:
The overall implementation is solid and follows direct controller conventions perfectly. The only issue is a minor schema design flaw where exampleCount (an output-only GCP field) was mapped to KRM .spec instead of .status.observedState. Since this is a new Alpha Greenfield resource, we recommend moving this field to Status before the resource schema is frozen/released.
|
|
||
| clonedDesired := proto.Clone(desired).(*pb.AdaptiveMtDataset) | ||
|
|
||
| // Since exampleCount is read-only / output-only on GCP, copy it from maskedActual to clonedDesired to prevent false diffs. |
There was a problem hiding this comment.
The clonedDesired.ExampleCount = maskedActual.ExampleCount statement is used to bypass differences on exampleCount because it is an output-only/read-only field in the GCP AdaptiveMtDataset resource.
According to KCC Greenfield design principles, service-generated/output-only fields should reside under status.observedState rather than .spec. This design leak in the schema necessitates workaround logic in the controller to avoid false diffs during reconciliation.
Since TranslateAdaptiveMtDataset is a new alpha Greenfield resource, we should move exampleCount from TranslateAdaptiveMtDatasetSpec to TranslateAdaptiveMtDatasetObservedState in apis/translate/v1alpha1/translateadaptivemtdataset_types.go, regenerate the mappers, and update the controller to clean up this workaround.
| f.SpecField(".display_name") | ||
| f.SpecField(".source_language_code") | ||
| f.SpecField(".target_language_code") | ||
| f.SpecField(".example_count") |
There was a problem hiding this comment.
.example_count is registered as f.SpecField(".example_count") because it was incorrectly defined under spec in the KRM types.
Once exampleCount is moved to status.observedState (since it is output-only), this must be registered using f.StatusField(".example_count") instead of f.SpecField.
| [missing_field] crd=transcoderjobs.transcoder.cnrm.cloud.google.com version=v1alpha1: field ".spec.templateID" is not set in unstructured objects | ||
| [missing_field] crd=transcoderjobs.transcoder.cnrm.cloud.google.com version=v1alpha1: field ".spec.ttlAfterCompletionDays" is not set in unstructured objects | ||
| [missing_field] crd=translateadaptivemtdatasets.translate.cnrm.cloud.google.com version=v1alpha1: field ".spec.displayName" is not set in unstructured objects | ||
| [missing_field] crd=translateadaptivemtdatasets.translate.cnrm.cloud.google.com version=v1alpha1: field ".spec.exampleCount" is not set in unstructured objects |
There was a problem hiding this comment.
The .spec.exampleCount exception in alpha-missingfields.txt is required only because exampleCount is mapped under .spec instead of .status.observedState. Because it is an output-only field, it cannot be configured in the test fixtures (create.yaml / update.yaml), triggering the alpha-missingfields linter.
Moving exampleCount to status would allow removing this exception completely.
|
🤖 AI Factory started addressing review feedback for this pull request. |
This Pull Request implements the direct controller, E2E fixtures, and fuzzer for
TranslateAdaptiveMtDatasetunderpkg/controller/direct/translate.Fixes #11851
Real GCP Recording Details
record-gcpwas successfully executed against real GCP.cnrm-barni-4Verification & Tests Passed
TestSomeMappersinpkg/fuzztesting/fuzztests(Passed).pkg/crd/template/...passed.apicheckscheck passed.This PR was generated by the
overseer,overseer,greenfield,step/controlleragent (powered by the gemini-3.5-flash model).