Skip to content

Address review feedback on the SDK bump automation - #103

Merged
ritz078 merged 2 commits into
mainfrom
ritz078/address-pr-101-review
Sep 1, 2026
Merged

Address review feedback on the SDK bump automation#103
ritz078 merged 2 commits into
mainfrom
ritz078/address-pr-101-review

Conversation

@ritz078

@ritz078 ritz078 commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

⚡ TL;DR

Follow-ups from the review of #101, then from the review of this PR. The stale-CDN guard had two blind spots, a hand-typed version was never checked against the registry, and a draft opened by a failing e2e run first told nobody what to do with it, then told them something that does not work.

🎯 What this improves

  • 🔎 The stale-CDN guard stops having blind spots: a README line listing two CDN URLs no longer lets the stale one through, and 1.20.1 no longer hides a stale 1.20.10.
  • ⌨️ A typo'd workflow_dispatch version fails in the first step, naming the version and the registry's status code, instead of as an npm 404 twenty minutes into the bump. A registry outage now reads differently from a version that does not exist.
  • 🧭 A failed bump explains itself, correctly: the draft it opens names the one action that actually attaches checks to it, and says plainly that re-dispatching the workflow will not.

🔧 What changed

  • update-nutrient-sdk.yml, stale-CDN check. grep -rEn ... | grep -v "pspdfkit-web@${VERSION}" printed one line per matching line, and the exclusion then discarded that whole line, so a line holding both pspdfkit-web@1.21.0 and pspdfkit-web@1.8.0 was excluded on the strength of the fresh reference. -o makes each reference its own output line. The exclusion also matched the version as a substring, so 1.20.1 would have hidden a stale 1.20.10; it now escapes the dots in ${VERSION} and anchors on $.
  • update-nutrient-sdk.yml, draft PR body. When the e2e suite fails the body gains a "This draft needs a human" section, because no checks are attached to the draft and every later scheduled run skips the version as "already handled". Its instructions now match what GitHub actually does: close and reopen the pull request to get Biome and Playwright to run against the bump, push a fix to the branch if one is needed, or close it and walk away. It also states that marking a draft ready for review triggers nothing, and that re-dispatching the workflow for the same version is refused.
  • check-nutrient-update.sh. A dispatched version is now confirmed to exist on the registry before anything else runs. -f is deliberately absent so a 404 and an unreachable registry stay distinguishable, and the message carries the status code.
  • Impact: no user-facing or API change. Repository automation only.

🤔 Why

  • Close and reopen, not close and re-dispatch. check-nutrient-update.sh lists pull requests with --state all, so a closed draft still reads as "already handled" and a re-run exits with should_update=false. Reopening fires pull_request: reopened as the human who did it, and that is a default activity type for both biome.yml and playwright.yml. ready_for_review is not, so marking the draft ready attaches nothing.
  • No ordering check, and no rollback claim either. An earlier revision of this PR claimed dispatching an older version was the rollback path. It is not: every released version already has an update-examples-X pull request, and the existing-PR check refuses those whatever state they are in. The comment now records the real reason no ordering check is needed — that check already covers it.
  • Not addressed here: pnpm audit fix. Fix remaining pnpm 11 audit handling #102 already fixes the invalid invocation on that line, so touching it here would only conflict.

🧪 How to test

The registry check, and what an old version really does:

./scripts/check-nutrient-update.sh 1.17.99   # not published, exits 1 naming "(HTTP 404)"
./scripts/check-nutrient-update.sh 1.17.0    # published, then refused: #96 already exists for that branch
./scripts/check-nutrient-update.sh           # dist-tag path, unchanged

Both grep blind spots, reproduced directly:

printf 'pspdfkit-web@1.20.10\npspdfkit-web@1.21.0 and pspdfkit-web@1.8.0\n' > /tmp/t.txt
grep -rEn  "pspdfkit-web@[0-9]+\.[0-9]+\.[0-9]+" /tmp/t.txt | grep -vF "pspdfkit-web@1.20.1"     # misses both
grep -rEon "pspdfkit-web@[0-9]+\.[0-9]+\.[0-9]+" /tmp/t.txt | grep -vE "pspdfkit-web@1\.20\.1$"  # reports both

✅ Verification

Check Result
bash -n on the script and on all ten workflow run blocks pass
check-nutrient-update.sh with 1.17.99 / 1.17.0 / no version exits 1 with (HTTP 404) / refused, a pull request for that branch exists / dist-tag path unchanged
Registry unreachable (registry.npmjs.invalid) curl exits 6, reported as "could not reach", not as unpublished
CDN check step run against the real tree at VERSION=1.20.0 flags nuxtjs 1.3.0 and gatsbyjs 1.8.0, exempts salesforce/README.md
Same step at VERSION=1.20.1 over a fixture tree flags 1.20.10 and a stale 1.9.0 sharing a line with 1.20.1; keeps 1.20.1 out
Both PR-body variants rendered with the step's own script recovery section present only on failure, all variables substituted
biome ci . pass, 138 files

⚠️ Risks / notes

https://claude.ai/code/session_0117hJP3TxNWJxrg4YPMNNiS

