Skip to content

AIX: extract more testable parse methods from command readers - #3503

Merged
dbwiddis merged 3 commits into
oshi:masterfrom
dbwiddis:aix-parse-coverage-2
Jul 21, 2026
Merged

dbwiddis merged 3 commits into
oshi:masterfrom
dbwiddis:aix-parse-coverage-2

Conversation

@dbwiddis

@dbwiddis dbwiddis commented Jul 21, 2026 •

Copy link
Copy Markdown
Member

Summary

Second AIX batch in the parse-seam testability effort (after AIX #3501; and Linux #3494, FreeBSD #3495, NetBSD/OpenBSD #3496, Solaris #3497/#3498, FileSystem #3499, disk drivers #3500). Each acquire-and-parse method keeps its acquisition and delegates to a package-private/static parse method taking the already-read input, so the parsing is unit-testable with synthetic fixtures instead of only on a live AIX host:

  • Lspv.parsePpSize(List) + Lspv.parsePartitions(List, ppSize, majMinMap) — splitting the two-command computeLogicalVolumes
  • Lscfg.parseModelSerial(List, device)
  • AixCentralProcessor: parseProcessorId(prtconf) → Quartet, parseCurrentFreq(pmcycles, count), parseSbits(proc.h), cachesForPowerVersion(version, cores)
  • AixOperatingSystem.parseServices(lssrc) (no longer mutates its input to drop the header)
  • AixFileSystem.parseOpenFileDescriptors(lsof) + parseMaxFileDescriptorsPerProcess(limits)

Fixtures are grounded in the real lspv -L/-p, lscfg -vl, prtconf, pmcycles -m, /usr/include/sys/proc.h, lssrc -a, lsof -nl, and /etc/security/limits output. New parse tests run on every platform; the existing AIX-only @EnabledOnOs(OS.AIX) live smoke tests are unaffected.

Note on coverage

As with #3501, the AIX package is still JaCoCo-excluded (**/unix/aix/**), so this lands as testability / regression-safety groundwork rather than an immediate coverage bump — un-excluding AIX is a separate follow-up.

Testing

  • oshi-common full gate green: spotless, checkstyle, install + forbiddenapis, javadoc; clean full-reactor install green.
  • All five AIX test classes pass; parse tests exercise each extracted method on the local (macOS) run.

No CHANGELOG entry — test/coverage refactor with no user-observable behavior change.

Summary by CodeRabbit

  • Bug Fixes
    • Improved AIX CPU, including vendor/model details, per-processor current frequency, and SBITS extraction, with more reliable cache sizing.
    • More robust AIX storage reporting by refining physical-to-logical volume/partition parsing, including inactive/missing physical volume handling.
    • Improved AIX model/serial extraction from system configuration output, plus safer parsing of file descriptor limits and service runtime states.
  • Tests
    • Added/expanded unit tests covering AIX model/serial, physical volume sizing and partition parsing, CPU parsing/frequency/SBITS/cache sizing, filesystem limits, and service parsing.

Second batch of AIX parse-seam extractions (after #3501), splitting acquisition
from parsing so the parsing is unit-testable with synthetic fixtures:

- Lspv: parsePpSize(List) + parsePartitions(List, ppSize, majMinMap), splitting
  the two-command computeLogicalVolumes
- Lscfg.parseModelSerial(List, device)
- AixCentralProcessor: parseProcessorId(prtconf) -> Quartet, parseCurrentFreq
  (pmcycles), parseSbits(proc.h), cachesForPowerVersion(version, cores)
- AixOperatingSystem.parseServices(lssrc) (no longer mutates the input list to
  drop the header)
- AixFileSystem.parseOpenFileDescriptors(lsof) + parseMaxFileDescriptorsPerProcess

Fixtures are grounded in the real lspv -L/-p, lscfg -vl, prtconf, pmcycles -m,
proc.h, lssrc -a, lsof -nl, and /etc/security/limits output. As with #3501 the
AIX package is still JaCoCo-excluded, so this is testability groundwork; the
existing @EnabledOnOs(AIX) live smoke tests are unaffected.
@coderabbitai

coderabbitai Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 73d54320-39d9-4327-89bb-344a442b0b7e

📥 Commits

Reviewing files that changed from the base of the PR and between 6283071 and 9a7107d.

📒 Files selected for processing (1)
  • oshi-common/src/main/java/oshi/driver/common/unix/aix/Lscfg.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • oshi-common/src/main/java/oshi/driver/common/unix/aix/Lscfg.java
📜 Recent review details
⏰ Context from checks skipped due to timeout. (13)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 21, macos-latest
  • GitHub Check: Test JDK 25, ubuntu-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 26, windows-latest
  • GitHub Check: Test JDK 26, macos-latest
  • GitHub Check: Test JDK 21, windows-latest
  • GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
  • GitHub Check: Analyze (java)
  • GitHub Check: Test JDK 25, OpenBSD (+ JNA==FFM)
  • GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
  • GitHub Check: Test JDK 25, OpenIndiana (+ JNA==FFM)
  • GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)

📝 Walkthrough

Walkthrough

AIX command execution is separated from parsing for device, processor, filesystem, and service data. New unit tests cover parser outputs, defaults, edge cases, and existing cache behavior.

Changes

AIX parser refactor

Layer / File(s) Summary
Device output parsers
oshi-common/src/main/java/oshi/driver/common/unix/aix/Lscfg.java, oshi-common/src/main/java/oshi/driver/common/unix/aix/Lspv.java, oshi-common/src/test/java/oshi/driver/common/unix/aix/*
Model, serial, physical-volume size, and partition parsing now consume command output supplied by callers and are covered by unit tests.
Processor output parsers
oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixCentralProcessor.java, oshi-common/src/test/java/oshi/hardware/common/platform/unix/aix/*
Processor identity, frequency, SBITS, and cache helpers parse provided input, with tests for normal, default, and POWER-version cases.
System information parsers
oshi-common/src/main/java/oshi/software/common/os/unix/aix/*, oshi-common/src/test/java/oshi/software/common/os/unix/aix/*
File descriptor and service parsing moves into dedicated helpers, with tests for headers, states, limits, and empty input.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • oshi/oshi#3469: Refactors AIX service discovery and lssrc -a parsing in AixOperatingSystem.

Poem

A rabbit found commands in a burrow of code,
And split their parsing from each noisy road.
Models and services now hop into tests,
Empty lines and defaults withstand every quest.
“Clean input,” cheered Bun, “makes review a delight!”

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: extracting AIX parsing logic into testable helper methods.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.42%. Comparing base (85d7b98) to head (9a7107d).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3503      +/-   ##
============================================
- Coverage     76.44%   76.42%   -0.03%     
  Complexity       76       76              
============================================
  Files           591      591              
  Lines         21695    21695              
  Branches       3611     3611              
============================================
- Hits          16585    16580       -5     
- Misses         3164     3168       +4     
- Partials       1946     1947       +1     
Flag Coverage Δ
freebsd 32.16% <ø> (-0.01%) ⬇️
linux 36.53% <ø> (+<0.01%) ⬆️
macos 37.67% <ø> (-0.04%) ⬇️
openbsd 31.30% <ø> (ø)
solaris 32.76% <ø> (ø)
windows 45.63% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
oshi-common/src/main/java/oshi/driver/common/unix/aix/Lscfg.java (1)

101-108: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Prevent ArrayIndexOutOfBoundsException on missing device description.

If the device string appears at the very end of the line (e.g., there is no trailing description text), s.split(device) will return an array of length 1. Accessing index [1] will then throw an ArrayIndexOutOfBoundsException. Adding a length check ensures this fallback safely skips when no description is present.

🛡️ Proposed fix
-            if (model == null && s.contains(device)) {
-                String locDesc = s.split(device)[1].trim();
-                int idx = locDesc.indexOf(' ');
-                if (idx > 0) {
-                    model = locDesc.substring(idx).trim();
-                }
-            }
+            if (model == null && s.contains(device)) {
+                String[] split = s.split(device);
+                if (split.length > 1) {
+                    String locDesc = split[1].trim();
+                    int idx = locDesc.indexOf(' ');
+                    if (idx > 0) {
+                        model = locDesc.substring(idx).trim();
+                    }
+                }
+            }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@oshi-common/src/main/java/oshi/driver/common/unix/aix/Lscfg.java` around
lines 101 - 108, Update the fallback logic in Lscfg’s model-parsing block to
inspect the result of s.split(device) before accessing element [1]. Only derive
locDesc and update model when a second element exists; otherwise safely skip the
fallback while preserving the existing description parsing behavior.
🧹 Nitpick comments (1)
oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixCentralProcessor.java (1)

108-121: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider using substring instead of split for prefix extraction.

Creating a regular expression and an array just to extract the remainder of a line is slightly less efficient and can throw an ArrayIndexOutOfBoundsException if the line ends exactly with the marker string. Since startsWith already confirms the prefix, using substring is safer and cleaner.

♻️ Proposed refactor
         for (final String checkLine : prtconf) {
             if (checkLine.startsWith(nameMarker)) {
-                cpuName = checkLine.split(nameMarker)[1].trim();
+                cpuName = checkLine.substring(nameMarker.length()).trim();
                 if (cpuName.startsWith("P")) {
                     cpuVendor = "IBM";
                 } else if (cpuName.startsWith("I")) {
                     cpuVendor = "Intel";
                 }
             } else if (checkLine.startsWith(familyMarker)) {
-                cpuFamily = checkLine.split(familyMarker)[1].trim();
+                cpuFamily = checkLine.substring(familyMarker.length()).trim();
             } else if (checkLine.startsWith(bitnessMarker)) {
-                cpu64bit = checkLine.split(bitnessMarker)[1].contains("64");
+                cpu64bit = checkLine.substring(bitnessMarker.length()).contains("64");
             }
         }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixCentralProcessor.java`
around lines 108 - 121, Replace the split-based prefix extraction in the prtconf
loop with substring operations after the existing startsWith checks. Update the
nameMarker and familyMarker branches in AixCentralProcessor so they safely trim
the text following each marker while preserving the current vendor and family
assignment behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixCentralProcessor.java`:
- Around line 147-148: Update the cache lookup in AixCentralProcessor to pass
the POWER version parsed from prtconf’s Processor Version field to
cachesForPowerVersion instead of parsing uname -n; reuse the existing parsed
version value and leave the cores argument unchanged.

---

Outside diff comments:
In `@oshi-common/src/main/java/oshi/driver/common/unix/aix/Lscfg.java`:
- Around line 101-108: Update the fallback logic in Lscfg’s model-parsing block
to inspect the result of s.split(device) before accessing element [1]. Only
derive locDesc and update model when a second element exists; otherwise safely
skip the fallback while preserving the existing description parsing behavior.

---

Nitpick comments:
In
`@oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixCentralProcessor.java`:
- Around line 108-121: Replace the split-based prefix extraction in the prtconf
loop with substring operations after the existing startsWith checks. Update the
nameMarker and familyMarker branches in AixCentralProcessor so they safely trim
the text following each marker while preserving the current vendor and family
assignment behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d4bd7c26-97fd-4a98-9a09-09eca71f2593

📥 Commits

Reviewing files that changed from the base of the PR and between 85d7b98 and 2302838.

📒 Files selected for processing (10)
  • oshi-common/src/main/java/oshi/driver/common/unix/aix/Lscfg.java
  • oshi-common/src/main/java/oshi/driver/common/unix/aix/Lspv.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixCentralProcessor.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/aix/AixFileSystem.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/aix/AixOperatingSystem.java
  • oshi-common/src/test/java/oshi/driver/common/unix/aix/LscfgTest.java
  • oshi-common/src/test/java/oshi/driver/common/unix/aix/LspvTest.java
  • oshi-common/src/test/java/oshi/hardware/common/platform/unix/aix/AixCentralProcessorTest.java
  • oshi-common/src/test/java/oshi/software/common/os/unix/aix/AixFileSystemTest.java
  • oshi-common/src/test/java/oshi/software/common/os/unix/aix/AixOperatingSystemTest.java
📜 Review details
⏰ Context from checks skipped due to timeout. (14)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 26, windows-latest
  • GitHub Check: Test JDK 21, windows-latest
  • GitHub Check: Test JDK 21, ubuntu-latest
  • GitHub Check: Test JDK 21, macos-latest
  • GitHub Check: Test JDK 26, macos-latest
  • GitHub Check: Test JDK 25, ubuntu-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)
  • GitHub Check: Test JDK 25, OpenIndiana (+ JNA==FFM)
  • GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
  • GitHub Check: Test JDK 25, OpenBSD (+ JNA==FFM)
  • GitHub Check: Analyze (java)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2026-04-12T19:22:09.716Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3149
File: oshi-common/src/main/java/oshi/hardware/common/platform/mac/MacCentralProcessor.java:159-163
Timestamp: 2026-04-12T19:22:09.716Z
Learning: When reviewing OSHI hardware platform code that uses or implements `CentralProcessor`/`PhysicalProcessor.getEfficiency()`, remember the API’s counterintuitive semantics: a *higher* efficiency-class value indicates *greater performance* (lower efficiency). P-cores/“performance cores” should therefore have higher values (e.g., 1) than E-cores/“efficiency cores” (e.g., 0), as documented in the `CentralProcessor` Javadoc. Do not flag code as incorrect solely because ARM_P_CORES or Intel P-cores are assigned higher efficiency values.

Applied to files:

  • oshi-common/src/main/java/oshi/software/common/os/unix/aix/AixOperatingSystem.java
  • oshi-common/src/main/java/oshi/driver/common/unix/aix/Lscfg.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/aix/AixFileSystem.java
  • oshi-common/src/main/java/oshi/driver/common/unix/aix/Lspv.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixCentralProcessor.java
📚 Learning: 2026-07-06T19:25:59.225Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3432
File: oshi-common/src/main/java/oshi/util/ExceptionUtil.java:26-56
Timestamp: 2026-07-06T19:25:59.225Z
Learning: In this repo’s SLF4J 1.x-compatible logging code, do not flag cases where a logger call uses SLF4J 1.6+ implicit-cause handling—e.g., `log.error("...{}", value, t)` (or similar with a single `{}` placeholder) where `t` is passed as the final/trailing argument. SLF4J will attach `t` as the log event’s cause with the full stack trace; this is equivalent to SLF4J 2.x’s fluent `atLevel(...).setCause(t).log(...)` and is intentionally used to preserve SLF4J 1.x runtime compatibility.

Applied to files:

  • oshi-common/src/main/java/oshi/software/common/os/unix/aix/AixOperatingSystem.java
  • oshi-common/src/main/java/oshi/driver/common/unix/aix/Lscfg.java
  • oshi-common/src/main/java/oshi/software/common/os/unix/aix/AixFileSystem.java
  • oshi-common/src/main/java/oshi/driver/common/unix/aix/Lspv.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixCentralProcessor.java
📚 Learning: 2026-04-12T19:34:56.879Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3149
File: oshi-common/src/main/java/oshi/hardware/common/platform/mac/MacCentralProcessor.java:159-163
Timestamp: 2026-04-12T19:34:56.879Z
Learning: In OSHI’s Java platform implementations, `PhysicalProcessor.getEfficiency()` / `EfficiencyClass` follow the same convention as Windows `PROCESSOR_RELATIONSHIP.EfficiencyClass`: a *higher* numeric efficiency class value represents *greater performance* and *less efficiency* (typically P-cores higher than E-cores). When reviewing, do not treat cases where P-cores are assigned higher efficiency/class values as a bug—this is intentional cross-platform consistency.

Applied to files:

  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixCentralProcessor.java
🔇 Additional comments (3)
oshi-common/src/main/java/oshi/driver/common/unix/aix/Lspv.java (1)

55-68: LGTM!

Also applies to: 85-108, 140-140

oshi-common/src/main/java/oshi/software/common/os/unix/aix/AixFileSystem.java (1)

175-189: LGTM!

Also applies to: 204-216

oshi-common/src/main/java/oshi/software/common/os/unix/aix/AixOperatingSystem.java (1)

179-195: LGTM!

Also applies to: 197-227

Address CodeRabbit review on the AIX parse extraction:

- AixCentralProcessor.parseProcessorId: replace split(marker)[1] with
  substring(marker.length()) after the existing startsWith checks, so a bare
  marker line with no value (e.g. "Processor Type:") no longer throws
  ArrayIndexOutOfBounds.
- Lscfg.parseModelSerial: check the split length before indexing [1], so a line
  ending in the device name (which splits to a single element) skips the
  description fallback instead of throwing.

Both paths are covered by new fixture tests. Behavior is otherwise unchanged.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
oshi-common/src/main/java/oshi/driver/common/unix/aix/Lscfg.java (1)

103-110: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Prefer substring over split for literal string extraction.

Since device is a literal string rather than a regular expression, using split inside a loop incurs unnecessary regex compilation and array allocation. You can achieve the exact same behavior safely and more efficiently by using indexOf and substring.

♻️ Proposed refactor
-                String[] locDescSplit = s.split(device);
-                // A device at the very end of the line splits to a single element; skip the fallback then
-                if (locDescSplit.length > 1) {
-                    String locDesc = locDescSplit[1].trim();
+                int startIdx = s.indexOf(device) + device.length();
+                // Skip fallback if the device name is at the very end of the line
+                if (startIdx < s.length()) {
+                    String locDesc = s.substring(startIdx).trim();
                     int idx = locDesc.indexOf(' ');
                     if (idx > 0) {
                         model = locDesc.substring(idx).trim();
                     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@oshi-common/src/main/java/oshi/driver/common/unix/aix/Lscfg.java` around
lines 103 - 110, Update the parsing logic in Lscfg’s device-location extraction
to replace s.split(device) with indexOf and substring using the literal device
delimiter. Preserve the existing behavior for devices at the end of the line and
continue deriving model from the trimmed text after the delimiter.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@oshi-common/src/main/java/oshi/driver/common/unix/aix/Lscfg.java`:
- Around line 103-110: Update the parsing logic in Lscfg’s device-location
extraction to replace s.split(device) with indexOf and substring using the
literal device delimiter. Preserve the existing behavior for devices at the end
of the line and continue deriving model from the trimmed text after the
delimiter.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a46db66d-af92-4b89-be49-a945141a8a61

📥 Commits

Reviewing files that changed from the base of the PR and between 2302838 and 6283071.

📒 Files selected for processing (4)
  • oshi-common/src/main/java/oshi/driver/common/unix/aix/Lscfg.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixCentralProcessor.java
  • oshi-common/src/test/java/oshi/driver/common/unix/aix/LscfgTest.java
  • oshi-common/src/test/java/oshi/hardware/common/platform/unix/aix/AixCentralProcessorTest.java
🚧 Files skipped from review as they are similar to previous changes (3)
  • oshi-common/src/test/java/oshi/driver/common/unix/aix/LscfgTest.java
  • oshi-common/src/test/java/oshi/hardware/common/platform/unix/aix/AixCentralProcessorTest.java
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixCentralProcessor.java
📜 Review details
⏰ Context from checks skipped due to timeout. (12)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Test JDK 25, macos-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 21, macos-latest
  • GitHub Check: Test JDK 26, macos-latest
  • GitHub Check: Test JDK 21, windows-latest
  • GitHub Check: Test JDK 25, windows-latest (+ JNA==FFM)
  • GitHub Check: Test JDK 26, windows-latest
  • GitHub Check: Test JDK 25, OpenBSD (+ JNA==FFM)
  • GitHub Check: Test JDK 25, FreeBSD (+ JNA==FFM)
  • GitHub Check: Test JDK 25, OpenIndiana (+ JNA==FFM)
  • GitHub Check: Lint (Spotless, Checkstyle, ForbiddenAPIs, Javadoc)
  • GitHub Check: Analyze (java)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2026-04-12T19:22:09.716Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3149
File: oshi-common/src/main/java/oshi/hardware/common/platform/mac/MacCentralProcessor.java:159-163
Timestamp: 2026-04-12T19:22:09.716Z
Learning: When reviewing OSHI hardware platform code that uses or implements `CentralProcessor`/`PhysicalProcessor.getEfficiency()`, remember the API’s counterintuitive semantics: a *higher* efficiency-class value indicates *greater performance* (lower efficiency). P-cores/“performance cores” should therefore have higher values (e.g., 1) than E-cores/“efficiency cores” (e.g., 0), as documented in the `CentralProcessor` Javadoc. Do not flag code as incorrect solely because ARM_P_CORES or Intel P-cores are assigned higher efficiency values.

Applied to files:

  • oshi-common/src/main/java/oshi/driver/common/unix/aix/Lscfg.java
📚 Learning: 2026-07-06T19:25:59.225Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3432
File: oshi-common/src/main/java/oshi/util/ExceptionUtil.java:26-56
Timestamp: 2026-07-06T19:25:59.225Z
Learning: In this repo’s SLF4J 1.x-compatible logging code, do not flag cases where a logger call uses SLF4J 1.6+ implicit-cause handling—e.g., `log.error("...{}", value, t)` (or similar with a single `{}` placeholder) where `t` is passed as the final/trailing argument. SLF4J will attach `t` as the log event’s cause with the full stack trace; this is equivalent to SLF4J 2.x’s fluent `atLevel(...).setCause(t).log(...)` and is intentionally used to preserve SLF4J 1.x runtime compatibility.

Applied to files:

  • oshi-common/src/main/java/oshi/driver/common/unix/aix/Lscfg.java

Follow-up to the earlier split-length guard: use indexOf/substring with the
literal device name in Lscfg.parseModelSerial. split(device) treats the device
as a regex and needs a length guard for a trailing-token line; indexOf/substring
is clearer and handles the end-of-line case directly (empty remainder -> no
model). Behavior is unchanged; covered by the existing fixture tests.
@dbwiddis
dbwiddis merged commit 03a40c0 into oshi:master Jul 21, 2026
19 checks passed
@dbwiddis
dbwiddis deleted the aix-parse-coverage-2 branch July 21, 2026 02:56
dbwiddis added a commit that referenced this pull request Jul 21, 2026
…sion (#3504)

* Fix AIX processor-cache detection reading the hostname as the POWER version

getCachesForModel selected the cache topology from
getFirstIntValue(uname -n) -- but uname -n is the network hostname, so on a
POWER8 box named e.g. "gcc119" it parsed 119, matched no switch case, and
returned an empty cache list. Read the POWER generation from prtconf's
"Processor Version" line instead (e.g. PV_8_Compat -> 8), via a new testable
parsePowerVersion(prtconf) seam. Verified against real prtconf/uname output
from an IBM,8284-22A (POWER8) cfarm host.

CHANGELOG entry to be added when the PR is opened (after #3503 lands).

* Add CHANGELOG entry for #3504 (AIX cache detection fix)
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.

1 participant