Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 8, 2026

The openapi-diff-runner was treating renamed files as separate additions and deletions, causing unnecessary dummy file creation and incorrect breaking change comparisons.

Changes

Core logic (command-helpers.ts)

  • Return renames array instead of flattening into additions/deletions
  • Auto-detect renames missed by git: when exactly one deletion and one addition exist in the same folder, treat as rename
  • Update return type to include renames: { from: string; to: string }[]

Breaking change detection (detect-breaking-change.ts, commands.ts)

  • Pass renamedSwaggers through detection context
  • Compare renamed files old-to-new instead of old-to-empty and empty-to-new
  • Eliminates false dummy file creation for simple renames

Example behavior

Before:

// Renaming foo.json → openapi.json produced:
{
  additions: ["openapi.json"],  // compared against empty
  deletions: ["foo.json"],       // compared against empty
  renames: []
}

After:

{
  additions: [],
  deletions: [],
  renames: [{ from: "foo.json", to: "openapi.json" }]  // compared directly
}

This handles Git-detected renames, case-only folder changes, and add/delete pairs that represent renames.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 8, 2026 07:31
- Updated command-helpers.ts to return renames separately
- Implemented logic to match deletions with additions in the same folder
- Updated commands.ts to pass renames to breaking change detection
- Updated detect-breaking-change.ts to process renamed files
- Fixed all test expectations in command-helpers.test.ts, commands.test.ts, and detect-breaking-change.test.ts

Co-authored-by: mikeharder <[email protected]>
- Updated comment in test to reflect correct breakdown (2 additions + 1 modification + 1 deletion + 1 rename)
- Fixed grammatical consistency (singular/plural agreement)

Co-authored-by: mikeharder <[email protected]>
Copilot AI changed the title [WIP] Add new API specification for Azure services [openapi-diff-runner] Support renamed files in breaking change detection Feb 8, 2026
Copilot AI requested a review from mikeharder February 8, 2026 07:35
@mikeharder
Copy link
Member

dup of #40303

@mikeharder mikeharder closed this Feb 11, 2026
@mikeharder mikeharder deleted the copilot/add-new-azure-api-specification branch February 11, 2026 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants