Skip to content

WQL arrays: document the rendering, keep rows whose properties are all empty (#201) - #204

Merged
bertysentry merged 3 commits into
mainfrom
201-document-wql-array-rendering
Oct 10, 2026
Merged

bertysentry merged 3 commits into
mainfrom
201-document-wql-array-rendering

Conversation

@bertysentry

@bertysentry bertysentry commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Closes #201. That issue proposed adding a trailing separator to WQL array values (a|b|) to match wmi-java. That turned out not to be implementable reliably, so the alignment goes the other way: wmi-java drops its trailing separator.

Why winrm-java can't add the trailing separator

WinRM's XML has no type information. On Windows Server 2022, with both the SELECT * (p:Win32_OperatingSystem) and the explicit-property (w:XmlFragment) response shapes:

  • <MUILanguages>fr-FR</MUILanguages> (a one-element string[]) is identical to <Caption>…</Caption>.
  • An empty array is left out of the response entirely (IPSecPermitTCPPorts on Win32_NetworkAdapterConfiguration), while a NULL is xsi:nil.
  • msftwinrm:UsePreciseArrays changes nothing on the WMI plugin's resource URI.

Only a CIM GetClass request (cim-xml/2/cim-schema/2/* with __cimnamespace and ClassName selectors) reports PROPERTY.ARRAY. It works on 2016 and 2022, but the resource URI doesn't exist on 2008 R2, and it costs one more request per class. Not worth it for a trailing pipe.

What changes

  • This PR:
    • Documents the rendering in wql.md and the WqlRow Javadoc. There's no trailing separator, a one-element array reads like a scalar, and an empty or NULL array is left out of the response (so string() returns null).
    • Fixes a related parser bug Codex spotted. An instance whose selected properties all came back empty was dropped, so SELECT IPSecPermitTCPPorts FROM Win32_NetworkAdapterConfiguration returned no rows on tc-win2022, where WMI returns one per adapter. Every instance is now a row; the PR adds a test and a CHANGELOG entry.
    • Fixes the column list. WqlResult.columns() used to read the property names of the first row only. A leading empty row then lost the names' case, and with SELECT * an adapter without IP configuration hid IPAddress and DefaultIPGateway from the columns of every row. It now reads the names of every row.
  • Drop the trailing separator from WMI array values wmi-java#77: arrays become a|b, a, and an empty string for an empty array.
  • Handle WMI arrays without a trailing "|" (WBEMGenHBA, WinStorageSpaces) community-connectors#428: WBEMGenHBA lost the last WWN byte without the trailing |, and WinStorageSpaces' predicted failure never fired over WMI.
  • MetricsHub/enterprise-connectors#478: three Director52ServeRAIDNT regexes required 3|. Without it the connector wasn't detected, controllers were dropped, and absent batteries were no longer excluded.
  • WinRM WQL: report a property missing from a row as an empty string metricshub-community#1388: an empty array missing from a WinRM row reached the engine as null, which crashes regex filters. It's now an empty string, like the WMI extension.

Tests

mvn verify passes.

🤖 Generated with Claude Code

…empty arrays

WinRM's XML carries no type information: a one-element array is identical to a
scalar and an empty array is left out of the response (checked on Windows Server
2022, with both the SELECT * and the explicit-property response shapes). Only a
CIM GetClass request could tell arrays apart, and it costs one more request per
class and fails on 2008 R2 — not worth it to add a trailing "|". wmi-java drops
its trailing separator instead, and the connectors that relied on it are fixed.

Closes #201

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-10T01:17:44.052200Z 25672db Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3c130b8abc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/site/markdown/wql.md Outdated
WinRM leaves an empty or NULL array out of the response, so selecting only such
a property yields instances with no property element, and the parser dropped
them: SELECT IPSecPermitTCPPorts FROM Win32_NetworkAdapterConfiguration returned
no rows on tc-win2022, where WMI returns one per adapter. Every instance is now
a row (2 rows on that host), on which string() returns null for the property.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bertysentry

Copy link
Copy Markdown
Contributor Author

@codex please review again

@bertysentry bertysentry changed the title Document how WQL arrays render (no trailing separator); align wmi-java instead (#201) WQL arrays: document the rendering, keep rows whose properties are all empty (#201) Oct 10, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7ac378c666

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/main/java/org/metricshub/winrm/light/WsmanClient.java
Comment thread src/site/markdown/wql.md Outdated
WinRM leaves out an empty or NULL array (checked again on tc-win2022: adapter 0's
NULL DefaultIPGateway, IPAddress, ... are absent, not xsi:nil), so rows can carry
different property sets. Taking the names from the first row only lost their
case when that row was empty (and the legacy executor's case-sensitive lookup
then missed the later values), and with SELECT * it hid IPAddress & co. from the
columns of every row. The test fixture that showed a NULL array as xsi:nil now
uses a scalar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bertysentry

Copy link
Copy Markdown
Contributor Author

@codex please review again

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 25672db315

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@bertysentry
bertysentry merged commit 5170fde into main Oct 10, 2026
5 checks passed
@bertysentry
bertysentry deleted the 201-document-wql-array-rendering branch October 10, 2026 18:29
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.

WQL array properties: add the trailing separator to match wmi-java

1 participant