Skip to content

Cleanup plan vs pre-commit analyzer gate: rule-family-per-agent decomposition blocks single-package PRs #744

Description

@rygel

Problem

The pre-commit analyzer gate (scripts/pre-commit-analyzer-gate.ps1) runs dotnet format style --severity warn and dotnet format analyzers --severity warn across all configured rules on every changed file. But docs/analyzer-cleanup/05-agent-assignments.md decomposes the cleanup work by rule family per agent (Agent A = SA1210, Agent B = SA15xx, Agent E = VSTHRD103, etc.). These two designs are partially incompatible: a single-package PR can land only when a file's co-located warnings all belong to the same agent's assigned rule family.

When a file has findings from multiple rule families (common — e.g. CLI/Program.cs has both SA1210 and VSTHRD103), any agent touching that file for their rule gets blocked by everyone else's co-located findings. The handoff forbids --no-verify, forbids suppressing analyzer rules, and constrains each agent to their own rule family — so there is no in-agent path to land.

Evidence

This hit repeatedly while executing Packages 02A, 01A, 01B, 02B, 03A, 03B, 03C–03F (PRs #736, #738, #739, #740, #741, #742, #743):

Each PR had to either (a) expand scope to clean co-located findings from other rule families, or (b) defer files and leave assigned findings unlanded.

Impact

  • Reviewer cognitive load: each cleanup PR mixes multiple rule families because it has to. Reviewers can't easily verify "this PR is purely SA1210."
  • Plan-ordering rigidity: Agent B (01B) effectively depends on Agent A (01A) being deferred-partial, and Agent E (03A) gets dragged into Agent A's files. The "one package per agent" model degrades into "whoever touches a file last cleans everything."
  • Agent H (rule promotion) is hard to land: promoting any rule to error requires the entire codebase to be clean for that rule, but the gate already enforces zero-warning on changed files — so the promotion's blast radius is wider than any single agent can address.

Suggested options (not prescriptive)

  1. Narrow the changed-file gate to assigned rule families. Add a per-PR allow-list (e.g. a \.analyzer-gate/scope.json entry per branch) so the gate only enforces the rules the PR claims to fix. Keep the full gate for the merge-to-main path. Smallest behavior change; preserves the package decomposition.
  2. Re-decompose packages to be file-complete. Group by file rather than rule family: each agent owns a set of files and fixes all warnings in them. Eliminates the cross-package dependency but produces larger, less reviewable PRs.
  3. Run a one-shot repo-wide cleanup pass outside the agent model: a single PR that fixes all warnings across all files, then enable the full gate. Highest-risk single PR but removes the decomposition problem entirely.
  4. Add InternalsVisibleTo / test scaffolding up front for the rules that need regression tests (e.g. WebProviderUsageMapper.Map is internal with no test access — Agent G's 03F couldn't add a focused test without a production-assembly policy change).

Recommendation

Option 1 is the smallest change that unblocks the remaining agents (especially H) without restructuring the plan. It also keeps each PR's scope honest — a reviewer reading "Package 01A" can trust the diff is SA1210-only.

Out of scope of this issue

The 7 linked PRs are all merge-ready (green CI, gate-passed). This issue is about the next round of cleanup work and the promotion step (Agent H), not about the current PRs.

cc @rygel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions