Skip to content

main does not build since #332 merged: CA1506 on Schema (class coupling 97, limit 96) #336

Open

Description

@matt-edmondson

What's wrong

Every target framework of Schema/Schema.csproj fails to compile on main (f3b46fc):

Schema/Models/Schema.cs(18,22): error CA1506: 'Schema' is coupled with '97' different types from '18' different namespaces. Rewrite or refactor the code to decrease its class coupling below '96'.

.editorconfig sets dotnet_diagnostic.CA1506.severity = error, so this breaks the build, not just the lint. The scheduled CI run on main fails: run 39869970714. Any open PR based on main, including the Dependabot PRs, will go red for the same reason.

Cause

The failure came from merging several PRs together. Building the first-parent merges in order:

Merge PR Result
0daa714 #330 builds
98eca91 #329 builds
f5bb8a4 #319 builds
c0878b6 #318 builds
451b9b2 #332 (rename history / diff / migrate, #127) CA1506, 97
every merge after, up to f3b46fc CA1506, 97

#332 adds SchemaRename and SchemaRenameKind to the Schema partial class (Schema/Models/Schema.cs, Schema/Models/Schema.Rename.cs). That fit the budget on #332's own base. By the time it merged, #318 and #319 had already added references to main (for example, ReportReservedNames uses Generation.SchemaGenerator/ISchemaCodeGenerator in Schema.Validation.cs), and the combination tips over the limit.

Fix / acceptance criteria

  • Bring Schema's coupling back under the limit by moving logic out of the type rather than suppressing the warning. Two options:
    • Move the rename-history bookkeeping (RecordRename, RenamesInternal) into its own collection type.
    • Move ReportReservedNames/GeneratedFileNames into a separate validator helper.
  • If you suppress it instead, use a SuppressMessage with a justification.
  • dotnet build and dotnet test pass on main for net8.0, net9.0 and net10.0, and CI is green.
  • Optionally, require branches to be up to date before merging, so batched merges cannot break main again.

Activity

  1. matt-edmondson commented on Oct 25, 2026

    @matt-edmondson
    ContributorAuthor

    Triage


    Generated by Claude Code

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions