Skip to content

fix: preserve models with colliding flattened Go names - #8236

Open
Shubham Padkonde (Shubham-Padkonde) wants to merge 10 commits into
microsoft:mainfrom
Shubham-Padkonde:fix/go-flattened-model-collision
Open

Shubham Padkonde (Shubham-Padkonde) wants to merge 10 commits into
microsoft:mainfrom
Shubham-Padkonde:fix/go-flattened-model-collision

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown
Contributor

Fixes #7823.

Go flattens inline model classes into their top-level package. When two distinct models acquire the same flattened name, AddClass keeps one and leaves references to the other pointing at a model that later refinement never visits. For Pipedrive's /oauth/token and /oauth/token/, that produces an interface embedding the unrefined IAdditionalDataHolder and the generated client does not compile.

Choose an available name before moving a model, retaining both objects and their existing references. Visit children in ordinal name order so suffix allocation is stable. Existing names are preserved where there is no collision.

Tests cover preserving both refined interfaces, existing numeric suffixes, multiple collisions, and reversed insertion order. The original preservation test fails before the change.

External validation uses the two token paths extracted from Pipedrive's upstream OpenAPI description:

  • Original generated code fails with undefined: IAdditionalDataHolder.
  • Updated generated code passes Linux Go 1.26.3 race tests and vet; JSON runtime checks preserve both distinct request bodies and all four response models (including compatibility response names).
  • The generated endpoint methods reference their respective request and response types. A second generation produces identical output, excluding the lock file and the external test file.
  • .NET 10 generator build passes with worktree SourceLink warnings.

Developed with Codex assistance. This does not claim validation of the full Pipedrive SDK or any live OAuth calls.

Additional validation:

  • Full builder suite: 2,351 passed, two existing skips; one live API-description download test hit its 100-second HTTP timeout. All three new regression cases passed.
  • Scoped C# formatting verification passes.

The focused retry of GetsGithubFromApisGuruWithExactMatchAsync also timed out during its external HttpClient download, after its search result was found; that test does not exercise Go refinement. The full suite is therefore not reported as fully green.

@baywet

Copy link
Copy Markdown
Member

Shubham Padkonde (@Shubham-Padkonde) your behaviour is disruptive, opening about 30 PRs on the repos in a couple of hours time, most likely code that was AI generated and not tested/reviewed, will only clog our review pipeline. Please stop opening additional pull requests and work on the comments added to existing ones. We have turned on pull requests limits on this repository, and will proceed to blocking you at the organization level if additional pull requests are opened on other repositories before the already opened ones are reviewed and closed/or merged.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The cyclic model migration path can still lose colliding models.

Review effort: Lite
Findings: None

What changed in this PR

Fixes Go model loss caused by colliding flattened names by preserving models with deterministic suffixes.

Changes:

  • Adds collision-safe, stable model naming.
  • Adds regression coverage for collisions and ordering.
  • Documents the fix in the changelog.
File Summary
src/​Kiota.Builder/​Refiners/​GoRefiner.cs Preserves colliding models during flattening; cyclic migration still lacks collision-safe allocation.
tests/​Kiota.Builder.Tests/​Refiners/​GoLanguageRefinerTests.cs Adds collision, suffix, and insertion-order regression tests.
CHANGELOG.md Documents the Go generation fix.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI review requested due to automatic review settings September 21, 2026 16:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 22, 2026 09:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 22, 2026 14:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@baywet

Copy link
Copy Markdown
Member

Shubham Padkonde (@Shubham-Padkonde) this PR is conflicting, would you mind handling the conflicts when you have a minute please?

Copilot AI review requested due to automatic review settings September 23, 2026 12:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 23, 2026 14:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged.

Copilot AI review requested due to automatic review settings September 23, 2026 17:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

Conflicts have been resolved. A maintainer will take a look shortly.

@github-actions

Copy link
Copy Markdown
Contributor

Conflicts have been resolved. A maintainer will take a look shortly.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged.

Copilot AI review requested due to automatic review settings September 24, 2026 01:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

Conflicts have been resolved. A maintainer will take a look shortly.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged.

Copilot AI review requested due to automatic review settings September 25, 2026 01:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

Conflicts have been resolved. A maintainer will take a look shortly.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged.

Copilot AI review requested due to automatic review settings September 25, 2026 21:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

Conflicts have been resolved. A maintainer will take a look shortly.

This branch has not been deployed

No deployments
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.

[Go] wrong interface IAdditionalDataHolder for PIPEDRIVE.COM api

3 participants