Skip to content

fix(EC-1994): correct off-by-one in validate image worker loop - #3425

Open
cuipinghuo wants to merge 1 commit into
conforma:mainfrom
cuipinghuo:EC-1994
Open

fix(EC-1994): correct off-by-one in validate image worker loop#3425
cuipinghuo wants to merge 1 commit into
conforma:mainfrom
cuipinghuo:EC-1994

Conversation

@cuipinghuo

@cuipinghuo cuipinghuo commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix off-by-one in worker loop at cmd/validate/image.go:404: <= changed to < so the loop spawns exactly numWorkers goroutines instead of numWorkers+1
  • Bump task worker defaults by 1 to preserve the effective concurrency users had before the fix (since the old <= loop spawned N+1 workers for a configured value of N):
    • verify-conforma-konflux-ta: 4 → 5
    • verify-enterprise-contract: 1 → 2
  • Update READMEs and generated docs to match new defaults; fix stale documentation that incorrectly claimed WORKERS was unused and defaulted to 35

Test plan

  • go build ./cmd/validate/ passes
  • go test -tags=unit ./cmd/validate/ -run TestValidateImage passes
  • make generate produces no additional diff

Resolves: https://redhat.atlassian.net/browse/EC-1994

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d2b957c3-04db-4370-a171-470f9fd8e3e8

📥 Commits

Reviewing files that changed from the base of the PR and between bd52d43 and ec4d985.

📒 Files selected for processing (6)
  • cmd/validate/image.go
  • docs/modules/ROOT/pages/verify-conforma-konflux-ta.adoc
  • docs/modules/ROOT/pages/verify-enterprise-contract.adoc
  • pipelines/enterprise-contract/0.1/enterprise-contract.yaml
  • tasks/verify-conforma-konflux-ta/0.1/verify-conforma-konflux-ta.yaml
  • tasks/verify-enterprise-contract/0.1/verify-enterprise-contract.yaml
🚧 Files skipped from review as they are similar to previous changes (5)
  • docs/modules/ROOT/pages/verify-conforma-konflux-ta.adoc
  • docs/modules/ROOT/pages/verify-enterprise-contract.adoc
  • tasks/verify-conforma-konflux-ta/0.1/verify-conforma-konflux-ta.yaml
  • tasks/verify-enterprise-contract/0.1/verify-enterprise-contract.yaml
  • cmd/validate/image.go

📝 Walkthrough

Walkthrough

The image validator now starts exactly the configured number of workers. The Konflux and enterprise contract pipeline defaults and documentation now use updated WORKERS values.

Changes

Worker count alignment

Layer / File(s) Summary
Match configured worker count
cmd/validate/image.go
The worker loop now starts exactly numWorkers workers.
Update Konflux worker default
tasks/verify-conforma-konflux-ta/0.1/verify-conforma-konflux-ta.yaml, docs/modules/ROOT/pages/verify-conforma-konflux-ta.adoc, tasks/verify-conforma-konflux-ta/0.1/README.md
The default changes from 4 to 5. The documentation describes parallel policy evaluation and the managed release pipeline override.
Update enterprise contract worker default
pipelines/enterprise-contract/0.1/enterprise-contract.yaml, tasks/verify-enterprise-contract/0.1/verify-enterprise-contract.yaml, docs/modules/ROOT/pages/verify-enterprise-contract.adoc, tasks/verify-enterprise-contract/0.1/README.md
The default changes from 1 to 2 in the pipeline, Task, and documentation.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Mergeability Score: ⚪ Minimal · up to ec4d9