Three follow-ups from the review of #101.

The stale-CDN check dropped whole lines, so a line carrying both a bumped
and a stale reference hid the stale one; it now matches with -o so each
reference is judged on its own, and excludes the current version with -F
so the dots in the version stay literal.

A dispatched version was taken at face value, surfacing a typo only as an
npm 404 well into the bump. It is now confirmed against the registry in
the check step. An older version stays allowed on purpose, as that is how
a bad release gets rolled back.

A draft opened by a failing e2e run told nobody what to do with it, while
every later scheduled run skipped that version for good. The draft body
now spells out the three recovery paths.

Claude-Session: https://claude.ai/code/session_0117hJP3TxNWJxrg4YPMNNiS

@sashamilenkovic sashamilenkovic 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.

The grep fix and the registry check are both correct; I verified them against the real tree and npm. Approving, with a few things worth a look, most important first.

Things to consider

1. "Close, delete the branch, re-dispatch" does not work (update-nutrient-sdk.yml:184). check-nutrient-update.sh lists PRs with --state all, so the closed draft still counts as "already exists" and the re-run exits with should_update=false. Confirmed: gh pr list --state all --head update-examples-1.20.0 still returns merged #100. Options two and three therefore have the same outcome.

Suggested wording: close and reopen this PR. A human reopening fires pull_request: reopened as that human, so Biome and Playwright run on the PR itself. Marking a draft ready does not trigger workflows, so this is also the way to get CI attached in the first option. If you'd rather make dispatch itself retry, list only open PRs when a version was passed explicitly. Caveat: all fourteen old update-examples-* branches still exist on origin, so a re-dispatch would then hit the "branch exists with no PR" check instead.

2. Rollback rationale doesn't hold (check-nutrient-update.sh:31). Every prior version has a merged update-examples-X PR, so the existing-PR check refuses all of them. ./scripts/check-nutrient-update.sh 1.17.0 prints "a pull request already exists", not "accepted" as the description says. Soften the comment or drop the rollback claim.

3. Version exclusion is a substring match (update-nutrient-sdk.yml:75). 1.20.1 would hide a stale 1.20.10. No SDK release has ever had a patch above 1, so purely theoretical; anchoring with grep -vE "pspdfkit-web@${VERSION//./\\.}\$" closes it if you want.

4. Registry error conflates an outage with a 404 (check-nutrient-update.sh:37). curl's stderr shows the real cause, so cosmetic. -w '%{http_code}' would make it precise.

Verified

  • Registry: nonexistent / older / current version returns 404 / 200 / 200; script exits 1 only on the first.
  • CDN grep at 1.20.0 flags nuxtjs 1.3.0 and gatsbyjs 1.8.0, exempts salesforce/README.md; both are in the updater map.
  • PR body renders correctly for success and failure with the YAML indent stripped; all variables substituted.

Outside this PR: the workflow has never run in CI, so a workflow_dispatch after merge would be the first real test.

The recovery section told a human to close the draft, delete the branch
and re-dispatch. That does not work: the existing-pull-request check
lists with --state all, so the closed draft still reads as "already
handled" and the re-run exits with should_update=false. It now says to
close and reopen the pull request instead, which fires
pull_request: reopened as that human and so does run Biome and
Playwright against the bump. Marking a draft ready for review is not an
activity type either workflow acts on, so it attaches no checks; the
section now says so rather than implying otherwise.

For the same reason, the comment claiming a dispatched older version is
the rollback path was wrong: every released version already has an
update-examples-X pull request, so the check refuses all of them. The
comment now records why no ordering check is needed at all.

Two smaller ones: the stale-CDN exclusion matched the version as a
substring, so 1.20.1 would have hidden a stale 1.20.10; it now escapes
the dots and anchors on $. And the registry check dropped curl's -f so
that a 404 and an unreachable registry no longer report identically.

Claude-Session: https://claude.ai/code/session_0117hJP3TxNWJxrg4YPMNNiS
@ritz078

ritz078 commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author

All four are in 7ebd6b3.

1. You're right that the closed draft still blocks the re-dispatch, and that reopening is the only way to get checks onto it. The section now offers close-and-reopen, push-a-fix-to-the-branch, or close-and-leave-it, and says explicitly that marking a draft ready for review triggers nothing and that re-dispatching for the same version is refused. I left --state all as it is — making dispatch retry would run into the fourteen stale update-examples-* branches you mention, and the branch-exists check would just fail differently.

2. Confirmed — #96 is merged for update-examples-1.17.0, so 1.17.0 is refused, not accepted. Dropped the rollback claim; the comment now says why no ordering check is needed at all, which is that the existing-PR check already covers it. Corrected the PR description too.

3. Anchored. Reproduced it first: at VERSION=1.20.1 the old form printed nothing for a 1.20.10 reference.

4. Dropped -f and switched to -w '%{http_code}'. A 404 says "not published on the registry (HTTP 404)"; an unresolvable host says "could not reach the npm registry (curl exited 6)".

@ritz078
ritz078 merged commit 9f9f199 into main Sep 1, 2026
3 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