perf: add syntactic prefilters before semantic-model calls in all affected analyzers#463
Conversation
Prompt: Perf Phase 1: syntactic prefilters before semantic-model calls in all affected analyzers
Pre-commit Hook Failure — Environmental IssueThe pre-commit hook is blocking the commit of the syntactic prefilter implementation due to a missing system utility in the build container. What the hook ranThe hook detected Status of the actual codeThe syntactic prefilter implementation is complete and correct:
Root causeThe build container is missing the To unblockInstall apt-get install -y procpsOr, if the CI environment has The uncommitted implementation is on the local working tree of branch |
Adds ps/pkill/free, needed by .NET benchmark tooling (BenchmarkDotNet process-priority/affinity handling) used in downstream repos. Confirmed locally with `podman build --format docker` of development-tools plus a direct check that ps/pkill/free are present and functional in the built image. Closes #1061 Prompt: apt-get install -y procps can you do that in the appropriate base container needed for funfair-tech/funfair-server-code-analysis#463
## Summary - Installs `procps` (`ps`, `pkill`, `free`, etc.) in `containers/base/development-tools/Dockerfile`, the base apt-packages layer shared by every downstream image (node/python/full/agent). - Needed by .NET benchmark tooling (BenchmarkDotNet process-priority/affinity handling) used in downstream repos — see funfair-tech/funfair-server-code-analysis#463. Closes #1061 ## Test plan - [x] Local `podman build --format docker -t development-tools:local containers/base/development-tools` completes successfully end-to-end (53/53 steps), including the build-time sanity check. - [x] Verified `ps`, `pkill`, `free` are present and functional in the built image (`ps from procps-ng 4.0.4`).
Blocked — BenchmarkDotNet Build Timeout on QEMU ContainerUpdate: The previous comment about a missing Root causeThe pre-commit hook runs Why CI passes but this container failsCI runs on What's blocked
To unblockAn operator needs to either:
The fix cannot be modifying the benchmark classes — switching them to |
…re once the fix ships (#1118) (#1119) ## Summary - Fixes #1118 - Following #1115, an audit of every currently-`Blocked` PR found `funfair-tech/funfair-server-code-analysis#463`: blocked purely because the agent diagnosed a missing `pgrep`/`procps` in the container image. The fix merged and propagated through the image build chain almost immediately, but the PR just sat `Blocked` until a human happened to notice — a manual-intervention condition this repo's own Headless Operation Principle says must be fixed in code. - `oneshot` gains `pr_json_env_block_image_sha` (parses a structured `<!-- orchestrator:env-block image-sha=<sha> --> ` trailer out of the PR's already-fetched comments — no new GitHub API call) and `current_agent_image_sha` (`podman inspect` on the freshly-pulled `:latest` tag's baked `IMAGE_SHA_DEVELOPMENT_AGENT` env var — no container run needed). - `try_auto_unblock_env_diagnosed_pr`, wired into both PR observe-blocked branches, auto-clears `Blocked` and comments the moment the recorded SHA differs from the current image's SHA. - Bounded by `MAX_PR_ENV_AUTO_UNBLOCKS` (default 3): if the same failure recurs after every rebuild, the "environment" diagnosis was probably wrong — auto-clearing stops and a one-time comment asks a human to look, instead of looping silently forever. - Scope is deliberately narrow (confirmed before implementing): only applies to blocks the agent itself tagged as environment/infrastructure. Runaway-cap blocks (#116/#387's case), reviewer-question blocks (#321's case), and CI-timeout/idle-exhausted blocks are untouched. - The agent-side marker convention (`agent-roles.instructions.md` § "Environment/Infrastructure Block Marker") is added separately in `cs-template`, since `ai/global/` is template-managed and can't be edited directly in this repo. ## How Has This Been Tested - [x] `bats test/oneshot.bats` — 522/522 passing, including new unit tests for `pr_json_env_block_image_sha`, `current_agent_image_sha`, `try_auto_unblock_env_diagnosed_pr`, `reset_env_unblock_attempts`, and 3 `main()` integration tests (auto-clears on a newer image, stays blocked when unchanged, stops at the cap and notifies once). - [x] `shellcheck oneshot` — clean. - [x] `markdownlint ai/local/debugging.instructions.md` — clean. - [x] `dotnet buildcheck -solution src/Credfeto.Template.slnx` — no errors (unaffected by this change). ## Types of changes - [x] New feature (non-breaking change which adds functionality) - [x] Additional Unit Tests/Integration Tests - [x] Docs change (debugging instructions) ## Checklist - [x] I have added tests to cover my changes. - [x] Unreleased section of CHANGELOG.md has been updated with details of this PR.
Summary
Add cheap syntactic prefilters immediately before semantic-model calls (
GetTypeInfo,GetSymbolInfo,FindInvokedMemberSymbol) in ten affected analyzers. Each prefilter usesIdentifier.Texton the syntax node's name token and compares against a staticHashSet<string>/FrozenSet<string>, avoiding expensive Roslyn semantic lookups for nodes that cannot possibly match.Affected analyzers:
ProhibitedMethodsDiagnosticsAnalyzer— prefilter on banned member names beforeGetTypeInfoForceMethodParametersInvocationsDiagnosticsAnalyzer— prefilter on{Serialize, SerializeAsync, Deserialize, DeserializeAsync, Received}ProhibitedMethodInvocationsDiagnosticsAnalyzer— prefilter on{True, False, AddOrUpdate, GetOrAdd, Equals}ProhibitedMethodWithStrictParametersInvocationDiagnosticsAnalyzer— prefilter on{Received, AddJsonFile}ProhibitedClassesInTestAssembliesDiagnosticsAnalyzer— syntactic receiver-name prefilter (Console)ProhibitedSubstituteForUsageInTestBaseDiagnosticsAnalyzer— check name isForbeforeGetSymbolInfoArgumentExceptionAnalysisDiagnosticsAnalyzer— prefilter on{ArgumentException, ArgumentNullException, ArgumentOutOfRangeException}TestClassFieldsAnalysisDiagnosticsAnalyzer— reorder:readonly/constcheck BEFOREIsDerivedFromTestBaseTestClassPropertyAnalysisDiagnosticsAnalyzer— reorder: accessor-mutability check BEFOREIsDerivedFromTestBaseTestDetection.IsTestMethod— attribute-name prefilter{Fact, Theory, FactAttribute, TheoryAttribute}beforeGetTypeInfoTest plan
FunFair.CodeAnalysis.Testspass unchanged (no new or removed diagnostics)FunFair.CodeAnalysis.Benchmark.Testsshow reduced mean time and/or allocations vs baselinedotnet buildsucceeds with no warningsdotnet buildcheckpassesCloses #457
🤖 Generated with Claude Code