Skip to content

fix: skip anti-pattern scan if already scanned today - #76

Closed
catastrophe-brandon wants to merge 5 commits into
RedHatInsights:masterfrom
catastrophe-brandon:skip-duplicate-daily-scan
Closed

catastrophe-brandon wants to merge 5 commits into
RedHatInsights:masterfrom
catastrophe-brandon:skip-duplicate-daily-scan

Conversation

@catastrophe-brandon

Copy link
Copy Markdown
Contributor

Summary

  • Added a today-already-scanned check to 02-scan-test-anti-patterns.py that queries the memory server for existing test-scan:*:{today} tasks before producing a start result
  • When the pod restarts within the same day (KEDA rescale, deployment update, OOM, etc.), the preflight now outputs skip instead of start, preventing a redundant agent session (~$0.24/cycle wasted on a no-op)

Test plan

  • All 65 preflight unit tests pass (including new test_skips_when_already_scanned_today)
  • Confirm pod restart within same day logs "Already scanned today" skip instead of launching agent session

Check the memory server for existing test-scan tasks with today's date
before producing a "start" result. Prevents redundant agent sessions
(and wasted tokens) when the pod restarts within the same day.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@catastrophe-brandon catastrophe-brandon self-assigned this Aug 12, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (master@c8ebe9f). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff            @@
##             master      #76   +/-   ##
=========================================
  Coverage          ?   79.10%           
=========================================
  Files             ?       10           
  Lines             ?     1168           
  Branches          ?        0           
=========================================
  Hits              ?      924           
  Misses            ?      244           
  Partials          ?        0           
Flag Coverage Δ
quality-monitor 79.10% <100.00%> (?)

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

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

The `in` operator could false-positive if a repo name contained a date
string matching today. Using endswith on the trailing date segment of
the external_key prevents this. Also removes stray f-string prefix.

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

Copy link
Copy Markdown
Contributor Author

Note: This fix should only be necessary until OpenShift-Fleet/rehor#428 is reviewed, approved, and merged.

catastrophe-brandon and others added 3 commits August 13, 2026 10:42
Matches the renamed source type in the rehor framework -- keda_scheduled
exits after one cycle (letting KEDA handle scheduling), while scheduled
preserves the existing loop-with-sleep behavior.

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

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

Found one deployment-blocking issue with the new runner source.

@@ -1,5 +1,5 @@
workflow: ./workflows/quality-monitor
source: scheduled
source: run_and_exit

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.

run_and_exit requires runner support that is not present in the pinned dev-bot submodule commit 47f7a53. This setting is therefore ignored, so the bot continues looping instead of executing one KEDA-triggered cycle. Update dev-bot to a commit containing rehor#428, or retain source: scheduled until that dependency is available.

@karelhala

Copy link
Copy Markdown
Contributor

/retest

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants