Conversation
Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
📝 WalkthroughWalkthroughVersion tags updated from 0.8.8 to 0.8.9 across GitHub Actions workflow, Dockerfile, and Makefile. Module-level DEFAULT_MAILS global refactored to instance attribute self.default_mails in NightlyTestsReport class, with all references updated accordingly. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
Makefile (1)
10-10: Consider a single source of truth for image version.Line 10 hardcodes a tag that is also duplicated in other files. Centralizing the version (e.g., Make variable/env-driven) reduces future mismatch risk.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Makefile` at line 10, The Makefile currently hardcodes the image tag string "quay.io/sclorg/upstream-daily-tests:0.8.9" which is duplicated elsewhere; introduce a single variable (e.g., IMAGE_VERSION or DAILY_TESTS_TAG) at the top of the Makefile and use that variable in the podman build invocation inside the target that runs the existing command, allowing it to be overridden from the environment; ensure other places that reference the same tag (search for the literal "upstream-daily-tests:0.8.9") are updated to use the new variable so the version is single-sourced.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@daily_tests/daily_nightly_tests_report.py`:
- Around line 445-447: The loop over self.available_test_case is unpacking into
(test_case, plan, _) but plan is unused (Ruff B007) and there are several noisy
print statements; change the unpacking to (test_case, _, _) or (test_case, *_ )
to acknowledge the unused element, remove or replace per-item print calls with a
single higher-level debug/info log (use the module logger at debug level) or
aggregate output outside the nested loops so the method that contains
available_test_case and the prints only emits concise logging; update references
in that method (e.g., where print("GENERATE_MAILS: ", self.data_dict),
print("GENERATE_MAILS: Available test cases: ", self.available_test_case), and
the inner per-item prints) accordingly.
- Line 194: The print statement currently outputs raw email addresses via
self.default_mails; change it to avoid exposing full addresses by logging only
the recipient count or masked addresses instead. Locate the line that prints
self.default_mails and replace it with either a count-based message (e.g.,
"Default mails count: N") or create a small mask function that transforms each
address to a non-sensitive form (e.g., keep first char of local-part and domain,
replace rest with asterisks) and log the masked list. Ensure you update the same
method/attribute that references self.default_mails so no raw addresses are
written to stdout/logs.
- Line 187: The DEFAULT_MAILS env parsing currently does self.default_mails =
os.environ["DEFAULT_MAILS"].split(",") which can leave empty or whitespace-only
entries; update the parsing for DEFAULT_MAILS (where self.default_mails is set)
to strip whitespace from each split token and filter out any empty strings so
self.default_mails contains only valid, non-empty addresses (e.g., perform
token.strip() and keep tokens with length > 0 after stripping).
---
Nitpick comments:
In `@Makefile`:
- Line 10: The Makefile currently hardcodes the image tag string
"quay.io/sclorg/upstream-daily-tests:0.8.9" which is duplicated elsewhere;
introduce a single variable (e.g., IMAGE_VERSION or DAILY_TESTS_TAG) at the top
of the Makefile and use that variable in the podman build invocation inside the
target that runs the existing command, allowing it to be overridden from the
environment; ensure other places that reference the same tag (search for the
literal "upstream-daily-tests:0.8.9") are updated to use the new variable so the
version is single-sourced.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6c72702c-343f-41d9-8311-100f9ced3fb8
📒 Files selected for processing (4)
.github/workflows/build-and-push.ymlDockerfile.daily-testsMakefiledaily_tests/daily_nightly_tests_report.py
| self.smtp_port = int(os.getenv("SMTP_PORT", 25)) | ||
| if "DEFAULT_MAILS" in os.environ: | ||
| DEFAULT_MAILS = os.environ["DEFAULT_MAILS"].split(",") | ||
| self.default_mails = os.environ["DEFAULT_MAILS"].split(",") |
There was a problem hiding this comment.
Sanitize DEFAULT_MAILS before storing recipients.
Line 187 can retain empty/whitespace entries (e.g., trailing commas), which may cause recipient validation failures later.
Proposed fix
- if "DEFAULT_MAILS" in os.environ:
- self.default_mails = os.environ["DEFAULT_MAILS"].split(",")
+ if "DEFAULT_MAILS" in os.environ:
+ self.default_mails = [
+ m.strip()
+ for m in os.environ["DEFAULT_MAILS"].split(",")
+ if m.strip()
+ ]📝 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.
| self.default_mails = os.environ["DEFAULT_MAILS"].split(",") | |
| if "DEFAULT_MAILS" in os.environ: | |
| self.default_mails = [ | |
| m.strip() | |
| for m in os.environ["DEFAULT_MAILS"].split(",") | |
| if m.strip() | |
| ] |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@daily_tests/daily_nightly_tests_report.py` at line 187, The DEFAULT_MAILS env
parsing currently does self.default_mails =
os.environ["DEFAULT_MAILS"].split(",") which can leave empty or whitespace-only
entries; update the parsing for DEFAULT_MAILS (where self.default_mails is set)
to strip whitespace from each split token and filter out any empty strings so
self.default_mails contains only valid, non-empty addresses (e.g., perform
token.strip() and keep tokens with length > 0 after stripping).
| print("GENERATE_MAILS: ", self.data_dict) | ||
| print("GENERATE_MAILS: Available test cases: ", self.available_test_case) | ||
| for test_case, plan, _ in self.available_test_case: |
There was a problem hiding this comment.
Fix unused loop variable and reduce noisy debug output.
Line 447 has an unused plan variable (Ruff B007), and the per-item prints on Lines 452-454/461 are very chatty in nested loops.
Proposed fix
- print("GENERATE_MAILS: ", self.data_dict)
- print("GENERATE_MAILS: Available test cases: ", self.available_test_case)
- for test_case, plan, _ in self.available_test_case:
+ print("GENERATE_MAILS: starting recipient aggregation")
+ for test_case, _plan, _ in self.available_test_case:
if test_case not in self.data_dict:
continue
for _, name in self.data_dict[test_case]:
for cont, mails in SCLORG_MAILS.items():
- print(
- f"generate_emails: Checking if container name '{name}' starts with '{cont}'"
- )
if str(Path(name).with_suffix("")) != cont:
continue
for ml in mails:
if ml in self.default_mails:
continue
self.default_mails.append(ml)
- print(f"GENERATE_MAILS: Additional emails: {self.default_mails}")
+ print(f"GENERATE_MAILS: total recipients={len(self.default_mails)}")Also applies to: 452-454, 461-461
🧰 Tools
🪛 Ruff (0.15.2)
[warning] 447-447: Loop control variable plan not used within loop body
Rename unused plan to _plan
(B007)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@daily_tests/daily_nightly_tests_report.py` around lines 445 - 447, The loop
over self.available_test_case is unpacking into (test_case, plan, _) but plan is
unused (Ruff B007) and there are several noisy print statements; change the
unpacking to (test_case, _, _) or (test_case, *_ ) to acknowledge the unused
element, remove or replace per-item print calls with a single higher-level
debug/info log (use the module logger at debug level) or aggregate output
outside the nested loops so the method that contains available_test_case and the
prints only emits concise logging; update references in that method (e.g., where
print("GENERATE_MAILS: ", self.data_dict), print("GENERATE_MAILS: Available test
cases: ", self.available_test_case), and the inner per-item prints) accordingly.
Summary by CodeRabbit
Chores
Refactor