Azure / azure-rest-api-specs

The source for REST API specifications for Microsoft Azure.
MIT License
2.67k stars 5.09k forks source link

[Se] Implementation of TypeSpec 'infoblurb' Mechanism in Brownfield PRs #30370

Open mario-guerra opened 2 months ago

mario-guerra commented 2 months ago

API Spec link

NA

API Spec version

NA

Please describe the feature.

We need to set up a mechanism to insert a non-blocking, high-visibility comment in every brownfield PR for services not yet converted to TypeSpec. This is part of the Brownfields adoption plan, aiming to encourage early adoption of TypeSpec conversion. The comment should inform teams about the TypeSpec tool and offer hands-on assistance from the TypeSpec Onboarding Support team for early adopters. It's crucial that this comment does not block PR merging and can be suppressed by teams blocked from converting due to pending centralized work.

Criteria for the comment to appear:

Action:

This setup should not include any blocking warnings, only a non-blocking comment. The text of the comment should be as follows:

NOTE - Brownfield services will soon be required to convert from OpenAPI to TypeSpec. The TypeSpec team has developed a tool to assist with this transition. By converting early, you’ll receive hands-on assistance and provide valuable feedback to improve the tool. Contact TypeSpec Onboarding Support to join a select group of early adopters and ensure a smooth transition.

mikeharder commented 1 month ago

I think this should be added to the existing check "TypeSpec Requirement", which already has the logic to determine greenfield vs brownfield. Here's the conclusion of the check:

https://github.com/Azure/azure-rest-api-specs/blob/46b386376ab0d53228a7f366d28e44bac8d592c3/eng/scripts/TypeSpec-Requirement.ps1#L169-L175

After L170, the check should additionally:

And last but not least:

mikeharder commented 1 month ago

@mario-guerra, @MattGertz: What should happen if check TypeSpecRequirement is suppressed? Should it be skipped or still apply? The initial feature request says "skip", but I wanted to double-check.

Currently, the tool checks for suppressions very early, and skips all other analysis if the check is suppressed. Since we want very much to avoid the tool failing or crashing if the spec author has suppressed it.

https://github.com/Azure/azure-rest-api-specs/blob/b88e6adfec1361cdafbea6200d0ef889f6f2fd20/eng/scripts/TypeSpec-Requirement.ps1#L83-L90

So if TSR is suppressed, it will also suppress all the brownfield notices. Currently, I believe very few specs should have TSR suppressed, and any which do should be tracked by ARM or DP.

mario-guerra commented 1 month ago

@mikeharder it's fine if the infoblurb is suppressed when the TSR suppression is applied.