Skip to content

ci: add DOM-surface regression integration test#7859

Open
gavinbarron wants to merge 1 commit into
mainfrom
gavinbarron/dom-surface-regression-test
Open

ci: add DOM-surface regression integration test#7859
gavinbarron wants to merge 1 commit into
mainfrom
gavinbarron/dom-surface-regression-test

Conversation

@gavinbarron

Copy link
Copy Markdown
Contributor

Description

Adds a DOM-surface regression integration test to catch binary/source breaking changes that a change to kiota''s generation logic could introduce into downstream SDKs (notably the Microsoft Graph SDKs), mirroring the surface-area validation the Graph SDK repos already run on spec changes.

How it works

Per language, the new workflow:

  1. Downloads a single OpenAPI description (Microsoft Graph beta, already in the IT matrix).
  2. Generates a baseline DOM export (kiota-dom-export.txt) using the published Microsoft.OpenApi.Kiota NuGet tool.
  3. Generates a current DOM export using the locally built kiota.
  4. Produces a git format-patch style patch between the two.
  5. Feeds the patch to microsoftgraph/kiota-dom-export-diff-tool/tool with fail-on-removal: true (pinned to a commit SHA); on PRs it posts the explanations as a comment.

No generator code change is required — the export is enabled via the existing Generation:ExportPublicApi flag (env var KIOTA_Generation__ExportPublicApi=true).

Files

  • it/generate-dom-export.ps1 — emit the DOM export for one generator/language/spec.
  • it/compare-dom-export.ps1 — install the baseline tool, build baseline + current exports, emit the patch.
  • .github/workflows/surface-area-tests.ymlcsharp + java × Graph beta matrix, analyze + comment + artifacts + branch-policy aggregator.
  • it/Readme.md, CHANGELOG.md — docs.

Initial scope

csharp and java against Graph beta, designed to expand to more languages/specs later.

Notes / caveats

  • The baseline is the last published release, so the diff reflects every change since that release, not only this PR''s delta. Acceptable for catching regressions; a base-branch comparison mode can be added later.
  • The patch is built with git format-patch -1 HEAD --minimal -U0 -w (not git diff --no-index) because the diff tool''s parser requires zero-context bodies and a trailing -- signature footer (DOM exports contain --> inheritance markers). Validated against the tool''s actual cleanup/parse algorithm.

Validation

Validated locally end-to-end: the env var enables the export, the published baseline tool installs and runs, both exports generate, and the produced patch parses cleanly through the diff tool''s algorithm with zero crash-inducing lines.

Closes #7858

Adds an integration test that diffs the kiota public API (DOM) export
produced by the published Microsoft.OpenApi.Kiota NuGet tool against the
export produced by the current changeset, failing on removals to catch
binary/source breaking changes in downstream SDKs.

- it/generate-dom-export.ps1: emit kiota-dom-export.txt for one generator/language/spec
- it/compare-dom-export.ps1: build baseline + current exports and a format-patch
- .github/workflows/surface-area-tests.yml: csharp/java x Graph beta matrix, feeds the
  patch to microsoftgraph/kiota-dom-export-diff-tool/tool with fail-on-removal

Closes #7858

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@gavinbarron gavinbarron requested a review from a team as a code owner June 25, 2026 18:23
@msgraph-bot msgraph-bot Bot added this to Kiota Jun 25, 2026
@github-code-quality

Copy link
Copy Markdown

Code Coverage Overview

Languages: C#

C# / code-coverage/dotnet

The overall coverage in the branch is 71%. Coverage data for the branch is not yet available.

Show a code coverage summary of the most covered files.
File a10d3d0 +/-
/home/runner/wo...guageRefiner.cs 98%
/home/runner/wo...criptRefiner.cs 98%
/home/runner/wo...MethodWriter.cs 97%
/home/runner/wo...MethodWriter.cs 96%
/home/runner/wo...MethodWriter.cs 96%
/home/runner/wo...MethodWriter.cs 95%
/home/runner/wo...rs/GoRefiner.cs 93%
/home/runner/wo...KiotaBuilder.cs 90%
/home/runner/wo...ationService.cs 89%
/home/runner/wo...xGenerator.g.cs 72%

Code Coverage is in Public Preview. Learn more and provide us with your feedback.

- csharp
- java
description:
- "https://github.com/microsoftgraph/msgraph-metadata/raw/refs/heads/master/openapi/beta/openapi.yaml"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The problem you'll have with beta is that API version allows breaking changes.
So from one week to another, you'll get noise not because of a Kiota regression, but because of the source.
I recommend to use v1 instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Add DOM-surface regression integration test to catch breaking changes from generation logic changes

2 participants