Repository navigation
perf: stop scanning unrelated DLLs for built-in analyzer rules - #1
Open
darrenator[bot] wants to merge 1 commit into
Open
darrenator[bot] wants to merge 1 commit into
darrenator[bot] wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
✅ 1 suggestion
✅ Codebase Fit (1 suggestion, 2m)
- 🟢 Hard-coded BuiltinRules assembly name string
The BuiltinRules assembly name is hard-coded as a string instead of being derived from or checked against the declaration in Rules.csproj.
✅ No findings
- Observability (1m)
- Bug Fix (1m)
- PR Scope (<1m)
⏭️ Skipped
- Concurrency: no shared state
Reviewed 20da7a1 in 2 min on vllm/reasoning. Comment /wopr review to run the skipped reviewers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Release Notes
None. ImmyBot package integration is separate.
Internal Release Notes
PowerShell Core rule discovery loads the known analyzer assemblies instead of every adjacent DLL. Unrelated host assemblies and their missing dependencies no longer interfere with built-in discovery. Explicit PowerShell custom rules remain supported.
Motivation
After merging immense/immybot#11257, Darren asked whether the repeated PSScriptAnalyzer DLL scans could be restricted and requested a fix with before/after measurements. That PR exposed the engine scanning roughly 410 application DLLs four times per analysis; an EF design assembly with an unavailable dependency caused diagnostics to disappear.
The fork hard-codes
*.dllfor Core discovery.IncludeRule/ExcludeRulefilter rule names after discovery, so they cannot prevent these loads. Built-ins already live in known assemblies; loading those directly removes the unnecessary scan without requiring a new setting or glob API.Summary
Targets
immybot-latest, which contains ImmyBot's existing runtime adaptations. No rule-instance cache, public API, or ImmyBot source change.Evidence
Synthetic crowded-directory benchmark: 410 extra managed DLLs, 100 exported classes each, five fresh processes per variant, five warm-up calls and 30 measured calls per process. Same SDK, runtime, dependencies, and release configuration before and after; alternating build order. Timings below are medians of process medians.
Get-ScriptAnalyzerRule)All 40 benchmark processes returned the same 69 rule names or the same alias diagnostic. These are local synthetic measurements, not editor latency measurements. The analysis sample executes one rule on
gci; large scripts, all-rule execution, PSES debounce, and the actual ImmyBot publish directory remain outside the benchmark. Clean-directory cold timing did not improve consistently.Measurement details, ranges, cold timing, memory, and reproduction commands. The reusable harness is tools/Measure-RuleDiscovery.ps1.
Before: all three new fresh-process tests fail: an invalid adjacent DLL aborts discovery; a managed unrelated DLL is loaded; a valid DLL with a missing base-type dependency aborts discovery.
After: all three pass, including checks for built-in diagnostics, formatting, and explicit PowerShell custom rules through both settings and custom-only invocation.
Testing
net6/PSV7Releasesource builds succeed with the same four existing warnings.ProgressActioncommon parameter, and five existing compatibility-profile assertions. The final additional missing-dependency regression was run separately and in the final focused suite.git diff --checkpass.Merge Danger
Door: two-way; revert the commit to restore the old discovery behavior.
Blast Radius: Core discovery. A third-party compiled rule/logger merely placed beside the engine is no longer implicitly registered. Explicit PowerShell
CustomRulePathbehavior is preserved; compiled custom-rule support is not added to Core. The legacy full-framework MEF branch is unchanged. Fresh rule construction preserves settings isolation; no shared mutable cache is introduced.Integration follow-up
No package is published by this PR. ImmyBot currently references private
PSScriptAnalyzer1.21.0. Package a new immutable version containing this fix, then updatePSScriptAnalyzerPackageVersionin ImmyBot'sDirectory.Packages.propsand verify the real editor. Existing NuGet packaging assets are onfeature/submodule-to-nuget(b0bde41), separate from this PR'simmybot-latestbase.