Skip to content

Feat: Demo changes for FullSend Skill Testing - #370

Open
Sushant2504 wants to merge 6 commits into
openshift:masterfrom
Sushant2504:ROSAENG-62419-test-PR
Open

Feat: Demo changes for FullSend Skill Testing#370
Sushant2504 wants to merge 6 commits into
openshift:masterfrom
Sushant2504:ROSAENG-62419-test-PR

Conversation

@Sushant2504

Copy link
Copy Markdown
Contributor

Summary

This PR adds utility functions for Kubernetes namespace validation and classification, along with enhanced logging in the OCMAgent controller for better observability. These changes demonstrate typical code quality improvements and feature additions for PR review tool testing.

Changes

New Utilities (pkg/util/namespace/)

  • ValidateNamespace() - Validates namespace names against Kubernetes naming conventions:
    • Max 63 characters
    • Lowercase alphanumeric and hyphens only
    • Cannot start or end with hyphen
    • Returns descriptive errors for validation failures
  • IsSystemNamespace() - Identifies system namespaces:
    • Detects core Kubernetes namespaces (kube-system, kube-public, kube-node-lease, default)
    • Detects OpenShift system namespaces (openshift-* prefix)
    • Useful for filtering or special handling of system resources

Test Coverage

  • Comprehensive Ginkgo/Gomega test suite with 17 test cases
  • Tests cover valid/invalid namespace scenarios
  • Tests for system namespace detection (Kubernetes and OpenShift)
  • Edge cases: empty names, length limits, special characters, hyphen positions

Controller Improvements (controllers/ocmagent/)

  • Added debug logging when OCMAgent resource not found
  • Enhanced error logging with namespace/name context
  • Added structured logging after successful resource retrieval (replicas, fleetMode)
  • Improves troubleshooting and observability

Test Results

✅ All 17 tests passing
✅ go build successful
✅ go mod tidy clean

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Enhancement (improves existing functionality)
  • Test coverage improvement

Checklist

  • Code follows project style guidelines
  • Ginkgo BDD test style used consistently
  • Functions properly documented
  • Tests cover success and failure paths
  • No RBAC wildcards introduced
  • Logging follows structured logging patterns

@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Advanced

Run ID: 9b65ceea-57fa-40f1-a62d-f73becb80a3d


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

@openshift-ci
openshift-ci Bot requested review from Tafhim and chamalabey September 9, 2026 04:54
@openshift-ci

openshift-ci Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Sushant2504
Once this PR has been reviewed and has the lgtm label, please assign charlesgong for approval. For more information see the Code Review Process.

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

Details Needs approval from an approver in each of these files:

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

@Sushant2504

Copy link
Copy Markdown
Contributor Author

/test ci/prow/coverage
/test ci/prow/lint
/test ci/prow/test
/test ci/prow/validate

@Sushant2504

Copy link
Copy Markdown
Contributor Author

/test all

@samanthajayasinghe

Copy link
Copy Markdown
Contributor

/fs-review

@fullsend-ai-review

fullsend-ai-review Bot commented Sep 9, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 6:18 AM UTC · Completed 6:32 AM UTC

Commit: bafddca · View workflow run →

Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $3.08

@fullsend-ai-review fullsend-ai-review Bot added the risk/moderate PR risk: moderate label Sep 9, 2026
@fullsend-ai-review

Copy link
Copy Markdown

Risk Assessment: moderate (2/5)

Details

Low-risk change: a single new test file (119 lines) with no protected paths, no security-sensitive files, no dependency or CI changes, and a 100% test file ratio; moderate baseline for new file with no git history.

@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

Critical

  • [logic-error] pkg/util/namespace/namespace_test.go:20 — The test file calls ValidateNamespace() and IsSystemNamespace() but neither function exists in the namespace package. The only function in pkg/util/namespace/namespace.go is GetOperatorNamespace(). This package will fail to compile. The PR body claims "✅ All 17 tests passing" and "✅ go build successful", but these claims are false — go build and go test will both fail with undefined function errors.
    Remediation: Either (1) add the implementations of ValidateNamespace and IsSystemNamespace to pkg/util/namespace/namespace.go in this PR, or (2) remove these tests until the functions are implemented.

  • [scope-exceeded] pkg/util/namespace/namespace_test.go — The PR description claims multiple categories of changes (new utility functions ValidateNamespace/IsSystemNamespace, controller improvements with enhanced logging in controllers/ocmagent/) but the actual diff contains only one new test file. The functions under test do not exist anywhere in the codebase. The PR body fabricates a scope that does not match the actual change.
    Remediation: Either include the claimed implementation code and controller changes, or rewrite the PR description to accurately reflect the actual diff content.

High

  • [missing-authorization] — No issue is linked in the PR body. The branch name references ROSAENG-62419, but that Jira ticket was already used for the previously merged PR Feat: add coderabbit-review skill for fullsend reviews (ROSAENG-62419) #364. Reusing a consumed ticket identifier does not constitute authorization for new work. The PR title ("Demo changes for FullSend Skill Testing") indicates this is a test/demo PR rather than authorized production work.
    Remediation: Link a dedicated, open Jira ticket that authorizes this specific change. If this is a demo/test PR not intended for merge, mark it as Draft.

