Skip to content

Block new spelling-based C# guard scanners; point to Cluckwork.Analyzers #1184

Closed

Description

@mforce

Part of the guardrails program (/correct, class 1). Evidence: 30 merged PRs from 2026-08-04 to 2026-10-06 (about 150 findings), listed in the coordinator's D report.

Mistake. Agents write guard tests that parse C# by spelling: CSharpSyntaxTree.ParseText with no semantic model, or regex over source text. Reviewers then find one bypass per round: aliases, generics, nested types, global using, #if !DEBUG (a P1 on #1056). AGENTS.md "Writing a guard" (#407) tells agents how to write a guard, but nothing enforces it. In tests/, 10 of the 13 files that parse C# never bind symbols.

Fix (architecture, kept in place by a ratchet). C# invariants belong in src/Cluckwork.Analyzers, which already runs CW1004 as a build error. Add a test in tests/Cluckwork.Application.Tests/Architecture/: every file under tests/ that parses C# without a CSharpCompilation must be on a pinned list, one row per file with a reason. A new file fails with an error that names Cluckwork.Analyzers (see ModuleEdgeAnalyzer.cs, CW1004) or CSharpCompilation as the fix. Removing a listed file reports its row as removable.

Done when

Activity

  1. added this to the Platform hardening milestone on Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions