Release: GUID canonicalization fix (dev -> main) #7

Merged
hannah-vernon merged 2 commits from dev into main 2026-07-02 11:25:27 -05:00

What does this PR do?

Promotes dev to main for release. Included since the last main release:

  • Fix false OrphanTreeEntry findings from ignorable characters in TaskCache Ids (#6).
    Some TaskCache\Tree "Id" values carry a stray ignorable character (for example a zero-width
    space) after the GUID. The registry and PowerShell hashtables ignore such characters, but a
    .NET HashSet keyed with OrdinalIgnoreCase treats them as significant, which produced a
    large batch of false OrphanTreeEntry findings (observed: 197 of 213 on a host whose tasks
    were actually healthy - only 26 were genuinely orphaned). GUIDs are now normalized by
    regex-extracting the canonical 8-4-4-4-12 hex pattern in both Test-ScheduledTaskHealth.ps1
    and Get-TaskCacheSummary.ps1.

Confirmed on the affected host after the fix: TreeWithoutTasks dropped from 197 to 26 and
TasksWithoutTree from 172 to 1, matching a direct Test-Path verification.

Fixes #

How was this tested?

  • Parser validation - 0 errors for both scripts
  • Reproduced the bug with a zero-width-space fixture (before: false orphans; after: 0),
    regression-tested that genuine orphans are still detected, and confirmed corrected counts on
    the real host.

Checklist

  • I have read the Contributing Guide
  • Changes are focused - one logical change per PR
  • Comment-based help updated for any changed parameters or behavior
  • Documentation updated (if user-visible behavior changed)
  • No commented-out code or debug leftovers
## What does this PR do? Promotes `dev` to `main` for release. Included since the last `main` release: - **Fix false `OrphanTreeEntry` findings from ignorable characters in TaskCache Ids** (#6). Some `TaskCache\Tree` "Id" values carry a stray ignorable character (for example a zero-width space) after the GUID. The registry and PowerShell hashtables ignore such characters, but a .NET `HashSet` keyed with `OrdinalIgnoreCase` treats them as significant, which produced a large batch of false `OrphanTreeEntry` findings (observed: 197 of 213 on a host whose tasks were actually healthy - only 26 were genuinely orphaned). GUIDs are now normalized by regex-extracting the canonical 8-4-4-4-12 hex pattern in both `Test-ScheduledTaskHealth.ps1` and `Get-TaskCacheSummary.ps1`. Confirmed on the affected host after the fix: TreeWithoutTasks dropped from 197 to 26 and TasksWithoutTree from 172 to 1, matching a direct `Test-Path` verification. Fixes # ## How was this tested? - [x] Parser validation - 0 errors for both scripts - [x] Reproduced the bug with a zero-width-space fixture (before: false orphans; after: 0), regression-tested that genuine orphans are still detected, and confirmed corrected counts on the real host. ## Checklist - [x] I have read the [Contributing Guide](../CONTRIBUTING.md) - [x] Changes are focused - one logical change per PR - [x] Comment-based help updated for any changed parameters or behavior - [x] Documentation updated (if user-visible behavior changed) - [x] No commented-out code or debug leftovers
Some TaskCache\Tree 'Id' values carry a stray ignorable character (e.g. a zero-width
space) after the GUID. The registry and PowerShell hashtables (culture-aware) ignore
such characters, but a .NET HashSet keyed with OrdinalIgnoreCase treats them as
significant. GUID comparison via that HashSet therefore failed to match the clean
TaskCache\Tasks\{GUID} subkey names, producing a large batch of false OrphanTreeEntry
findings (observed: 197 of 213 on a host whose tasks were actually healthy).

Normalize GUIDs by extracting the canonical 8-4-4-4-12 hex pattern with a regex, which
discards any surrounding or embedded stray characters before comparison:

- Get-TaskCacheSummary.ps1: Format-Guid now regex-extracts the canonical GUID.
- Test-ScheduledTaskHealth.ps1: add ConvertTo-CanonicalGuid and apply it when reading
  Tree Id values and Tasks subkey names. OrphanTaskEntry findings keep the real subkey
  name for backup/removal paths.

Verified against fixtures: a host with zero-width-space Tree Ids now reports zero false
orphans, while genuinely orphaned Tree and Tasks entries are still detected.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Reviewed-on: #6
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
hannah-vernon/GmsaScheduledTaskTools!7
No description provided.