Add CodeRabbit instruction to prefer k8s sets over bespoke maps#31234
Add CodeRabbit instruction to prefer k8s sets over bespoke maps#31234stbenjam wants to merge 2 commits into
Conversation
Instruct CodeRabbit to flag new Go code that uses map[string]bool or
map[string]struct{} as ad-hoc sets, and recommend k8s.io/apimachinery/pkg/util/sets
instead.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Pipeline controller notification For optional jobs, comment This repository is configured in: automatic mode |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited) Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
WalkthroughConvert the once-retry allowlist from a map to k8s sets: import and use ChangesRetry allowlist refactor and contributor guidance
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 14 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (14 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: stbenjam The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Replace the bespoke map[string]bool with k8s.io/apimachinery/pkg/util/sets for the retry allowlist, which provides type-safe set operations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@coderabbitai Why are these checks failing on this PR? It has no tests in it...
|
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Get PR details and check status
gh pr view 31234 --repo openshift/origin --json statusCheckRollup,title,files 2>/dev/null | jq '.'
# Also look at the PR checks
gh pr checks 31234 --repo openshift/origin 2>/dev/null | head -60Length of output: 8812 🏁 Script executed: #!/bin/bash
# Look at any comments on the PR that might explain the failures
gh pr view 31234 --repo openshift/origin --json comments 2>/dev/null | jq '.comments[] | {author: .author.login, body: .body[:500]}' 2>/dev/null | head -100
# Also check the PR reviews
gh pr view 31234 --repo openshift/origin --json reviews 2>/dev/null | jq '.reviews[] | {author: .author.login, state: .state, body: .body[:500]}' 2>/dev/null | head -100Length of output: 2642
In short: no CI checks are actually failing right now. If you're seeing CodeRabbit flagging issues in the |
|
Scheduling required tests: |
|
@stbenjam: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Summary
**/*.gothat flags new usage ofmap[string]boolormap[string]struct{}as ad-hoc sets and recommendsk8s.io/apimachinery/pkg/util/setsinstead.Existing bespoke map-set usage
There are ~50 non-vendor files currently using this pattern that could be migrated over time:
Files using
map[string]boolormap[string]struct{}as setspkg/
pkg/e2eanalysis/e2e_analysis.gopkg/monitortestlibrary/allowedalerts/matches_test.gopkg/monitortestlibrary/allowedbackenddisruption/matches_test.gopkg/monitortestlibrary/historicaldata/next_best_guess.gopkg/monitortestlibrary/historicaldata/next_best_guess_test.gopkg/monitortests/cli/adm_upgrade/status/controlplane.gopkg/monitortests/clusterversionoperator/terminationmessagepolicy/monitortest.gopkg/monitortests/etcd/etcdloganalyzer/etcd_recorder_test.gopkg/monitortests/kubeapiserver/auditloganalyzer/handle_audit_latency.gopkg/monitortests/kubeapiserver/crdversionchecker/monitortest.gopkg/monitortests/kubeapiserver/faultyloadbalancer/monitortest.gopkg/monitortests/network/legacynetworkmonitortests/networking.gopkg/monitortests/node/legacynodemonitortests/kubelet.gopkg/monitortests/testframework/highcputestanalyzer/monitortest.gopkg/monitortests/testframework/operatorloganalyzer/operator_lease_check.gopkg/resourcewatch/observe/observe.gopkg/test/ginkgo/cmd_runsuite.gopkg/test/ginkgo/podanalysis.gopkg/test/ginkgo/queue_test.gopkg/test/ginkgo/retries.gopkg/test/ginkgo/retries_test.gopkg/test/ginkgo/sharder_test.gopkg/testsuites/suites_test.gotest/extended/
test/extended/builds/run_policy.gotest/extended/cluster/cm.gotest/extended/dr/common.gotest/extended/edge_topologies/arbiter_topology.gotest/extended/edge_topologies/tnf_node_replacement_flow.gotest/extended/edge_topologies/tnf_node_replacement_ovn_vm.gotest/extended/edge_topologies/tnf_node_replacement_types.gotest/extended/edge_topologies/utils/services/pacemaker.gotest/extended/images/imagechange_buildtrigger.gotest/extended/machine_config/helpers.gotest/extended/machines/cluster.gotest/extended/networking/egressip.gotest/extended/networking/egressip_helpers.gotest/extended/networking/network_segmentation.gotest/extended/networking/route_advertisements.gotest/extended/operators/cluster.gotest/extended/prometheus/prometheus.gotest/extended/prometheus/prometheus_builds.gotest/extended/prometheus/storage.gotest/extended/router/h2spec.gotest/extended/router/metrics.gotest/extended/router/stress.gotest/extended/tls/tls_observed_config.gotest/extended/util/compat_otp/clusters.gotest/extended/util/compat_otp/rosacli/kubelet_config_service.gotest/extended/util/configv1shim.gotest/extended/util/prometheus/helpers.gotools/
tools/changelog/changelog.goTest plan
map[string]bool/map[string]struct{}set patterns🤖 Generated with Claude Code
Summary by CodeRabbit