Skip to content

fix: generated file content depends on Environment.NewLine, causing full rewrite churn across OSes #246

Description

@credfeto

Found by AI full-repo code analysis (bugs and performance sweep of non-test projects).

Problem

Three generators compare freshly generated content against the on-disk file with ordinal/byte equality, but generate platform-dependent newlines:

  • src/Credfeto.DotNet.Repo.Tools.TemplateUpdate/Services/DependaBotConfigBuilder.cs:72string.Join(Environment.NewLine, config)
  • src/Credfeto.DotNet.Repo.Tools.TemplateUpdate/Services/LabelsBuilder.cs — all AppendLine calls
  • src/Credfeto.DotNet.Repo.Tools.TemplateUpdate/PartialFileHelper.cs:27-33Environment.NewLine concatenation

Failure scenario

Running the tool on Windows after Linux (or vice versa) makes every dependabot.yml, labels.yml, labeler.yml, and partial file compare unequal: one Windows run produces a commit + push per repo for every generated file across the whole fleet with only line-ending changes, and the next Linux run reverts them all again.

Suggested fix

Emit a fixed "\n" newline in all three generators.

Scope

  • src/Credfeto.DotNet.Repo.Tools.TemplateUpdate/Services/DependaBotConfigBuilder.cs
  • src/Credfeto.DotNet.Repo.Tools.TemplateUpdate/Services/LabelsBuilder.cs
  • src/Credfeto.DotNet.Repo.Tools.TemplateUpdate/PartialFileHelper.cs

Metadata

Metadata

Assignees

No one assigned

    Labels

    AI-WorkWork for an AI AgentBugGeneric bug fixLowLow PriorityPerformancePerformance enhancement or issuecredfeto-dotnet-repo-tools-templateupdateChanges in Credfeto.DotNet.Repo.Tools.TemplateUpdate project

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions