Skip to content

Add project-level TypeSpec discovery - #47293

Merged
Timothee Guerin (timotheeguerin) merged 4 commits into
mainfrom
timotheeguerin/shared-typespec-project-discovery
Oct 15, 2026
Merged

Timothee Guerin (timotheeguerin) merged 4 commits into
mainfrom
timotheeguerin/shared-typespec-project-discovery

Conversation

@timotheeguerin

@timotheeguerin Timothee Guerin (timotheeguerin) commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

ARM (Control Plane) API Specification Update Pull Request

Service-wide discovery is appropriate for TSV but too broad for SDK generation: changing one project would also select unchanged siblings. Add a separate shared helper for project-level discovery, leaving TSV's service-wide selection unchanged.

import { findTypeSpecProjectsForChangedFiles } from "@azure-tools/specs-shared/typespec-projects";

const projects = await findTypeSpecProjectsForChangedFiles(repoRoot, changedFiles);

The helper selects the nearest config in the old layout, or all ancestor configs in the resource-manager/data-plane layout, without selecting unrelated siblings or descendants. Results associate each project with the changed files that selected it, letting SDK callers preserve README pairing without rediscovering projects. Both discovery functions share changed-path-to-service grouping; TSV's selection behavior and caller are unchanged.

Builds on the merged extraction PR #47298. SDK generation reuse is demonstrated separately in #47294.

Tip

Overwhelmed by all this guidance? See the Getting help section at the bottom of this PR description.

PR review workflow diagram

Please understand this diagram before proceeding. It explains how to get your PR approved & merged.

spec_pr_review_workflow_diagram

Purpose of this PR

What's the purpose of this PR? Check the specific option that applies. This is mandatory!

  • New resource provider.
  • New API version for an existing resource provider. (If API spec is not defined in TypeSpec, the PR should have been created in adherence to OpenAPI specs PR creation guidance).
  • Update existing version for a new feature. (This is applicable only when you are revising a private preview API version.)
  • Update existing version to fix OpenAPI spec quality issues in S360.
  • Convert existing OpenAPI spec to TypeSpec spec (do not combine this with implementing changes for a new API version).
  • Other, please clarify:
    • Engineering-only addition of project-level TypeSpec discovery with shared changed-file grouping and unchanged service-level selection. No API specifications or SDK configurations are modified.

Due diligence checklist

To merge this PR, you must go through the following checklist and confirm you understood
and followed the instructions by checking all the boxes:

The API-specific checklist below is not applicable to this engineering-only PR.

  • I confirm this PR is modifying Azure Resource Manager (ARM) related specifications, and not data plane related specifications.
  • I have reviewed following Resource Provider guidelines, including
    ARM resource provider contract and
    REST guidelines (estimated time: 4 hours).
    I understand this is required before I can proceed to the diagram Step 2, "ARM API changes review", for this PR.
  • A release plan has been created. If not, please create one as it will help guide you through the REST API and SDK creation process.

Additional information

Viewing API changes

For convenient view of the API changes made by this PR, refer to the URLs provided in the table
in the Generated ApiView comment added to this PR. You can use ApiView to show API versions diff.

Suppressing failures

If one or multiple validation error/warning suppression(s) is detected in your PR, please follow the
suppressions guide to get approval.

Getting help

  • First, please carefully read through this PR description, from top to bottom. Please fill out the Purpose of this PR and Due diligence checklist.
  • If you don't have permissions to remove or add labels to the PR, request write access per aka.ms/azsdk/access#request-access-to-rest-api-or-sdk-repositories
  • To understand what you must do next to merge this PR, see the Next Steps to Merge comment. It will appear within few minutes of submitting this PR and will continue to be up-to-date with current PR state.
  • For guidance on fixing this PR CI check failures, see the hyperlinks provided in given failure
    and https://aka.ms/ci-fix.
  • For help with ARM review (PR workflow diagram Step 2), see https://aka.ms/azsdk/pr-arm-review.
  • If the PR CI checks appear to be stuck in queued state, please add a comment with contents /azp run.
    This should result in a new comment denoting a PR validation pipeline has started and the checks should be updated after few minutes.
  • If the help provided by the previous points is not enough, post to https://aka.ms/azsdk/support/specreview-channel and link to this PR.
  • For guidance on SDK breaking change review, refer to https://aka.ms/ci-fix.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Next Steps to Merge

✅ All automated merging requirements have been met! To get your PR merged, see aka.ms/azsdk/specreview/merge.

Comment generated by summarize-checks workflow run.

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.

🟢 Approval recommended

The refactor preserves TSV selection behavior and provides focused coverage for both discovery scopes and filesystem failures.

0 open findings

What changed in this PR

Centralizes TypeSpec project discovery in @azure-tools/specs-shared, preserving TSV behavior while supporting project-scoped SDK tooling.

Changes:

  • Adds shared glob and TypeSpec discovery utilities with service/project scopes.
  • Migrates TypeSpec Validation to the shared utilities.
  • Adds comprehensive discovery tests and documentation.
File Description
.github/​shared/​src/​glob.ts Adds shared file globbing.
.github/​shared/​src/​typespec-projects.ts Implements scoped project discovery.
.github/​shared/​test/​glob.test.ts Updates shared glob test setup.
.github/​shared/​test/​typespec-projects.test.ts Tests discovery scopes and failures.
.github/​shared/​package.json Exports the new modules.
.github/​shared/​readme.md Documents the shared APIs.
eng/​tools/​typespec-validation/​src/​find-projects.ts Delegates discovery to shared helpers.
eng/​tools/​typespec-validation/​src/​run-projects.ts Uses shared all-project discovery.
eng/​tools/​typespec-validation/​src/​rules/​compile.ts Imports the shared glob helper.
eng/​tools/​typespec-validation/​src/​rules/​folder-structure.ts Imports the shared glob helper.
eng/​tools/​typespec-validation/​test/​compile.test.ts Updates the glob test import.
eng/​tools/​typespec-validation/​test/​folder-structure.test.ts Updates the glob test import.
eng/​tools/​typespec-validation/​test/​find-projects.test.ts Removes tests relocated to shared.
eng/​tools/​typespec-validation/​test/​mocks.ts Mocks the shared glob export.

🧠 Review effort: Balanced


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

@timotheeguerin Timothee Guerin (timotheeguerin) changed the title Share TypeSpec project discovery across tooling Support project-scoped TypeSpec discovery Oct 14, 2026
@timotheeguerin
Timothee Guerin (timotheeguerin) changed the base branch from main to timotheeguerin/extract-typespec-project-discovery October 14, 2026 16:27
Base automatically changed from timotheeguerin/extract-typespec-project-discovery to main October 15, 2026 12:40

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.

🟢 Approval recommended

The focused implementation preserves validation behavior, covers project selection with regression tests, and has no unresolved findings.

0 open findings

🧠 Review effort: Balanced

@timotheeguerin Timothee Guerin (timotheeguerin) changed the title Support project-scoped TypeSpec discovery Add project-level TypeSpec discovery Oct 15, 2026
@timotheeguerin
Timothee Guerin (timotheeguerin) marked this pull request as ready for review October 15, 2026 15:44
@timotheeguerin
Timothee Guerin (timotheeguerin) merged commit 5b6e8f3 into main Oct 15, 2026
107 checks passed
@timotheeguerin
Timothee Guerin (timotheeguerin) deleted the timotheeguerin/shared-typespec-project-discovery branch October 15, 2026 15:45
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