Skip to content

refactor: drop MetricsConfig from ToolchainStatus type#1264

Merged
xcoulon merged 2 commits intocodeready-toolchain:masterfrom
xcoulon:toolchain_status_metrics_api_drop
Mar 6, 2026
Merged

refactor: drop MetricsConfig from ToolchainStatus type#1264
xcoulon merged 2 commits intocodeready-toolchain:masterfrom
xcoulon:toolchain_status_metrics_api_drop

Conversation

@xcoulon
Copy link
Copy Markdown
Contributor

@xcoulon xcoulon commented Mar 4, 2026

Signed-off-by: Xavier Coulon xcoulon@redhat.com

Summary by CodeRabbit

  • Chores

    • Updated module dependencies to alternative pinned versions.
  • Tests

    • Adjusted metrics synchronization test to rely on default reconciliation after restart rather than forcing a recount, ensuring metrics remain correct through normal behavior.

Signed-off-by: Xavier Coulon <xcoulon@redhat.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 46791da6-c7fa-49d2-8364-b6b52697815a

📥 Commits

Reviewing files that changed from the base of the PR and between 5ada7b4 and 9aca320.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (1)
  • go.mod

Walkthrough

Updated two module dependency versions in go.mod and simplified a metrics test by removing an explicit forced metrics synchronization; the test now relies on default reconciliation after a pod restart. Total changes are small (two dependency version bumps and minor test edits).

Changes

Cohort / File(s) Summary
Module dependency versions
go.mod
Bumped versions for github.com/codeready-toolchain/api and github.com/codeready-toolchain/toolchain-common to newer commit-pinned revisions.
Test simplification
test/metrics/metrics_test.go
Removed explicit ToolchainConfig setting that forced metrics synchronization in TestForceMetricsSynchronization; subtest renamed and now relies on default reconciliation after restarting the pod.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main objective of the pull request - removing MetricsConfig from ToolchainStatus type, which aligns with the dependency updates and test refactoring changes shown in the changeset.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@go.mod`:
- Around line 34-37: The two replace directives pointing
github.com/codeready-toolchain/api -> github.com/xcoulon/api and
github.com/codeready-toolchain/toolchain-common ->
github.com/xcoulon/toolchain-common must be accompanied by a tracked rollback
plan: add a clear comment above each replace in go.mod that states the reason,
the maintainer/owner, the explicit target date to remove the replace (e.g.,
YYYY-MM-DD), and a link to a new GitHub issue or PR that tracks "Remove
personal-fork replace when upstream releases change X"; also create that GitHub
issue titled to reference the modules (github.com/xcoulon/api and
github.com/xcoulon/toolchain-common) and set the milestone/assignee so the
replace will be removed on or before the target date. Ensure the comment
references the exact replace lines and the temporary fork versions currently
used.

In `@test/metrics/metrics_test.go`:
- Around line 707-709: The test calls hostAwait.UpdateToolchainConfig(t) with no
modifiers, which is inconsistent with other usages that pass explicit options;
either remove this call if no config change is needed, or replace it with a call
that includes the intended modifiers (for example
testconfig.AutomaticApproval().Enabled(true/false) or other testconfig.*
options) so the intent is explicit; look for UpdateToolchainConfig and replace
or remove it accordingly, aligning with neighboring tests that use
testconfig.AutomaticApproval().Enabled(...) as the pattern.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7b4fa444-9e0a-475c-b460-ad4f6e427408

📥 Commits

Reviewing files that changed from the base of the PR and between cd620d9 and 5ada7b4.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (2)
  • go.mod
  • test/metrics/metrics_test.go

Comment thread go.mod Outdated
Comment on lines +34 to +37
replace github.com/codeready-toolchain/api => github.com/xcoulon/api v0.0.0-20260302105036-669d151cfca4

replace github.com/codeready-toolchain/toolchain-common => github.com/xcoulon/toolchain-common v0.0.0-20260304134451-ea974aea63a4

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

github.com/codeready-toolchain/api recent releases tags ToolchainStatus MetricsConfig

💡 Result:

  • GitHub Releases (codeready-toolchain/api): There are no published releases in the repository. [1]
  • Git tags (codeready-toolchain/api): The repository’s Tags page also shows no tags. [2]
  • API types you mentioned: ToolchainStatus is defined in the api/v1alpha1 package, and HostConfig includes a Metrics MetricsConfig field (i.e., MetricsConfig exists/used there). [3]

Sources:
[1] (github.com)
[2] (github.com)
[3] (pkg.go.dev)

Citations:


🌐 Web query:

github.com/codeready-toolchain/toolchain-common recent releases tags 2026

💡 Result:

As of March 4, 2026, the GitHub repo codeready-toolchain/toolchain-common shows:

  • Releases: None published (so no 2026 releases). [1]
  • Tags: The repo’s Tags page does not list any tags (so no 2026 tags visible). [2]

Sources: [1], [2]


🏁 Script executed:

# Check the current go.mod content and context around lines 34-37
cat go.mod | head -40

Repository: codeready-toolchain/toolchain-e2e

Length of output: 1667


🏁 Script executed:

# Search for ToolchainStatus and MetricsConfig in the codebase to understand the change
rg "MetricsConfig|ToolchainStatus" --type go -A 2 -B 2 | head -50

Repository: codeready-toolchain/toolchain-e2e

Length of output: 3215


Ensure personal-fork replace directives have documented rollback plans.

Lines 34 and 36 route two core modules to personal forks (github.com/xcoulon/*) with no published official versions available containing these changes. Official repos have no releases or tags. While these forks may be intentional for active development, leaving them on master creates maintainability and supply-chain risk if development stalls or the forks diverge.

Add a tracked rollback plan with an explicit target date to remove these directives once the required changes are published in the official repositories.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@go.mod` around lines 34 - 37, The two replace directives pointing
github.com/codeready-toolchain/api -> github.com/xcoulon/api and
github.com/codeready-toolchain/toolchain-common ->
github.com/xcoulon/toolchain-common must be accompanied by a tracked rollback
plan: add a clear comment above each replace in go.mod that states the reason,
the maintainer/owner, the explicit target date to remove the replace (e.g.,
YYYY-MM-DD), and a link to a new GitHub issue or PR that tracks "Remove
personal-fork replace when upstream releases change X"; also create that GitHub
issue titled to reference the modules (github.com/xcoulon/api and
github.com/xcoulon/toolchain-common) and set the milestone/assignee so the
replace will be removed on or before the target date. Ensure the comment
references the exact replace lines and the temporary fork versions currently
used.

