Skip to content

refactor: remove trivial deps and dead code - #21991

Draft
davdhacs wants to merge 20 commits into
masterfrom
davdhacs/remove-trivial-deps
Draft

refactor: remove trivial deps and dead code#21991
davdhacs wants to merge 20 commits into
masterfrom
davdhacs/remove-trivial-deps

Conversation

@davdhacs

@davdhacs davdhacs commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Description

Remove or replace several direct Go dependencies with stdlib equivalents or already-imported alternatives, reducing supply-chain attack surface. Each removal is a separate atomic commit.

Deps fully removed from go.mod (8 modules eliminated):

  • tkuchiki/go-timezone — replaced with stdlib time.Time.Zone() (the offset is authoritative; the library re-derives it from ambiguous abbreviations)
  • gorilla/schema — replaced with direct url.Values encoding/decoding for a 4-field string struct
  • VividCortex/ewma — replaced with 3 lines of inline EWMA math (single use in a progress bar speed display)
  • vbauerster/mpb/v4 — replaced with simple line-based progress output (matching kubectl's approach)
  • acarl005/stripansi — removed (was only needed by mpb)
  • adhocore/gronx — consolidated with existing robfig/cron.v2 (14k stars vs 513, actually smaller source)
  • jeremywohl/flatten — replaced with 15-line recursive map flattener in test helper
  • joshdk/go-junit — replaced with stdlib encoding/xml structs in test

Major dep tree reductions:

  • stackrox/external-network-pusher466 transitive deps eliminated by inlining 4 string constants and 4 JSON struct definitions
  • cloud.google.com/go/artifactregistry275 transitive deps eliminated by inlining 2 OAuth scope URL strings

Deps demoted from direct to indirect:

  • go.uber.org/atomic — replaced with stdlib sync/atomic (Uber deprecated it; stays indirect via zap until they drop it)

Dead code removed:

Net result: 10 modules fully eliminated from go.mod, 1 demoted to indirect, 1 dead code package deleted.

User-facing documentation

  • CHANGELOG.md is updated OR update is not needed
  • documentation PR is created and is linked above OR is not needed

No user-facing behavior changes. The roxctl central db restore progress display changes from a fancy multi-bar to simple line-based output (same information, less visual flair).

Testing and quality

  • the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • modified existing tests

Existing tests for refresh_token_cookie (5 tests), reprocessor, logging, operator translation (deployment defaults + securedcluster), and JUnit printer continue to pass. The logconvert subcommand had no tests. Cron validation covered by existing integration tests.

How I validated my change

  • go build ./... passes with all changes applied
  • go test ./pkg/auth/authproviders/... — 5 tests pass
  • go test ./central/reprocessor/... — tests pass
  • go test ./pkg/logging/... — tests pass (pre-existing flake in TestRateLimitedLogger unrelated)
  • go test ./operator/internal/central/values/translation/... — tests pass
  • go test ./operator/internal/securedcluster/values/translation/... — tests pass
  • go test ./pkg/printers/... -run TestJunit — 2 tests pass
  • go test ./pkg/networkgraph/defaultexternalsrcs/... — tests pass
  • go mod tidy confirms no orphaned deps
  • Validated robfig/cron.v2.Parse("0 " + expr) correctly validates standard 5-field cron expressions
  • GKE e2e tests pass (first run on fe965e4)

davdhacs and others added 8 commits July 28, 2026 14:56
TimeToOffset used tkuchiki/go-timezone to look up UTC offsets by timezone
abbreviation. This is both unnecessary and less accurate than the stdlib:
time.Time.Zone() already returns the exact offset, while the library
re-derives it from the abbreviation and returns 0 on ambiguous names
(e.g. "CST" maps to multiple offsets).

Removes one direct dependency (tkuchiki/go-timezone) and its transitive
deps from go.mod.

Partially generated with AI assistance (Claude Code).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
go.uber.org/atomic is deprecated by Uber in favor of stdlib sync/atomic,
which gained equivalent method-based types (Int32, Int64, etc.) in Go 1.19.

API mapping: NewInt32(0) → new(atomic.Int32), .Inc() → .Add(1),
.Dec() → .Add(-1). .Load()/.Store() are identical.

Partially generated with AI assistance (Claude Code).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The refresh token cookie used gorilla/schema (a reflection-based
struct-to-url.Values encoder/decoder) for a 4-field string struct.
Replaced with direct url.Values access — simpler, no reflection,
no external dependency for this trivial case.

All 5 existing round-trip tests pass unchanged.

Partially generated with AI assistance (Claude Code).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The log-convert subcommand was disabled in PR #21301 (central-entrypoint
roxctl removal) but the package and command registration were left behind.
Remove the dead code and its import.

Generated with AI assistance.
Removes gorilla/schema and tkuchiki/go-timezone from direct deps.
Demotes go.uber.org/atomic from direct to indirect (still needed
transitively by zap).

Generated with AI assistance.
Single use in restore progress display. The exponentially weighted
moving average with age=30 is: value += (2/31) * (sample - value).
Three lines of arithmetic vs a whole dependency.

Generated with AI assistance.
These schema:"..." tags were left behind when gorilla/schema was
replaced with direct url.Values encoding. No code reads them now.

Generated with AI assistance.
@openshift-ci

openshift-ci Bot commented Jul 28, 2026

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The changes replace selected third-party utilities with standard-library or local implementations, modernize restore progress tracking, migrate cron validation, simplify cookie and timezone handling, update operator and provider parsing, and remove the hidden log-convert command.

Changes

Runtime dependency replacements

Layer / File(s) Summary
Standard-library atomic counters
central/reprocessor/reprocessor.go, pkg/logging/module.go, go.mod
Counters now use sync/atomic.Int32 with Add.
Cookie and timezone handling
pkg/auth/authproviders/refresh_token_cookie.go, pkg/timeutil/offset.go, go.mod
Cookies use explicit query values, and timezone offsets come directly from t.Zone().
Artifact Registry scope ownership
pkg/cloudproviders/gcp/auth/*, pkg/registries/google/google.go, go.mod
Artifact Registry scopes are defined locally and used by credential and registry token creation.

Restore transfer progress

Layer / File(s) Summary
Progress bar abstraction
roxctl/central/db/transfer/progress_bar.go
Adds atomic progress tracking, periodic rendering, byte formatting, and reader proxying.
Transfer progress integration
roxctl/central/db/transfer/transfer.go
Uses the new progress bar for HTTP and copy transfers and counts actual bytes read.
Restore progress and status integration
roxctl/central/db/restore/v2_restorer.go, go.mod
Connects restore operations to the progress bar and uses inline speed calculation.

Validation and test parsing

Layer / File(s) Summary
Robfig cron validation
central/complianceoperator/..., sensor/kubernetes/...
Uses cron.v2 parsing for schedule validation.
Local map flattening
operator/internal/values/testing/utils.go, operator/internal/*/translation/*_test.go
Adds and adopts a recursive map-flattening helper in translation tests.
Direct JUnit XML parsing
pkg/printers/junit_test.go
Tests parse emitted JUnit XML directly with local XML models.

Other command and data decoupling

Layer / File(s) Summary
Remove log-convert registration
roxctl/maincommand/command.go
Removes the hidden log-convert command from the command tree.
Local network data contracts
pkg/networkgraph/defaultexternalsrcs/*
Defines local external-network constants and JSON-mapping types.

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

Sequence Diagram(s)

sequenceDiagram
  participant Restorer as v2Restorer
  participant ProgressBar as transfer.ProgressBar
  participant Transfer as transfer
  Restorer->>ProgressBar: CreateProgressBar
  Restorer->>Transfer: performHTTPRequest
  Transfer->>ProgressBar: ProxyReader and count bytes
  Restorer->>ProgressBar: Read current progress
  ProgressBar-->>Restorer: Render transfer status and ETA
Loading

Suggested reviewers: guzalv, grimmimeloni, alkmim

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.50% 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
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.
Title check ✅ Passed The title accurately summarizes the main change: removing trivial dependencies and deleting dead code.
Description check ✅ Passed The description matches the required template and includes the major sections with concrete details, testing, and validation notes.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch davdhacs/remove-trivial-deps

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.

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

🚀 Build Images Ready

Images are ready for commit 510db81. To use with deploy scripts:

export MAIN_IMAGE_TAG=4.12.x-626-g510db81bf7

davdhacs added 2 commits July 28, 2026 15:40
Replace vbauerster/mpb multi-progress-bar library with plain
fmt.Fprintf status lines, matching the approach used by kubectl
and other Go CLI tools. Removes the mpb dep and its statusline.go
filler implementation.

This also removes the indirect deps on VividCortex/ewma and
acarl005/stripansi which were only needed by mpb.

Generated with AI assistance.
Three modules fully eliminated from the dependency tree.

Generated with AI assistance.

@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: 2

🤖 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 `@roxctl/central/db/transfer/progress_bar.go`:
- Line 96: Update FormatSize so its unit lookup supports sizes beyond GiB,
extending the unit sequence to include at least terabytes and continuing through
petabytes before indexing with exp. Preserve the existing scaling and formatting
behavior while preventing out-of-bounds access for larger byte values.

In `@roxctl/central/db/transfer/transfer.go`:
- Around line 36-40: Update the read-progress handling in the transfer method
around r.reader.Read and use count > 0, rather than err == nil, as the condition
for updating r.lastActivity and incrementing r.bar. Preserve the returned error
while counting bytes delivered alongside non-nil errors such as io.EOF.
🪄 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: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 1ad44b03-bdfc-4255-aa8d-0c02cebf15cb

📥 Commits

Reviewing files that changed from the base of the PR and between 576d94f and ff539eb.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (5)
  • go.mod
  • roxctl/central/db/restore/statusline.go
  • roxctl/central/db/restore/v2_restorer.go
  • roxctl/central/db/transfer/progress_bar.go
  • roxctl/central/db/transfer/transfer.go
💤 Files with no reviewable changes (2)
  • roxctl/central/db/restore/statusline.go
  • go.mod

div *= unit
exp++
}
return fmt.Sprintf("%.1f %ciB", float64(b)/float64(div), "KMG"[exp])

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.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Files matching progress_bar.go:"
fd -a 'progress_bar\.go$' . || true

file="$(fd 'progress_bar\.go$' . | head -n1 || true)"
if [ -n "$file" ]; then
  echo "--- outline ---"
  ast-grep outline "$file" || true
  echo "--- relevant lines ---"
  nl -ba "$file" | sed -n '1,150p'
fi

echo "--- FormatSize usages in repo ---"
rg -n "FormatSize|progress_bar|transfer" -S . --glob '!vendor/**' --glob '!*.sum' | head -n 200

Repository: stackrox/stackrox

Length of output: 1079


🏁 Script executed:

#!/bin/bash
set -euo pipefail

file="/home/jailuser/git/roxctl/central/db/transfer/progress_bar.go"
echo "--- progress_bar.go lines 1-140 ---"
awk '{printf "%4d\t%s\n", NR, $0}' "$file" | sed -n '1,140p'

echo "--- FormatSize references ---"
grep -RIn "FormatSize" . --exclude-dir=.git || true

echo "--- unit divider boundary values (read-only simulation) ---"
python3 - <<'PY'
divs = [1024, 1048576, 1073741824, 1099511627776, 1125899906842624, 1152921504606846976]
exp = 0
for bytes in [1023, 1024, 1048575, 1048576, 1073741823, 1073741824, 1099511627775, 1099511627776]:
    div = divs[exp]
    k = "KMG"
    print(bytes, "div=", div, "exp=", exp, "index=", bytes // div, "next_exp_when_exceed_div=", exp + (bytes // div >= 2))
    if bytes // div >= len(k):
        print("  would overflow KMG at", bytes)
    if bytes >= divs[exp+1]:
        exp += 1
PY

Repository: stackrox/stackrox

Length of output: 4377


🏁 Script executed:

#!/bin/bash
set -euo pipefail

file="/home/jailuser/git/roxctl/central/db/transfer/progress_bar.go"

echo "--- exact diff/stat ---"
git diff -- roxctl/central/db/transfer/progress_bar.go || true

echo "--- local static bounds check for "KMG" slice ---"
python3 - <<'PY'
path = "/home/jailuser/git/roxctl/central/db/transfer/progress_bar.go"
text = open(path).read()
start = text.index("\nfunc FormatSize(b int64) string {\n")
end = text.index("\n}\ntype countingReader", start)
fn = text[start:end]
print(fn)
print("\nContains 'KMGTPE' unit suffix:", "KMGTPE" in fn)
print("Contains 'KMG' literal:", "'KMG'" in fn or '"KMG"' in fn)

# Static loop invariant based on the shown source:
# "KMG" has indices 0..2, so exp >= 3 overflows. The loop increments
# exp starting at 0 while n = b / 1024 stays >= 1024. Hence any
# b >= 1024**4 causes exp == 3 at return.
units = [1024, 1024**2, 1024**3, 1024**4, 1024**5, 1024**6]
suffixes = "KMG"
for b in units:
    if b < 1024:
        continue
    div, exp = 1024, 0
    n = b // 1024
    while n >= 1024:
        div *= 1024
        exp += 1
    print(b, "expected unit", suffixes[min(exp, len(suffixes)-1)], "final exp", exp, "overflow=", exp >= len(suffixes))
PY

Repository: stackrox/stackrox

Length of output: 332


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "--- source references containing KMG/KMGTPE/FormatSize ---"
grep -RInE "FormatSize|KMG|KMGTPE" roxctl/central/db --exclude-dir=.git || true

echo "--- bounds of byte literals in format function with line numbers ---"
python3 - <<'PY'
from pathlib import Path
p = Path("roxctl/central/db/transfer/progress_bar.go")
lines = p.read_text().splitlines()
for i in range(85, 97):
    print(f"{i}: {lines[i-1]}")

slice_literal = '"KMG"'
print(f"KMG literal line =", next((i+1 for i,l in enumerate(lines) if slice_literal in l), None))
print("contains KMGTPE literal:", "KMGTPE" in p.read_text())
PY

Repository: stackrox/stackrox

Length of output: 1381


Handle sizes beyond GiB.

FormatSize uses exp to index "KMG" after div grows past 1 GiB; at 1 TiB exp becomes 3, causing a bounds panic from the progress-render goroutine. Support larger units such as KMGTPE before indexing.

🤖 Prompt for 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.

In `@roxctl/central/db/transfer/progress_bar.go` at line 96, Update FormatSize so
its unit lookup supports sizes beyond GiB, extending the unit sequence to
include at least terabytes and continuing through petabytes before indexing with
exp. Preserve the existing scaling and formatting behavior while preventing
out-of-bounds access for larger byte values.

Comment on lines 36 to 40
count, err := r.reader.Read(p)
if err == nil {
r.lastActivity.StoreAtomic(timestamp.Now())
r.progressBar.IncrBy(len(p))
r.bar.IncrBy(count)
}

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Files matching transfer.go:"
fd -a 'transfer.go$' . || true

echo
echo "Relevant file outline and contents:"
if [ -f roxctl/central/db/transfer/transfer.go ]; then
  wc -l roxctl/central/db/transfer/transfer.go
  ast-grep outline roxctl/central/db/transfer/transfer.go --view expanded || true
  cat -n roxctl/central/db/transfer/transfer.go
else
  echo "roxctl/central/db/transfer/transfer.go not found"
fi

echo
echo "Search for progressWatchReader usages and Close semantics:"
rg -n "progressWatchReader|IncrBy|lastActivity|Read\\(p\\)|Read\\(" roxctl/central/db/transfer roxctl || true

Repository: stackrox/stackrox

Length of output: 10586


🌐 Web query:

Go io.Reader documentation returned bytes and error may be non-nil

💡 Result:

In Go, the io.Reader interface's Read method is explicitly designed to allow returning both data (n > 0) and an error (err!= nil) in the same call [1][2]. This behavior occurs when a reader encounters an error or end-of-file condition after successfully reading some bytes [1][3]. For example, a reader might return the final bytes of a stream along with an io.EOF error simultaneously [1][4]. Because of this, callers must always process the returned bytes (n > 0) before considering the error (err) [1][5]. The standard, correct pattern for handling io.Reader is: n, err:= r.Read(p) if n > 0 { // Process the n bytes of data first process(p[:n]) } if err!= nil { // Handle the error (e.g., check for io.EOF) handle(err) } If you follow the common but incorrect pattern of checking the error first (e.g., if err!= nil { return err }), you risk discarding valid data returned by the final read operation [6][7]. Following the established pattern ensures that you correctly handle both partial reads and the various allowed behaviors of EOF [1][4].

Citations:


Count bytes returned even when an error accompanies them.

io.Reader can legally return n > 0 with a non-nil error, including io.EOF. The current err == nil gate skips those transferred bytes and leaves the watchdog activity stale, so transfers can report less progress than actually read. Update the progress/activity timestamp when count > 0, independently of err.

Proposed fix
 	count, err := r.reader.Read(p)
-	if err == nil {
+	if count > 0 {
 		r.lastActivity.StoreAtomic(timestamp.Now())
 		r.bar.IncrBy(count)
 	}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
count, err := r.reader.Read(p)
if err == nil {
r.lastActivity.StoreAtomic(timestamp.Now())
r.progressBar.IncrBy(len(p))
r.bar.IncrBy(count)
}
count, err := r.reader.Read(p)
if count > 0 {
r.lastActivity.StoreAtomic(timestamp.Now())
r.bar.IncrBy(count)
}
🤖 Prompt for 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.

In `@roxctl/central/db/transfer/transfer.go` around lines 36 - 40, Update the
read-progress handling in the transfer method around r.reader.Read and use count
> 0, rather than err == nil, as the condition for updating r.lastActivity and
incrementing r.bar. Preserve the returned error while counting bytes delivered
alongside non-nil errors such as io.EOF.

davdhacs added 2 commits July 28, 2026 15:49
gronx (513 stars, 1474 lines) was only used for IsValid() — cron
expression syntax checking. robfig/cron.v2 (14k stars, 806 lines) is
already in go.mod for Central's backup scheduler and can validate by
parsing with a "0 " prefix to convert 5-field to 6-field format.

One fewer module in the supply chain; robfig/cron is strictly more
popular and actually smaller.

Generated with AI assistance.
Generated with AI assistance.
@davdhacs

Copy link
Copy Markdown
Contributor Author

/test pull-ci-stackrox-stackrox-master-gke-qa-e2e-tests

@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 `@sensor/kubernetes/complianceoperator/utils.go`:
- Around line 195-198: Update both cron validation paths in
sensor/kubernetes/complianceoperator/utils.go at lines 195-198 and 214-217,
which call cronlib.Parse after prepending “0 ”, to support the documented
six-field cron expressions with seconds. Use cronlib’s explicit optional-seconds
or known-format parser consistently in both locations, or restrict and document
callers to five-field input if six-field schedules are not supported.
🪄 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: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: d864f550-c504-4561-983c-571bb35a3017

📥 Commits

Reviewing files that changed from the base of the PR and between ff539eb and fe965e4.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (3)
  • central/complianceoperator/v2/compliancemanager/manager_impl.go
  • go.mod
  • sensor/kubernetes/complianceoperator/utils.go
💤 Files with no reviewable changes (1)
  • go.mod

Comment on lines 195 to 198
if req.GetCron() != "" {
cron := gronx.New()
if !cron.IsValid(req.GetCron()) {
if _, err := cronlib.Parse("0 " + req.GetCron()); err != nil {
errList.AddStrings("schedule is not valid")
}

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check whether callers, tests, or documentation use six-field, descriptor, or extended cron syntax.
rg -n -C2 \
  -e 'GetCron\(\)' \
  -e '@(daily|hourly|weekly|monthly|every)' \
  -e '[LW#]' \
  --glob '*.go' --glob '*.md' --glob '*.proto' .

Repository: stackrox/stackrox

Length of output: 50374


Use the correct label for the major cron validation issue.

cronlib.Parse defaults to standard five-field cron, but supported six-field cron specs including seconds should remain valid. Since these validation paths unconditionally add 0 before GetCron(), six-field expressions become seven-field and fail during apply/update validation. If six-field cron is supported, parse with explicit optional-seconds support or a known format; otherwise document/update callers to only send five-field cron.

📍 Affects 1 file
  • sensor/kubernetes/complianceoperator/utils.go#L195-L198 (this comment)
  • sensor/kubernetes/complianceoperator/utils.go#L214-L217
🤖 Prompt for 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.

In `@sensor/kubernetes/complianceoperator/utils.go` around lines 195 - 198, Update
both cron validation paths in sensor/kubernetes/complianceoperator/utils.go at
lines 195-198 and 214-217, which call cronlib.Parse after prepending “0 ”, to
support the documented six-field cron expressions with seconds. Use cronlib’s
explicit optional-seconds or known-format parser consistently in both locations,
or restrict and document callers to five-field input if six-field schedules are
not supported.

Sources: Path instructions, MCP tools

davdhacs added 2 commits July 28, 2026 15:57
The flatten library was imported for a single function used in 3 test
files: recursively flattening a nested map to dot-separated keys.
Replaced with a 15-line FlattenMap helper in the existing operator
test utilities package.

Generated with AI assistance.
Generated with AI assistance.
@davdhacs

Copy link
Copy Markdown
Contributor Author

/test gke-nongroovy-e2e-tests

The go-junit library was used in a single test file to round-trip
verify JUnit XML output. Replaced with 20 lines of encoding/xml
struct definitions and xml.Unmarshal.

Generated with AI assistance.
davdhacs added 5 commits July 28, 2026 16:37
Generated with AI assistance.
The stackrox/external-network-pusher module (466 transitive deps!)
was imported for 4 string constants and 4 simple JSON struct
definitions. Inline them directly — zero behavioral change,
massive dep tree reduction.

Generated with AI assistance.
This module brought 466 transitive dependencies for 4 string
constants and 4 JSON struct definitions.

Generated with AI assistance.
The entire cloud.google.com/go/artifactregistry module (275 transitive
deps) was imported in 2 files solely for DefaultAuthScopes(), which
returns two OAuth scope URL strings. Inline them.

Generated with AI assistance.
275 transitive dependencies eliminated for two OAuth scope strings.

Generated with AI assistance.
@davdhacs

Copy link
Copy Markdown
Contributor Author

/test gke-nongroovy-e2e-tests

1 similar comment
@davdhacs

Copy link
Copy Markdown
Contributor Author

/test gke-nongroovy-e2e-tests

@davdhacs

Copy link
Copy Markdown
Contributor Author

/retest

@openshift-ci

openshift-ci Bot commented Jul 29, 2026

Copy link
Copy Markdown

@davdhacs: 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/ocp-4-12-compliance-e2e-tests 510db81 link false /test ocp-4-12-compliance-e2e-tests
ci/prow/ocp-4-12-scanner-v4-install-tests 510db81 link false /test ocp-4-12-scanner-v4-install-tests
ci/prow/ocp-4-12-nongroovy-e2e-tests 510db81 link false /test ocp-4-12-nongroovy-e2e-tests
ci/prow/ocp-4-12-operator-e2e-tests 510db81 link false /test ocp-4-12-operator-e2e-tests
ci/prow/ocp-4-12-qa-e2e-tests 510db81 link false /test ocp-4-12-qa-e2e-tests
ci/prow/ocp-4-22-scanner-v4-install-tests 510db81 link false /test ocp-4-22-scanner-v4-install-tests
ci/prow/ocp-4-22-compliance-e2e-tests 510db81 link false /test ocp-4-22-compliance-e2e-tests
ci/prow/ocp-4-22-nongroovy-e2e-tests 510db81 link false /test ocp-4-22-nongroovy-e2e-tests
ci/prow/ocp-4-22-operator-e2e-tests 510db81 link false /test ocp-4-22-operator-e2e-tests
ci/prow/ocp-4-22-qa-e2e-tests 510db81 link false /test ocp-4-22-qa-e2e-tests
ci/prow/gke-nongroovy-e2e-tests 510db81 link true /test gke-nongroovy-e2e-tests
ci/prow/gke-operator-e2e-tests 510db81 link false /test gke-operator-e2e-tests
ci/prow/gke-ui-e2e-tests 510db81 link true /test gke-ui-e2e-tests
ci/prow/gke-qa-e2e-tests 510db81 link false /test gke-qa-e2e-tests
ci/prow/gke-upgrade-tests 510db81 link false /test gke-upgrade-tests
ci/prow/gke-scanner-v4-install-tests 510db81 link false /test gke-scanner-v4-install-tests

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.

@openshift-ci

openshift-ci Bot commented Jul 29, 2026

Copy link
Copy Markdown

PR needs rebase.

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.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant