Skip to content

Refresh the local product cache before reading live Patch Status - #72

Draft
luigilink wants to merge 2 commits into
mainfrom
fix/productupdate-patchstatus-stale-cache-71
Draft

luigilink wants to merge 2 commits into
mainfrom
fix/productupdate-patchstatus-stale-cache-71

Conversation

@luigilink

Copy link
Copy Markdown
Owner

Pull Request (PR) description

Fixes the stale Patch Status reported in #71, found during the v5.2.0 live-test campaign on a Subscription Edition farm.

Problem

The live Patch Status refresh added in #59 read SPProductVersions.GetProductVersions($spFarm) (via Get-SPSServersPatchStatus), which returns the product/patch status cached in the configuration database. A local binary install does not update that cache until Get-SPProduct -Local runs on the server, so right after -Action ProductUpdate the Binaries card kept the pre-install value (No Action Required) while Central Administration already showed Upgrade Blocked.

Fix

Call Get-SPProduct -Local to refresh the local server's product cache before reading the patch status in the ProductUpdate action (it runs locally on each patched server, so -Local updates that server's own config-DB entry). This also makes the master's later aggregate reads accurate once every server has refreshed its own entry. A refresh failure is non-fatal (logged to verbose; the read then degrades to the previous behaviour).

This Pull Request (PR) fixes the following issues

Task list

  • Added a CHANGELOG entry (Unreleased / Fixed).
  • PSScriptAnalyzer 0 issues on src; Pester 296 passed / 0 failed / 1 skipped. The ProductUpdate live-status path is Windows/SharePoint-only and not unit-tested, consistent with the rest of that action.

Note: targets the 5.x line (main); to be cherry-picked to support/4.x together with #64/#68/#59.

The #59 live Patch Status refresh read SPProductVersions.GetProductVersions,
which returns the product/patch status cached in the configuration database. A
local binary install does not update that cache until Get-SPProduct -Local runs
on the server, so the card kept the pre-install status (e.g. No Action Required)
instead of the real post-install one (e.g. Upgrade Blocked).

Call Get-SPProduct -Local before reading the patch status in the ProductUpdate
action (which runs locally on each patched server), so the read reflects the
live state. This also makes the master's later aggregate reads accurate once
every server has refreshed its own entry.

Refs #71
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Pester Test Results

  1 files   46 suites   12s ⏱️
186 tests 186 ✅ 0 💤 0 ❌
297 runs  297 ✅ 0 💤 0 ❌

Results for commit 018b64a.

♻️ 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.

Copilot review overview

🟡 Changes recommended

The refresh call must use -ErrorAction Stop for its fallback handling to catch non-terminating errors reliably.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Refreshes SharePoint’s local product cache after ProductUpdate so dashboards report current patch status.

Changes:

  • Runs Get-SPProduct -Local after successful installation.
  • Documents the fix for #71.
File Description
src/​SPSUpdate.ps1 Refreshes the local product cache before reading patch status.
CHANGELOG.md Records the dashboard status fix.

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

Comment thread src/SPSUpdate.ps1 Outdated
Add -ErrorAction Stop to Get-SPProduct -Local so a non-terminating failure is
caught by the surrounding try/catch and handled as the intended non-fatal
verbose path, instead of leaking an error record before the read continues.

Refs #71

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.

Copilot review overview

🟢 Approval recommended

The implementation matches the issue requirements and safely preserves fallback behavior.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@luigilink
luigilink marked this pull request as draft October 7, 2026 14:21
@luigilink

Copy link
Copy Markdown
Owner Author

Hold — do not merge into a release yet. The underlying fix changes the live Patch Status path, which can only be exercised by a real CU install (an already-patched server reports exit 17025 / already installed and does not re-trigger the refresh). Converting to draft until it can be validated end-to-end during the next CU campaign. It must not be included in a release build or cherry-picked to support/4.x until that validation passes.

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.

ProductUpdate live Patch Status shows a stale pre-install value (config-DB product cache not refreshed)

2 participants