Skip to content

Add PhoneLookupMode test config builder#532

Merged
fbm3307 merged 6 commits into
codeready-toolchain:masterfrom
fbm3307:twilio-la
Jun 9, 2026
Merged

Add PhoneLookupMode test config builder#532
fbm3307 merged 6 commits into
codeready-toolchain:masterfrom
fbm3307:twilio-la

Conversation

@fbm3307

@fbm3307 fbm3307 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor
  • Add Verification().PhoneLookupMode() builder method for ToolchainConfig tests
  • Update go.mod to reference toolchainapi with phone-lookup types

related Prs:

api : codeready-toolchain/api#509
Registration-Service: codeready-toolchain/registration-service#595
host operator: codeready-toolchain/host-operator#1268
toolchain-e2e: codeready-toolchain/toolchain-e2e#1285

Summary by CodeRabbit

  • Chores
    • Updated dependency pins and cleaned up several indirect modules in the Go dependency manifest.
  • New Features
    • Added fluent configuration options to control phone lookup mode and to specify excluded countries for registration verification, enabling chained configuration of verification behavior.

- Add Verification().PhoneLookupMode() builder method for ToolchainConfig tests
- Update go.mod to reference toolchainapi with phone-lookup types

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Feny Mehta <fbm3307@gmail.com>
@fbm3307 fbm3307 requested a review from metlos June 4, 2026 08:46
@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: c9902b03-5479-4526-8da0-c07e5f87f707

📥 Commits

Reviewing files that changed from the base of the PR and between c30cc73 and ee42371.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (1)
  • go.mod
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Verify Dependencies
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • go.mod
🔀 Multi-repo context codeready-toolchain/api, codeready-toolchain/host-operator, codeready-toolchain/toolchain-e2e

[::codeready-toolchain/api::]

  • New types/fields present in api:
    • api/v1alpha1/toolchainconfig_types.go: PhoneLookupMode type and constants defined. (matches lines around 319, 321, 324–326)
      • PhoneLookupMode field on RegistrationService verification: toolchainconfig_types.go:405: PhoneLookupMode *PhoneLookupMode \json:"phoneLookupMode,omitempty"``
    • PhoneLookupExcludedCountries field present: toolchainconfig_types.go:411: PhoneLookupExcludedCountries []string \json:"phoneLookupExcludedCountries,omitempty"``
    • Deepcopy & openapi generated references: api/v1alpha1/zz_generated.deepcopy.go (PhoneLookupMode, PhoneLookupExcludedCountries), api/v1alpha1/zz_generated.openapi.go (descriptions)
    • API docs mention both fields: api/v1alpha1/docs/apiref.adoc (PhoneLookupMode, phoneLookupExcludedCountries)

[::codeready-toolchain/host-operator::]

  • Call sites that read RegistrationService Verification config (may be impacted if new fields are consumed later):
    • controllers/usersignup/usersignup_controller.go:587 — uses config.RegistrationService().Verification().CaptchaEnabled()
    • cmd/main.go:183 — crtConfig.RegistrationService().Verification().CaptchaEnabled()
    • controllers/toolchainconfig/configuration_test.go:396–420 — tests constructing/asserting Verification settings
    • controllers/usersignup/usersignup_controller_test.go:4110 — constructs ToolchainConfig via test helpers: testconfig.RegistrationService().Verification().CaptchaEnabled(...)
  • No direct references to PhoneLookupMode or PhoneLookupExcludedCountries found in host-operator.

[::codeready-toolchain/toolchain-e2e::]

  • Many tests use the testconfig Verification builder and update ToolchainConfig (consumers of toolchain-common test builders):
    • test/e2e/usersignup_test.go:197 — hostAwait.UpdateToolchainConfig(..., testconfig.RegistrationService().Verification().Enabled(false))
    • test/metrics/metrics_test.go:627 — uses testconfig.RegistrationService().Verification().Enabled(false)
    • test/e2e/parallel/registration_service_test.go — contains registration service tests (e.g., TestPhoneVerification) that likely depend on registration behavior and may rely on ToolchainConfig updates
  • These tests import the testconfig builder from toolchain-common (github.com/codeready-toolchain/toolchain-common/pkg/test/config) and will compile against the updated builder methods.

Conclusion:

  • The api repo contains the new PhoneLookupMode and PhoneLookupExcludedCountries fields and generated artifacts — matches the toolchain-common test builder additions.
  • host-operator and toolchain-e2e consume the testconfig/Verification builder; toolchain-e2e has registration-related tests that could be affected by changes to verification config.
  • No direct usages of the new PhoneLookup fields found in host-operator or toolchain-e2e source (they will be exercised via updated test builders).
🔇 Additional comments (1)
go.mod (1)

29-29: LGTM!


Walkthrough

Bumps the direct require of github.com/codeready-toolchain/api and trims several indirect pins in go.mod, and adds two fluent setters—PhoneLookupMode and PhoneLookupExcludedCountries—on RegistrationServiceVerificationOption in test config.

Changes