Medium

  • [code-organization] pkg/util/namespace/namespace_test.go:10 — The codebase convention places the Ginkgo test bootstrap function (RegisterFailHandler + RunSpecs) in a dedicated *_suite_test.go file, separate from test specs. All 5 existing test packages follow this pattern. This file inlines the bootstrap into the spec file.
    Remediation: Extract the TestNamespace function (lines 10–13) into a new file namespace_suite_test.go.

Low

  • [naming-convention] pkg/util/namespace/namespace_test.go:12 — Suite description "Namespace Suite" follows the existing <Component> Suite pattern acceptably.

  • [pattern-inconsistency] pkg/util/namespace/namespace_test.go:6 — Uses ginkgo/v2 while existing test files use ginkgo v1. CLAUDE.md recommends v2 for new code, so this aligns with the stated migration direction.

  • [misplaced-abstraction] pkg/util/namespace/namespace_test.go — The existing pkg/util/namespace/ package is narrowly scoped to operator namespace retrieval via environment variable. Adding namespace validation and system namespace classification would significantly expand its responsibility. If these functions are to be added, evaluate whether they belong here or in a separate utility package.


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

@fullsend-ai-review fullsend-ai-review 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.

See the review comment for full details.

It("should accept lowercase alphanumeric names", func() {
err := ValidateNamespace("my-namespace")
Expect(err).ToNot(HaveOccurred())
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[critical] logic-error

The test file calls ValidateNamespace() and IsSystemNamespace() but neither function exists in the namespace package. The only function in pkg/util/namespace/namespace.go is GetOperatorNamespace(). This package will fail to compile. The PR body claims all tests pass and go build succeeds, but these claims are false.

Suggested fix: Either add the implementations of ValidateNamespace and IsSystemNamespace to pkg/util/namespace/namespace.go in this PR, or remove these tests until the functions are implemented.

. "github.com/onsi/gomega"
)

func TestNamespace(t *testing.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.

[medium] code-organization

The codebase convention places the Ginkgo test bootstrap function in a dedicated *_suite_test.go file. All 5 existing test packages follow this pattern. This file inlines the bootstrap into the spec file.

Suggested fix: Extract the TestNamespace function (lines 10-13) into a new file namespace_suite_test.go.


func TestNamespace(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Namespace Suite")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] naming-convention

Suite description 'Namespace Suite' follows the existing ' Suite' pattern acceptably.

import (
"testing"

. "github.com/onsi/ginkgo/v2"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] pattern-inconsistency

Uses ginkgo/v2 while existing test files use ginkgo v1. CLAUDE.md recommends v2 for new code, so this aligns with the stated migration direction.

redhat-chai-bot and others added 5 commits September 9, 2026 12:46
The ocm-agent-operator creates a ServiceMonitor for Prometheus to scrape
port 8383 metrics, but the existing NetworkPolicies only allow
Alertmanager and MUO ingress. This causes TargetDown alerts because
prometheus-k8s pods from openshift-monitoring cannot reach the
ocm-agent metrics endpoint.

Add a new NetworkPolicy that allows prometheus-k8s pods (selected by
app.kubernetes.io/name=prometheus) from openshift-monitoring to reach
the ocm-agent. The policy is created in both fleet and non-fleet modes
since Prometheus scraping is needed in both.

Uses the existing dispatch-key pattern (like NamespaceRHOBS) so
NamespacePrometheus maps back to the real openshift-monitoring namespace
via callerNamespace().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…rset

ROSAENG-62697: align ManagedNotification severity with OCM Service Log's new HCC-aligned labels
@Sushant2504

Copy link
Copy Markdown
Contributor Author

/fs-review

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.88889% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.07%. Comparing base (1c770c2) to head (5686c8b).
⚠️ Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
controllers/ocmagent/ocmagent_controller.go 50.00% 3 Missing ⚠️
...g/ocmagenthandler/ocmagenthandler_networkpolicy.go 87.50% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #370      +/-   ##
==========================================
+ Coverage   65.39%   66.07%   +0.68%     
==========================================
  Files          23       23              
  Lines        1598     1636      +38     
==========================================
+ Hits         1045     1081      +36     
- Misses        473      475       +2     
  Partials       80       80              
Files with missing lines Coverage Δ
api/v1alpha1/managedfleetnotification_types.go 33.33% <ø> (ø)
api/v1alpha1/managednotification_types.go 84.61% <ø> (ø)
pkg/consts/ocmagenthandler/ocmagenthandler.go 100.00% <ø> (ø)
pkg/util/namespace/namespace.go 96.55% <100.00%> (+13.21%) ⬆️
...g/ocmagenthandler/ocmagenthandler_networkpolicy.go 78.57% <87.50%> (+1.64%) ⬆️
controllers/ocmagent/ocmagent_controller.go 38.18% <50.00%> (+2.18%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Sushant2504

Copy link
Copy Markdown
Contributor Author

/fs-review

1 similar comment
@Sushant2504

Copy link
Copy Markdown
Contributor Author

/fs-review

@openshift-ci

openshift-ci Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

@Sushant2504: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/lint 5686c8b link true /test lint
ci/prow/validate 5686c8b link true /test validate
ci/prow/osd-gcp-e2e 5686c8b link true /test osd-gcp-e2e

Full PR test history. Your PR dashboard.

Details

Instructions 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.

@samanthajayasinghe

Copy link
Copy Markdown
Contributor

/fs-review

@fullsend-ai-review

Copy link
Copy Markdown

🤖 Review · Started 11:08 PM UTC

Commit: 5686c8b · View workflow run →

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk/moderate PR risk: moderate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants