Skip to content

Merge v4-beta to v4 (2026-05-28)#171

Merged
PaulNewling merged 23 commits into
v4from
merge-2026-05-28
May 29, 2026
Merged

Merge v4-beta to v4 (2026-05-28)#171
PaulNewling merged 23 commits into
v4from
merge-2026-05-28

Conversation

@PaulNewling
Copy link
Copy Markdown
Collaborator

@PaulNewling PaulNewling commented May 28, 2026

Merge v4-beta into v4

Greptile Summary

This PR merges v4-beta into v4, introducing a new changeset/check-coverage composite action that verifies every modified workspace package has a corresponding changeset entry, plus a fix-beta.sh helper and a hardened sed pattern in merge-beta.sh.

  • New check-coverage action + bats test suite: cross-checks direct workspace-package edits and catalog version bumps against changeset status, exiting 1 on a gap and 2 on tooling failure; known named-catalog discriminator limitation is documented with a skipped test.
  • fix-beta.sh: re-syncs v4-beta from v4; the two-pattern sed may silently miss @v4 refs followed by non-whitespace terminators.
  • merge-beta.sh fix: replaces blanket s/@v4-beta/@v4/g with a pattern anchored to milaboratory/github-ci paths, preventing corruption of third-party action pins.

Confidence Score: 4/5

Safe to merge; the new check-coverage action and its test suite are well-constructed, and the merge-beta.sh sed fix correctly scopes rewrites to self-refs.

The core new feature and the merge-beta.sh fix are solid. fix-beta.sh two-pattern sed silently skips @v4 refs followed by non-whitespace terminators, and find commands traverse node_modules without pruning — both low-risk in practice but latent correctness gaps in a developer-facing maintenance script.

fix-beta.sh — the sed anchoring approach and find traversal scope warrant a second look before this script is used in anger.

Important Files Changed

Filename Overview
actions/changeset/check-coverage/check-coverage.sh New shell script implementing changeset coverage checking; well-structured with proper bash version guard, temp-file cleanup, and exit-code contract.
fix-beta.sh New developer utility to re-sync v4-beta from v4; sed two-pattern approach misses refs followed by non-whitespace terminators; find traversal lacks node_modules pruning.
merge-beta.sh Updated sed pattern now anchors @v4-beta replacement to milaboratory/github-ci self-refs only, preventing corruption of third-party action pins.
.github/workflows/node-simple-pnpm.yaml Adds a diagnostic changeset-coverage job with continue-on-error: true so gaps surface as a red check without blocking merges.
actions/changeset/check-coverage/test/coverage.bats Comprehensive bats test suite covering direct edits, catalog bumps, empty changesets, BASE_BRANCH parameterization, and tooling failures; known limitation skipped and documented.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[check-coverage.sh] --> B[changeset status - get bumped packages]
    B --> C{status.json non-empty?}
    C -- No and no-changesets msg --> D[bumped set is empty]
    C -- No and other error --> E[exit 2 tooling failure]
    C -- Yes --> F[build bumped set from releases]
    D --> G
    F --> G[pnpm filter list - get direct-edit packages]
    G --> H{pnpm-workspace.yaml changed?}
    H -- Yes --> I[yq: extract changed catalog keys via symmetric diff]
    I --> J[scan package.json files for catalog consumers]
    J --> K[add consumers to required set]
    K --> L
    H -- No --> L[compare required set vs bumped set]
    L --> M{any missing?}
    M -- None --> N[exit 0 - all covered]
    M -- Some --> O[print error per missing package then exit 1]
Loading
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
fix-beta.sh:80
**Sed patterns leave `@v4` refs followed by non-whitespace terminators unrewritten**

The two-pattern approach covers `@v4` at end-of-line (`\$`) and `@v4` followed by a whitespace character. However, it silently skips refs where `@v4` is followed by any other character — for example a `"` in a double-quoted YAML scalar, a `'` in single-quoted values, or `#` immediately adjacent to the tag without a space. Any such ref would remain as `@v4` on the v4-beta branch after `fix-beta.sh` runs. A single anchored pattern like `\([^[:alnum:]-]\|$\)` as the trailing boundary would close all of these cases in one expression instead of two.

### Issue 2 of 2
fix-beta.sh:75-78
**`find` traversal does not exclude `node_modules/` or `.git/`**

`find . -type f -name "action.yaml"` walks the entire working tree including `node_modules/` (present after any `pnpm install`) and `.git/`. While the anchored sed pattern prevents spurious rewrites, the traversal is unnecessary overhead. Adding `-not -path './node_modules/*' -not -path './.git/*'` would keep the scope tight. The same improvement applies to the equivalent call in `merge-beta.sh`.

Reviews (1): Last reviewed commit: "Merge v4-beta into v4" | Re-trigger Greptile

Greptile also left 2 inline comments on this PR.

dbolotin and others added 23 commits May 25, 2026 15:46
New composite action `actions/changeset/check-coverage` that fails when a
PR's changesets don't bump every workspace package the PR modifies.
Catches the catalog-software gap (pnpm-workspace.yaml catalog version
bumped without a matching changeset for the consuming workflow package).

Wired into the existing `check-changesets` job in node-simple-pnpm.yaml
as a `continue-on-error: true` step on PR / merge_group events. Emits
`::error file=…,line=…::` annotations inline on the PR diff; never
blocks merge.
TODO: REVERT before merging this PR — flip
@feat/changeset-coverage-check back to @v4-beta. The action only
lives on this branch right now; consumers pinning the workflow at
this branch otherwise resolve the nested uses: against v4-beta and
fail to find the action.
The over-broad sed in merge-beta.sh/fix-beta.sh flips @v4 → @v4-beta on
every ref, including third-party actions. actions/checkout and
aws-actions/configure-aws-credentials have no @v4-beta tag upstream,
so the workflow fails to load when a consumer pins this branch.

Only this file is fixed — the minimum needed to canary-test the new
coverage check. The same bug affects 27 other files on v4-beta and
needs a separate sed-scope fix in merge-beta.sh / fix-beta.sh.
Same pre-existing sed-scope bug as the previous commit, now hit in the
composite actions check-changesets transitively calls. Restores
actions/setup-node, pnpm/action-setup, and actions/cache to @v4.
The pre-existing sed-scope bug in merge-beta.sh / fix-beta.sh will be
handled in a separate ticket. Reverts d5f16a1 and 335ff48.
…s suite

Refactor check-coverage.sh (267 → 213 lines):
- step 4a now uses `pnpm -r --filter '[origin/<base>]' list` instead of
  hand-rolled longest-prefix matching over the changed-files list and the
  manual ignore patterns. Root-level paths (.github/, docs/, README) aren't
  in any package directory, so pnpm's filter naturally excludes them.
- step 4b parses pnpm-workspace.yaml structurally with yq (flat key=value
  pairs from both .catalog and .catalogs.*) instead of a line-level regex
  over the diff. Avoids the regex's false-positive surface — e.g. an
  unrelated `overrides.<name>` bump no longer spuriously requires
  catalog-consumer bumps.
- workspace map is now built lazily, only when pnpm-workspace.yaml changed.
- drops the `::error file=,line=::` per-file annotation plumbing. Devs land
  on .changeset/ when fixing this anyway; the summary block still names
  every missing package.

Add bats suite under test/ with a minimal pnpm-workspace fixture and a CI
workflow (0-test-changeset-coverage.yaml) that runs the suite on PRs that
touch the action. 14 cases cover direct edits, catalog miss/hit/partial,
private packages, structural-vs-regex catalog parsing, and the no-
changesets corner.
Drop the workflow-self path from the trigger filter — the suite should
only run when the action it tests actually changes. Add workflow_dispatch
as a manual escape hatch for re-running after a workflow edit.
declare -A is bash 4+. macOS ships 3.2 at /bin/bash; without homebrew's
bash earlier on PATH the script aborts at the first declare with a
cryptic 'invalid option'. Detect at start and emit a useful error
instead.
Note that ubuntu-latest runners ship bash 5+ — so the guard is a no-op
in CI; it exists to help local runs on macOS, whose /bin/bash is still
3.2 and would otherwise produce a cryptic 'invalid option' error.
- check-coverage.sh: tighten catalog detection to `startswith("catalog:")`
  (was `startswith("catalog")`) — pnpm's protocol prefix is the literal
  `catalog:`.

- node-simple-pnpm.yaml: add `!cancelled()` to the coverage-check
  conditional so the step skips on cancelled jobs (manual cancel,
  concurrency-group eviction) instead of burning runner minutes.

- test/helpers.bash: harden `_build_base_workspace` — `set -e` inside
  the subshell, capture output to a log file, dump only on failure.
  Without this, a silently failing `pnpm install` corrupts the base
  workspace and every test then fails with a confusing error pointing
  at the script under test, not the install.

- test/coverage.bats: three new tests.
  - BASE_BRANCH input: production callers pass `v4` (or `master`),
    not `main`. Five `origin/${BASE_BRANCH}` references in the script
    could regress to hardcoded `main`; this guards against it.
  - exit 2 on missing changeset binary: locks down the tooling-failure
    contract distinct from exit 1 (coverage gap).
  - named-catalog over-flagging: skip-marked, documents the deferred
    bug from the PR body with a runnable fixture for the follow-up.
…e primary case

The prior description led with the catalog-version gap, but the more
common case the action catches is the simple one: edit files inside a
workspace package, forget to add that package to the changeset. List
both, with the direct-edit case first.
merge-beta.sh and fix-beta.sh perform a blanket sed flip of @v4 ↔
@v4-beta across action.yaml and .github/workflows/*.yaml. The intent
is to keep self-references (milaboratory/github-ci/...) on the right
ref for each branch. The sed pattern is too greedy: it also rewrites
third-party action refs that happen to be pinned to @v4 — for example
actions/checkout@v4 becomes actions/checkout@v4-beta, a tag that
doesn't exist in the upstream repo.

Symptom on v4-beta runs:

  Unable to resolve action `actions/checkout@v4-beta`,
  unable to find version `v4-beta`

This blocks the `get run metadata` and `preflight (require-latest)`
jobs in node-simple-pnpm.yaml and similar workflows, cascading skips
into downstream jobs (`check for changesets`, `pre-build`, etc.).
Caught while canary-testing PR #168 (changeset coverage check).

This commit flips back, on v4-beta only, the 107 third-party refs that
were incorrectly rewritten across 36 files. Affected action repos:

  actions/checkout              (41 lines)
  aws-actions/configure-aws-credentials (24)
  actions/cache                 (13)
  actions/download-artifact     (12)
  actions/upload-artifact       (8, incl. one /merge subpath)
  actions/setup-java            (3)
  actions/setup-node            (2)
  pnpm/action-setup             (1)
  azure/setup-kubectl           (1)
  azure/setup-helm              (1)

milaboratory/github-ci/...@v4-beta self-refs are unchanged.

Follow-up: the underlying sed scope in merge-beta.sh / fix-beta.sh
should be tightened so this doesn't recur on the next promotion.
Tracked separately.
The previous sed in merge-beta.sh and fix-beta.sh treated @v4 / @v4-beta
as bare version tags. In practice they are git refs on a specific repo
(milaboratory/github-ci), so the substitution must only fire when the
preceding path is `milaboratory/github-ci/...`. Without that anchor the
sed rewrites third-party action pins too (actions/checkout@v4,
aws-actions/configure-aws-credentials@v4, pnpm/action-setup@v4, etc.),
producing references like actions/checkout@v4-beta that do not exist
upstream. The previous commit cleaned up the resulting corruption on
v4-beta; this commit prevents recurrence.

Both scripts now wrap the version pattern with a captured prefix:

    \(milaboratory/github-ci[^[:space:]@]*\)@v4...

The character class excludes @ so the greedy match stops at the @
sign, leaving the version token to be matched and replaced.
fix-beta.sh keeps its two-pattern form (end-of-line + whitespace
boundary) to avoid the @v4 → @v4-beta-beta prefix collision; that
guarantee is preserved.

Verified with a fixture covering self-refs, third-party refs, mixed
content, and the prefix-collision case. Both directions are idempotent.

Also flips six lingering milaboratory/github-ci/.../@v4 self-refs in
.github/workflows/node-simple-pnpm.yaml back to @v4-beta. These were
left behind by a previous manual fixup attempt (5baba62 revert) and
are exactly what the new fix-beta.sh sed produces when run against
the current tree.

Out of scope: actions/*/test-*.yaml files referenced by `act`-based
unit tests. Those deliberately pin @v4 and are outside the find
globs in both scripts.
fix: root-cause + cleanup for merge-beta/fix-beta sed-scope bug
check-coverage ran as a step with continue-on-error: true, so a gap
exited 1 but the step was reported success — the gap showed only as an
annotation on a green run, which reviewers miss.

Move it to its own 'changeset coverage (diagnostic)' job: the step drops
continue-on-error (a gap turns the job red), the job sets
continue-on-error: true (run stays green, merge not blocked). The native
'changeset status' gate in check-changesets is unchanged.

Only node-simple-pnpm.yaml uses check-coverage.
…age-diagnostic-job

ci(changeset): make coverage gaps a visible non-blocking check
Comment thread fix-beta.sh
Comment thread fix-beta.sh
@PaulNewling PaulNewling merged commit a64c8ca into v4 May 29, 2026
2 checks passed
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