Skip to content

Moved normalised-date() to top level to use in sla_violation_profiler…#856

Open
JanAms130 wants to merge 2 commits into
open-component-model:masterfrom
JanAms130:normalise-dates-in-sla-violation-profiler
Open

Moved normalised-date() to top level to use in sla_violation_profiler…#856
JanAms130 wants to merge 2 commits into
open-component-model:masterfrom
JanAms130:normalise-dates-in-sla-violation-profiler

Conversation

@JanAms130

Copy link
Copy Markdown
Contributor

… and used it

What this PR does / why we need it:

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Release note:


… and used it

Signed-off-by: JanAms130 <AmsJan@web.de>
@JanAms130 JanAms130 requested a review from a team as a code owner June 12, 2026 08:06
@JanAms130 JanAms130 linked an issue Jun 12, 2026 that may be closed by this pull request
10 tasks
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@JanAms130, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 37 minutes and 11 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

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.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6c247ff6-dea8-4e4b-ab2c-2e6614a88439

📥 Commits

Reviewing files that changed from the base of the PR and between f91de15 and a868f5c.

📒 Files selected for processing (1)
  • sla_violation_profiler.py
📝 Walkthrough

Walkthrough

This pull request introduces a module-level normalise_date utility function that standardizes date handling for SLA violation computations. The utility is then systematically applied across rescoring filtering, policy violation iteration, and version-level SLA tracking to ensure all temporal comparisons use UTC-aware datetimes.

Changes

Date Normalization Integration

Layer / File(s) Summary
Date normalization utility definition
rescore/utility.py
normalise_date function accepts str, datetime.datetime, or datetime.date and returns UTC-aware datetime.datetime. ISO strings are parsed and normalized; naive datetimes receive UTC; aware datetimes are converted to UTC; date objects become midnight UTC. The function is used in rescorings_for_finding_by_specificity for the ordering key.
Rescoring filtering with normalized creation dates
sla_violation_profiler.py
filter_rescorings_before_release_date applies normalise_date to each rescoring's creation date when comparing against release date and when computing the sort key.
Policy violation SLA computation with normalized dates
sla_violation_profiler.py
iter_policy_violations normalizes the input finding.discovery_date and release_date, computes a normalized deadline from either rescoring due_date or allowed_processing_time plus normalized discovery date, and compares normalized rescoring creation dates against the normalized deadline window.
Version-level SLA violation tracking with date normalization and same-day skip guard
sla_violation_profiler.py
iter_version_sla_violations normalizes release_date and each finding's creation date for initial comparison. A new guard condition skips processing when any pre-filtered rescoring has a normalized creation date on the same calendar day as the finding's normalized creation date.
Entry point normalization for version SLA processing
sla_violation_profiler.py
create_sla_violation normalizes the release_date derived from the root component's creation date before passing it to version-level SLA evaluation.

🎯 3 (Moderate) | ⏱️ ~25 minutes

🐰 A tale of dates in disarray,
Now unified in UTC's way,
From discovery to release so bright,
Every rescoring finds the light!
No more timezone confusion's plight.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description lacks critical details. The 'What this PR does / why we need it' and 'Special notes for your reviewer' sections are empty placeholders, and the issue reference is incomplete. Fill in the 'What this PR does / why we need it' section with details about the refactoring and its benefits. Complete the issue reference or remove if not applicable. Add any relevant reviewer notes.
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: moving normalised-date() to module level for use in sla_violation_profiler. It is concise and specific.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

@JanAms130 JanAms130 requested review from 8R0WNI3 and zkdev June 12, 2026 08:09

@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 `@sla_violation_profiler.py`:
- Around line 105-110: The current loop unconditionally continues when a
rescoring has the same calendar day as the finding, which prevents any later SLA
checks (iter_policy_violations) for that finding; change the logic so same-day
rescoring does not suppress SLA evaluation unless the rescoring explicitly
removes SLA info. Replace the unconditional continue in the loop over
sorted_rescorings (the block using
rescore.utility.normalise_date(rescoring.meta.creation_date) and
finding_creation_date) with a conditional that only skips to the next rescoring
when that rescoring does not set a due_date or allowed_processing_time (i.e.,
rescoring has no SLA fields); otherwise allow the code to proceed to the
iter_policy_violations path so finite due_date/allowed_processing_time can still
produce overdue violations.
🪄 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

Run ID: 6205b181-bc6d-4d57-8580-d0fc5b7fb8ff

📥 Commits

Reviewing files that changed from the base of the PR and between 8bdc70e and f91de15.

📒 Files selected for processing (2)
  • rescore/utility.py
  • sla_violation_profiler.py

Comment thread sla_violation_profiler.py Outdated
Signed-off-by: JanAms130 <AmsJan@web.de>
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.

SLA adherence tracking

1 participant