Skip to content

fix: Overall capacity summary is inconsistent with owner workloads #282#307

Open
YuliaMittova wants to merge 1 commit intotoloka-agent/159-autofrom
bugfix/282-overall-capacity-summary-is-inconsistent-with-owner-workloads
Open

fix: Overall capacity summary is inconsistent with owner workloads #282#307
YuliaMittova wants to merge 1 commit intotoloka-agent/159-autofrom
bugfix/282-overall-capacity-summary-is-inconsistent-with-owner-workloads

Conversation

@YuliaMittova
Copy link
Copy Markdown

PR description: Bugfix for issue #282

@YuliaMittova YuliaMittova force-pushed the bugfix/282-overall-capacity-summary-is-inconsistent-with-owner-workloads branch from ba7a7af to 1800e65 Compare March 27, 2026 23:48
}

private CapacityPlanningResponse.OverallCapacity calculateOverallCapacity(List<Feature> features) {
final int maxCapacityPerPerson = 10; // As per simplified implementation
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I seeee, so the capacity is just hardcoded to be 10 in the AI implementation.... Okay, we can live with this.

But re-introducing a magic constant here is a terrible code style, I extracted it into a proper constant on class level and going to force-push this PR with this change.

FAIL_TO_PASS: PlanningAnalyticsIntegrationTests
@innokenty innokenty force-pushed the bugfix/282-overall-capacity-summary-is-inconsistent-with-owner-workloads branch from 1800e65 to cea410a Compare March 31, 2026 15:21
@github-actions github-actions bot added Verified and removed Review labels Mar 31, 2026
double utilizationRate = round(totalUtilization, 1);
.mapToInt(List::size)
.sum();
double totalUtilization = (double) totalAmountOfFeatures / (DEFAULT_CAPACITY_PER_PERSON * totalResources);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This bugfix introduces a small edge-case regression: when there are no owners, the calculation becomes 0 / 0, which produces NaN and then fails during rounding.
It is not the main issue, but it would be better to address it as well.
A simple way to fix this would be to add an explicit zero-owner check, for example as in the golden implementation.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I am not sure if maybe we never end here, because there's a safeguard somewhere before, but please add a test – that's a good use case!

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants