Skip to content

Commit 3fab731

Browse files
msyycCopilot
andauthored
fix(eng): trigger all emitter CI on any pnpm-workspace.yaml change (Azure#5059)
Fixes Azure#5010. ## Problem `@typespec/http-client-python` is not a workspace package — it is consumed from npm through the pnpm **catalog**, so bumping it only edits the root `pnpm-workspace.yaml`. pnpm attributes root-file changes to the **root package only**, so `pnpm --filter "...[base]"` reports no affected emitter and `detect-affected` returns `python: false`. That is why Azure#5009 ran no Python CI. ## Fix Add `pnpm-workspace.yaml` to `sharedExtra`, so any change to it triggers every emitter target — the same treatment the `core` submodule pointer already gets. The file changes rarely and always affects dependency resolution repo-wide, so this is deliberately blunt rather than trying to work out which catalog entry moved. ## Verification Simulated the Azure#5009 diff locally with `BASE_SHA=origin/main`: ``` Affected targets: {"python":true,"java":true,"typescript":true,"go":true} ``` Plus a unit test in `eng/scripts/detect-affected.test.ts`. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 19d6a84d-f603-41ee-8377-6dfb7e661391
1 parent 6e9b765 commit 3fab731

3 files changed

Lines changed: 23 additions & 3 deletions

File tree

eng/scripts/detect-affected.config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"submodulePath": "core",
33
"ignore": ["**/test/**", "**/tests/**", "**/*.test.ts", "**/*.md"],
4-
"sharedExtra": [".github/actions/setup/**"],
4+
"sharedExtra": [".github/actions/setup/**", "pnpm-workspace.yaml"],
55
"targets": {
66
"python": {
77
"package": "@azure-tools/typespec-python",

eng/scripts/detect-affected.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@ describe("computeAffected", () => {
9696
expect(computeAffected(NONE, ["core"], CONFIG)).toEqual(ALL_AFFECTED);
9797
});
9898

99+
// Azure/typespec-azure#5010: catalog upstreams such as
100+
// `@typespec/http-client-python` are not workspace packages, so pnpm reports no
101+
// affected package when one is bumped. The root workspace file must trigger
102+
// every target on its own.
103+
it("pnpm-workspace.yaml change triggers all targets", () => {
104+
expect(computeAffected(NONE, ["pnpm-workspace.yaml", "pnpm-lock.yaml"], CONFIG)).toEqual(
105+
ALL_AFFECTED,
106+
);
107+
});
108+
99109
it("unrelated root file change triggers nothing", () => {
100110
expect(computeAffected(NONE, ["README.md", "package.json"], CONFIG)).toEqual(NONE_AFFECTED);
101111
});

eng/scripts/detect-affected.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ import { pathToFileURL } from "node:url";
2121
// TO ADD A NEW UPSTREAM LIBRARY (e.g. a new typespec-azure-* package that an
2222
// emitter depends on): nothing to do — the workspace graph picks it up
2323
// automatically as soon as the emitter declares the dependency.
24+
//
25+
// EXCEPTION — upstreams consumed from npm via the pnpm catalog (e.g.
26+
// `@typespec/http-client-python`): these are not workspace packages, so the
27+
// graph cannot see them. Bumping one edits only the root `pnpm-workspace.yaml`,
28+
// which pnpm attributes to the root package alone, leaving every emitter
29+
// unaffected (Azure/typespec-azure#5010). `pnpm-workspace.yaml` is therefore in
30+
// `sharedExtra`: any change to it triggers all targets. It changes rarely and
31+
// always affects dependency resolution repo-wide, so this is deliberately blunt
32+
// rather than trying to work out which catalog entry moved.
2433
// -----------------------------------------------------------------------------
2534

2635
interface Target {
@@ -35,7 +44,7 @@ interface Config {
3544
submodulePath: string;
3645
/** Globs whose sole change should NOT trigger anything; passed to pnpm via `--changed-files-ignore-pattern`. */
3746
ignore: string[];
38-
/** Paths that trigger every target (shared CI infrastructure). */
47+
/** Paths that trigger every target (shared CI infra + the root pnpm workspace file). */
3948
sharedExtra: string[];
4049
targets: Record<string, Target>;
4150
}
@@ -79,7 +88,8 @@ export function matchesAny(file: string, patterns: string[]): boolean {
7988
* A target fires on any of three signals: its package is in the pnpm-derived
8089
* affected set, OR one of the two things the graph cannot see changed — the
8190
* `core` submodule pointer (which every emitter depends on, so it triggers all
82-
* targets), or a non-package `extra` CI-infra path.
91+
* targets), or an `extra` path outside any package (CI infra, and the root
92+
* `pnpm-workspace.yaml` — see the header comment).
8393
*
8494
* @param affectedPackages Target package OR any graph-dependent of a meaningfully
8595
* changed package (from `pnpm --filter "...[base]"`).

0 commit comments

Comments
 (0)