Skip to content

SPSUpdate: retry transient SideBySide update conflicts (6x/15s) - #80

Merged
luigilink merged 3 commits into
mainfrom
fix/sbs-update-conflict-retry-79
Oct 21, 2026
Merged

luigilink merged 3 commits into
mainfrom
fix/sbs-update-conflict-retry-79

Conversation

@luigilink

Copy link
Copy Markdown
Owner

Pull Request (PR) description

Implements a bounded retry policy for transient SharePoint update conflicts in Set-SPSSideBySideToken.

Context: customer runs hit SPWebService.Update() conflicts while PSCONFIG was still writing:

"An update conflict has occurred, and you must re-try this action... The object SPWebService was updated by ... in the PSCONFIG process"

Previously the first conflict aborted the side-by-side phase (Failed to Run Set-SPSSideBySideToken CmdLet).

What changed

  • Added conflict-specific retry around each SPWebService.Update() call in Set-SPSSideBySideToken:
    • 6 attempts max
    • 15 seconds between attempts
    • Retry only when the exception matches the update-conflict signature
    • Non-conflict exceptions still fail fast
    • Persistent conflicts still fail after the retry budget
  • Applied to all three update paths in the cmdlet:
    • enable side-by-side mode
    • set side-by-side token
    • disable side-by-side mode
  • Added Pester tests:
    • succeeds after transient conflicts
    • fails after max attempts when conflicts persist
    • does not retry non-conflict errors
  • Added CHANGELOG [Unreleased] entry.

Why this shape

  • Targets the real transient race (PSCONFIG / config DB write overlap) without masking real errors.
  • Bounded retries keep the run deterministic.
  • Policy values match the agreed “profil court” (6 × 15s).

This Pull Request (PR) fixes the following issues

Task list

  • Added an entry to the change log under the Unreleased section of the
    file CHANGELOG.md. Entry should say what was changed and how that
    affects users (if applicable), and reference the issue being resolved
    (if applicable).
  • Added/updated documentation and descriptions where appropriate?
  • New/changed code adheres to [Style Guidelines]?

Retry transient SPWebService.Update() conflicts in Set-SPSSideBySideToken
(6 attempts, 15 seconds between attempts), while still failing fast on
non-conflict exceptions and surfacing persistent conflicts after the budget.

Add Pester coverage for success-after-retry, max-attempts failure, and
non-conflict no-retry behavior.

Fixes #79

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Pester Test Results

  1 files   50 suites   10s ⏱️
209 tests 209 ✅ 0 💤 0 ❌
323 runs  323 ✅ 0 💤 0 ❌

Results for commit 93687f5.

♻️ This comment has been updated with latest results.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Retrying the same stale service instance can exhaust the retry budget without resolving the version conflict.

1 open issue
What changed in this PR

Adds bounded retries for SharePoint side-by-side update conflicts, addressing #79.

Changes:

  • Applies six-attempt, 15-second conflict retries to enable, token-setting, and disable operations.
  • Adds retry behavior tests and documents the change.
File Description
tests/​Set-SPSSideBySideToken.Tests.ps1 Tests transient recovery, retry exhaustion, and non-conflict failure.
src/​Modules/​SPSUpdate.Common/​Public/​Set-SPSSideBySideToken.ps1 Adds shared conflict-retry logic to all three updates.
CHANGELOG.md Documents the retry policy and user impact.

Review effort: Balanced

On each retry attempt, reload the current SPWebApplication by identity, reapply
the intended change, then call Update() on the refreshed WebService instance.
This avoids exhausting retries on a stale object version after PSCONFIG writes.

Extend tests with a stale-instance scenario that only succeeds after refresh.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The modified enable-mode and disable-mode paths still lack test coverage.

1 open issue
1 resolved since last review

Review effort: Balanced

Comment thread tests/Set-SPSSideBySideToken.Tests.ps1 Resolved
Expand Set-SPSSideBySideToken tests to cover both mode-transition callbacks
(enable and disable), each with transient conflict recovery, retry exhaustion,
and non-conflict fail-fast behavior.

Also keep stale-instance refresh coverage explicit for conflict retries.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

SharePoint runtime behavior still needs validation beyond the supplied mocked tests.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@luigilink luigilink left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Files reviewed - LGTM

@luigilink
luigilink merged commit d0fe612 into main Oct 21, 2026
4 checks passed
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.

Set-SPSSideBySideToken: bounded retry on SPWebService update-conflict

2 participants