Comment on lines +707 to +709
t.Run("verify metrics are still correct after restarting pod", func(t *testing.T) {
// given
hostAwait.UpdateToolchainConfig(t, testconfig.Metrics().ForceSynchronization(true))
hostAwait.UpdateToolchainConfig(t)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# 1) Inspect UpdateToolchainConfig implementation and zero-arg handling.
echo "=== UpdateToolchainConfig implementation ==="
rg -n -C6 --type=go '\bfunc\s+\(.*\)\s+UpdateToolchainConfig\(' 

echo -e "\n=== No-arg calls (with just t) ==="
rg -n -C2 --type=go '\bUpdateToolchainConfig\(t\)'

echo -e "\n=== Calls with explicit modifiers ==="
rg -n -C2 --type=go '\bUpdateToolchainConfig\(t,\s*'

Repository: codeready-toolchain/toolchain-e2e

Length of output: 9257


Remove UpdateToolchainConfig(t) or pass explicit modifiers.

This is the only call in the codebase without explicit modifiers. Every other call passes explicit options (e.g., testconfig.AutomaticApproval().Enabled(...)). Clarify the intent: either this subtest requires specific config changes or the call should be removed entirely.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/metrics/metrics_test.go` around lines 707 - 709, The test calls
hostAwait.UpdateToolchainConfig(t) with no modifiers, which is inconsistent with
other usages that pass explicit options; either remove this call if no config
change is needed, or replace it with a call that includes the intended modifiers
(for example testconfig.AutomaticApproval().Enabled(true/false) or other
testconfig.* options) so the intent is explicit; look for UpdateToolchainConfig
and replace or remove it accordingly, aligning with neighboring tests that use
testconfig.AutomaticApproval().Enabled(...) as the pattern.

Signed-off-by: Xavier Coulon <xcoulon@redhat.com>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 5, 2026

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Mar 5, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: MatousJobanek, rajivnathan, xcoulon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [MatousJobanek,rajivnathan,xcoulon]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@xcoulon xcoulon merged commit 3c9d868 into codeready-toolchain:master Mar 6, 2026
11 of 12 checks passed
@xcoulon xcoulon deleted the toolchain_status_metrics_api_drop branch March 6, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants