Skip to content

Optimize Test - 21877 - #1592

Open
Manoj Kesana (Manoj-Kesana) wants to merge 3 commits into
devfrom
Optimize-21877
Open

Manoj Kesana (Manoj-Kesana) wants to merge 3 commits into
devfrom
Optimize-21877

Conversation

@Manoj-Kesana

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI 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.

🟡 Changes recommended

The batching still over-fetches, reports misleading failure identifiers, and lacks required Pester coverage.

1 open finding
What changed in this PR

Optimizes assessment 21877 by batching sponsor lookups and limiting reported sponsorless guests.

Changes:

  • Normalizes database results to an array.
  • Replaces per-user Graph calls with batched requests.
  • Caps sponsorless-user details at 20.
File Description
src/​powershell/​tests/​Test-Assessment.21877.ps1 Adds batched sponsor lookup and bounded reporting.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/powershell/tests/Test-Assessment.21877.ps1 Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@Manoj-Kesana Manoj Kesana (Manoj-Kesana) added the ready for review PR is ready for review and merging label Oct 13, 2026
@Manoj-Kesana
Manoj Kesana (Manoj-Kesana) marked this pull request as ready for review October 13, 2026 08:54
Copilot AI balanced review requested due to automatic review settings October 13, 2026 08:54

Copilot AI 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.

🔵 Needs a closer look

Batch failures incorrectly report the internal batch ID as the guest ID.

0 open findings

1 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity Failure path reports batch sequence ID instead of guest ID

src/​powershell/​tests/​Test-Assessment.21877.ps1:71

Invoke-ZtGraphBatchRequest -Matched returns the original input in Argument on success, but its failure paths return the generated batch request instead (Invoke-ZtGraphBatchRequest.ps1:687-715). Therefore Argument.id here is the batch sequence ID, not the guest ID, and a server-side failure will identify the wrong guest. Resolve the guest from the matched result ID (or change the helper contract) before constructing this error.

🧠 Review effort: Balanced

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Manoj Kesana (@Manoj-Kesana) Please, address my feedback.

Anton Staykov (@astaykov) Just for the record:

The batching helper has known problems with missing responses and retries

This assessment now uses the batching helper directly. That helper has existing problems that are already being handled separately:

  • If Graph omits a response for one request in a batch, the helper sends that request again. There is no limit on these repeated attempts, so the assessment may keep running until a timeout or manual stop ends it. The offline check confirmed that the request was sent again, then stopped the next attempt deliberately. It did not leave the assessment running to demonstrate a hang.
  • The previous individual requests used the repository's Invoke-ZtRetry function (Invoke-ZtGraphRequestCache.ps1#L121). The batching helper calls the Graph SDK directly (Invoke-ZtGraphBatchRequest.ps1#L581), without that function. This removes the repository's additional retry handling when sending the batch fails. The SDK may still retry the batch itself; this review did not test those SDK retries against Graph.

The helper does retry individual requests that receive HTTP 429, meaning Graph is limiting the request rate. That behavior passed an offline check with no retry delay. It does not establish that temporary server errors, such as HTTP 503, will also be retried.

There are planned fixes for missing responses and failed-batch retries in PR #1584 follow-up. Those fixes should be separately tracked. They are relevant risks for this assessment, but they are not new defects introduced by PR #1592 or additional reasons to block it.

Comment thread src/powershell/tests/Test-Assessment.21877.ps1 Outdated
Comment thread src/powershell/tests/Test-Assessment.21877.ps1 Outdated
Comment thread src/powershell/tests/Test-Assessment.21877.ps1 Outdated
Comment thread src/powershell/tests/Test-Assessment.21877.ps1
@Manoj-Kesana Manoj Kesana (Manoj-Kesana) removed the ready for review PR is ready for review and merging label Oct 14, 2026
@Manoj-Kesana
Manoj Kesana (Manoj-Kesana) marked this pull request as draft October 14, 2026 05:09
@Manoj-Kesana Manoj Kesana (Manoj-Kesana) added the ready for review PR is ready for review and merging label Oct 14, 2026
@Manoj-Kesana
Manoj Kesana (Manoj-Kesana) marked this pull request as ready for review October 14, 2026 18:34
Copilot AI balanced review requested due to automatic review settings October 15, 2026 01:44

Copilot AI 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.

🟢 Approval recommended

No blocking issues were identified in the batching logic or result-status handling.

0 open findings

🧠 Review effort: Balanced

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

This branch has not been deployed

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

Labels

ready for review PR is ready for review and merging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants