Fix up LDAP parser errors - #101
Conversation
A change in PowerShell 7.4 broke the logic the parser error was using to display the filter offset being displayed on a parser error. This uses a newer API to bring back a better error message for existing PowerShell versions as well as support for an even better API used in PowerSHell 7.7+.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #101 +/- ##
==========================================
+ Coverage 74.70% 80.48% +5.78%
==========================================
Files 63 63
Lines 7069 7549 +480
Branches 903 901 -2
==========================================
+ Hits 5281 6076 +795
+ Misses 1604 1276 -328
- Partials 184 197 +13
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Restores richer LDAP filter parse error positioning after PowerShell 7.4 formatter changes by switching away from reflection-based InvocationInfo manipulation and adding a regression test + changelog note.
Changes:
- Replace reflection-based
_invocationInfosetting with aTargetObjecthashtable carrying line/column position metadata. - Add a Pester test asserting
ParserErrorand positional metadata for invalid-LDAPFilter. - Document the behavior change/requirements in the changelog.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/Get-OpenADObject.Tests.ps1 | Adds coverage asserting parser error category + positional metadata on invalid LDAP filters. |
| src/PSOpenAD.Module/Commands/GetOpenAD.cs | Switches parser error formatting to PowerShell’s newer formatting expectations via TargetObject metadata. |
| CHANGELOG.md | Notes the improved parse error location output and PS 7.7+ column support. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
A change in PowerShell 7.4 broke the logic the parser error was using to display the filter offset being displayed on a parser error. This uses a newer API to bring back a better error message for existing PowerShell versions as well as support for an even better API used in PowerSHell 7.7+.