Fix hashtable .Keys/.Values collision in skill coverage tool - #831
Merged
Conversation
Get-SignificantTerms returned $terms.Keys; when a teaching point contains the word 'keys', PowerShell hashtable member access resolves to that entry's value instead of the key collection, collapsing the keyword set and making points like test-tagging Step 3 uncoverable. Use get_Keys()/get_Values() to bypass key-name shadowing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a PowerShell hashtable member-access edge case in the skill coverage measurement script where a literal significant term like "keys" could shadow the .Keys property and collapse the extracted keyword set, preventing certain teaching points from ever being credited.
Changes:
- Replace hashtable property access
.Keys/.Valueswithget_Keys()/get_Values()to avoid key-name shadowing. - Add an inline comment explaining the
.Keyscollision scenario and why the method form is used.
Show a summary per file
| File | Description |
|---|---|
| eng/skill-coverage/Measure-SkillCoverage.ps1 | Uses get_Keys() / get_Values() to prevent keyword extraction and pattern enumeration from breaking when a hashtable contains entries named keys/values. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
Evangelink
enabled auto-merge (squash)
June 25, 2026 09:00
Contributor
|
✅ Evaluation passed for |
YuliiaKovalova
approved these changes
Jun 25, 2026
elvisw
pushed a commit
to elvisw/dotnet-skills
that referenced
this pull request
Jun 29, 2026
…dotnet#831) Get-SignificantTerms returned $terms.Keys; when a teaching point contains the word 'keys', PowerShell hashtable member access resolves to that entry's value instead of the key collection, collapsing the keyword set and making points like test-tagging Step 3 uncoverable. Use get_Keys()/get_Values() to bypass key-name shadowing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Get-SignificantTermsineng/skill-coverage/Measure-SkillCoverage.ps1returned$terms.Keys. When a teaching point's text contains the word "keys", PowerShell's hashtable member access resolves.Keysto that entry's value ($true) instead of the key collection — so the keyword set collapses to{True}and the point can never meet the ≥2-hit match rule.This made
dotnet-test/test-taggingStep 3 "Classify each test method" permanently uncoverable, regardless of eval content.Fix
Use the method form (
get_Keys()/get_Values()), which bypasses key-name shadowing. Applied to the confirmed.Keysreturn and the two same-class.Valuesreturns for robustness.Verification
After the fix,
test-taggingcoverage goes 24→25/28 (Step 3 now credited) with no regressions across the rest of thedotnet-testplugin. Complements #830, whose author surfaced this bug.Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com