Skip to content

Post-3339 audit pass + consolidated manual benchmark workflow - #3340

Merged
dbwiddis merged 3 commits into
oshi:masterfrom
dbwiddis:docs-and-audit-pass
Jun 5, 2026
Merged

dbwiddis merged 3 commits into
oshi:masterfrom
dbwiddis:docs-and-audit-pass

Conversation

@dbwiddis

@dbwiddis dbwiddis commented Jun 5, 2026 •

Copy link
Copy Markdown
Member

Summary

Audit pass after the Solaris/illumos FFM port (#3339) merged, plus consolidation of the JMH benchmark jobs that were sprinkled across the per-OS workflows.

Docs / cross-platform consistency

  • CHANGELOG.md — entry for Solaris/illumos FFM port (#3338) #3339.
  • README.md, src/site/markdown/index.md, FAQ.md, PERFORMANCE.md, oshi-core/src/main/java/oshi/SystemInfo.java, oshi-core/src/main/java/oshi/package-info.java — supported-platform lists are now consistent (JNA covers everything OSHI has ever targeted; FFM lists Linux/macOS/Windows/FreeBSD/OpenBSD/Solaris (illumos)), with the (illumos) parenthetical and an OpenBSD/Solaris row in the README factory table.

Coverage / module config

  • pom.xml — adds OpenBsdPowerSource* and SolarisPowerSource* to the JaCoCo excludes for parity with the other platforms.
  • oshi-core-ffm/src/test/java/module-info.test — drops three stale --add-opens for oshi.driver.mac{,.disk,.net} (no tests exist in those packages).

Tests

  • Five FFM smoke tests (SystemInfoTest, VirtualMemoryFFMTest, OperatingSystemFFMTest, GlobalMemoryFFMTest, ForeignFunctionsTest) gained OS.SOLARIS in their @EnabledOnOs annotation so the Solaris CI run actually exercises them.

Benchmarks

  • New .github/workflows/benchmarks.yaml — single workflow_dispatch-only workflow that runs the JMH suite on all six supported platforms (Linux, macOS, Windows, FreeBSD, OpenBSD, OpenIndiana). OpenIndiana mem is bumped to 12288 MB because back-to-back JMH JVM forks otherwise exhaust illumos's native malloc pool. OpenBSD step sets JAVA_HOME=/usr/local/jdk-25 explicitly because pkg_add maven wraps mvn with its own JDK shim but a bare java invocation does not inherit it.
  • linux.yaml, macos.yaml, windows.yaml — drop the per-OS benchmarks: job; numbers are captured ad-hoc now instead of on every push.
  • PERFORMANCE.md — refresh all six platform tables from a single consistent run for clean apples-to-apples comparison.

Pre-existing JNA bug fix (Solaris PowerSource)

  • oshi-core/src/main/java/oshi/hardware/platform/unix/solaris/SolarisPowerSource.java and oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/solaris/SolarisPowerSourceFFM.java — psPowerUsageRate was declared 0d and never assigned, which also forced psAmperage to 0 via the downstream psAmperage = psPowerUsageRate * 1000 / voltageNow calc. psCharging / psDischarging were never written from bst_state (only a local isCharging was read). And the bit mask was 0x10 despite the inline ACPI comment naming bit 1 (= 0x02) as the charging bit. Now assigns psPowerUsageRate = bst_rate, masks 0x01 for discharging and 0x02 for charging per ACPI BST spec, and gates the time-remaining calc on psDischarging. The other platforms (Mac/Windows/Linux/FreeBSD/OpenBSD) were audited and confirmed correct — Solaris was the lone outlier.

Test plan

  • Pre-commit gate passes on oshi-core + oshi-core-ffm: spotless:apply, checkstyle:check, install, forbiddenapis:check, javadoc:javadoc
  • Manual Benchmarks (manual) workflow run captured a clean snapshot for all six platforms before refreshing the tables in PERFORMANCE.md — https://github.com/dbwiddis/oshi/actions/runs/27004570481
  • Existing per-OS CI workflows continue to pass on this PR (Linux/macOS/Windows/FreeBSD/OpenBSD/OpenIndiana test+coverage jobs; no behavioral change there)
  • Solaris PowerSource fix can't be exercised in CI (the OpenIndiana VM has no battery) — reviewers, please eyeball the diff against the ACPI BST spec

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added support for Solaris (illumos), OpenBSD, and FreeBSD with the FFM implementation for improved performance.
  • Bug Fixes

    • Improved battery state detection in Solaris power source handling.
  • Documentation

    • Updated platform support documentation, FAQ, and performance benchmarks to reflect expanded compatibility.
    • Expanded supported platform list to include Solaris (illumos) and DragonFly BSD.
  • Tests

    • Extended test coverage to run on newly supported platforms.

dbwiddis and others added 3 commits June 5, 2026 01:15
Audit pass after the Solaris/illumos FFM port (#3339) merged.

Docs: CHANGELOG entry, README + index.md add the (illumos) parenthetical
and an OpenBSD/Solaris row in the factory table, FAQ + PERFORMANCE +
SystemInfo + package-info now list FreeBSD/OpenBSD/Solaris (illumos)
consistently in the FFM-supported set.

Coverage / module config: add OpenBSD and Solaris PowerSource to the
JaCoCo excludes for parity with the other platforms; drop three stale
add-opens for oshi.driver.mac{,.disk,.net} from the FFM test
module-info (no tests exist in those packages).

Tests: add OS.SOLARIS to the @EnabledOnOs annotation on five FFM smoke
tests (SystemInfoTest, VirtualMemoryFFMTest, OperatingSystemFFMTest,
GlobalMemoryFFMTest, ForeignFunctionsTest) so the new Solaris CI run
actually exercises them.

Benchmarks: new .github/workflows/benchmarks-unix.yaml is a one-shot
workflow_dispatch capture for FreeBSD/OpenBSD/OpenIndiana JMH numbers,
with OpenIndiana mem bumped to 12288 to give back-to-back JVM forks a
chance against illumos's native malloc pool. Temporary push-trigger on
this branch so the numbers can be captured before merge; will be
removed before PR.

Pre-existing JNA bug fix in SolarisPowerSource (and the FFM port that
inherited it): psPowerUsageRate was declared 0d and never assigned,
which also forced psAmperage to 0; psCharging/psDischarging were never
written from bst_state (only a local isCharging was read); and the
bit mask was 0x10 despite the inline comment naming bit 1 (= 0x02) as
the charging bit. Now assigns psPowerUsageRate = bst_rate, masks 0x01
for discharging and 0x02 for charging per ACPI BST spec, and uses
psDischarging (rather than !isCharging) to gate the time-remaining
calc.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Previously each OS workflow (linux.yaml, macos.yaml, windows.yaml) ran a
JMH benchmark job on every push and the FreeBSD/OpenBSD/OpenIndiana jobs
that I'd added in the previous commit followed the same pattern. We
aren't tracking the numbers automatically — they only feed PERFORMANCE.md
— so running them on every push wastes CI minutes.

Consolidate all six platforms into a single Benchmarks (manual) workflow
gated to workflow_dispatch (plus a temporary push trigger on this branch
so the numbers can be captured before merge; will be removed before PR).
Drop the benchmarks: job from linux/macos/windows.

OpenBSD: pkg_add maven wraps mvn with its own JAVA_HOME shim but a bare
`java -jar` invocation needs PATH/JAVA_HOME set explicitly; the first
capture pass failed with `sh: java: not found` for exactly this reason.

PERFORMANCE.md: populate FreeBSD and Solaris (illumos) tables from the
first manual run (https://github.com/dbwiddis/oshi/actions/runs/27003767696).
OpenBSD left as TODO pending a successful follow-up run.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Replaces the older per-platform numbers (which were collected at
different times against different commits) with a single consistent
snapshot from the latest Benchmarks (manual) workflow run, so the
JNA-vs-FFM comparisons across platforms are apples-to-apples. OpenBSD
numbers are populated for the first time; the JAVA_HOME/PATH fix in the
previous commit lets the bare `java -jar` step find the JDK.

Also drops the temporary push: trigger from benchmarks.yaml; the
workflow is now workflow_dispatch-only as originally intended.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@codecov

codecov Bot commented Jun 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.04%. Comparing base (11dcff0) to head (5e625c6).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3340      +/-   ##
============================================
+ Coverage     67.81%   75.04%   +7.22%     
  Complexity       76       76              
============================================
  Files           605      602       -3     
  Lines         26000    25813     -187     
  Branches       4026     3986      -40     
============================================
+ Hits          17633    19371    +1738     
+ Misses         6343     4186    -2157     
- Partials       2024     2256     +232     
Flag Coverage Δ
freebsd 23.21% <ø> (+0.16%) ⬆️
linux 26.90% <ø> (+0.20%) ⬆️
macos 30.26% <ø> (+0.21%) ⬆️
openbsd 22.55% <ø> (+0.15%) ⬆️
solaris 24.83% <ø> (?)
windows 36.22% <ø> (+0.23%) ⬆️

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 commented Jun 5, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR consolidates benchmark execution into a dedicated manual workflow across multiple platforms, extends FFM support to Solaris (illumos), fixes battery state reading in Solaris power implementations, and updates all documentation to reflect the expanded BSD and Solaris platform coverage.

Changes

Solaris FFM Support and Benchmark Workflow Refactor

Layer / File(s) Summary
Manual Benchmark Workflow
.github/workflows/benchmarks.yaml
New workflow provides on-demand JMH benchmark execution across Linux, macOS, Windows (native runners) and FreeBSD, OpenBSD, OpenIndiana (VM-based runners) with consistent fixed JMH parameters and platform-specific setup (JAVA_HOME/PATH, memory configuration).
CI Workflow Consolidation
.github/workflows/linux.yaml, .github/workflows/macos.yaml, .github/workflows/windows.yaml
Removes duplicate benchmarks jobs from macOS and Windows workflows, consolidating them into the new dedicated benchmarks.yaml workflow; fixes Docker command syntax in Linux CI by removing stray lines.
Solaris Power Source Battery State Fix
oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/solaris/SolarisPowerSourceFFM.java, oshi-core/src/main/java/oshi/hardware/platform/unix/solaris/SolarisPowerSource.java, pom.xml
Corrects battery state interpretation to read charging/discharging flags from bst_state bit 0 (discharging) and bit 1 (charging); assigns power usage rate from bst_rate; computes time remaining only when actively discharging; adds coverage exclusions for power source classes.
Solaris FFM Test Platform Support
oshi-core-ffm/src/test/java/oshi/ffm/ForeignFunctionsTest.java, oshi-core-ffm/src/test/java/oshi/ffm/GlobalMemoryFFMTest.java, oshi-core-ffm/src/test/java/oshi/ffm/OperatingSystemFFMTest.java, oshi-core-ffm/src/test/java/oshi/ffm/SystemInfoTest.java, oshi-core-ffm/src/test/java/oshi/ffm/VirtualMemoryFFMTest.java, oshi-core-ffm/src/test/java/module-info.test
Extends OS-gated test annotations to include OS.SOLARIS across multiple FFM test classes; removes obsolete macOS module access directives from test JVM configuration.
Platform Support Documentation
README.md, FAQ.md, src/site/markdown/index.md, oshi-core/src/main/java/oshi/SystemInfo.java, oshi-core/src/main/java/oshi/package-info.java
Expands supported platform lists to explicitly enumerate Solaris (illumos), FreeBSD, and OpenBSD; clarifies FFM availability on these platforms in SystemInfoFactory selection logic and Javadoc; specifies JNA fallback for unsupported platforms (AIX, DragonFly BSD, NetBSD).
Performance Benchmarks and Changelog
PERFORMANCE.md, CHANGELOG.md
Refreshes FFM vs. JNA benchmark tables with manually-collected data from the new benchmark workflow for Linux, macOS, Windows; adds new subsections with benchmark results and VM-caveat notes for FreeBSD, OpenBSD, and Solaris; updates changelog with PR reference and contributor credit for Solaris/illumos FFM support.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • oshi/oshi#3214: Directly precedes this PR—refactored benchmark jobs into separate workflow; this PR consolidates that refactor into a dedicated benchmarks.yaml workflow.
  • oshi/oshi#3330: Both PRs extend @EnabledOnOs annotations on the same FFM test classes to cover additional UNIX platforms (Solaris in this PR vs. FreeBSD in #3330).
  • oshi/oshi#3331: Shares the same pattern of platform-support documentation and JaCoCo coverage updates for BSD/Solaris FFM work.

Poem

🐰 A rabbit hops through platforms new,
From Solaris gates to FreeBSD's dew,
Benchmarks dance in workflow's light,
Battery bits read crystal-bright!
Power flows where once it stumbled—
Documentation rebuilt, unhumbled! 🌟

🚥 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 directly relates to the main changeset: consolidating JMH benchmark jobs into a single workflow and performing documentation audit post-Solaris support.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

@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: 2

🤖 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 @.github/workflows/benchmarks.yaml:
- Line 22: Update each actions/checkout step (the lines using "uses:
actions/checkout@...") to disable credential persistence by adding
persist-credentials: false to the step inputs; locate the checkout occurrences
shown in the diff (the uses: actions/checkout@... lines at the reported
positions) and ensure each of those checkout steps includes persist-credentials:
false so the workflow does not store the GITHUB_TOKEN in local git config.
- Around line 14-17: Add an explicit top-level permissions block to pin the
workflow token to least privilege (e.g., read-only) instead of relying on repo
defaults; update the YAML at the top near the existing "on: workflow_dispatch" /
before "jobs:" to include a permissions mapping such as granting contents: read
(and any other minimal read-only scopes your benchmarks require, e.g., packages:
read or actions: read) so the workflow token cannot perform write actions.
🪄 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: ff2a7802-6476-4369-b67b-c5c28f9d9538

📥 Commits

Reviewing files that changed from the base of the PR and between 11dcff0 and 5e625c6.

📒 Files selected for processing (20)
  • .github/workflows/benchmarks.yaml
  • .github/workflows/linux.yaml
  • .github/workflows/macos.yaml
  • .github/workflows/windows.yaml
  • CHANGELOG.md
  • FAQ.md
  • PERFORMANCE.md
  • README.md
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/solaris/SolarisPowerSourceFFM.java
  • oshi-core-ffm/src/test/java/module-info.test
  • oshi-core-ffm/src/test/java/oshi/ffm/ForeignFunctionsTest.java
  • oshi-core-ffm/src/test/java/oshi/ffm/GlobalMemoryFFMTest.java
  • oshi-core-ffm/src/test/java/oshi/ffm/OperatingSystemFFMTest.java
  • oshi-core-ffm/src/test/java/oshi/ffm/SystemInfoTest.java
  • oshi-core-ffm/src/test/java/oshi/ffm/VirtualMemoryFFMTest.java
  • oshi-core/src/main/java/oshi/SystemInfo.java
  • oshi-core/src/main/java/oshi/hardware/platform/unix/solaris/SolarisPowerSource.java
  • oshi-core/src/main/java/oshi/package-info.java
  • pom.xml
  • src/site/markdown/index.md
💤 Files with no reviewable changes (4)
  • .github/workflows/macos.yaml
  • oshi-core-ffm/src/test/java/module-info.test
  • .github/workflows/linux.yaml
  • .github/workflows/windows.yaml
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Test JDK 25, OpenBSD (+ JNA==FFM)
  • GitHub Check: JMH Benchmarks, macos-latest
  • GitHub Check: Test JDK 25, OpenIndiana (+ JNA==FFM)
🧰 Additional context used
🧠 Learnings (17)
📓 Common learnings
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3307
File: .github/workflows/netbsd.yaml:4-8
Timestamp: 2026-05-30T02:27:59.447Z
Learning: In the oshi/oshi repository, the `.github/workflows/netbsd.yaml` CI workflow intentionally triggers only on `push` to the `netbsd-port` branch during development. Before the final merge to master, NetBSD CI will be integrated into the main Unix CI workflow (e.g., `.github/workflows/pr.yaml` or equivalent). Do not flag the limited trigger scope as an issue on this PR.
📚 Learning: 2026-03-29T20:01:06.452Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3014
File: oshi-core-java11/src/main/java/module-info.java:10-17
Timestamp: 2026-03-29T20:01:06.452Z
Learning: In the oshi project, `oshi-core-java25/src/main/java/module-info.java` intentionally does NOT export `oshi.util.platform.unix.freebsd`, `oshi.util.platform.unix.openbsd`, or `oshi.util.platform.unix.solaris`, because the FFM (Foreign Function & Memory) implementation only supports Windows, macOS, and Linux. This differs from `oshi-core-java11/src/main/java/module-info.java` which exports all Unix platform packages. The asymmetry is by design.

Applied to files:

  • oshi-core/src/main/java/oshi/package-info.java
  • oshi-core-ffm/src/test/java/oshi/ffm/ForeignFunctionsTest.java
  • oshi-core-ffm/src/test/java/oshi/ffm/GlobalMemoryFFMTest.java
  • oshi-core-ffm/src/test/java/oshi/ffm/VirtualMemoryFFMTest.java
  • oshi-core-ffm/src/test/java/oshi/ffm/OperatingSystemFFMTest.java
  • oshi-core/src/main/java/oshi/SystemInfo.java
  • pom.xml
  • README.md
  • oshi-core-ffm/src/test/java/oshi/ffm/SystemInfoTest.java
  • src/site/markdown/index.md
  • PERFORMANCE.md
📚 Learning: 2026-04-06T04:45:51.516Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3121
File: oshi-core/src/main/java/oshi/software/os/linux/LinuxOperatingSystem.java:53-53
Timestamp: 2026-04-06T04:45:51.516Z
Learning: In the oshi/oshi project, the public API is strictly limited to interfaces and classes in the `oshi`, `oshi.hardware`, and `oshi.software.os` packages. All platform-specific code under subpackages like `oshi.software.os.linux`, `oshi.hardware.platform.linux`, etc., is considered implementation detail — not public API. Do not flag changes to platform-specific classes (e.g., making `LinuxOperatingSystem` abstract, narrowing constructor visibility, adding abstract methods) as public API breaks.

Applied to files:

  • oshi-core/src/main/java/oshi/package-info.java
  • oshi-core-ffm/src/test/java/oshi/ffm/OperatingSystemFFMTest.java
  • oshi-core/src/main/java/oshi/SystemInfo.java
  • README.md
  • src/site/markdown/index.md
📚 Learning: 2026-04-03T18:44:48.200Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3112
File: oshi-core/src/main/java/oshi/PlatformEnum.java:63-66
Timestamp: 2026-04-03T18:44:48.200Z
Learning: In oshi/oshi PlatformEnum.java, the DRAGONFLYBSD enum constant is intentionally added for platform detection only (no implementation classes exist yet). It allows UnsupportedOperationException messages to say "DragonFly BSD" rather than "Unknown". Full DragonFly BSD support is tracked in issue `#2583`. Do not flag the missing switch-case implementations as a bug.

Applied to files:

  • oshi-core/src/main/java/oshi/package-info.java
  • oshi-core-ffm/src/test/java/oshi/ffm/ForeignFunctionsTest.java
  • oshi-core-ffm/src/test/java/oshi/ffm/OperatingSystemFFMTest.java
  • oshi-core/src/main/java/oshi/SystemInfo.java
  • README.md
  • src/site/markdown/index.md
  • FAQ.md
📚 Learning: 2026-05-31T04:49:16.646Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3310
File: oshi-core/src/main/java/oshi/software/os/unix/netbsd/NetBsdOperatingSystem.java:164-166
Timestamp: 2026-05-31T04:49:16.646Z
Learning: In the oshi/oshi project, the NetBSD platform intentionally removes all JNA/native library dependencies (PR `#3310`). `NetBsdOperatingSystem.getThreadId()` uses `(int) Thread.currentThread().getId()` rather than `NetBsdLibc._lwp_self()` because the JNA native library is not bundled with the Maven dependency for the NetBSD platform. The mismatch between Java thread ids and kernel LWP ids is an accepted trade-off. Do not suggest reintroducing JNA-based calls (such as `NetBsdLibc._lwp_self()`) in NetBSD platform code.

Applied to files:

  • oshi-core/src/main/java/oshi/package-info.java
  • oshi-core/src/main/java/oshi/SystemInfo.java
  • README.md
  • src/site/markdown/index.md
  • PERFORMANCE.md
📚 Learning: 2026-04-18T03:18:06.205Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3170
File: oshi-benchmark/src/test/java/oshi/comparison/PerfmonComparisonTest.java:177-183
Timestamp: 2026-04-18T03:18:06.205Z
Learning: In `oshi-benchmark/src/test/java/oshi/comparison/PerfmonComparisonTest.java`, GPU engine PDH instance counts (from `GpuInformationJNA.queryGpuEngineCounters()` / `GpuInformationFFM.queryGpuEngineCounters()`) are highly volatile — counts can differ dramatically (e.g., 53 vs 40) even between queries taken milliseconds apart. Do not assert instance count equality or exact instance list matching between JNA and FFM results. The only reliable assertion is that both are empty or both are non-empty (`assertThat(ffm.getA().isEmpty()).isEqualTo(jna.getA().isEmpty())`).

Applied to files:

  • oshi-core-ffm/src/test/java/oshi/ffm/GlobalMemoryFFMTest.java
  • oshi-core-ffm/src/test/java/oshi/ffm/VirtualMemoryFFMTest.java
  • oshi-core-ffm/src/test/java/oshi/ffm/OperatingSystemFFMTest.java
  • PERFORMANCE.md
📚 Learning: 2026-04-17T23:43:35.860Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3168
File: oshi-core-java25/src/main/java/oshi/ffm/windows/PdhFFM.java:0-0
Timestamp: 2026-04-17T23:43:35.860Z
Learning: In `oshi-core-java25/src/main/java/oshi/ffm/windows/PdhFFM.java`, the `PDH_RAW_COUNTER_LAYOUT` Java FFM struct layout must place `FirstValue` at byte offset 16 (not 12). The native MSVC compiler inserts 4 bytes of implicit alignment padding before the `LONGLONG FirstValue` field (after CStatus=4 bytes + FILETIME TimeStamp=8 bytes = 12 bytes), because LONGLONG requires 8-byte alignment. The total struct size is 40 bytes (with trailing padding). Do not use JAVA_LONG_UNALIGNED without explicit padding here, as that incorrectly places FirstValue at offset 12 and causes reads of garbage counter values.

Applied to files:

  • oshi-core-ffm/src/test/java/oshi/ffm/GlobalMemoryFFMTest.java
  • oshi-core-ffm/src/test/java/oshi/ffm/VirtualMemoryFFMTest.java
📚 Learning: 2026-04-15T04:56:18.352Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3163
File: oshi-core-java25/src/test/java/oshi/ffm/mac/CoreFoundationTest.java:97-103
Timestamp: 2026-04-15T04:56:18.352Z
Learning: In CoreFoundationTest.java (oshi-core-java25/src/test/java/oshi/ffm/mac/CoreFoundationTest.java), asserting exact CFGetRetainCount deltas (+1 after retain, -1 after release) is intentional and considered reliable for freshly created CF objects (e.g., CFStringRef via CFStringRef.createCFString) where the test holds sole ownership. Do not flag these assertions as flaky — the Apple "avoid CFGetRetainCount" advisory applies to shared/framework-managed objects, not exclusively owned objects in unit tests.

Applied to files:

  • oshi-core-ffm/src/test/java/oshi/ffm/GlobalMemoryFFMTest.java
  • oshi-core-ffm/src/test/java/oshi/ffm/OperatingSystemFFMTest.java
📚 Learning: 2026-04-20T03:07:05.660Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3176
File: oshi-core-java25/src/main/java/oshi/hardware/platform/windows/WindowsVirtualMemoryFFM.java:53-60
Timestamp: 2026-04-20T03:07:05.660Z
Learning: In OSHI's Windows FFM paging file implementation (`oshi-core-java25/src/main/java/oshi/hardware/platform/windows/WindowsVirtualMemoryFFM.java`), the `querySwapUsed()` method uses the Windows PDH raw counter for "% Usage" on the paging file. Despite its name, this raw counter returns page counts: `FirstValue` is the number of pages currently used and `SecondValue` is the total number of pages in the swap file. The formatted counter performs the division and multiplies by 100% to yield a true percentage. Therefore, computing swap used bytes as `pageSize * used.get()` (pages × page size) is correct — do not treat the return value as a percentage.

Applied to files:

  • oshi-core-ffm/src/test/java/oshi/ffm/GlobalMemoryFFMTest.java
  • oshi-core-ffm/src/test/java/oshi/ffm/VirtualMemoryFFMTest.java
📚 Learning: 2026-05-04T04:58:36.843Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3227
File: oshi-metrics/src/main/java/oshi/metrics/OshiMetrics.java:35-48
Timestamp: 2026-05-04T04:58:36.843Z
Learning: In `oshi-metrics/src/main/java/oshi/metrics/OshiMetrics.java`, the `private final OperatingSystem os` field is intentionally stored in the constructor even though it is not yet used. It is a placeholder for future OS-level metrics (e.g., process metrics) that will be added incrementally. Do not flag it as dead code.

Applied to files:

  • oshi-core-ffm/src/test/java/oshi/ffm/OperatingSystemFFMTest.java
  • oshi-core/src/main/java/oshi/SystemInfo.java
📚 Learning: 2026-04-03T18:43:51.290Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3112
File: oshi-core/src/main/java/oshi/PlatformEnum.java:99-100
Timestamp: 2026-04-03T18:43:51.290Z
Learning: In oshi/oshi PlatformEnum.java, the DragonFly BSD detection uses `osName.equalsIgnoreCase("dragonflybsd")` intentionally, mirroring the exact same check in JNA's `Platform.java` source. Java's `os.name` property on DragonFly BSD is "dragonflybsd" (no space), so `startsWith("DragonFly")` is NOT the correct pattern here. Do not suggest changing it to `startsWith`.

Applied to files:

  • oshi-core-ffm/src/test/java/oshi/ffm/OperatingSystemFFMTest.java
  • oshi-core/src/main/java/oshi/SystemInfo.java
📚 Learning: 2026-04-08T00:58:10.736Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3125
File: oshi-core-java25/src/main/java/oshi/hardware/platform/windows/WindowsPowerSourceFFM.java:131-133
Timestamp: 2026-04-08T00:58:10.736Z
Learning: In `oshi-core/src/main/java/oshi/hardware/platform/windows/WindowsPowerSourceJNA.java` and `oshi-core-java25/src/main/java/oshi/hardware/platform/windows/WindowsPowerSourceFFM.java`, the `getPowerSources()` method intentionally returns a singleton list wrapping a single `getPowerSource("System Battery")` call, and the enumeration loop short-circuits after the first eligible battery pack. This matches the longstanding JNA behavior and is not a bug. A broader refactor to support zero-or-more batteries across both implementations is planned for a later date. Do not flag this as an issue.

Applied to files:

  • pom.xml
  • oshi-core/src/main/java/oshi/hardware/platform/unix/solaris/SolarisPowerSource.java
  • oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/solaris/SolarisPowerSourceFFM.java
📚 Learning: 2026-05-07T23:18:49.419Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3234
File: CHANGELOG.md:3-3
Timestamp: 2026-05-07T23:18:49.419Z
Learning: In the oshi/oshi repository, CHANGELOG.md intentionally uses `#####` (H5) headings for section labels like "New Features" and "Bug Fixes and Improvements" directly under the H1 release title. This is a decade-old formatting convention, not a markdown lint error. Do not flag MD001 heading-increment warnings for this file.

Applied to files:

  • src/site/markdown/index.md
  • CHANGELOG.md
📚 Learning: 2026-05-30T02:27:59.447Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3307
File: .github/workflows/netbsd.yaml:4-8
Timestamp: 2026-05-30T02:27:59.447Z
Learning: In the oshi/oshi repository, the `.github/workflows/netbsd.yaml` CI workflow intentionally triggers only on `push` to the `netbsd-port` branch during development. Before the final merge to master, NetBSD CI will be integrated into the main Unix CI workflow (e.g., `.github/workflows/pr.yaml` or equivalent). Do not flag the limited trigger scope as an issue on this PR.

Applied to files:

  • .github/workflows/benchmarks.yaml
📚 Learning: 2026-05-31T05:53:04.246Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3311
File: .github/workflows/site.yaml:21-21
Timestamp: 2026-05-31T05:53:04.246Z
Learning: When a GitHub Actions workflow verifies that a pinned commit SHA matches a version tag, dereference annotated tags before comparing to a commit SHA. The API `GET /repos/{owner}/{repo}/git/refs/tags/{tag}` returns the tag *object* SHA for annotated tags (not the underlying commit SHA), so comparing it directly to a commit SHA will cause false mismatches. Instead: (1) fetch the tag object SHA via `GET /repos/{owner}/{repo}/git/refs/tags/{tag}`; (2) resolve that tag object to the underlying commit by calling `GET /repos/{owner}/{repo}/git/tags/{tag_object_sha}`; (3) compare the pinned commit SHA to the resolved commit at `.object.sha`.

Applied to files:

  • .github/workflows/benchmarks.yaml
📚 Learning: 2026-04-06T04:45:47.644Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3121
File: oshi-core/src/main/java/oshi/software/os/linux/LinuxOperatingSystem.java:53-53
Timestamp: 2026-04-06T04:45:47.644Z
Learning: In the oshi/oshi project, only interfaces and classes in the root packages `oshi`, `oshi.hardware`, and `oshi.software.os` are considered the public API. Code in subpackages that represent specific implementations/platforms (e.g., `oshi.software.os.linux`, `oshi.hardware.platform.linux`, and similar subpackages) is implementation detail. When reviewing, do not treat changes to classes in these platform-specific subpackages as public API breaks (for example: making `LinuxOperatingSystem` abstract, narrowing constructor visibility, or adding/removing abstract methods should not be flagged as breaking public API).

Applied to files:

  • oshi-core/src/main/java/oshi/hardware/platform/unix/solaris/SolarisPowerSource.java
📚 Learning: 2026-04-19T01:28:47.155Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3174
File: oshi-benchmark/src/test/java/oshi/comparison/WmiComparisonTest.java:237-257
Timestamp: 2026-04-19T01:28:47.155Z
Learning: In `oshi-benchmark/src/test/java/oshi/comparison/WmiComparisonTest.java`, the WMI comparison tests (e.g., `testProcessor`) intentionally validate only index 0 and a few representative fields per WMI data type (String, uint16, uint32, uint64). Exhaustive row-by-row comparison is deliberately avoided for numerically heavy multi-row tables. The design rationale is: matching row counts + a few selected fields covering each data type is sufficient to verify JNA vs FFM driver parity. Do not suggest looping over all rows for these tests.

Applied to files:

  • PERFORMANCE.md
🪛 LanguageTool
PERFORMANCE.md

[uncategorized] ~11-~11: The official name of this software platform is spelled with a capital “H”.
Context: ...iggered Benchmarks (manual) workflow (.github/workflows/benchmarks.yaml) on GitHub A...

(GITHUB)


[style] ~71-~71: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...ileStoreandProcesses` numbers carry very wide error bars in the nested VM; treat them...

(EN_WEAK_ADJECTIVE)

🪛 zizmor (1.25.2)
.github/workflows/benchmarks.yaml

[warning] 22-22: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)


[warning] 38-38: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)


[warning] 54-54: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)


[warning] 70-70: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)


[warning] 88-88: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)


[warning] 111-111: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)


[warning] 18-32: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block

(excessive-permissions)


[warning] 34-48: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block

(excessive-permissions)


[warning] 50-64: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block

(excessive-permissions)


[warning] 66-82: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block

(excessive-permissions)


[warning] 84-105: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block

(excessive-permissions)

🔇 Additional comments (15)
README.md (1)

19-19: LGTM!

Also applies to: 79-81

FAQ.md (1)

95-95: LGTM!

Also applies to: 99-99

src/site/markdown/index.md (1)

19-19: LGTM!

Also applies to: 78-80

oshi-core/src/main/java/oshi/SystemInfo.java (1)

64-64: LGTM!

oshi-core/src/main/java/oshi/package-info.java (1)

35-36: LGTM!

Also applies to: 38-39

PERFORMANCE.md (1)

11-11: LGTM!

Also applies to: 17-21, 27-33, 41-45, 49-59, 61-72, 73-84

CHANGELOG.md (1)

15-15: LGTM!

oshi-core-ffm/src/main/java/oshi/hardware/platform/unix/solaris/SolarisPowerSourceFFM.java (1)

115-125: LGTM!

oshi-core/src/main/java/oshi/hardware/platform/unix/solaris/SolarisPowerSource.java (1)

131-131: LGTM!

Also applies to: 136-141

pom.xml (1)

845-846: LGTM!

oshi-core-ffm/src/test/java/oshi/ffm/ForeignFunctionsTest.java (1)

27-27: LGTM!

oshi-core-ffm/src/test/java/oshi/ffm/GlobalMemoryFFMTest.java (1)

31-31: LGTM!

oshi-core-ffm/src/test/java/oshi/ffm/OperatingSystemFFMTest.java (1)

29-29: LGTM!

oshi-core-ffm/src/test/java/oshi/ffm/SystemInfoTest.java (1)

54-54: LGTM!

oshi-core-ffm/src/test/java/oshi/ffm/VirtualMemoryFFMTest.java (1)

23-23: LGTM!

Comment on lines +14 to +17
on:
workflow_dispatch:

jobs:

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add explicit least-privilege permissions for the workflow.

This workflow doesn’t declare permissions, so token scope depends on repo defaults. Pin it to read-only for benchmark runs.

Suggested hardening
 on:
   workflow_dispatch:
 
+permissions:
+  contents: read
+
 jobs:
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
on:
workflow_dispatch:
jobs:
on:
workflow_dispatch:
permissions:
contents: read
jobs:
🤖 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 @.github/workflows/benchmarks.yaml around lines 14 - 17, Add an explicit
top-level permissions block to pin the workflow token to least privilege (e.g.,
read-only) instead of relying on repo defaults; update the YAML at the top near
the existing "on: workflow_dispatch" / before "jobs:" to include a permissions
mapping such as granting contents: read (and any other minimal read-only scopes
your benchmarks require, e.g., packages: read or actions: read) so the workflow
token cannot perform write actions.

name: JMH benchmarks, Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Disable credential persistence in all checkout steps.

actions/checkout currently keeps the token in local git config by default. These jobs don’t need push/authenticated git operations, so disable it.

Suggested hardening (apply to each checkout step)
-      - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
+      - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
+        with:
+          persist-credentials: false

Also applies to: 38-38, 54-54, 70-70, 88-88, 111-111

🧰 Tools
🪛 zizmor (1.25.2)

[warning] 22-22: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)

🤖 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 @.github/workflows/benchmarks.yaml at line 22, Update each actions/checkout
step (the lines using "uses: actions/checkout@...") to disable credential
persistence by adding persist-credentials: false to the step inputs; locate the
checkout occurrences shown in the diff (the uses: actions/checkout@... lines at
the reported positions) and ensure each of those checkout steps includes
persist-credentials: false so the workflow does not store the GITHUB_TOKEN in
local git config.

@dbwiddis
dbwiddis merged commit 1df9441 into oshi:master Jun 5, 2026
21 of 22 checks passed
@dbwiddis
dbwiddis deleted the docs-and-audit-pass branch June 5, 2026 14:36
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