Skip to content

Keep every element of WQL array properties (#189) - #193

Merged
bertysentry merged 2 commits into
mainfrom
189-wql-array-properties-keep-only-their-last-element
Sep 29, 2026
Merged

bertysentry merged 2 commits into
mainfrom
189-wql-array-properties-keep-only-their-last-element

Conversation

@bertysentry

Copy link
Copy Markdown
Contributor

Fixes #189.

Problem

A WMI array property (IPAddress, IPSubnet, DefaultIPGateway in Win32_NetworkAdapterConfiguration, Capabilities in Win32_DiskDrive...) came back with only its last element: WS-Management sends the array as sibling elements sharing one name, and WsmanClient.collectRows overwrote the previous value on each one. The 1.x CXF backend had the same defect (WinRMService.convertRow in v1.1.02), so no consumer relied on the old output.

Change

  • WsmanClient.collectRows joins the sibling values (Map.merge), so every WQL path is fixed at once: fluent, streaming, legacy and CLI.
  • Default separator is | ("192.0.2.10|fe80::1"); WinRMClient.Builder.arraySeparator(String) changes it (builder-level, like loadUserProfile()). Legacy LightWinRMService.createInstance overloads keep the default.
  • WqlRow.get() / string() Javadoc now says what the code does: a WMI NULL is an empty string (unchanged since 1.x, so legacy List<List<String>> consumers are not affected), null means "no such property".
  • Docs: WQL → Reading the result, the builder options table on the index page, and the changelog.

Verification

  • New parity test: an instance with a repeated IPAddress, a scalar in between, and an xsi:nil property; existing parity tests updated for the new parameter.
  • mvn clean verify site: BUILD SUCCESS, 0 checkstyle / PMD / SpotBugs findings.
  • Live, with the standalone CLI on tc-win2022 (Windows Server 2022) and anaxagore (2008 R2):
    SELECT Caption, IPAddress, IPSubnet, DefaultIPGateway FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = TRUE returns "IPAddress":"10.0.238.160|fe80::1d5c:d7e:62d0:160b","IPSubnet":"255.255.0.0|64" — both elements present on both hosts.

Not done (on purpose)

  • No List<List<Object>> / typed CIM mapping variant: it needs a full CIM-to-Java type mapping and a second result API. The joined string covers the reported problem; open a follow-up issue if typed values are wanted.
  • No CLI --array-separator option: the CLI emits |-joined strings; add the flag if someone asks.

🤖 Generated with Claude Code

WS-Management returns a WMI array property as sibling elements sharing one
name; each one used to overwrite the previous, so only the last element
survived (IPAddress, IPSubnet, DefaultIPGateway, Capabilities...). The
elements are now joined with "|" by default; the new
WinRMClient.Builder.arraySeparator(String) changes the separator.

The WqlRow Javadoc now matches the code: a WMI NULL is an empty string and
null means "no such property". Documented in wql.md, the builder options
table and the changelog.

Closes #189

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@bertysentry bertysentry linked an issue Sep 29, 2026 that may be closed by this pull request
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 29, 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-09-29T22:58:27.837464Z 5d7c8f4 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: 99f8e22aa1

ℹ️ 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/LightWinRMService.java
Comment thread src/main/java/org/metricshub/winrm/light/WsmanClient.java Outdated
…s linearly

Restore the createInstance overload without arraySeparator as a delegating
compatibility overload, and build joined array values with StringBuilders so
a large array (SMBIOS raw tables) is appended in linear time.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@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. You're on a roll.

Reviewed commit: 5d7c8f4d25

ℹ️ 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 7969bdf into main Sep 29, 2026
5 checks passed
@bertysentry
bertysentry deleted the 189-wql-array-properties-keep-only-their-last-element branch September 29, 2026 23:44
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 keep only their last element

1 participant