Skip to content

Add streams.yml alias collision validation - #3265

Open
redhat-chai-bot wants to merge 2 commits into
openshift-eng:mainfrom
redhat-chai-bot:add-streams-alias-collision-validation
Open

Add streams.yml alias collision validation#3265
redhat-chai-bot wants to merge 2 commits into
openshift-eng:mainfrom
redhat-chai-bot:add-streams-alias-collision-validation

Conversation

@redhat-chai-bot

@redhat-chai-bot redhat-chai-bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Adds semantic validation to the ocp-build-data-validator that flags collisions between top-level stream names and resolved alias values in streams.yml.

What it validates

  1. Alias vs stream name — an alias value matching any top-level stream name (including its own)
  2. Duplicate aliases — the same alias defined in multiple streams

Context

This was identified after a golang-builder pipeline crash caused by a stream in streams.yml listing its own name as an alias (e.g. rhel-9-golang-1.21 with alias rhel-9-golang-1.21). Fixed in openshift-eng/ocp-build-data#12213, but this validation ensures it is caught proactively.

Changes

  • ocp-build-data-validator/validator/streams.py — new semantic validation module
  • ocp-build-data-validator/tests/test_streams.py — 7 test cases
  • ocp-build-data-validator/validator/__main__.py — wire streams validation into the pipeline

AI-generated. Review for accuracy.

@thegreyd requested in Slack thread

Summary by CodeRabbit

  • New Features

    • Added validation for stream aliases.
    • Detects aliases that conflict with stream names or are duplicated across streams.
    • Reports all detected alias conflicts in clear error messages.
  • Tests

    • Added coverage for valid aliases, empty alias lists, duplicate aliases, name collisions, and multiple simultaneous conflicts.

@openshift-ci

openshift-ci Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign thegreyd 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

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@redhat-chai-bot, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 39 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository: openshift-eng/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1a3724ba-65a9-4e2e-b842-be334f27a0f6

📥 Commits

Reviewing files that changed from the base of the PR and between d0f4a6a and 1057a29.

📒 Files selected for processing (2)
  • ocp-build-data-validator/tests/test_streams.py
  • ocp-build-data-validator/validator/streams.py

Walkthrough

The validator now recognizes streams artifacts, detects alias collisions with stream names or other aliases, reports validation failures, and bypasses GitHub validation after stream validation.

Changes

Stream validation

Layer / File(s) Summary
Alias collision rules and tests
ocp-build-data-validator/validator/streams.py, ocp-build-data-validator/tests/test_streams.py
Added validation for aliases that match stream names or appear on multiple streams. Tests cover valid configurations, collisions, duplicate aliases, combined errors, and empty alias lists.
Validator integration
ocp-build-data-validator/validator/__main__.py
The validator recognizes streams artifacts, runs streams.validate, reports errors, prints success for valid data, and skips GitHub validation.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ValidatorMain
  participant StreamsValidate
  participant ValidationSupport
  ValidatorMain->>StreamsValidate: validate(stream_data)
  StreamsValidate-->>ValidatorMain: collision errors or None
  ValidatorMain->>ValidationSupport: fail_validation(error) when errors exist
  ValidatorMain-->>ValidatorMain: report success and skip GitHub validation when valid
Loading
🚥 Pre-merge checks | ✅ 10 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Ai-Attribution ⚠️ Warning AI use is stated in the PR, but its only commit has Co-Authored-By: Claude Opus 4.6 and no Assisted-by or Generated-by trailer. Replace the AI Co-Authored-By trailer with the required Red Hat Assisted-by or Generated-by trailer, using the project-approved attribution format.
✅ Passed checks (10 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: validating alias collisions in streams.yml.
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.
No-Weak-Crypto ✅ Passed The PR changes only stream alias validation, pipeline wiring, and tests; the changed files contain no weak-crypto algorithms, crypto APIs, custom cryptography, or secret comparisons.
Container-Privileges ✅ Passed The patch changes only Python source and tests. No added lines contain privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, root, or allowPrivilegeEscalation settings.
No-Sensitive-Data-In-Logs ✅ Passed New errors log only the colliding alias and stream identifiers; the code does not log passwords, tokens, URLs, PII, or full stream configuration values.
No-Hardcoded-Secrets ✅ Passed The three changed files contain no sensitive-name literal assignments, credential-bearing URLs, or strict base64 string literals longer than 32 characters.
No-Injection-Vectors ✅ Passed The PR adds no listed injection sink; streams.py only compares data and formats error text, and YAML parsing uses ruamel.yaml YAML(typ="safe").
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 `@ocp-build-data-validator/validator/streams.py`:
- Around line 38-43: The alias collision logic in the stream validation flow
must ignore repeated aliases owned by the same stream. In the block updating
alias_to_stream, compare alias_to_stream[alias] with stream_name and append to
collisions only when they differ, while preserving the existing owner mapping;
add a regression test covering duplicate aliases within one stream.
🪄 Autofix

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: Repository: openshift-eng/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f2d709ef-4355-41a0-a6bb-33f602185bbe

📥 Commits

Reviewing files that changed from the base of the PR and between 261e3d7 and d0f4a6a.

📒 Files selected for processing (3)
  • ocp-build-data-validator/tests/test_streams.py
  • ocp-build-data-validator/validator/__main__.py
  • ocp-build-data-validator/validator/streams.py

Comment thread ocp-build-data-validator/validator/streams.py Outdated
redhat-chai-bot and others added 2 commits August 11, 2026 03:14
Detect collisions between top-level stream names and alias values
in streams.yml. Two types of collisions are caught:
- An alias value that matches a top-level stream name
- The same alias value defined in multiple streams

Follows the existing releases.py pattern for semantic validation
that runs after schema validation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
rh-pre-commit.version: 2.2.0
rh-pre-commit.check-secrets: ENABLED
The previous check incorrectly flagged duplicate aliases within the same
stream as cross-stream collisions. Now only aliases shared between
different streams are reported as errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
rh-pre-commit.version: 2.2.0
rh-pre-commit.check-secrets: ENABLED
@redhat-chai-bot
redhat-chai-bot force-pushed the add-streams-alias-collision-validation branch from ea036f9 to 1057a29 Compare August 11, 2026 03:15
@openshift-ci

openshift-ci Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

@redhat-chai-bot: The following test 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/security 1057a29 link false /test security

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.

@thegreyd thegreyd added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants