Skip to content

⭐ Add native Windows API for services enumeration#6474

Draft
chris-rock wants to merge 4 commits intomainfrom
chris-rock/native-windows-services
Draft

⭐ Add native Windows API for services enumeration#6474
chris-rock wants to merge 4 commits intomainfrom
chris-rock/native-windows-services

Conversation

@chris-rock
Copy link
Copy Markdown
Member

This PR optimizes the Windows services resource to use native Windows APIs instead of PowerShell when running locally on Windows systems. This should be around 20x faster than the powershell-based service enumeration.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 26, 2026

Test Results

4 799 tests  ±0   4 795 ✅ ±0   2m 18s ⏱️ -1s
  415 suites ±0       4 💤 ±0 
   31 files   ±0       0 ❌ ±0 

Results for commit be1f5f4. ± Comparison against base commit fd76e74.

♻️ This comment has been updated with latest results.

Implement native Windows Service Control Manager (SCM) API calls for
local Windows connections, bypassing PowerShell for better performance.

- Add services_native_windows.go using golang.org/x/sys/windows/svc/mgr
- Add services_native_unix.go stub for non-Windows builds
- Detect local Windows connections and use native API (~1-10ms vs 200-500ms)
- Automatic fallback to PowerShell for remote connections or on failure
@chris-rock chris-rock force-pushed the chris-rock/native-windows-services branch from 014b4fd to eec3301 Compare January 26, 2026 07:08
czunker added a commit that referenced this pull request Feb 26, 2026
Extract the Windows test workflow from #6474 to enable running
Windows-specific tests (e.g. registry-based detection) in CI.

See: #6474

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
czunker added a commit that referenced this pull request Feb 26, 2026
The previous version ran all tests in the services package on Windows,
which included Linux/macOS tests that fail due to path separators and
symlinks. Now dynamically discovers packages containing _windows_test.go
files and only runs those.

See: #6474

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
czunker added a commit that referenced this pull request Mar 3, 2026
* ✨ Add Windows test workflow for PR CI

Extract the Windows test workflow from #6474 to enable running
Windows-specific tests (e.g. registry-based detection) in CI.

See: #6474

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

* 🐛 Fix Windows test workflow to only run Windows-specific tests

The previous version ran all tests in the services package on Windows,
which included Linux/macOS tests that fail due to path separators and
symlinks. Now dynamically discovers packages containing _windows_test.go
files and only runs those.

See: #6474

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

* 🐛 Fix review comments on Windows test workflow

- Use relative paths for package discovery (DirectoryName returns absolute)
- Filter empty strings from package split to avoid ghost arguments
- Propagate go test exit code through Tee-Object
- Add -count=1 to disable test caching in CI

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

* 🐛 Fix script injection risk and remove push trigger in Windows workflow

Pass test packages via environment variable instead of direct interpolation
to prevent potential script injection. Remove push trigger to match the
PR-only intent of the workflow filename.

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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