← Back to Pull requests

Greenfield: Implement direct controller, E2E fixtures, and fuzzer for BigQueryRowAccessPolicy #15732

Closed
unknown closed this pull request without merging on Nov 15, 2026 14:33 UTC
View on GitHub
unknown unknown commented on Nov 15, 2026 04:13 UTC
Author

Implement Greenfield Step 2 (direct controller, fuzzer, and E2E fixtures) for BigQueryRowAccessPolicy under bigquery.cnrm.cloud.google.com/v1alpha1 following .gemini/skills/kcc-direct-controller-logic-greenfield-implementer/SKILL.md:

  • Implemented the direct controller for BigQueryRowAccessPolicy in pkg/controller/direct/bigquery/bigqueryrowaccesspolicy_controller.go using the Google Cloud BigQuery REST client (google.golang.org/api/bigquery/v2).

  • Handled reference normalization in AdapterForObject via common.NormalizeGreenfieldReferences.

  • Handled grantees drift detection by querying RowAccessPolicies.GetIamPolicy in Find(), as GCP's Get endpoint does not include grantees in the RowAccessPolicy payload (members granted row-level access are assigned role roles/bigquery.filteredDataViewer).

  • Enabled .Force(true) on deletion to handle the case of deleting the last row-access policy on a table without triggering GCP 400.

  • Implemented round-trip fuzzer in pkg/controller/direct/bigquery/bigqueryrowaccesspolicy_fuzzer.go using fuzztesting.RegisterKRMFuzzer_NoProto, passing TestFocusedMappers.

  • Created minimal and maximal test fixtures with dependencies under pkg/test/resourcefixture/testdata/basic/bigquery/v1alpha1/bigqueryrowaccesspolicy/ and recorded them against real GCP using RECORD_AUDIT_PROBE=1 hack/record-gcp in project cnrm-barni-4, capturing authentic _http.log, _http_report.md, and _audit_probe.log (all 7 automated validation checks passed).

  • Normalized observedState timestamps in tests/e2e/normalize.go and synchronized tests/apichecks/testdata/exceptions/alpha-missingfields.txt.

  • Registered BigQueryRowAccessPolicy in pkg/controller/resourceconfig/static_config.go.

  • Documented Step 2 findings in .gemini/journals/bigquery.md.
  • Fixes #15712

    ``release-note
    NONE

    
    ## Review Instructions
    
    Use .gemini/skills/reviewgen-greenfield-controller/SKILL.md to conduct the review.
    
    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-15712/recipe-fix-20261115-010638-4997)</sub>
    
    <!-- factory:task-output kind=Change task=recipe-fix-20261115-010638-4997 -->
    
    ---
    
    ### Greenfield: Implement MockGCP and Alignment for BigQueryRowAccessPolicy
    
    This pull request was generated by an AI coding agent.
    
    Implement Phase 3 (MockGCP and Alignment) for `BigQueryRowAccessPolicy` (`bigquery.cnrm.cloud.google.com/v1alpha1`) following Greenfield Step 3 (`.gemini/skills/kcc-direct-mockgcp-implementer/SKILL.md`):
    
    - Implemented `RowAccessPoliciesServer` in `mockgcp/mockbigquery/rowaccesspolicy.go` supporting `GetRowAccessPolicy`, `InsertRowAccessPolicy`, `UpdateRowAccessPolicy`, `DeleteRowAccessPolicy`, and `ListRowAccessPolicies` RPCs.
    - Registered `RowAccessPoliciesServerServer` on gRPC server and `RowAccessPoliciesServerHandler` on the HTTP mux in `mockgcp/mockbigquery/service.go`.
    - Added parent table existence check in `InsertRowAccessPolicy` before creating the row access policy.
    - Updated `mockIAMPolicies` to accept `storage.Storage` reference to dynamically resolve IAM policies for BigQuery row access policies:
      - Maps `grantees` into bindings with role `roles/bigquery.filteredDataViewer`.
      - Sets `version: 1` when bindings are present.
    - Added `BigQueryRowAccessPolicy` to the supported mock kinds switch in `config/tests/samples/create/harness.go`.
    - Generated `_http_mock.log` for both `bigqueryrowaccesspolicy-minimal` and `bigqueryrowaccesspolicy-maximal` fixtures with 0 discrepancies against real GCP baseline logs.
    - Verified all fixtures pass cleanly via `hack/compare-mock`, `TestGoldenLogAlignment`, and `./dev/ci/presubmits/tests-e2e-fixtures-suite bigquery`.
    
    Fixes #15749
    
    
    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
    * **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 3 criteria and invariants are satisfied.
    
    <!-- factory:group-step issue=15749 -->
    
    ---
    
    ### Greenfield: Release BigQueryRowAccessPolicy (remove it from BLOCKED_KINDS)
    
    This pull request was generated by an AI coding agent.
    
    Removes `BigQueryRowAccessPolicy` 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/bigquery/v1alpha1/bigqueryrowaccesspolicy/` (`bigqueryrowaccesspolicy-minimal` and `bigqueryrowaccesspolicy-maximal`) have been verified to have authentic real-GCP golden logs (`_http.log`), audit probe logs (`_audit_probe.log`), and mock golden logs (`_http_mock.log`).
    
    Fixes #15755
    
    
    release-note
    New Alpha Resources (Direct Reconciler):
    BigQueryRowAccessPolicy
    `

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

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

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: lovelace-coder-bot Review duration: 619m
    All Vouch review confidence checks passed
    Residual risk 0.25 = Change Risk (0.57) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.57 · 650 lines diff across 8 files
    0.57
    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
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #15732"
    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: 57% (MEDIUM) · Higher = larger blast radius
    57%
    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: 24.7% · Safe to merge
    24.7%