The worker loop now creates the configured number of workers, with defaults and documentation updated consistently; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 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 (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the off-by-one fix in the validate image worker loop.
Description check ✅ Passed The description explains the changes, rationale, ticket, and validation steps, covering the template requirements despite different section headings.
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.
✨ 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.

@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
acceptance 54.38% <100.00%> (-0.02%) ⬇️
generative 12.28% <0.00%> (-4.09%) ⬇️
integration 23.59% <100.00%> (-3.99%) ⬇️
unit 72.20% <100.00%> (+0.22%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
cmd/validate/image.go 91.31% <100.00%> (ø)

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

jsmid1
jsmid1 previously approved these changes Jul 23, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Jul 23, 2026

Copy link
Copy Markdown

🤖 Review · ⚠️ Cancelled · Started 2:07 PM UTC · Ended 2:15 PM UTC
Commit: 87c4a29 · View workflow run →

@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 `@tasks/verify-conforma-konflux-ta/0.1/verify-conforma-konflux-ta.yaml`:
- Line 180: Synchronize the README worker defaults with the Task definitions:
for tasks/verify-conforma-konflux-ta/0.1/verify-conforma-konflux-ta.yaml lines
180-180, document the effective default as 5 instead of 35/unused; for
tasks/verify-enterprise-contract/0.1/verify-enterprise-contract.yaml lines
186-186, update the README default from 1 to 2.
🪄 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: Pro Plus

Run ID: 8ffe48a4-a59b-47ad-aa6c-96664ec08be3

📥 Commits

Reviewing files that changed from the base of the PR and between ea9f3be and 44b18de.

📒 Files selected for processing (2)
  • tasks/verify-conforma-konflux-ta/0.1/verify-conforma-konflux-ta.yaml
  • tasks/verify-enterprise-contract/0.1/verify-enterprise-contract.yaml

@fullsend-ai-review

fullsend-ai-review Bot commented Jul 23, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 2:16 PM UTC · Completed 2:31 PM UTC
Commit: 87c4a29 · View workflow run →

@fullsend-ai-review

fullsend-ai-review Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review

Findings

Medium

  • [stale-default-value] docs/modules/ROOT/pages/verify-conforma-vsa-release-ta.adoc:55 — The WORKERS parameter default is documented as 4, but this PR bumps the related verify-conforma-konflux-ta task default from 4 to 5 to preserve effective concurrency after the off-by-one fix. If the VSA release task inherits or mirrors the same default, this doc is now stale and the VSA release task's YAML (defined externally) may also need its WORKERS default bumped from 4 to 5.
    Remediation: Confirm whether the VSA release task shares the same default lineage as verify-conforma-konflux-ta. If so, update the doc and the external task YAML. If the VSA release task has its own independent default, confirm it is still correct and leave as-is.

Low

  • [test-adequacy] cmd/validate/image.go:404 — No test covers the worker loop to verify that exactly numWorkers goroutines are spawned. The off-by-one existed since the loop was introduced and was not caught by tests. A regression test would prevent reintroduction.
    Remediation: Consider adding a test that asserts the number of concurrent workers matches the --workers flag value (e.g., via an atomic counter in a test-only worker function).
Previous run

Review

Findings

Medium

  • [stale-default-value] docs/modules/ROOT/pages/verify-conforma-vsa-release-ta.adoc:55 — The WORKERS parameter default is documented as 4, but the verify-conforma-konflux-ta task YAML default was bumped from 4 to 5 in this PR. The sibling page verify-conforma-konflux-ta.adoc was correctly updated, but this page was missed.
    Remediation: Update the WORKERS default from 4 to 5 in verify-conforma-vsa-release-ta.adoc to match the updated task YAML default, unless this task has its own separate WORKERS override.

Low

  • [default-consistency] cmd/validate/image.go:59 — The Go-code default for workers remains 5, but before the off-by-one fix the effective worker count was 6 (<= 5 spawns workers 0–5). The task YAML defaults were each bumped by 1 to preserve effective concurrency (4→5 and 1→2), yet the CLI's own default was not bumped (5→6). Users invoking the CLI directly will silently drop from 6 to 5 effective workers. This appears to be an intentional choice (the default was always meant to be 5), but is worth confirming.

  • [documentation-accuracy] tasks/verify-conforma-konflux-ta/0.1/README.md:34 — The README update replaces the old claim that WORKERS was unused ("All policy evaluations are run with 35 workers") with a note about managed release pipelines overriding via conforma.workerCount in konflux-release-data. This corrects stale documentation and is valuable cleanup, though it goes slightly beyond the minimal off-by-one fix scope.

Previous run (2)

Review

Findings

Low

  • [scope alignment] tasks/verify-enterprise-contract/0.1/verify-enterprise-contract.yaml:186 — The PR description only mentions fixing the off-by-one bug in the worker loop, but the PR also changes default WORKERS values across two task definitions and their documentation, and removes the "currently not used" note from the verify-conforma-konflux-ta README. These changes preserve the previous effective worker counts (since the old <= loop spawned N+1 workers for a configured value of N), but this rationale is not stated in the PR description.
    Remediation: Update the PR description to explain that the default values are bumped by 1 to preserve the previous effective worker counts after the off-by-one fix.

Labels: Bug fix in CLI validate command with documentation updates

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review fullsend-ai-review Bot added ready-for-merge All reviewers approved — ready to merge bug Something isn't working cli labels Jul 23, 2026
@joejstuart

Copy link
Copy Markdown
Contributor

The change looks good, I'm just unsure of the impact to the users that modify the workers outside of the task (ie: in konflux-release-data). All configs that modify the count are set to 35, which means we're only taking away 1 worker, so it should be negligible. They could see a little slower runtimes though. In theory it should slow a 10 minute Conforma run by 17 seconds.
The alternative is we live with this bug.

Comment thread tasks/verify-conforma-konflux-ta/0.1/README.md
@fullsend-ai-review

fullsend-ai-review Bot commented Jul 23, 2026

Copy link
Copy Markdown

🤖 Finished Review · ❌ Failure · Started 8:26 PM UTC · Completed 8:40 PM UTC
Commit: 87c4a29 · View workflow run →

jsmid1
jsmid1 previously approved these changes Jul 28, 2026
BohdanMar
BohdanMar previously approved these changes Aug 12, 2026
cuipinghuo added a commit to cuipinghuo/release-service-catalog that referenced this pull request Aug 13, 2026
An off-by-one fix in conforma/cli (conforma/cli#3425) corrected the
worker loop from <= to <, reducing actual worker count by 1. Bump the
fallback default to preserve the effective concurrency users had before
the fix. This only affects releases where conforma.workerCount is not
set in konflux-release-data.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: cuipinghuo <chuo@redhat.com>
The worker loop used <= instead of <, spawning numWorkers+1 goroutines
instead of the intended numWorkers. Bump task defaults to preserve the
effective concurrency users had before the fix:
- verify-conforma-konflux-ta: 4 → 5
- verify-enterprise-contract: 1 → 2

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@fullsend-ai-review

fullsend-ai-review Bot commented Aug 13, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 6:54 PM UTC · Completed 7:08 PM UTC

Commit: 87c4a29 · View workflow run →

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

Comment thread cmd/validate/image.go
// Initialize each worker. They will wait patiently until a job is sent to the jobs
// channel, or the jobs channel is closed.
for i := 0; i <= numWorkers; i++ {
for i := 0; i < numWorkers; i++ {

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] test-adequacy

No test covers the worker loop to verify that exactly numWorkers goroutines are spawned. The off-by-one existed since the loop was introduced and was not caught by tests. A regression test would prevent reintroduction.

Suggested fix: Consider adding a test that asserts the number of concurrent workers matches the --workers flag value.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not sure that's worth it.

@fullsend-ai-review fullsend-ai-review Bot removed the ready-for-merge All reviewers approved — ready to merge label Aug 13, 2026
@fullsend-ai-review fullsend-ai-review Bot added the requires-manual-review Review requires human judgment label Aug 13, 2026
@simonbaird

Copy link
Copy Markdown
Member

Rebase should fix the EC violation now that #3496 is merged.

srivickynesh pushed a commit to srivickynesh/build-definitions that referenced this pull request Aug 14, 2026
An off-by-one fix in conforma/cli (conforma/cli#3425) corrected the
worker loop from <= to <, reducing actual worker count by 1. Bump the
default to preserve the effective concurrency users had before the fix.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cli requires-manual-review Review requires human judgment size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants