diff --git a/actions/changeset/check-coverage/action.yaml b/actions/changeset/check-coverage/action.yaml index 8bf83617..17ec6121 100644 --- a/actions/changeset/check-coverage/action.yaml +++ b/actions/changeset/check-coverage/action.yaml @@ -1,18 +1,19 @@ name: Check changeset coverage author: 'MiLaboratories' description: | - Fail if a PR's changesets don't cover every workspace package it modifies. + Fail if a PR's changesets don't cover every workspace package whose own + files it edits — e.g. editing block code under packages// without + adding that package to the changeset. - Catches two common gaps: - - editing files inside a workspace package (e.g. block code under - packages//) without adding that package to the changeset; - - bumping a catalog version in pnpm-workspace.yaml without a matching - bump for packages that consume it as a runtime dependency via - `catalog:` — build-tool bumps in devDependencies are ignored. + Dependency-version bumps are intentionally NOT flagged, including catalog + bumps in pnpm-workspace.yaml. A catalog entry always pins an external + package, and `pnpm changeset` never requires a release for an external + dependency bump — it propagates versions through the internal dependency + chain automatically at `changeset version` time. Flagging consumers of a + bumped catalog dependency would over-report relative to `pnpm changeset`. - Runs after `pnpm install`. Requires the runner to have `pnpm`, `jq`, and - `yq` (mikefarah, v4+) on PATH — all pre-installed on GitHub-hosted - ubuntu-latest images. + Runs after `pnpm install`. Requires the runner to have `pnpm` and `jq` on + PATH — both pre-installed on GitHub-hosted ubuntu-latest images. inputs: base-branch: diff --git a/actions/changeset/check-coverage/check-coverage.sh b/actions/changeset/check-coverage/check-coverage.sh index 4fc6d08e..0014ab86 100755 --- a/actions/changeset/check-coverage/check-coverage.sh +++ b/actions/changeset/check-coverage/check-coverage.sh @@ -1,25 +1,25 @@ #!/usr/bin/env bash # -# Verify the PR's changesets bump every workspace package the PR modifies. -# Exit 1 on a coverage gap; exit 2 on tooling failure; exit 0 otherwise. +# Verify the PR has a changeset for every workspace package whose own files +# it edits. Exit 1 on a coverage gap; exit 2 on tooling failure; exit 0 +# otherwise. # -# Two sources of "modified": +# "Modified" means a direct edit to a workspace package's own files, detected +# via `pnpm --filter '[]' list` — pnpm runs the per-package git-diff +# check itself. Root-level paths (`.github/`, `docs/`, `pnpm-workspace.yaml`, +# `README.md`) live in no package directory, so they never trigger inclusion. # -# 1. Direct edits to a workspace package's files, detected via -# `pnpm --filter '[]' list` — pnpm runs the per-package -# git-diff check itself. -# -# 2. Catalog version bumps in pnpm-workspace.yaml: for each touched -# catalog key, find workspace packages that consume it as a runtime -# dependency (`dependencies` or `peerDependencies`) via -# `"": "catalog:..."` and require those packages to bump. -# -# Runtime sections only — skip devDependencies and optionalDependencies. -# A build-tool bump (e.g. @platforma-sdk/block-tools in a block's model, -# @platforma-sdk/tengo-builder in its workflow) leaves the published -# artifact unchanged, and `pnpm changeset` ignores it too. Counting it -# flagged packages the PR never touched — e.g. a UI-only change that -# carried a shared build-tool bump. +# Dependency-version bumps never require a changeset — including catalog +# bumps in pnpm-workspace.yaml. A catalog entry always pins an *external* +# package (workspace packages are referenced via `workspace:*`, never +# `catalog:`). `pnpm changeset` ignores such a bump twice over: it never +# releases a package because an external dependency's version changed, and it +# propagates internal bumps through the dependency chain automatically at +# `changeset version` time. So requiring a hand-written changeset for a +# package that only "changed" via a dependency bump over-reports relative to +# `pnpm changeset` — see platforma-open/clonotype-space#95, where a +# `@platforma-sdk/workflow-tengo` catalog bump spuriously failed the +# untouched `.workflow` package. # # Skips private (unpublished) workspace packages — they never appear in # the changeset's release set. @@ -50,12 +50,11 @@ fi # absolute paths on macOS (prepends cwd, causing ENOENT). Cwd-relative is # safe on every platform. status_json=".changeset-coverage-status-$$.json" -pkg_list_json=".changeset-coverage-pkgs-$$.json" # --------------------------------------------------------------------------- # 1. Bumped set from `changeset status --output=...`. # --------------------------------------------------------------------------- -trap 'rm -f "${status_json}" "${pkg_list_json}"' EXIT +trap 'rm -f "${status_json}"' EXIT # Invoke the binary directly. `pnpm exec` and `pnpm