Dependency updates and test configuration

Layer / File(s) Summary
Test config: phone lookup setters
pkg/test/config/toolchainconfig.go
Added RegistrationServiceVerificationOption.PhoneLookupMode(value toolchainv1alpha1.PhoneLookupMode) and RegistrationServiceVerificationOption.PhoneLookupExcludedCountries(values []string), each setting fields under Spec.Host.RegistrationService.Verification and returning RegistrationServiceOption for chaining.
Module dependency updates (go.mod)
go.mod
Bumped github.com/codeready-toolchain/api require version and removed/rewrote multiple indirect require entries (removed github.com/fatih/color, github.com/go-bindata/go-bindata, github.com/gobuffalo/flect, github.com/inconshreveable/mousetrap, github.com/mattn/go-colorable, github.com/mattn/go-isatty; replaced tail of indirect list with a retained set of pinned golang.org/x/*, k8s.io/*, and related entries).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

dependencies, test

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding PhoneLookupMode test config builder methods to the test configuration utility.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot added dependencies Pull requests that update a dependency file test Work that adds, fixes, or maintains automated tests or coverage (unit, integration, e2e, flakiness) labels Jun 4, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@go.mod`:
- Line 126: Remove the forbidden replace directive that swaps the protected
module github.com/codeready-toolchain/api for github.com/fbm3307/toolchainapi in
go.mod; either delete the replace line entirely or move it out of the committed
go.mod into a local-only workflow (e.g., a developer-only script or a replace in
a temporary local go.mod) so the repository no longer contains the replace
directive for the protected module and CI will pass.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 89d9e1fc-8867-4876-9797-b8f73ec26907

📥 Commits

Reviewing files that changed from the base of the PR and between 6db0c02 and f7d10b0.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (2)
  • go.mod
  • pkg/test/config/toolchainconfig.go
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: GolangCI Lint
  • GitHub Check: test
  • GitHub Check: Verify Dependencies
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • pkg/test/config/toolchainconfig.go
  • go.mod
🧠 Learnings (1)
📚 Learning: 2025-10-24T10:18:07.200Z
Learnt from: MatousJobanek
Repo: codeready-toolchain/toolchain-common PR: 496
File: pkg/owners/fetcher_test.go:29-32
Timestamp: 2025-10-24T10:18:07.200Z
Learning: In the codeready-toolchain repositories, the import pattern `controllerruntime "sigs.k8s.io/controller-runtime"` should be kept for consistency across the codebase, even if specific functions like SetControllerReference are used from sub-packages like controllerutil.

Applied to files:

  • go.mod
🪛 GitHub Actions: ci-check-gomod / 0_go.mod replacements.txt
go.mod

[error] 1-1: CI check failed: go.mod contains forbidden module replacements for protected modules. Error: 'the above replacement(s) are not allowed in go.mod' (go list -m all piped to grep -E detects replacements matching PROTECTED_MODULES).

🔀 Multi-repo context codeready-toolchain/api, codeready-toolchain/host-operator, codeready-toolchain/toolchain-e2e

[::codeready-toolchain/api::] — repository clone failed; could not fetch files (network/clone error). Unable to verify new phone-lookup types or consumers in this repo. Please provide access or ensure repo is reachable so I can inspect api PR #509.

[::codeready-toolchain/host-operator::] — no matches for PhoneLookupMode / PhoneLookup / RegistrationService.Verification found.

[::codeready-toolchain/toolchain-e2e::]

  • testsupport/wait/host.go:1690 — returns comparison against actual.Spec.Host.RegistrationService.Verification.Enabled
  • testsupport/wait/host.go:1694 — marshals actual.Spec.Host.RegistrationService.Verification.Enabled

Implication: toolchain-e2e references RegistrationService.Verification.Enabled in host objects and may need updates if the underlying types in github.com/codeready-toolchain/api (the module replaced in go.mod) change shape (e.g., new enum/field for PhoneLookupMode). Verify that the api changes are backward-compatible for Verification.* fields.

🔇 Additional comments (1)
pkg/test/config/toolchainconfig.go (1)

508-513: LGTM!

Comment thread go.mod Outdated
Comment thread pkg/test/config/toolchainconfig.go Outdated
Signed-off-by: Feny Mehta <fbm3307@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
fbm3307 and others added 2 commits June 8, 2026 13:15
- Add Verification().PhoneLookupExcludedCountries() builder method
- Bump toolchainapi replace for annotation reduction and new field

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Feny Mehta <fbm3307@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Feny Mehta <fbm3307@gmail.com>
fbm3307 added 2 commits June 9, 2026 12:43
Signed-off-by: Feny Mehta <fbm3307@gmail.com>
@sonarqubecloud

sonarqubecloud Bot commented Jun 9, 2026

Copy link
Copy Markdown

@fbm3307 fbm3307 merged commit 82d1748 into codeready-toolchain:master Jun 9, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file test Work that adds, fixes, or maintains automated tests or coverage (unit, integration, e2e, flakiness)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants