Skip to content

[master] [Subscription Billing] Infinite loop in CalculateBillingPeriod when HarmonizeNextBillingTo caps at stale "Next Billing To" date#8830

Draft
sanjmaurya wants to merge 2 commits into
microsoft:mainfrom
sanjmaurya:bugs/Bug-640056-SubscriptionBillingInfiniteLoopCalculateBillingPeriodN2
Draft

[master] [Subscription Billing] Infinite loop in CalculateBillingPeriod when HarmonizeNextBillingTo caps at stale "Next Billing To" date#8830
sanjmaurya wants to merge 2 commits into
microsoft:mainfrom
sanjmaurya:bugs/Bug-640056-SubscriptionBillingInfiniteLoopCalculateBillingPeriodN2

Conversation

@sanjmaurya

@sanjmaurya sanjmaurya commented Jun 26, 2026

Copy link
Copy Markdown

AB#640056

Bug 640056: [master] [ALL-E][Subscription Billing] Infinite loop in CalculateBillingPeriod when HarmonizeNextBillingTo caps at stale "Next Billing To" date

@sanjmaurya sanjmaurya requested a review from a team June 26, 2026 06:03
@github-actions github-actions Bot added AL: Apps (W1) Add-on apps for W1 From Fork Pull request is coming from a fork Linked Issue is linked to a Azure Boards work item labels Jun 26, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Jun 26, 2026
PreviousBillingPeriodEnd := 0D;
while (BillingPeriodEnd < BillingDate) and
((BillingPeriodEnd < ServiceCommitment."Subscription Line End Date") or (ServiceCommitment."Subscription Line End Date" = 0D))
do

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.

$\textbf{🟡\ Medium\ Severity\ —\ Agent} \quad \color{gray}{\texttt{\small Iteration\ 1}}$

The new loop-progress guard (BillingPeriodEnd > PreviousBillingPeriodEnd) correctly prevents an infinite loop, but when it fires it exits silently: the var output parameter BillingPeriodEnd is left holding the non-advancing value returned by CalculateNextBillingToDateForServiceCommitment, and the caller receives no signal distinguishing a normal exit (billing date or end-date boundary reached) from an abnormal one (the inner function failed to advance the period).

In subscription billing, a silently incorrect BillingPeriodEnd can produce wrong invoice amounts or missed billing lines.

Recommendation:

  • after the loop, detect the abnormal case — for example by checking whether the guard condition would have allowed another iteration but didn't — and raise an Error or emit a telemetry signal so the failure surface is observable.

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why

@github-actions

Copy link
Copy Markdown
Contributor

Copilot PR Review

Iteration 1 · Outcome: completed

Knowledge source: https://github.com/microsoft/BCQuality@822cae1b2771ac25f665f73369f69093bd4fd630

Findings by domain

Findings split into Knowledge-backed (cite a BCQuality article) and Agent (the agent's own judgement, no matching BCQuality rule).

Domain Findings Knowledge-backed Agent Inline Fallback
Agent 1 0 1 1 0

Totals: 0 knowledge-backed · 1 agent findings.

Orchestrator pre-filter (13 file(s) excluded)

  • layer-disabled (knowledge) : 13 file(s)

Findings produced by the Copilot CLI agent against BCQuality at 822cae1b2771ac25f665f73369f69093bd4fd630. Reply 👎 on any inline comment to flag false positives.

@sanjmaurya sanjmaurya marked this pull request as draft June 26, 2026 12:38
@sanjmaurya sanjmaurya closed this Jun 26, 2026
@sanjmaurya sanjmaurya reopened this Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1 From Fork Pull request is coming from a fork Linked Issue is linked to a Azure Boards work item

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant